Hey I have a problem with django-taggit <https://github.com/alex/django-taggit>, I want to know how can I delete unused tags In django ? (python 2.7.9 and Django 1.7.4)
heres is my code: *models.py* from django.db import models from updown.fields import RatingField from taggit.managers import TaggableManager from taggit.models import * from django.db.models.signals import pre_delete class Article(models.Model): titre = models.CharField(max_length=100) auteur = models.CharField(max_length=42) contenu = models.TextField(null=True) date = models.DateTimeField(auto_now_add=True, auto_now=False, verbose_name="Date de parution") image = models.ImageField(upload_to='article', default= 'article/amazarashi.jpeg') rating = RatingField(can_change_vote=True) tags = TaggableManager(blank=True) def __str__(self): return self.titre def before_deleting(sender, instance, **kwargs): if not TaggedItem.objects.filter(tags=instance.tags): print "Deleting tag", instance instance.tags.delete() pre_delete.connect(before_deleting, sender=TaggedItem) here is my: *views.py* (I obviously imported my models.py to my views) def innertag(request, id): tag = Tag.objects.get(id = id) articles = Article.objects.filter(tags=tag) context = {'tag': tag, 'articles': articles} populateContext(request, context) return render(request, 'innerajouter.html', context) How can I reslove this problem I need to delete, the unused url of the tag and the tag itself. Any suggestion would be really helpful, -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f5cfb7d5-d74a-4ac3-9604-3b37281bb107%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.