if sometag.article_set.count() == 0:
    pass # your code here

On 4/11/06, Brian Elliott <[EMAIL PROTECTED]> wrote:
>
> Suppose I have the following two model objects:
>
> class Tag(models.Model):
>         name = models.CharField(maxlength=10)
>
> class Article(models.Model):
>         tags = models.ManyToManyField(Tag)
>
>
> Each Article can be associated with multiple Tags and vice versa.
> How can I query the Tag model to obtain all Tags with no associated
> articles?  (m-r)  I basically want to delete unused tags.
>
> Thanks,
> Brian
>
>
> >
>


--
--Max Battcher--
http://www.worldmaker.net/
All progress is based upon a universal innate desire on the part of
every organism to live beyond its income. --Samuel Butler

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to