List Info

Thread: Django-tagging weirdness (noob question)




Django-tagging weirdness (noob question)
country flaguser name
United States
2007-10-09 20:45:46
Greetings (please forgive me - I'm well past my coffee
buzz)

I'm trying to implement the django-tagging app.  My
"links" app has a
tags field.
As a CharField, there's no problem. When I changed it to get
the
sexier ManyToManyField it got weird. The tags appear and
transfer
between fields (in admin view) and save in the link like
they should,
but they do not appear in the tagging "tagged
items" table - only in
the link (in admin view). I humbly beg for assistance. 
(yes, I'm a
noob... I know)

Here's a piece of the Link.model:
from tagging.models import Tag

class Link(models.Model):

    url = models.URLField(verify_exists=False)
    title = models.CharField(maxlength=512)
    tags = models.ManyToManyField(Tag,
filter_interface=models.HORIZONTAL)

    def save(self):
        super(Link, self).save()
        self.tags = self.tag_list

    def _get_tags(self):
        return Tag.objects.get_for_object(self)

    def _set_tags(self, tags):
        Tag.objects.update_tags(self, tag_list)

    tag_list = property(_get_tags, _set_tags)

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return self.url


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Django-tagging weirdness (noob question)
user name
2007-10-09 20:55:37

On 10-Oct-07, at 7:15 AM, coffeeho wrote:

> I'm trying to implement the django-tagging app.  My
"links" app has a
> tags field.

could you clarify which version of django you are using

-- 

regards
kg
http://lawgon.livejourn
al.com
http://nrcfosshelpline
.in/web/



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Django-tagging weirdness (noob question)
country flaguser name
United States
2007-10-10 08:11:44
I'm using version 0.96.

On Oct 9, 8:55 pm, Kenneth Gonsalves <law...thenilgiris.com> wrote:
> On 10-Oct-07, at 7:15 AM, coffeeho wrote:
>
> > I'm trying to implement the django-tagging app. 
My "links" app has a
> > tags field.
>
> could you clarify which version of django you are
using
>
> --
>
> regards
> kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.i
n/web/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Django-tagging weirdness (noob question)
user name
2007-10-10 10:55:33
On 10/9/07, coffeeho <coffeehogmail.com> wrote:
> As a CharField, there's no problem. When I changed it
to get the
> sexier ManyToManyField it got weird. The tags appear
and transfer
> between fields (in admin view) and save in the link
like they should,
> but they do not appear in the tagging "tagged
items" table - only in
> the link (in admin view). I humbly beg for assistance. 
(yes, I'm a
> noob... I know)

This won't work; because of database-level requirements,
many-to-many
fields aren't updated by the admin (or any sort of
automatically-generated form) until *after* the object has
completely
saved, which means that when save() is running the
many-to-many
relation isn't yet updated.

-- 
"Bureaucrat Conrad, you are technically correct -- the
best kind of correct."

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )