I was wondering whether anyone can help me, I'm absolutely stumped
where to start creating a hierarchical menu in Django. I've scoured
Google and don't seem to be able to find anything to get me started.

Basically I'm looking to create a simple list based menu like so:

> Home
 > Category 1
  > Range 1
  > Range 2
 > Category 2
 > Category 3

To explain I currently have my models like so:

class Category(models.Model):
    id = models.AutoField('id', primary_key=True)
    name = models.CharField(maxlength=50)

class Range(models.Model):
        id = models.AutoField('id', primary_key=True)
        category = models.ForeignKey(Category)
        name = models.CharField(maxlength=50)

Initially I'd thought about using the select_related syntax along
these lines:
Range.objects.all().select_related()

However I'm not sure that is going give me the granularity I won't be
able to determine the depth of the navigation or whether this is the
parent of the range selected.

Any help would be greatly appreciated!


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to