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

Reply via email to