| 1 |
""" |
| 2 |
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``. |
| 9 |
""" |
| 10 |
|
| 11 |
from django.db import models |
| 12 |
|
| 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 __str__(self): |
| 22 |
return self.headline |