Comments (8)
I pushed some tests in 4090a28, which indicate a failure to reproduce, do these tests fail for you? What Django version?
from django-taggit.
Edit, a little testing shows that there's an issue with Django 1.1, but 1.2 is unaffected. This is almost definitely a result of the refactoring Carl Meyer did to the delete infrastructure, which Russ committed. I'll add a note to the docs and close this, I doubt it's possible to fix.
from django-taggit.
Now documented in c5cbe2e. Closing this ticket (if you happen to have a solution for 1.1 I'm happy to fix it, but I'm not sure it's possible).
from django-taggit.
Yes, the test fails with 0.6 and Django 1.1. Django's 1.1 delete_batch_related tries to delete the TaggedItems by calling db_prep_value on each PK (object_id).
Do you have any sugestion to a possible workaround ? Prbl is get_prep_lookup sometimes gets called with tag id and other times with objects id, and I cannot tell then apart).
FAIL: test_delete_bulk (taggit.tests.tests.TaggableManagerTestCase)
Traceback (most recent call last):
File "/mnt/wkrjc2/views/rjc_vBox_Operad_2009/vbox_dev/altitude_configurator/altitude_configurator/vendors/taggit/tests/tests.py", line 96, in test_delete_bulk
self.assert_tags_equal(kitty.tags.all(), ["feline"])
File "/mnt/wkrjc2/views/rjc_vBox_Operad_2009/vbox_dev/altitude_configurator/altitude_configurator/vendors/taggit/tests/tests.py", line 17, in assert_tags_equal
self.assertEqual(got, tags)
File "/usr/lib/python2.3/unittest.py", line 302, in failUnlessEqual
raise self.failureException,
AssertionError: [] != ['feline']
from django-taggit.
Unfortunately I don't see a good solution, simply replacing the bulk delete with individual deletes would probably solve it.
from django-taggit.
Individual delete also has the same problem. Basically Django's ORM assumes tags are many-to-many relations and tries to delete the related entries in the m2m table, just like anyother m2m relation.
From subqueries.py:
for f in cls._meta.many_to_many:
w1 = self.where_class()
db_prep_value = None
if isinstance(f, generic.GenericRelation):
from django.contrib.contenttypes.models import ContentType
ct_field = f.rel.to._meta.get_field(f.content_type_field_name)
w1.add((Constraint(None, ct_field.column, ct_field), 'exact',
ContentType.objects.get_for_model(cls).id), AND)
id_field = f.rel.to._meta.get_field(f.object_id_field_name)
db_prep_value = id_field.get_db_prep_value
for offset in range(0, len(pk_list), GET_ITERATOR_CHUNK_SIZE):
where = self.where_class()
where.add((Constraint(None, f.m2m_column_name(), f), 'in',
map(db_prep_value,
pk_list[offset : offset + GET_ITERATOR_CHUNK_SIZE])),
AND)
if w1:
where.add(w1, AND)
self.do_query(f.m2m_db_table(), where)
This adds the constraint to delete each TaggedItem but doesn't filter by content_type.
from django-taggit.
Hrm... I see the issue but I don't really have a solution (other than upgrade to 1.2).
from django-taggit.
You are right, the difference is on http://code.djangoproject.com/ticket/12953
and http://github.com/django/django/commit/836d297e68d6a63103780295adebf6eaf6779611
I cannot upgrade to Django 1.2 because I'm suck in RHEL4 (python 2.3).
from django-taggit.
Related Issues (20)
- Add support for initialising tags via a list on object creation HOT 1
- Add support for new async api HOT 2
- Getting this error while running tests: 'index_together' is deprecated. Use 'Meta.indexes' in 'taggit.TaggedItem' instead. HOT 5
- tag entered in Cyrillic be displayed in Latin
- Tag Ordering Inconsistent HOT 4
- Tags longer than 100 chars raise 500 error HOT 15
- Django Taggit 5.0 is not compatible with Django <4.1 HOT 4
- RTD builds are broken HOT 1
- Multiple queries when adding tags HOT 3
- Reverse query name for 'XXX' clashes
- New 5.0.0 migrations fails: Found wrong number (0) of indexes HOT 3
- DRF - Incorrectly processed Tag input string HOT 2
- Cannot query using tags__name__in HOT 1
- Ticket objects need to have a primary key value before you can access their tags HOT 1
- Add Django 5.0 Support
- Update Python Support
- Offer Tag Merging HOT 2
- [October 2024] Remove Support of Python 3.8
- Mypy Support For TaggableManager HOT 1
- Getting 'Python int too large to convert to SQLite INTEGER' when adding tags in DRF application HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-taggit.