El Friday 11 May 2007 18:06:48 James Bennett escribió: > On 5/11/07, Christian M Hoeppner <[EMAIL PROTECTED]> wrote: > > Just what I needed. Still... I have to handle this in a custom admin > > view, do I? Even after reading that chapter in the django book I'm unsure > > about those custom views. Where do I tell it to show that text input if > > it's not in the post's model? And where do I find the place where it > > calls the model.save() method to update the tags there? > > You'll want to read through the tagging application's documentation > thoroughly; it handles all that for you, with no need to hack on the > admin or do funny stuff in the 'save' method. > > This minimal example should give you an idea of how it works: > > from django.db import models > from tagging.fields import TagField > > class Post(models.Model): > title = models.CharField(maxlength=250) > body = models.TextField() > tags = TagField() > > The TagField will show up in the admin as a text input where you can > type in tags, and then it will handle setting up the relations behind > the scenes. The 'tags' attribute of each Post object will also return > the list of tags, and assigning to it will set new tags.
Works like a charm. Thank you, James. I owe you a cold beer! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---