diff options
author | Dirk Wallenstein <halsmit@t-online.de> | 2012-04-29 03:11:48 +0000 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2012-04-30 14:22:21 +0800 |
commit | 55ef92901f11ce5497eb55df3064a5a74821a1e7 (patch) | |
tree | 5e71b419f53c6cdd4c5717559ab2dd47d8045d4e /apps/patchwork/models.py | |
parent | b76f7dd32ef83d55ace2f38ed84f5fc76e65e18e (diff) | |
download | patchwork-55ef92901f11ce5497eb55df3064a5a74821a1e7.tar.bz2 patchwork-55ef92901f11ce5497eb55df3064a5a74821a1e7.tar.xz |
Use an explicit initial default patch state
This will make editing states through the admin UI less error-prone, and
will facilitate parsing patches when relying on a default state, as well as
testing.
Use the explicit default state when parsing mails.
Signed-off-by: Dirk Wallenstein <halsmit@t-online.de>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork/models.py')
-rw-r--r-- | apps/patchwork/models.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py index bb8d8e7..67c69ff 100644 --- a/apps/patchwork/models.py +++ b/apps/patchwork/models.py @@ -191,6 +191,9 @@ class PatchMbox(MIMENonMultipart): self.set_payload(_text.encode(self.patch_charset)) encode_7or8bit(self) +def get_default_initial_patch_state(): + return State.objects.get(ordering=0) + class Patch(models.Model): project = models.ForeignKey(Project) msgid = models.CharField(max_length=255) @@ -198,7 +201,7 @@ class Patch(models.Model): date = models.DateTimeField(default=datetime.datetime.now) submitter = models.ForeignKey(Person) delegate = models.ForeignKey(User, blank = True, null = True) - state = models.ForeignKey(State) + state = models.ForeignKey(State, default=get_default_initial_patch_state) archived = models.BooleanField(default = False) headers = models.TextField(blank = True) content = models.TextField(null = True, blank = True) |