dlamotte / django-tagging

Automatically exported from code.google.com/p/django-tagging
Other
0 stars 0 forks source link

Model Inheritance #166

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

Hello, 

Now i have only just started out on the django road so i might be going
about this in the wrong way but... if i have a base model class with a
couple of common fields - TagField including - then inherit from that base
class. 

class Item(models.Model):

    title = models.CharField(max_length=200)
    description = models.TextField()

    tags = TagField('Test', help_text='Test')

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

    def __unicode__(self):
        return self.title

class Resource(Item):
    author = models.ForeignKey(User)

When it comes to add a new/change an existing Resource item (in the admin)
the tag field is displayed but on save the tags are not saved into the tag
table.

If i dont use inheritance on the models then all works as expected.

What am i doing wrong or is this a genuine bug?

many thanks,

Alex. 

Original issue reported on code.google.com by a...@redvision.co.uk on 17 Oct 2008 at 5:08

GoogleCodeExporter commented 8 years ago
Similar problem here (using tagging trunk r154 and django trunk r9100). 

In fact, it appears that tags are correctly saved, but with the baseclass
content_type_id and not the derived class one. 

Original comment by bruno.de...@gmail.com on 13 Nov 2008 at 2:16

GoogleCodeExporter commented 8 years ago
Attached patch for this issue, tags are stored for the registered model only.

Original comment by oyvind.s...@gmail.com on 7 Jan 2009 at 5:08

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Attached new patch for this issue, tags are stored for all models based of the
inherited model.

Original comment by oyvind.s...@gmail.com on 7 Jan 2009 at 7:39

Attachments:

GoogleCodeExporter commented 8 years ago
Attached a patch that works for latest revision of tagging (rev. 154). It works 
for
all models. Previous version raised an "index out of bounds" exception for not
registered models.

Please see tagging's docs/overview.txt for what does that mean to register a 
model.
Also see this issue:
http://code.google.com/p/django-tagging/issues/detail?id=95&q=register

Original comment by restless...@gmail.com on 12 Jan 2009 at 12:53

Attachments:

GoogleCodeExporter commented 8 years ago
I'm experiencing the same trouble

Original comment by joshuaka...@gmail.com on 3 Aug 2009 at 7:44

GoogleCodeExporter commented 8 years ago
But thanks for the patch #5 - works great!

Original comment by joshuaka...@gmail.com on 3 Aug 2009 at 7:56

GoogleCodeExporter commented 8 years ago
Thanks for the patch! I was going kind of crazy because some models (with no 
inheritance) were working fine with tags, but others were.

Is it possible to get a context diff or an updated patch? The old patch is 
pretty old 
now.

Original comment by ble...@gmail.com on 29 Aug 2009 at 8:17

GoogleCodeExporter commented 8 years ago
Updated patch for 0.3pre

Original comment by Anatoliy...@gmail.com on 13 Nov 2009 at 10:59

Attachments:

GoogleCodeExporter commented 8 years ago
Hi guys, 
Any reason why this didn't make it in the release?
Thanks, B

Original comment by balint.h...@gmail.com on 17 May 2011 at 2:10

GoogleCodeExporter commented 8 years ago
It doesn't look like this project has had a checkin in over a year. It's not my 
place to pronounce it dead, but it's worth noting that a lot more attention 
seems to be being paid to django-taggit these days. (Search for it over at 
github.)

Original comment by lay...@gmail.com on 17 May 2011 at 4:55