On Sep 13, 12:26 pm, ashy <ashwinmo...@gmail.com> wrote: > Ok, > > but I want to retrieve rows from both the tables based on the foreign > key. > User.objects.all() > or > Userdata.objects.all() > will give me data from either table. How can retrieve data from both > the tables using the foreign key? > > thanks > ashy
You're thinking in the wrong terms. Django's models are *objects*, not tables, even if they store data in tables. So you need to think in an object-orientated way. Read this bit of the documentation: http://docs.djangoproject.com/en/1.2/topics/db/queries/#one-to-many-relationships and come back if you have any more questions. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.