diff --git a/docker/install-extras b/docker/install-extras index fc81638b5..5ebbfa853 100755 --- a/docker/install-extras +++ b/docker/install-extras @@ -5,3 +5,4 @@ su - -c "apt-get update \ && apt-get install -qy graphviz ghostscript apache2-utils \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*" + \ No newline at end of file diff --git a/ietf/community/models.py b/ietf/community/models.py index ffaf307b0..a5c98f8e5 100644 --- a/ietf/community/models.py +++ b/ietf/community/models.py @@ -1,14 +1,21 @@ # Copyright The IETF Trust 2012-2019, All Rights Reserved +# -*- coding: utf-8 -*- + + +from __future__ import absolute_import, print_function, unicode_literals + from django.contrib.auth.models import User from django.db import models from django.db.models import signals from django.urls import reverse as urlreverse +from django.utils.encoding import python_2_unicode_compatible from ietf.doc.models import Document, DocEvent, State from ietf.group.models import Group from ietf.person.models import Person, Email from ietf.utils.models import ForeignKey +@python_2_unicode_compatible class CommunityList(models.Model): user = ForeignKey(User, blank=True, null=True) group = ForeignKey(Group, blank=True, null=True) @@ -34,6 +41,7 @@ class CommunityList(models.Model): return "" +@python_2_unicode_compatible class SearchRule(models.Model): # these types define the UI for setting up the rule, and also # helps when interpreting the rule and matching documents @@ -79,6 +87,7 @@ class SearchRule(models.Model): def __str__(self): return "%s %s %s/%s/%s/%s" % (self.community_list, self.rule_type, self.state, self.group, self.person, self.text) +@python_2_unicode_compatible class EmailSubscription(models.Model): community_list = ForeignKey(CommunityList) email = ForeignKey(Email) diff --git a/ietf/dbtemplate/models.py b/ietf/dbtemplate/models.py index 9ba70a9be..0678236c5 100644 --- a/ietf/dbtemplate/models.py +++ b/ietf/dbtemplate/models.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- # Copyright The IETF Trust 2012-2019, All Rights Reserved - - +from __future__ import absolute_import, print_function, unicode_literals from django.db import models from django.core.exceptions import ValidationError from django.template import Context +from django.utils.encoding import python_2_unicode_compatible from ietf.group.models import Group from ietf.name.models import DBTemplateTypeName @@ -19,6 +19,7 @@ TEMPLATE_TYPES = ( ) +@python_2_unicode_compatible class DBTemplate(models.Model): path = models.CharField( max_length=255, unique=True, blank=False, null=False, ) title = models.CharField( max_length=255, blank=False, null=False, ) diff --git a/ietf/iesg/models.py b/ietf/iesg/models.py index d20172cbd..bf716a9d9 100644 --- a/ietf/iesg/models.py +++ b/ietf/iesg/models.py @@ -1,5 +1,6 @@ # Copyright The IETF Trust 2007-2019, All Rights Reserved - +# -*- coding: utf-8 -*- +# # Portion Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. Contact: Pasi Eronen # @@ -32,11 +33,15 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +from __future__ import absolute_import, print_function, unicode_literals + import datetime from django.db import models +from django.utils.encoding import python_2_unicode_compatible - +@python_2_unicode_compatible class TelechatAgendaItem(models.Model): TYPE_CHOICES = ( (1, "Any Other Business (WG News, New Proposals, etc.)"), @@ -51,7 +56,7 @@ class TelechatAgendaItem(models.Model): def __str__(self): type_name = self.TYPE_CHOICES_DICT.get(self.type, str(self.type)) - return '%s: %s' % (type_name, self.title or "") + return "%s: %s" % (type_name, self.title or "") class Telechat(models.Model): telechat_id = models.IntegerField(primary_key=True) @@ -77,6 +82,7 @@ class TelechatDateManager(models.Manager): def active(self): return self.get_queryset().filter(date__gte=datetime.date.today()) +@python_2_unicode_compatible class TelechatDate(models.Model): objects = TelechatDateManager() diff --git a/ietf/ipr/models.py b/ietf/ipr/models.py index 0c79818e1..4b70dbe3c 100644 --- a/ietf/ipr/models.py +++ b/ietf/ipr/models.py @@ -1,10 +1,15 @@ # Copyright The IETF Trust 2007-2019, All Rights Reserved +# -*- coding: utf-8 -*- + + +from __future__ import absolute_import, print_function, unicode_literals import datetime from django.conf import settings -from django.urls import reverse from django.db import models +from django.urls import reverse +from django.utils.encoding import python_2_unicode_compatible from ietf.doc.models import DocAlias from ietf.name.models import DocRelationshipName,IprDisclosureStateName,IprLicenseTypeName,IprEventTypeName @@ -12,6 +17,7 @@ from ietf.person.models import Person from ietf.message.models import Message from ietf.utils.models import ForeignKey +@python_2_unicode_compatible class IprDisclosureBase(models.Model): by = ForeignKey(Person) # who was logged in, or System if nobody was logged in compliant = models.BooleanField("Complies to RFC3979", default=True) @@ -148,6 +154,7 @@ class GenericIprDisclosure(IprDisclosureBase): holder_contact_info = models.TextField(blank=True, help_text="Address, phone, etc.") statement = models.TextField() # includes licensing info +@python_2_unicode_compatible class IprDocRel(models.Model): disclosure = ForeignKey(IprDisclosureBase) document = ForeignKey(DocAlias) @@ -178,6 +185,7 @@ class IprDocRel(models.Model): else: return "%s which applies to %s" % (self.disclosure, self.document.name) +@python_2_unicode_compatible class RelatedIpr(models.Model): source = ForeignKey(IprDisclosureBase,related_name='relatedipr_source_set') target = ForeignKey(IprDisclosureBase,related_name='relatedipr_target_set') @@ -186,6 +194,7 @@ class RelatedIpr(models.Model): def __str__(self): return "%s %s %s" % (self.source.title, self.relationship.name.lower(), self.target.title) +@python_2_unicode_compatible class IprEvent(models.Model): time = models.DateTimeField(auto_now_add=True) type = ForeignKey(IprEventTypeName) diff --git a/ietf/liaisons/models.py b/ietf/liaisons/models.py index ed2ddfac9..77a29e9a0 100644 --- a/ietf/liaisons/models.py +++ b/ietf/liaisons/models.py @@ -1,8 +1,13 @@ # Copyright The IETF Trust 2007-2019, All Rights Reserved +# -*- coding: utf-8 -*- + + +from __future__ import absolute_import, print_function, unicode_literals from django.conf import settings from django.urls import reverse as urlreverse from django.db import models +from django.utils.encoding import python_2_unicode_compatible from django.utils.text import slugify from ietf.person.models import Email, Person @@ -24,6 +29,7 @@ STATE_EVENT_MAPPING = { } +@python_2_unicode_compatible class LiaisonStatement(models.Model): title = models.CharField(max_length=255) from_groups = models.ManyToManyField(Group, blank=True, related_name='liaisonstatement_from_set') @@ -47,7 +53,6 @@ class LiaisonStatement(models.Model): class Meta: ordering = ['id'] - def __str__(self): return self.title or "" @@ -198,6 +203,7 @@ class LiaisonStatement(models.Model): approval_set.intersection_update(group.liaison_approvers()) return list(set([ r.email.address for r in approval_set ])) +@python_2_unicode_compatible class LiaisonStatementAttachment(models.Model): statement = ForeignKey(LiaisonStatement) document = ForeignKey(Document) @@ -207,6 +213,7 @@ class LiaisonStatementAttachment(models.Model): return self.document.name +@python_2_unicode_compatible class RelatedLiaisonStatement(models.Model): source = ForeignKey(LiaisonStatement, related_name='source_of_set') target = ForeignKey(LiaisonStatement, related_name='target_of_set') @@ -216,6 +223,7 @@ class RelatedLiaisonStatement(models.Model): return "%s %s %s" % (self.source.title, self.relationship.name.lower(), self.target.title) +@python_2_unicode_compatible class LiaisonStatementGroupContacts(models.Model): group = ForeignKey(Group, unique=True, null=True) contacts = models.CharField(max_length=255,blank=True) @@ -225,6 +233,7 @@ class LiaisonStatementGroupContacts(models.Model): return "%s" % self.group.name +@python_2_unicode_compatible class LiaisonStatementEvent(models.Model): time = models.DateTimeField(auto_now_add=True) type = ForeignKey(LiaisonStatementEventTypeName) diff --git a/ietf/mailinglists/models.py b/ietf/mailinglists/models.py index 63e4808d8..a3e742f28 100644 --- a/ietf/mailinglists/models.py +++ b/ietf/mailinglists/models.py @@ -1,22 +1,29 @@ # Copyright The IETF Trust 2016-2019, All Rights Reserved +# -*- coding: utf-8 -*- +from __future__ import absolute_import, print_function, unicode_literals + from django.conf import settings from django.core.validators import validate_email from django.db import models +from django.utils.encoding import python_2_unicode_compatible from ietf.person.models import Person from ietf.utils.models import ForeignKey +@python_2_unicode_compatible class List(models.Model): name = models.CharField(max_length=32) description = models.CharField(max_length=256) advertised = models.BooleanField(default=True) + def __str__(self): return "" % self.name def info_url(self): return settings.MAILING_LIST_INFO_URL % {'list_addr': self.name } +@python_2_unicode_compatible class Subscribed(models.Model): time = models.DateTimeField(auto_now_add=True) email = models.CharField(max_length=64, validators=[validate_email]) @@ -26,6 +33,7 @@ class Subscribed(models.Model): class Meta: verbose_name_plural = "Subscribed" +@python_2_unicode_compatible class Whitelisted(models.Model): time = models.DateTimeField(auto_now_add=True) email = models.CharField("Email address", max_length=64, validators=[validate_email]) diff --git a/ietf/mailtrigger/models.py b/ietf/mailtrigger/models.py index 7e770b388..7de884552 100644 --- a/ietf/mailtrigger/models.py +++ b/ietf/mailtrigger/models.py @@ -1,7 +1,12 @@ # Copyright The IETF Trust 2015-2019, All Rights Reserved +# -*- coding: utf-8 -*- + + +from __future__ import absolute_import, print_function, unicode_literals from django.db import models from django.template import Template, Context +from django.utils.encoding import python_2_unicode_compatible from email.utils import parseaddr from ietf.utils.mail import formataddr, get_email_addresses_from_text @@ -28,6 +33,7 @@ def clean_duplicates(addrlist): addresses.append(addr) return addresses +@python_2_unicode_compatible class MailTrigger(models.Model): slug = models.CharField(max_length=32, primary_key=True) desc = models.TextField(blank=True) @@ -40,6 +46,7 @@ class MailTrigger(models.Model): def __str__(self): return self.slug +@python_2_unicode_compatible class Recipient(models.Model): slug = models.CharField(max_length=32, primary_key=True) desc = models.TextField(blank=True) diff --git a/ietf/message/models.py b/ietf/message/models.py index 0740d1f27..9a03bde36 100644 --- a/ietf/message/models.py +++ b/ietf/message/models.py @@ -1,8 +1,14 @@ # Copyright The IETF Trust 2012-2019, All Rights Reserved +# -*- coding: utf-8 -*- + + +from __future__ import absolute_import, print_function, unicode_literals + import datetime import email.utils from django.db import models +from django.utils.encoding import python_2_unicode_compatible import debug # pyflakes:ignore @@ -13,6 +19,7 @@ from ietf.name.models import RoleName from ietf.utils.models import ForeignKey from ietf.utils.mail import get_email_addresses_from_text +@python_2_unicode_compatible class Message(models.Model): time = models.DateTimeField(default=datetime.datetime.now) by = ForeignKey(Person) @@ -41,6 +48,7 @@ class Message(models.Model): return r if isinstance(r, list) else get_email_addresses_from_text(r) +@python_2_unicode_compatible class MessageAttachment(models.Model): message = ForeignKey(Message) filename = models.CharField(max_length=255, db_index=True, blank=True) @@ -53,6 +61,7 @@ class MessageAttachment(models.Model): return self.filename +@python_2_unicode_compatible class SendQueue(models.Model): time = models.DateTimeField(default=datetime.datetime.now) by = ForeignKey(Person) @@ -71,6 +80,7 @@ class SendQueue(models.Model): return "'%s' %s -> %s (sent at %s)" % (self.message.subject, self.message.frm, self.message.to, self.sent_at or "") +@python_2_unicode_compatible class AnnouncementFrom(models.Model): name = ForeignKey(RoleName) group = ForeignKey(Group) diff --git a/ietf/name/models.py b/ietf/name/models.py index 19d2d7eea..453b7042e 100644 --- a/ietf/name/models.py +++ b/ietf/name/models.py @@ -1,9 +1,15 @@ # Copyright The IETF Trust 2010-2019, All Rights Reserved +# -*- coding: utf-8 -*- + + +from __future__ import absolute_import, print_function, unicode_literals from django.db import models +from django.utils.encoding import python_2_unicode_compatible from ietf.utils.models import ForeignKey +@python_2_unicode_compatible class NameModel(models.Model): slug = models.CharField(max_length=32, primary_key=True) name = models.CharField(max_length=255) diff --git a/ietf/nomcom/models.py b/ietf/nomcom/models.py index 249958cb7..d0977acea 100644 --- a/ietf/nomcom/models.py +++ b/ietf/nomcom/models.py @@ -1,5 +1,7 @@ # Copyright The IETF Trust 2012-2019, All Rights Reserved # -*- coding: utf-8 -*- +from __future__ import absolute_import, print_function, unicode_literals + import os from django.db import models @@ -8,6 +10,7 @@ from django.conf import settings from django.contrib.auth.models import User from django.template.loader import render_to_string from django.template.defaultfilters import linebreaks +from django.utils.encoding import python_2_unicode_compatible import debug # pyflakes:ignore @@ -40,6 +43,7 @@ class ReminderDates(models.Model): nomcom = ForeignKey('NomCom') +@python_2_unicode_compatible class NomCom(models.Model): public_key = models.FileField(storage=NoLocationMigrationFileSystemStorage(location=settings.NOMCOM_PUBLIC_KEYS_DIR), upload_to=upload_path_handler, blank=True, null=True) @@ -82,14 +86,14 @@ class NomCom(models.Model): def pending_email_count(self): return self.feedback_set.filter(type__isnull=True).count() - def encrypt(self, cleartext:str) -> bytes: + def encrypt(self, cleartext): try: cert_file = self.public_key.path except ValueError as e: raise ValueError("Trying to read the NomCom public key: " + str(e)) command = "%s smime -encrypt -in /dev/stdin %s" % (settings.OPENSSL_COMMAND, cert_file) - code, out, error = pipe(command, cleartext.encode()) + code, out, error = pipe(command, cleartext.encode('utf-8')) if code != 0: log("openssl error: %s:\n Error %s: %s" %(command, code, error)) if not error: @@ -106,6 +110,7 @@ def delete_nomcom(sender, **kwargs): post_delete.connect(delete_nomcom, sender=NomCom) +@python_2_unicode_compatible class Nomination(models.Model): position = ForeignKey('Position') candidate_name = models.CharField(verbose_name='Candidate name', max_length=255) @@ -130,6 +135,7 @@ class Nomination(models.Model): return "%s (%s)" % (self.candidate_name, self.candidate_email) +@python_2_unicode_compatible class Nominee(models.Model): email = ForeignKey(Email) @@ -147,9 +153,9 @@ class Nominee(models.Model): def __str__(self): if self.email.person and self.email.person.name: - return '%s <%s> %s' % (self.email.person.plain_name(), self.email.address, self.nomcom.year()) + return "%s <%s> %s" % (self.email.person.plain_name(), self.email.address, self.nomcom.year()) else: - return '%s %s' % (self.email.address, self.nomcom.year()) + return "%s %s" % (self.email.address, self.nomcom.year()) def name(self): if self.email.person and self.email.person.name: @@ -157,6 +163,7 @@ class Nominee(models.Model): else: return self.email.address +@python_2_unicode_compatible class NomineePosition(models.Model): position = ForeignKey('Position') @@ -186,6 +193,7 @@ class NomineePosition(models.Model): nominees__in=[self.nominee]) +@python_2_unicode_compatible class Position(models.Model): nomcom = ForeignKey('NomCom') name = models.CharField(verbose_name='Name', max_length=255, help_text='This short description will appear on the Nomination and Feedback pages. Be as descriptive as necessary. Past examples: "Transport AD", "IAB Member"') @@ -232,6 +240,7 @@ class Position(models.Model): rendered = linebreaks(rendered) return rendered +@python_2_unicode_compatible class Topic(models.Model): nomcom = ForeignKey('NomCom') subject = models.CharField(verbose_name='Name', max_length=255, help_text='This short description will appear on the Feedback pages.') @@ -261,6 +270,7 @@ class Topic(models.Model): rendered = linebreaks(rendered) return rendered +@python_2_unicode_compatible class Feedback(models.Model): nomcom = ForeignKey('NomCom') author = models.EmailField(verbose_name='Author', blank=True) diff --git a/ietf/redirects/models.py b/ietf/redirects/models.py index eddf59cc7..6a3b702e5 100644 --- a/ietf/redirects/models.py +++ b/ietf/redirects/models.py @@ -1,9 +1,15 @@ # Copyright The IETF Trust 2007-2019, All Rights Reserved +# -*- coding: utf-8 -*- + + +from __future__ import absolute_import, print_function, unicode_literals from django.db import models +from django.utils.encoding import python_2_unicode_compatible from ietf.utils.models import ForeignKey +@python_2_unicode_compatible class Redirect(models.Model): """Mapping of CGI script to url. The "rest" is a sprintf-style string with %(param)s entries to insert @@ -24,6 +30,7 @@ class Redirect(models.Model): def __str__(self): return "%s -> %s/%s" % (self.cgi, self.url, self.rest) +@python_2_unicode_compatible class Suffix(models.Model): """This is a "rest" and "remove" (see Redirect class) for requests with command=. @@ -35,6 +42,7 @@ class Suffix(models.Model): class Meta: verbose_name_plural="Suffixes" +@python_2_unicode_compatible class Command(models.Model): """When a request comes in with a command= argument, the command is looked up in this table to see if there diff --git a/ietf/review/models.py b/ietf/review/models.py index 2a1536077..4cdb34297 100644 --- a/ietf/review/models.py +++ b/ietf/review/models.py @@ -1,10 +1,15 @@ # Copyright The IETF Trust 2016-2019, All Rights Reserved +# -*- coding: utf-8 -*- + + +from __future__ import absolute_import, print_function, unicode_literals import datetime from simple_history.models import HistoricalRecords from django.db import models +from django.utils.encoding import python_2_unicode_compatible from ietf.doc.models import Document from ietf.group.models import Group @@ -13,6 +18,7 @@ from ietf.name.models import ReviewTypeName, ReviewRequestStateName, ReviewResul from ietf.utils.validators import validate_regular_expression_string from ietf.utils.models import ForeignKey, OneToOneField +@python_2_unicode_compatible class ReviewerSettings(models.Model): """Keeps track of admin data associated with a reviewer in a team.""" history = HistoricalRecords() @@ -39,6 +45,7 @@ class ReviewerSettings(models.Model): class Meta: verbose_name_plural = "reviewer settings" +@python_2_unicode_compatible class ReviewSecretarySettings(models.Model): """Keeps track of admin data associated with a secretary in a team.""" team = ForeignKey(Group, limit_choices_to=~models.Q(reviewteamsettings=None)) @@ -51,6 +58,7 @@ class ReviewSecretarySettings(models.Model): class Meta: verbose_name_plural = "review secretary settings" +@python_2_unicode_compatible class UnavailablePeriod(models.Model): team = ForeignKey(Group, limit_choices_to=~models.Q(reviewteamsettings=None)) person = ForeignKey(Person) @@ -81,6 +89,7 @@ class UnavailablePeriod(models.Model): def __str__(self): return "{} is unavailable in {} {} - {}".format(self.person, self.team.acronym, self.start_date or "", self.end_date or "") +@python_2_unicode_compatible class ReviewWish(models.Model): """Reviewer wishes to review a document when it becomes available for review.""" time = models.DateTimeField(default=datetime.datetime.now) @@ -95,6 +104,7 @@ class ReviewWish(models.Model): verbose_name_plural = "review wishes" +@python_2_unicode_compatible class NextReviewerInTeam(models.Model): team = ForeignKey(Group, limit_choices_to=~models.Q(reviewteamsettings=None)) next_reviewer = ForeignKey(Person) @@ -106,6 +116,7 @@ class NextReviewerInTeam(models.Model): verbose_name = "next reviewer in team setting" verbose_name_plural = "next reviewer in team settings" +@python_2_unicode_compatible class ReviewRequest(models.Model): """Represents a request for a review and the process it goes through.""" state = ForeignKey(ReviewRequestStateName) @@ -130,6 +141,7 @@ class ReviewRequest(models.Model): def request_closed_time(self): return self.doc.request_closed_time(self) or self.time +@python_2_unicode_compatible class ReviewAssignment(models.Model): """ One of possibly many reviews assigned in response to a ReviewRequest """ review_request = ForeignKey(ReviewRequest) @@ -152,6 +164,7 @@ def get_default_review_types(): def get_default_review_results(): return ReviewResultName.objects.filter(slug__in=['not-ready', 'right-track', 'almost-ready', 'ready-issues', 'ready-nits', 'ready']) +@python_2_unicode_compatible class ReviewTeamSettings(models.Model): """Holds configuration specific to groups that are review teams""" group = OneToOneField(Group) diff --git a/ietf/secr/proceedings/models.py b/ietf/secr/proceedings/models.py index 107da0cd3..e7d24e7c8 100644 --- a/ietf/secr/proceedings/models.py +++ b/ietf/secr/proceedings/models.py @@ -1,8 +1,14 @@ # Copyright The IETF Trust 2013-2019, All Rights Reserved +# -*- coding: utf-8 -*- + + +from __future__ import absolute_import, print_function, unicode_literals + import os from django.conf import settings from django.db import models +from django.utils.encoding import python_2_unicode_compatible from ietf.meeting.models import Meeting @@ -57,6 +63,7 @@ class InterimMeeting(Meeting): else: return '' +@python_2_unicode_compatible class Registration(models.Model): rsn = models.AutoField(primary_key=True) fname = models.CharField(max_length=255) diff --git a/ietf/settings.py b/ietf/settings.py index 66b98ef92..1060e0b2a 100644 --- a/ietf/settings.py +++ b/ietf/settings.py @@ -831,6 +831,7 @@ MEETING_VALID_MIME_TYPE_EXTENSIONS = { INTERNET_DRAFT_DAYS_TO_EXPIRE = 185 FLOORPLAN_MEDIA_DIR = 'floor' +FLOORPLAN_DIR = os.path.join(MEDIA_ROOT, FLOORPLAN_MEDIA_DIR) # ============================================================================== diff --git a/ietf/stats/models.py b/ietf/stats/models.py index 7a139bcf7..924ff962e 100644 --- a/ietf/stats/models.py +++ b/ietf/stats/models.py @@ -1,6 +1,11 @@ # Copyright The IETF Trust 2017-2019, All Rights Reserved +# -*- coding: utf-8 -*- + + +from __future__ import absolute_import, print_function, unicode_literals from django.db import models +from django.utils.encoding import python_2_unicode_compatible import debug # pyflakes:ignore @@ -10,6 +15,7 @@ from ietf.person.models import Person from ietf.utils.models import ForeignKey +@python_2_unicode_compatible class AffiliationAlias(models.Model): """Records that alias should be treated as name for statistical purposes.""" @@ -27,6 +33,7 @@ class AffiliationAlias(models.Model): class Meta: verbose_name_plural = "affiliation aliases" +@python_2_unicode_compatible class AffiliationIgnoredEnding(models.Model): """Records that ending should be stripped from the affiliation for statistical purposes.""" @@ -35,6 +42,7 @@ class AffiliationIgnoredEnding(models.Model): def __str__(self): return self.ending +@python_2_unicode_compatible class CountryAlias(models.Model): """Records that alias should be treated as country for statistical purposes.""" @@ -48,6 +56,7 @@ class CountryAlias(models.Model): class Meta: verbose_name_plural = "country aliases" +@python_2_unicode_compatible class MeetingRegistration(models.Model): """Registration attendee records from the IETF registration system""" meeting = ForeignKey(Meeting) diff --git a/ietf/submit/models.py b/ietf/submit/models.py index 9450a283d..04f7400bf 100644 --- a/ietf/submit/models.py +++ b/ietf/submit/models.py @@ -1,9 +1,15 @@ # Copyright The IETF Trust 2011-2019, All Rights Reserved +# -*- coding: utf-8 -*- + + +from __future__ import absolute_import, print_function, unicode_literals + import datetime import email +import jsonfield from django.db import models -import jsonfield +from django.utils.encoding import python_2_unicode_compatible import debug # pyflakes:ignore @@ -24,6 +30,7 @@ def parse_email_line(line): name, addr = email.utils.parseaddr(line) if '@' in line else (line, '') return dict(name=name, email=addr) +@python_2_unicode_compatible class Submission(models.Model): state = ForeignKey(DraftSubmissionStateName) remote_ip = models.CharField(max_length=100, blank=True) @@ -71,6 +78,7 @@ class Submission(models.Model): checks = [ self.checks.filter(checker=c).latest('time') for c in self.checks.values_list('checker', flat=True).distinct() ] return checks +@python_2_unicode_compatible class SubmissionCheck(models.Model): time = models.DateTimeField(default=datetime.datetime.now) submission = ForeignKey(Submission, related_name='checks') @@ -89,6 +97,7 @@ class SubmissionCheck(models.Model): def has_errors(self): return self.errors != '[]' +@python_2_unicode_compatible class SubmissionEvent(models.Model): submission = ForeignKey(Submission) time = models.DateTimeField(default=datetime.datetime.now) @@ -102,6 +111,7 @@ class SubmissionEvent(models.Model): ordering = ("-time", "-id") +@python_2_unicode_compatible class Preapproval(models.Model): """Pre-approved draft submission name.""" name = models.CharField(max_length=255, db_index=True) @@ -111,6 +121,7 @@ class Preapproval(models.Model): def __str__(self): return self.name +@python_2_unicode_compatible class SubmissionEmailEvent(SubmissionEvent): message = ForeignKey(Message, null=True, blank=True,related_name='manualevents') msgtype = models.CharField(max_length=25)