Skip to content

Commit 03d9016

Browse files
committed
Merged django-1.8 work forward to copy of 6.39.1
- Legacy-Id: 12504
2 parents 7935926 + 19ec458 commit 03d9016

36 files changed

Lines changed: 420 additions & 516 deletions

env/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/local
66
/lib
77
/include
8+
/pip-selfcheck.json

ietf/dbtemplate/template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from docutils.utils import SystemMessage
55
import debug # pyflakes:ignore
66

7-
from django.template import Template as DjangoTemplate, TemplateDoesNotExist, TemplateEncodingError
7+
from django.template.base import Template as DjangoTemplate, TemplateDoesNotExist, TemplateEncodingError
88
from django.template.loader import BaseLoader
99
from django.utils.encoding import smart_unicode
1010

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('doc', '0016_auto_20160927_0713'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='docevent',
16+
name='type',
17+
field=models.CharField(max_length=50, choices=[(b'new_revision', b'Added new revision'), (b'new_submission', b'Uploaded new revision'), (b'changed_document', b'Changed document metadata'), (b'added_comment', b'Added comment'), (b'added_message', b'Added message'), (b'deleted', b'Deleted document'), (b'changed_state', b'Changed state'), (b'changed_stream', b'Changed document stream'), (b'expired_document', b'Expired document'), (b'extended_expiry', b'Extended expiry of document'), (b'requested_resurrect', b'Requested resurrect'), (b'completed_resurrect', b'Completed resurrect'), (b'changed_consensus', b'Changed consensus'), (b'published_rfc', b'Published RFC'), (b'added_suggested_replaces', b'Added suggested replacement relationships'), (b'reviewed_suggested_replaces', b'Reviewed suggested replacement relationships'), (b'changed_group', b'Changed group'), (b'changed_protocol_writeup', b'Changed protocol writeup'), (b'changed_charter_milestone', b'Changed charter milestone'), (b'initial_review', b'Set initial review time'), (b'changed_review_announcement', b'Changed WG Review text'), (b'changed_action_announcement', b'Changed WG Action text'), (b'started_iesg_process', b'Started IESG process on document'), (b'created_ballot', b'Created ballot'), (b'closed_ballot', b'Closed ballot'), (b'sent_ballot_announcement', b'Sent ballot announcement'), (b'changed_ballot_position', b'Changed ballot position'), (b'changed_ballot_approval_text', b'Changed ballot approval text'), (b'changed_ballot_writeup_text', b'Changed ballot writeup text'), (b'changed_rfc_editor_note_text', b'Changed RFC Editor Note text'), (b'changed_last_call_text', b'Changed last call text'), (b'requested_last_call', b'Requested last call'), (b'sent_last_call', b'Sent last call'), (b'scheduled_for_telechat', b'Scheduled for telechat'), (b'iesg_approved', b'IESG approved document (no problem)'), (b'iesg_disapproved', b'IESG disapproved document (do not publish)'), (b'approved_in_minute', b'Approved in minute'), (b'iana_review', b'IANA review comment'), (b'rfc_in_iana_registry', b'RFC is in IANA registry'), (b'rfc_editor_received_announcement', b'Announcement was received by RFC Editor'), (b'requested_publication', b'Publication at RFC Editor requested'), (b'sync_from_rfc_editor', b'Received updated information from RFC Editor'), (b'requested_review', b'Requested review'), (b'assigned_review_request', b'Assigned review request'), (b'closed_review_request', b'Closed review request')]),
18+
),
19+
migrations.AlterField(
20+
model_name='dochistory',
21+
name='tags',
22+
field=models.ManyToManyField(to='name.DocTagName', blank=True),
23+
),
24+
migrations.AlterField(
25+
model_name='document',
26+
name='tags',
27+
field=models.ManyToManyField(to='name.DocTagName', blank=True),
28+
),
29+
]

ietf/doc/models.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import datetime, os
44

55
from django.db import models
6+
from django.core import checks
67
from django.core.exceptions import ValidationError
78
from django.core.urlresolvers import reverse as urlreverse
89
from django.core.validators import URLValidator
@@ -26,6 +27,20 @@ class StateType(models.Model):
2627
def __unicode__(self):
2728
return self.slug
2829

30+
@checks.register('db-consistency')
31+
def check_statetype_slugs(app_configs, **kwargs):
32+
errors = []
33+
state_type_slugs = [ t.slug for t in StateType.objects.all() ]
34+
for type in DocTypeName.objects.all():
35+
if not type.slug in state_type_slugs:
36+
errors.append(checks.Error(
37+
"The document type '%s (%s)' does not have a corresponding entry in the doc.StateType table" % (type.name, type.slug),
38+
hint="You should add a doc.StateType entry with a slug '%s' to match the DocTypeName slug."%(type.slug),
39+
obj=type,
40+
id='datatracker.doc.E0015',
41+
))
42+
return errors
43+
2944
class State(models.Model):
3045
type = models.ForeignKey(StateType)
3146
slug = models.SlugField()
@@ -53,7 +68,7 @@ class DocumentInfo(models.Model):
5368
title = models.CharField(max_length=255)
5469

5570
states = models.ManyToManyField(State, blank=True) # plain state (Active/Expired/...), IESG state, stream state
56-
tags = models.ManyToManyField(DocTagName, blank=True, null=True) # Revised ID Needed, ExternalParty, AD Followup, ...
71+
tags = models.ManyToManyField(DocTagName, blank=True) # Revised ID Needed, ExternalParty, AD Followup, ...
5772
stream = models.ForeignKey(StreamName, blank=True, null=True) # IETF, IAB, IRTF, Independent Submission
5873
group = models.ForeignKey(Group, blank=True, null=True) # WG, RG, IAB, IESG, Edu, Tools
5974

@@ -277,7 +292,7 @@ def relations_that(self, relationship):
277292
if isinstance(self, Document):
278293
return RelatedDocument.objects.filter(target__document=self, relationship__in=relationship).select_related('source')
279294
elif isinstance(self, DocHistory):
280-
return RelatedDocHistory.objects.filter(target__document=self, relationship__in=relationship).select_related('source')
295+
return RelatedDocHistory.objects.filter(target__document=self.doc, relationship__in=relationship).select_related('source')
281296
else:
282297
return RelatedDocument.objects.none()
283298

ietf/doc/templatetags/ietf_filters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from ietf.utils.text import fill
1414
from django import template
1515
from django.conf import settings
16-
from django.utils.html import escape, fix_ampersands
16+
from django.utils.html import escape
1717
from django.template.defaultfilters import truncatewords_html, linebreaksbr, stringfilter, striptags, urlize
1818
from django.template import resolve_variable
1919
from django.utils.safestring import mark_safe, SafeData
@@ -69,7 +69,7 @@ def parse_email_list(value):
6969
(name, email) = parseaddr(addr)
7070
if not(name):
7171
name = email
72-
ret.append('<a href="mailto:%s">%s</a>' % ( fix_ampersands(email), escape(name) ))
72+
ret.append('<a href="mailto:%s">%s</a>' % ( email.replace('&', '&amp;'), escape(name) ))
7373
return mark_safe(", ".join(ret))
7474
else:
7575
return value

ietf/doc/utils_search.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def fill_in_document_table_attributes(docs):
1212
docs_dict = dict((d.pk, d) for d in docs)
1313
doc_ids = docs_dict.keys()
1414

15-
rfc_aliases = dict(DocAlias.objects.filter(name__startswith="rfc", document__in=doc_ids).values_list("document_id", "name"))
15+
rfc_aliases = dict(DocAlias.objects.filter(name__startswith="rfc", document__in=doc_ids).values_list("document", "name"))
1616

1717
# latest event cache
1818
event_types = ("published_rfc",
@@ -79,9 +79,9 @@ def fill_in_document_table_attributes(docs):
7979
d.updated_by_list = []
8080

8181
xed_by = RelatedDocument.objects.filter(target__name__in=rfc_aliases.values(),
82-
relationship__in=("obs", "updates")).select_related('target__document_id')
82+
relationship__in=("obs", "updates")).select_related('target__document')
8383
rel_rfc_aliases = dict(DocAlias.objects.filter(name__startswith="rfc",
84-
document__in=[rel.source_id for rel in xed_by]).values_list('document_id', 'name'))
84+
document__in=[rel.source_id for rel in xed_by]).values_list('document', 'name'))
8585
for rel in xed_by:
8686
d = docs_dict[rel.target.document_id]
8787
if rel.relationship_id == "obs":
@@ -101,7 +101,7 @@ def prepare_document_table(request, docs, query=None, max_results=500):
101101
if not isinstance(docs, list):
102102
# evaluate and fill in attribute results immediately to decrease
103103
# the number of queries
104-
docs = docs.select_related("ad", "ad__person", "std_level", "intended_std_level", "group", "stream")
104+
docs = docs.select_related("ad", "std_level", "intended_std_level", "group", "stream")
105105
docs = docs.prefetch_related("states__type", "tags", "groupmilestone_set__group", "reviewrequest_set__team")
106106

107107
docs = list(docs[:max_results])

ietf/doc/views_material.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class UploadMaterialForm(forms.Form):
3838
def __init__(self, doc_type, action, group, doc, *args, **kwargs):
3939
super(UploadMaterialForm, self).__init__(*args, **kwargs)
4040

41-
self.fields["state"].queryset = self.fields["state"].queryset.filter(type=doc_type)
41+
self.fields["state"].queryset = self.fields["state"].queryset.filter(type__slug=doc_type.slug)
4242

4343
self.doc_type = doc_type
4444
self.action = action

ietf/doc/views_stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def model_to_timeline_data(model, field='time', **kwargs):
3636
a JsonResponse() argument. The model must have a DateTimeField field.
3737
If the time field is named something else than 'time', the name must
3838
be supplied."""
39-
assert field in model._meta.get_all_field_names()
39+
assert field in [ f.name for f in model._meta.get_fields() ]
4040

4141
objects = ( model.objects.filter(**kwargs)
4242
.order_by('date')

ietf/idindex/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def all_id2_txt():
101101
# this returns a lot of data so try to be efficient
102102

103103
drafts = Document.objects.filter(type="draft").exclude(name__startswith="rfc").order_by('name')
104-
drafts = drafts.select_related('group', 'group__parent', 'ad', 'ad__email', 'intended_std_level', 'shepherd', 'shepherd__email')
104+
drafts = drafts.select_related('group', 'group__parent', 'ad', 'intended_std_level', 'shepherd', )
105105
drafts = drafts.prefetch_related("states")
106106

107107
rfc_aliases = dict(DocAlias.objects.filter(name__startswith="rfc",
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('ipr', '0008_auto_20160720_0218'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='genericiprdisclosure',
16+
name='holder_contact_email',
17+
field=models.EmailField(max_length=254),
18+
),
19+
migrations.AlterField(
20+
model_name='holderiprdisclosure',
21+
name='holder_contact_email',
22+
field=models.EmailField(max_length=254),
23+
),
24+
migrations.AlterField(
25+
model_name='holderiprdisclosure',
26+
name='ietfer_contact_email',
27+
field=models.EmailField(max_length=254, blank=True),
28+
),
29+
migrations.AlterField(
30+
model_name='iprdisclosurebase',
31+
name='submitter_email',
32+
field=models.EmailField(max_length=254, blank=True),
33+
),
34+
migrations.AlterField(
35+
model_name='nondocspecificiprdisclosure',
36+
name='holder_contact_email',
37+
field=models.EmailField(max_length=254),
38+
),
39+
migrations.AlterField(
40+
model_name='thirdpartyiprdisclosure',
41+
name='ietfer_contact_email',
42+
field=models.EmailField(max_length=254),
43+
),
44+
]

0 commit comments

Comments
 (0)