Open satish-gathole-driveu opened 9 years ago
I am using Django 1.8.1
Models:
class Profile(models.Model): charge_by = models.CharField(max_length=16, choices=CHARGE_BY_CHOICES, blank=False, null=False) valid_from = models.DateTimeField(blank=True, null=True) valid_to = models.DateTimeField(blank=True, null=True)
class Slot(models.Model): profile = models.ForeignKey(Profile) start_time = models.TimeField() end_time = models.TimeField()
class SlotSlab(models.Model): slot = models.ForeignKey(Slot) num_hours = models.SmallIntegerField(blank=False, null=False) price = models.DecimalField(max_digits=10, decimal_places=2)
And in admin.py I have following
class SlotSlabline(NestedTabularInline): model = SlotSlab
class SlotInline(NestedTabularInline): model = Slot inlines = [SlotSlabline,]
class ProfileAdmin(NestedModelAdmin): inlines = [SlotInline,]
admin.site.register(Profile, ProfileAdmin)
But When I tried to create Profile getting error(Attached image):
'SlotInline' object has no attribute 'queryset'
I am using Django 1.8.1
Models:
class Profile(models.Model): charge_by = models.CharField(max_length=16, choices=CHARGE_BY_CHOICES, blank=False, null=False) valid_from = models.DateTimeField(blank=True, null=True) valid_to = models.DateTimeField(blank=True, null=True)
class Slot(models.Model): profile = models.ForeignKey(Profile) start_time = models.TimeField() end_time = models.TimeField()
class SlotSlab(models.Model): slot = models.ForeignKey(Slot) num_hours = models.SmallIntegerField(blank=False, null=False) price = models.DecimalField(max_digits=10, decimal_places=2)
And in admin.py I have following
class SlotSlabline(NestedTabularInline): model = SlotSlab
class SlotInline(NestedTabularInline): model = Slot inlines = [SlotSlabline,]
class ProfileAdmin(NestedModelAdmin): inlines = [SlotInline,]
admin.site.register(Profile, ProfileAdmin)
But When I tried to create Profile getting error(Attached image):
'SlotInline' object has no attribute 'queryset'