PageRenderTime 102ms CodeModel.GetById 41ms app.highlight 1ms RepoModel.GetById 59ms 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
 1"""
 219. OR lookups
 3
 4To perform an OR lookup, or a lookup that combines ANDs and ORs, combine
 5``QuerySet`` objects using ``&`` and ``|`` operators.
 6
 7Alternatively, use positional arguments, and pass one or more expressions of
 8clauses using the variable ``django.db.models.Q`` (or any object with an
 9``add_to_query`` method).
10"""
11
12from django.db import models
13
14class Article(models.Model):
15    headline = models.CharField(max_length=50)
16    pub_date = models.DateTimeField()
17
18    class Meta:
19       ordering = ('pub_date',)
20
21    def __unicode__(self):
22        return self.headline