我有一个使用Orderable类的片段。我想在第一个医嘱内容中添加另一个医嘱内容类。例如:
models.py:
@register_snippet
class LocationHours(ClusterableModel):
location = models.CharField(
max_length=255,
blank=True,
help_text='Location for this set of Hours.'
)
panels = [
MultiFieldPanel([
FieldPanel('location'),
InlinePanel('location_hours'),
], "Hours"),
]
class Hours(Orderable):
snippet = ParentalKey('LocationHours', related_name='location_hours', on_delete=models.CASCADE)
...
panels = [
...
InlinePanel('hours_override', label="Hours Overrides"),
]
class HoursOverride(Orderable):
orderable = ParentalKey('Hours', related_name='hours_override', on_delete=models.CASCADE)
我该怎么做呢?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐