if i have a model like class ShelfManager(models.Manager):
use_for_related_fields = True def create_cabinet(self, name, number_of_shelfs): cabinet = self.create(name=name, number_of_shelfs=number_of_shelfs) created_shelfs = 0 while created_shelfs < number_of_shelfs: cabinet.shelfs.create() created_shelfs += 1 return place class Cabinet(models.Model): name = models.CharField(max_length=50, unique=True) number_of_shelfs = models.IntegerField shelfs = ShelfManager() class Shelfs(models.Model): place = models.ForeignKey(Cabinet, on_delete=models.CASCADE, null=True, blank=True, related_name='shelfs') ... and i want shelf to hold either model Box, Filter or Barrel but not sure which approach to use :P -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPLZMbPTNJ8OavQiaUpdELVH4wo9V9p94zkFWDwZS4sXdZtS8g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.