Questions tagged [django-taggit]

django-taggit is a reusable Django application designed to making adding tagging to your project easy and fun.

django-taggit works with Django 1.1 and 1.2 (see Known Issues for known issues with older versions of Django), and Python 2.4-2.X.

306 questions
4
votes
1 answer

Django ORM fails to recognise concrete inheritance in nested ON statement

Defining a custom Django user combined with django-taggit I have ran into an ORM issue, I also have this issue in the django admin filters. NOTE: I am using this snippet: https://djangosnippets.org/snippets/1034/ # User id |…
user2298943
  • 632
  • 5
  • 20
4
votes
2 answers

Django autocomplete light, taggit and the admin interface

I'm trying to use autocomplete_light and taggit both on an admin form. I've read the docs on integrating autocomplete light and taggit here, and the docs on integrating autocomplete light in the admin here. But there seems to be little (or no)…
4
votes
3 answers

How to count the repetition of the elements in a list python, django

I have a django app, I am using django-taggit for my blog. Now I have a list of elements (In fact objects) that I got from database in one of my view as below tags = [, , , , , ,…
Shiva Krishna Bavandla
  • 25,548
  • 75
  • 193
  • 313
4
votes
3 answers

django taggit prevent overlapping tags across different models

I have two different models. class MessageArchive(models.Model): from_user = models.CharField(null=True, blank=True, max_length=300) archived_time = models.DateTimeField(auto_now_add=True) label = models.ForeignKey(MessageLabel,…
user1629366
  • 1,931
  • 5
  • 20
  • 30
4
votes
4 answers

How do I use django's Q with django taggit?

I have a Result object that is tagged with "one" and "two". When I try to query for objects tagged "one" and "two", I get nothing back: q = Result.objects.filter(Q(tags__name="one") & Q(tags__name="two")) print len(q) # prints zero, was expecting…
shino
  • 4,562
  • 5
  • 38
  • 57
4
votes
1 answer

Deleting the tags that are not used by any other object

I am trying to modify this file https://github.com/alex/django-taggit/blob/master/taggit/models.py so that when a tag is not associated with any other object, it gets deleted. Here's what I added to the end of the file: # --- # Delete the tags that…
azio
  • 575
  • 1
  • 6
  • 12
4
votes
1 answer

Copy tags to copied django object

I'm using django-taggit to tag my to do records. class Action(models.Model): name = models.CharField("Action Name", max_length=200) complete = models.BooleanField(default=False, verbose_name="Complete?") tags = TaggableManager() I'm…
Ed.
  • 4,439
  • 10
  • 60
  • 78
4
votes
3 answers

Return object tags as a list

Using django-tagging, for an object that has multiple tags assigned to it, how can I return a simple list of tag names? object.tags() returns an object that is not easily translated to json, and TaggableManager is not iterable. Any other ways?
Goro
  • 9,919
  • 22
  • 74
  • 108
3
votes
1 answer

most_common with django-taggit

I'm trying to get an ordered list of the most-used tags on my site. The API docs for django taggit reference a most_common() method, but I can't seem to make it work. Docs say: "Returns a QuerySet of all tags, annotated with the number of times they…
shacker
  • 14,712
  • 8
  • 89
  • 89
3
votes
3 answers

django: django-taggit usage

This is probably a stupid question but I downloaded Django-taggit and the docs mentioned adding a TaggableManagermanager to the each model I want to associate. This is fine, but what about models from external apps I "pip-ed"? What's the best way…
goh
  • 27,631
  • 28
  • 89
  • 151
3
votes
2 answers

django-taggit common tags only visible from base url

I have a basic application where Users create Groups. These Groups can have multiple tags (by way of django-taggit) and, once posted, are rendered on a home page, sorted newest to oldest. In my views.py I have two different tag lists that the home…
3
votes
1 answer

SearchVectorField - joined reference not allowed for taggit field

My model definition is as follows (a simplified model of the one being used in actual product. There are a coupe of other fields: from django.db import models from taggit.managers import TaggableManager from django.contrib.postgres.search import…
finite_diffidence
  • 893
  • 2
  • 11
  • 20
3
votes
1 answer

Django taggit aggregation query to return count per tag

I am using Django 3.2 and django-taggit 1.4 I have a model like this: class Meal(models.Model): # some fields is_cooked = models.Boolean() tags = TaggitManager() I am trying to generate a dictionary keyed by tag name and value of the…
Homunculus Reticulli
  • 65,167
  • 81
  • 216
  • 341
3
votes
0 answers

How to display just the tags in form instead of all the list elements in Django?

I have a form used to create and edit an object on Django, and I'm trying to implement tags with django-taggit and Crispy Forms. Currently it's working great to create the tags, and it creates a list of tags for the field. When I want to edit the…
Guillermo Brachetta
  • 3,857
  • 3
  • 18
  • 36
3
votes
2 answers

How to import django-taggit tag in django-import-export

I can't import Django-taggit tags using Django-import-export. This error is when the value is entered. Line number: 1 - invalid literal for int() with base 10: 'def' Also, this error is when the value is blank. Line number: 2 - Cannot add
1 2
3
20 21