django-taggit creating dozens of queries in admin panel when saving custom tag
See original GitHub issueI posted about this on StackOverlow, but here it is in summary:
I have a GenericTaggedItemBase
for my tagging through model so I can add an extra field to tags (a twitter username). I have a post_save
hook which is supposed to check for tags added to content which have twitter usernames, and to post a tweet to those usernames with a link to the content.
When I save the content item and look in the Django Debug Toolbar I see it make some queries I’ve written in the post_save
hook, but then some weirdness like this:
SELECT * FROM tag_mappings LIMIT 21
The following queries after that basically loop through the 21 results from the first query and looks up the tags.
There are more code samples on the StackOverflow question but this looks to be something django-taggit is doing. Here’s a full screeshot:
Is this a known issue? I’m not sure if it happens without the custom through model or the post_save
hook; happy to check.
Issue Analytics
- State:
- Created 10 years ago
- Comments:11 (7 by maintainers)
thanks for piping in! Alright, I’m going to close this one out, and assume that was the case here. Only have so many hours in the day, and triaging 100+ issues took a while 😃
This is an ancient issue of mine, but in retrospect I’m fairly sure it was something weird on my end rather than django-taggit. I was doing all kinds of non-Django things because I was new to the framework (eg. running raw SQL queries as you can see in the linked StackOverflow post) via post-save hooks.