I believe there's a project called GeoDjango that's dealing with this very issue, you should check it out: http://code.djangoproject.com/wiki/GeoDjango
Oscar On Mon, Jul 14, 2008 at 12:27 AM, MarC <[EMAIL PROTECTED]> wrote: > > Hello everybody, > > I'm trying to come up with the most django simple friendly way to store > records in a "tree" kind of database. For instance my records are > Beverages, Food>Fruits>Apples, Food>Vegetables>Carrots, etc . Ideally > I'd like to be able to select records that may be categories (Food, > Beverages or Fruits, Vegetables) as specific products/leafs (Apples, > Carrots) and be able to fetch parents and sons from each record. > > I wonder if any of you have already faced this problem and have any good > tips to share. > > my first tentative is: > << > from django.db import models > > # Create your models here. > class Food(models.Model): > name = models.CharField(max_length=50); > parents = models.ForeignKey('Food'); > class Admin: > pass > >> > > But I'm having trouble to create a root "Food" node with no ForeignKey > defined or ForeignKey pointed to himself from the admin site. > > Any help will be very appreciated! Thanks in advance, > MarC > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---