equal
deleted
inserted
replaced
|
1 """ |
|
2 19. OR lookups |
|
3 |
|
4 To perform an OR lookup, or a lookup that combines ANDs and ORs, combine |
|
5 ``QuerySet`` objects using ``&`` and ``|`` operators. |
|
6 |
|
7 Alternatively, use positional arguments, and pass one or more expressions of |
|
8 clauses using the variable ``django.db.models.Q`` (or any object with an |
|
9 ``add_to_query`` method). |
|
10 """ |
|
11 |
|
12 from django.db import models |
|
13 |
|
14 class 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 |