PageRenderTime 26ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/modeltests/or_lookups/models.py

https://code.google.com/p/mango-py/
Python | 22 lines | 8 code | 4 blank | 10 comment | 0 complexity | 73c8c3546cd79e7a94d57d2363bb3dd9 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. """
  2. 19. OR lookups
  3. To perform an OR lookup, or a lookup that combines ANDs and ORs, combine
  4. ``QuerySet`` objects using ``&`` and ``|`` operators.
  5. Alternatively, use positional arguments, and pass one or more expressions of
  6. clauses using the variable ``django.db.models.Q`` (or any object with an
  7. ``add_to_query`` method).
  8. """
  9. from django.db import models
  10. class Article(models.Model):
  11. headline = models.CharField(max_length=50)
  12. pub_date = models.DateTimeField()
  13. class Meta:
  14. ordering = ('pub_date',)
  15. def __unicode__(self):
  16. return self.headline