blog.id dosen“t do the trick ? Smith, you should look at ManyToMany relationships. These wiil make you models more readable and easy to deal with.
Give a look here: http://www.djangoproject.com/documentation/model-api/ Cheers -- Rui On Mon, Jul 7, 2008 at 8:07 AM, smith <[EMAIL PROTECTED]> wrote: > > hi > As I am new to django I am having a lots of problem.. > So my query is: > > class Blog(models.Model): > name = models.CharField(maxlength=100) > > class Entry(models.Model): > blog = models.ForeignKey(Blog) > headline = models.CharField(maxlength=255) > > class content(models.Model): > name = models.CharField(maxlength=60) > industry = models.ForeignKey(Blog ) > > So my question is how to get blog id from Entry field.?? > I mean I want to get all content in my Entry view function from blog.. > > view function: > > def Entry(request, entryid): > > > Entry = Entry.objects.get(id=entryid) > > blog = entry.blog > > I know blog will give me the correct value but I need the id so that I > can iterate over it to get list of content associated to blog in entry > view. > > > thanks in advance.. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---