Hi, Try this:
class Entry(models.Model): ... tags = models.ManyToManyField( Tag ) class Tags(self): return self.tags.all() class Tag(models.Model): ... And now, Entry.Targs() returns all Tags related to the blog entry. Regards, Marcin On Dec 13, 8:54 am, "Young Gyu Park" <[EMAIL PROTECTED]> wrote: > class Entry(models.Model): > blog = models.ForeignKey(Blog,related_name='entries') > Title = models.CharField(maxlength=250, blank=False, null=False) > Slug = models.SlugField(maxlength=250, blank=False, null=False, > prepopulate_from=('Title',)) > Content = models.TextField(blank=False, null=False) > Post_Date = models.DateTimeField(auto_now_add=True) > tags = blog.select_relates().tags # models.ManyToManyField('Tag', > blank=True, related_name='entries') > Pictures = models.ForeignKey('Picture', blank=True, null=True, > related_name='entries') > Files = models.ForeignKey('File', blank=True, null=True, > related_name='entries') > # comments = models.ForeignKey(Comment, blank=True, null=True, > related_name='entries') > Is_Draft = models.BooleanField(default=False, help_text="Draft entries > are visible only to the author and admins") > Comments_Allowed = models.BooleanField(default=True) > Trackbacks_Allowed = models.BooleanField(default=False) > > class Tag(models.Model): > blog = models.ForeignKey(Blog,related_name='tags') > Name = models.CharField(maxlength=250) > Slug = models.SlugField(maxlength=250, prepopulate_from=('Name',)) > Total_ref = models.IntegerField(blank=True, default=0) > Font_size = models.IntegerField(blank=True, default=0) > > This is the two table that I'm using. > > What I want to do is in this models that I want to refer the Tag list by not > all tag list but Blog.tag list > > When I execute this code in the web, I can see the whole tag list. > But I want to see the tag list belonged to blog's user > > If I can solve this problem in the template code, but I want to solve this > problem in terms of models. > Because this solution could be more neat. > > Give me a clue!!!! > > Thanks, always --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---