X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=apps%2Fpatchwork%2Fmodels.py;h=91c0f97f3f02e1208047757a1c022ccdd94df205;hb=74425beba0dc641509c5268571ea5328ac8185ec;hp=02fb8b4a4e55fc77489145c3280c0b13169abec3;hpb=65404776f7f0e975737a5c8c69dc0b2ae5fe93da;p=patchwork diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py index 02fb8b4..91c0f97 100644 --- a/apps/patchwork/models.py +++ b/apps/patchwork/models.py @@ -23,7 +23,6 @@ from django.core.urlresolvers import reverse from django.contrib.sites.models import Site from django.conf import settings from patchwork.parser import hash_patch -import django.oldforms as oldforms import re import datetime, time @@ -179,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) @@ -252,7 +251,7 @@ class Patch(models.Model): mail['Subject'] = self.name mail['Date'] = email.utils.formatdate( time.mktime(self.date.utctimetuple())) - mail['From'] = str(self.submitter) + mail['From'] = unicode(self.submitter) mail['X-Patchwork-Id'] = str(self.id) mail.set_unixfrom('From patchwork ' + self.date.ctime()) @@ -266,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) @@ -283,6 +283,7 @@ class Comment(models.Model): class Meta: ordering = ['date'] + unique_together = [('msgid', 'patch')] class Bundle(models.Model): owner = models.ForeignKey(User)