views:

7

answers:

0

Prompt please next time.

Availability: - Sections of the catalog, in different levels - The result of either directory

Can standard methods include walking on the structure?

Example:

  • Section 1
    • Section 1.1
    • Section 1.2
    • Section 1.2.1

Need a list is not all sections of the heap, but first in Section 1., We choose to see sections 1.1 and 1.2, etc. ... but when they got to 1.2.1, then without any problems item is seen to lie in this section

or still need her to write?

Thanks

class CatalogTops(models.Model):
    top    = models.ForeignKey('self', verbose_name="section", blank=True, null=True)
    name   = models.CharField(verbose_name="section name", max_length=250)

class CatalogItems(models.Model):
    top    = models.ForeignKey('CatalogTops', verbose_name="section")
    name   = models.CharField(verbose_name="item name", max_length=250)