On Sat, Jul 5, 2008 at 11:23 PM, Nicolas Steinmetz <[EMAIL PROTECTED]> wrote:
> Despite I read a lot of time the overview.txt on the django tagging svn
> repository, I still can't stand how to use it at my model's level. I'm
> quite new to python and may miss some elements.
>
> When diving into the register part, it says it requiers a field for tag
> which is supposed to be "tags". But what kind of type is this tag supposed
> to be ? a TagField() ?
>
> I came down to this kind of things which looks not the optimum for me (at
> least at validate & runserver step, it stops shouting...):
>
> from django.db import models
> import tagging
> from tagging.models import Tag
> from tagging.fields import TagField
>
> # Create your models here.
> class Links(models.Model):
>    title = models.CharField(max_length=80)
>    description = models.TextField()
>    url = models.URLField()
>    tags = TagField()
>
>    class Admin:
>        list_display = ('title', 'description', 'url', 'tags',)
>        list_filter = ['title', 'tags']
>        search_fields = ['title','tags',]
>
>    class Meta:
>        verbose_name = "Lien"
>        verbose_name_plural = "Liens"
>
> tagging.register(Links)
>
> But when I try to save a link, I got :
>
> IntegrityError at /admin/links/links/add/
> tagging_taggeditem.object_id may not be NULL
>
> What did I miss ?

It seems you are running into one of django-tagging quirks.
See issue #95 [http://code.google.com/p/django-tagging/issues/detail?id=95].


-- 
Marek Stępniowski
http://stepniowski.com

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to