Hi all, Here I have a model called Product. It has a self relationship as shown below.
class Product(models.Model): name = models.CharField(max_length = 200, blank = True) main_product = models.ForeignKey('self', verbose_name = "Subproduct of", help_text = "sl.no. of the containing component", blank = True, null = True) sl_no = models.CharField(max_length = 200, verbose_name = "Serial No.", blank = True) make_model = models.CharField(max_length = 200, verbose_name = "Make & Model", blank = True) I have to show these products in a tree view in template. Here product-1 can have a subproduct prouduct-2 and product-2 can have a subproduct prouduct-3 and so on. Can anyone suggest an efficent way to repersent this as a tree(means how the queryset be formatted before rendering to template). Thank in advance. leppy. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---