Ticket #13328: models.py

File models.py, 843 bytes (added by Brandon Konkle, 11 years ago)

An abbreviated models.py which, when used, reproduces the error.

Line 
1from django.db import models
2
3class LiveEntryManager(models.Manager):
4    def get_query_set(self):
5        return super(LiveEntryManager, self).get_query_set().filter(
6            release_date__lte=datetime.datetime.now(),
7            status=Entry.STATUS_LIVE
8            )
9
10class Entry(models.Model):
11    STATUS_DRAFT = 1
12    STATUS_QUEUED = 2
13    STATUS_LIVE = 3
14
15    ENTRY_STATUS_CHOICES = (
16        (STATUS_DRAFT,  "Draft"),
17        (STATUS_QUEUED, "Queued"),
18        (STATUS_LIVE,   "Live"),
19    )
20   
21    release_date = models.DateTimeField(
22        blank=True,
23        db_index=True,
24        default=datetime.datetime.now,
25        editable=True,
26        help_text="Don't change this after publishing; it breaks URLs."
27    )
28    status = models.PositiveSmallIntegerField(choices=ENTRY_STATUS_CHOICES)
29   
30    live = LiveEntryManager()
Back to Top