Tuesday, July 9, 2013

Re: Creating a Node in Django ORM

On 09/07/13 14:07, Nafiul Islam wrote:
> How would you create a node using Django's ORM. This is what I
> mean: https://dpaste.de/JG52c/
>
> Now, what I am basically trying to create is a liked list with nodes here.
>
Nafiul,

From your code snippet, it looks like you are trying to create a tree.
Look at django-mptt or google "django tree" for more information.

If you are trying to do a linked list, with 'previous' and 'next'
pointers, they just need to go in as foreign keys, but see
https://docs.djangoproject.com/en/1.5/ref/models/fields/#django.db.models.ForeignKey.related_name
because you will need to use the related_name attribute to make the
foreign key relationships distinct from each other. You will also need a
List object that holds the head (and perhaps tail) pointers for the list.

John

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate