title: check for existence and active state in django filter
body: <p>Is there a way to do a combined filter to see if an object exists and if it exists whether it is active or not?</p>
  
  <p>Trying to find out whether a like model instance exists for a user or not, and whether the like is active or not.</p>
  
  <p>I'm using this to change the display of initial css. If the user has liked it then it will display say a green like button or something to signify this. The ajax then updates the counter / toggles css class, view creates a like or toggles the state of an existing like. Just wondering if there's a neater way to check this condition.</p>
  
  <p>Current filtering / method:</p>
  
  <pre><code>likes = article.articlelike_set.filter(is_active=1)
  users_like = likes.filter(user=request.user)
  user_liked_article = users_like[0].is_active if users_like.exists() else False
  </code></pre>
  
  <p>like / article model relation in like app:</p>
  
  <pre><code>class BaseLike(models.Model):
  
      user = models.ForeignKey(User)
      created = models.DateTimeField(auto_now_add=True)
      is_active = models.BooleanField(default=True)
  
      class Meta:
  
          abstract = True
  
  class ArticleLike(BaseLike, models.Model):
  
      article = models.ForeignKey('article.Article')
      ....
  </code></pre>
  
  <p>article model:</p>
  
  <pre><code>class ArticleBaseFields(models.Model):
  
      created = models.DateTimeField(default=timezone.now)
      ...
      slug = models.SlugField(unique=1)
  
      class Meta:
  
          abstract = True
  
  class Article(ArticleBaseFields,models.Model):
  
      body = models.TextField(max_length=5000)
      publisher = models.ForeignKey('userprofiles.ArticlePublisher', related_name="publisher") 
      #Publisher is a profile with a OneToOneField to auth.models User model
      ...
  </code></pre>