diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2008-10-29 11:21:05 +1100 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2008-10-29 11:21:05 +1100 |
commit | 74425beba0dc641509c5268571ea5328ac8185ec (patch) | |
tree | f9033b51d3b5608f398b5ce358ba202edefb10ad /apps/patchwork/models.py | |
parent | 4da08a17e860b6831f9446af46b2f562efeeb461 (diff) | |
download | patchwork-74425beba0dc641509c5268571ea5328ac8185ec.tar.bz2 patchwork-74425beba0dc641509c5268571ea5328ac8185ec.tar.xz |
[models] Make patches unique on (msgid, project), not just (msgid)
On patchwork.ozlabs.org, we may see multiple patches for different
projects, but with the same message-id.
We want these patches to show up on both projects, so we need to change
the current UNIQUE contstraint on msgid.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork/models.py')
-rw-r--r-- | apps/patchwork/models.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py index bb0b52c..91c0f97 100644 --- a/apps/patchwork/models.py +++ b/apps/patchwork/models.py @@ -178,7 +178,7 @@ class PatchMbox(MIMENonMultipart): class Patch(models.Model): project = models.ForeignKey(Project) - msgid = models.CharField(max_length=255, unique = True) + msgid = models.CharField(max_length=255) name = models.CharField(max_length=255) date = models.DateTimeField(default=datetime.datetime.now) submitter = models.ForeignKey(Person) @@ -265,10 +265,11 @@ class Patch(models.Model): class Meta: verbose_name_plural = 'Patches' ordering = ['date'] + unique_together = [('msgid', 'project')] class Comment(models.Model): patch = models.ForeignKey(Patch) - msgid = models.CharField(max_length=255, unique = True) + msgid = models.CharField(max_length=255) submitter = models.ForeignKey(Person) date = models.DateTimeField(default = datetime.datetime.now) headers = models.TextField(blank = True) @@ -282,6 +283,7 @@ class Comment(models.Model): class Meta: ordering = ['date'] + unique_together = [('msgid', 'patch')] class Bundle(models.Model): owner = models.ForeignKey(User) |