Merged django18 work forward to 6.39

- Legacy-Id: 12449
This commit is contained in:
Henrik Levkowetz 2016-12-05 14:01:25 +00:00
commit 0bb7854591
19 changed files with 154 additions and 168 deletions

View file

@ -4,7 +4,7 @@ from docutils.core import publish_string
from docutils.utils import SystemMessage
import debug # pyflakes:ignore
from django.template import Template as DjangoTemplate, TemplateDoesNotExist, TemplateEncodingError
from django.template.base import Template as DjangoTemplate, TemplateDoesNotExist, TemplateEncodingError
from django.template.loader import BaseLoader
from django.utils.encoding import smart_unicode

View file

@ -53,7 +53,7 @@ class DocumentInfo(models.Model):
title = models.CharField(max_length=255)
states = models.ManyToManyField(State, blank=True) # plain state (Active/Expired/...), IESG state, stream state
tags = models.ManyToManyField(DocTagName, blank=True, null=True) # Revised ID Needed, ExternalParty, AD Followup, ...
tags = models.ManyToManyField(DocTagName, blank=True) # Revised ID Needed, ExternalParty, AD Followup, ...
stream = models.ForeignKey(StreamName, blank=True, null=True) # IETF, IAB, IRTF, Independent Submission
group = models.ForeignKey(Group, blank=True, null=True) # WG, RG, IAB, IESG, Edu, Tools
@ -277,7 +277,7 @@ class DocumentInfo(models.Model):
if isinstance(self, Document):
return RelatedDocument.objects.filter(target__document=self, relationship__in=relationship).select_related('source')
elif isinstance(self, DocHistory):
return RelatedDocHistory.objects.filter(target__document=self, relationship__in=relationship).select_related('source')
return RelatedDocHistory.objects.filter(target__document=self.doc, relationship__in=relationship).select_related('source')
else:
return RelatedDocument.objects.none()

View file

@ -13,7 +13,7 @@ from ietf.doc.models import ConsensusDocEvent
from ietf.doc.utils import get_document_content
from django import template
from django.conf import settings
from django.utils.html import escape, fix_ampersands
from django.utils.html import escape
from django.template.defaultfilters import truncatewords_html, linebreaksbr, stringfilter, striptags, urlize
from django.template import resolve_variable
from django.utils.safestring import mark_safe, SafeData
@ -69,7 +69,7 @@ def parse_email_list(value):
(name, email) = parseaddr(addr)
if not(name):
name = email
ret.append('<a href="mailto:%s">%s</a>' % ( fix_ampersands(email), escape(name) ))
ret.append('<a href="mailto:%s">%s</a>' % ( email.replace('&', '&amp;'), escape(name) ))
return mark_safe(", ".join(ret))
else:
return value

View file

@ -12,7 +12,7 @@ def fill_in_document_table_attributes(docs):
docs_dict = dict((d.pk, d) for d in docs)
doc_ids = docs_dict.keys()
rfc_aliases = dict(DocAlias.objects.filter(name__startswith="rfc", document__in=doc_ids).values_list("document_id", "name"))
rfc_aliases = dict(DocAlias.objects.filter(name__startswith="rfc", document__in=doc_ids).values_list("document", "name"))
# latest event cache
event_types = ("published_rfc",
@ -79,9 +79,9 @@ def fill_in_document_table_attributes(docs):
d.updated_by_list = []
xed_by = RelatedDocument.objects.filter(target__name__in=rfc_aliases.values(),
relationship__in=("obs", "updates")).select_related('target__document_id')
relationship__in=("obs", "updates")).select_related('target__document')
rel_rfc_aliases = dict(DocAlias.objects.filter(name__startswith="rfc",
document__in=[rel.source_id for rel in xed_by]).values_list('document_id', 'name'))
document__in=[rel.source_id for rel in xed_by]).values_list('document', 'name'))
for rel in xed_by:
d = docs_dict[rel.target.document_id]
if rel.relationship_id == "obs":
@ -101,7 +101,7 @@ def prepare_document_table(request, docs, query=None, max_results=500):
if not isinstance(docs, list):
# evaluate and fill in attribute results immediately to decrease
# the number of queries
docs = docs.select_related("ad", "ad__person", "std_level", "intended_std_level", "group", "stream")
docs = docs.select_related("ad", "std_level", "intended_std_level", "group", "stream")
docs = docs.prefetch_related("states__type", "tags", "groupmilestone_set__group", "reviewrequest_set__team")
docs = list(docs[:max_results])

View file

@ -38,7 +38,7 @@ class UploadMaterialForm(forms.Form):
def __init__(self, doc_type, action, group, doc, *args, **kwargs):
super(UploadMaterialForm, self).__init__(*args, **kwargs)
self.fields["state"].queryset = self.fields["state"].queryset.filter(type=doc_type)
self.fields["state"].queryset = self.fields["state"].queryset.filter(type__slug=doc_type.slug)
self.doc_type = doc_type
self.action = action

View file

@ -40,7 +40,7 @@ class LiaisonStatement(models.Model):
other_identifiers = models.TextField(blank=True, null=True) # Identifiers from other bodies
body = models.TextField(blank=True)
tags = models.ManyToManyField(LiaisonStatementTagName, blank=True, null=True)
tags = models.ManyToManyField(LiaisonStatementTagName, blank=True)
attachments = models.ManyToManyField(Document, through='LiaisonStatementAttachment', blank=True)
state = models.ForeignKey(LiaisonStatementState, default='pending')
@ -212,7 +212,7 @@ class RelatedLiaisonStatement(models.Model):
class LiaisonStatementGroupContacts(models.Model):
group = models.ForeignKey(Group, unique=True)
group = models.ForeignKey(Group, unique=True, null=True)
contacts = models.CharField(max_length=255,blank=True)
cc_contacts = models.CharField(max_length=255,blank=True)

View file

@ -22,8 +22,8 @@ def clean_duplicates(addrlist):
class MailTrigger(models.Model):
slug = models.CharField(max_length=32, primary_key=True)
desc = models.TextField(blank=True)
to = models.ManyToManyField('Recipient', null=True, blank=True, related_name='used_in_to')
cc = models.ManyToManyField('Recipient', null=True, blank=True, related_name='used_in_cc')
to = models.ManyToManyField('Recipient', blank=True, related_name='used_in_to')
cc = models.ManyToManyField('Recipient', blank=True, related_name='used_in_cc')
class Meta:
ordering = ["slug"]

File diff suppressed because one or more lines are too long

View file

@ -1,93 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<django-objects version="1.0"><object pk="179" model="dbtemplate.dbtemplate"><field type="CharField" name="path">/meeting/proceedings/defaults/overview.rst</field><field type="CharField" name="title">Proceedings Overview Template</field><field type="TextField" name="variables"><None></None></field><field to="name.dbtemplatetypename" name="type" rel="ManyToOneRel">rst</field><field type="TextField" name="content">The Internet Engineering Task Force (IETF) provides a forum for working groups to coordinate technical development of new protocols. Its most important function is the development and selection of standards within the Internet protocol suite.
The IETF began in January 1986 as a forum for technical coordination by contractors for the then US Defense Advanced Research Projects Agency (DARPA), working on the ARPANET, US Defense Data Network (DDN), and the Internet core gateway system. Since that time, the IETF has grown into a large open international community of network designers, operators, vendors, and researchers concerned with the evolution of the Internet architecture and the smooth operation of the Internet.
The IETF mission includes:
* Identifying and proposing solutions to pressing operational and technical problems in the Internet
* Specifying the development or usage of protocols and the near-term architecture, to solve technical problems for the Internet
* Facilitating technology transfer from the Internet Research Task Force (IRTF) to the wider Internet community;and
* Providing a forum for the exchange of relevant information within the Internet community between vendors, users, researchers, agency contractors, and network managers.
Technical activities in the IETF are addressed within working groups. All working groups are organized roughly by function into seven areas. Each area is led by one or more Area Directors who have primary responsibility for that one area of IETF activity. Together with the Chair of the IETF/IESG, these Area Directors comprise the Internet Engineering Steering Group (IESG).
=================== =================================== ========================
Name Area Email
=================== =================================== ========================
Jari Arkko IETF Chair chair@ietf.org
Jari Arkko General Area jari.arkko@piuha.net
Alia Atlas Routing Area akatlas@gmail.com
Deborah Brungard Routing Areas db3546@att.com
Ben Campbell Applications and Real-Time Area ben@nostrum.com
Benoit Claise Operations and Management Area bclaise@cisco.com
Alissa Cooper Applications and Real-Time Area alissa@cooperw.in
Spencer Dawkins Transport Area spencerdawkins.ietf@gmail.com
Stephen Farrell Security Area stephen.farrell@cs.tcd.ie
Brian Haberman Internet Area brian@innovationslab.net
Joel Jaeggli Operations and Management Area joelja@bogus.com
Barry Leiba Applications and Real-Time Area barryleiba@computer.org
Terry Manderson Internet Area terry.manderson@icann.org
Kathleen Moriarty Security Area Kathleen.Moriarty.ietf@gmail.com
Alvaro Retana Routing Area aretana@cisco.com
Martin Stiemerling Transport Area mls.ietf@gmail.com
=================== =================================== ========================
Liaison and ex-officio members include:
=================== =================================== ========================
Olaf Kolkman IAB Chair iab-chair@iab.org
Danny McPherson IAB Liaison danny@tcb.net
Michelle Cotton IANA Liaison iana@iana.org
Sandy Ginoza RFC Editor Liaison rfc-editor@rfc-editor.org
Alexa Morris IETF Secretariat Liaison exec-director@ietf.org
=================== =================================== ========================
The IETF has a Secretariat, which is managed by Association Management Solutions, LLC (AMS) in Fremont, California.The IETF Executive Director is Alexa Morris (exec-director@ietf.org).
Other personnel that provide full-time support to the Secretariat include:
========================= ===================================
Senior Meeting Planner Marcia Beaulieu
Project Manager Stephanie McCammon
Meeting Regsitrar Maddy Conner
Project Manager Cindy Morgan
Project Manager Amy Vezza
========================= ===================================
To contact the Secretariat, please refer to the addresses and URLs provided on the IETF Secretariat Web page.
The IETF also has a general Administrative Support Activity headed by the IETF Administrative Director, Ray Pelletier iad@ietf.org
The working groups conduct their business during the tri-annual IETF meetings, at interim working group meetings, and via electronic mail on mailing lists established for each group. The tri-annual IETF meetings are 4.5 days in duration, and consist of working group sessions, training sessions, and plenary sessions. The plenary sessions include technical presentations, status reports, and an open IESG meeting.
Following each meeting, the IETF Secretariat publishes meeting proceedings, which contain reports from all of the groups that met, as well as presentation slides, where available. The proceedings also include a summary of the standards-related activities that took place since the previous IETF meeting.
Meeting minutes, working group charters (including information about the working group mailing lists), and general information on current IETF activities are available on the IETF Web site at https://www.ietf.org.</field><field to="group.group" name="group" rel="ManyToOneRel">1</field></object></django-objects>

View file

@ -418,7 +418,7 @@ class TimeSlot(models.Model):
duration = TimedeltaField()
location = models.ForeignKey(Room, blank=True, null=True)
show_location = models.BooleanField(default=True, help_text="Show location in agenda.")
sessions = models.ManyToManyField('Session', related_name='slots', through='SchedTimeSessAssignment', null=True, blank=True, help_text=u"Scheduled session, if any.")
sessions = models.ManyToManyField('Session', related_name='slots', through='SchedTimeSessAssignment', blank=True, help_text=u"Scheduled session, if any.")
modified = models.DateTimeField(auto_now=True)
#

View file

@ -1,6 +1,6 @@
from django.conf import settings
from django import forms
from django.contrib.formtools.preview import FormPreview, AUTO_ID
from formtools.preview import FormPreview, AUTO_ID
from django.shortcuts import get_object_or_404, redirect
from django.utils.decorators import method_decorator
from django.shortcuts import render_to_response

View file

@ -205,8 +205,8 @@ class Position(models.Model):
class Feedback(models.Model):
nomcom = models.ForeignKey('NomCom')
author = models.EmailField(verbose_name='Author', blank=True)
positions = models.ManyToManyField('Position', blank=True, null=True)
nominees = models.ManyToManyField('Nominee', blank=True, null=True)
positions = models.ManyToManyField('Position', blank=True)
nominees = models.ManyToManyField('Nominee', blank=True)
subject = models.TextField(verbose_name='Subject', blank=True)
comments = EncryptedTextField(verbose_name='Comments')
type = models.ForeignKey(FeedbackTypeName, blank=True, null=True)

View file

@ -75,8 +75,8 @@ def merge_persons(source,target,stream):
admin_site = admin.site
using = 'default'
deletable_objects, perms_needed, protected = admin.utils.get_deleted_objects(
objs, opts, user, admin_site, using)
deletable_objects, model_count, perms_needed, protected = (
admin.utils.get_deleted_objects(objs, opts, user, admin_site, using) )
if len(deletable_objects) > 1:
print >>stream, "Not Deleting Person: {}({})".format(source.ascii,source.pk)

View file

@ -21,7 +21,6 @@ from ietf import __version__
import debug
DEBUG = True
TEMPLATE_DEBUG = DEBUG
debug.debug = DEBUG
# Valid values:
@ -216,13 +215,38 @@ SESSION_SAVE_EVERY_REQUEST = True
PREFERENCES_COOKIE_AGE = 60 * 60 * 24 * 365 * 50 # Age of cookie, in seconds: 50 years
TEMPLATE_LOADERS = (
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
BASE_DIR + "/templates",
BASE_DIR + "/secr/templates",
],
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.request',
'django.template.context_processors.media',
#'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'ietf.context_processors.server_mode',
'ietf.context_processors.debug_mark_queries_from_view',
'ietf.context_processors.revision_info',
'ietf.secr.context_processors.secr_revision_info',
'ietf.context_processors.rfcdiff_base_url',
],
'loaders': [
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)),
'ietf.dbtemplate.template.Loader',
)
]
},
},
]
MIDDLEWARE_CLASSES = (
'django.middleware.csrf.CsrfViewMiddleware',
@ -240,25 +264,6 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = 'ietf.urls'
TEMPLATE_DIRS = (
BASE_DIR + "/templates",
BASE_DIR + "/secr/templates",
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.contrib.messages.context_processors.messages',
'ietf.context_processors.server_mode',
'ietf.context_processors.debug_mark_queries_from_view',
'ietf.context_processors.revision_info',
'ietf.secr.context_processors.secr_revision_info',
'ietf.context_processors.rfcdiff_base_url',
)
# Additional locations of static files (in addition to each app's static/ dir)
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
@ -754,6 +759,10 @@ LIST_ACCOUNT_DELAY = 60*60*25 # 25 hours
ACCOUNT_REQUEST_EMAIL = 'account-request@ietf.org'
SILENCED_SYSTEM_CHECKS = [
"fields.W342", # Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
]
# Put the production SECRET_KEY in settings_local.py, and also any other
# sensitive or site-specific changes. DO NOT commit settings_local.py to svn.
@ -768,7 +777,7 @@ for app in INSTALLED_APPS:
# Add DEV_APPS to INSTALLED_APPS
INSTALLED_APPS += DEV_APPS
MIDDLEWARE_CLASSES += DEV_MIDDLEWARE_CLASSES
TEMPLATE_CONTEXT_PROCESSORS += DEV_TEMPLATE_CONTEXT_PROCESSORS
TEMPLATES[0]['OPTIONS']['context_processors'] += DEV_TEMPLATE_CONTEXT_PROCESSORS
# We provide a secret key only for test and development modes. It's
@ -777,7 +786,9 @@ TEMPLATE_CONTEXT_PROCESSORS += DEV_TEMPLATE_CONTEXT_PROCESSORS
# publicly available, for instance from the source repository.
if SERVER_MODE != 'production':
# stomp out the cached template loader, it's annoying
TEMPLATE_LOADERS = tuple(l for e in TEMPLATE_LOADERS for l in (e[1] if isinstance(e, tuple) and "cached.Loader" in e[0] else (e,)))
loaders = TEMPLATES[0]['OPTIONS']['loaders']
loaders = tuple(l for e in loaders for l in (e[1] if isinstance(e, tuple) and "cached.Loader" in e[0] else (e,)))
TEMPLATES[0]['OPTIONS']['loaders'] = loaders
CACHES = {
'default': {

View file

@ -77,7 +77,7 @@ class Submission(models.Model):
return Document.objects.filter(name=self.name).first()
class SubmissionCheck(models.Model):
time = models.DateTimeField(auto_now=True, default=None) # The default is to make makemigrations happy
time = models.DateTimeField(auto_now=True)
submission = models.ForeignKey(Submission, related_name='checks')
checker = models.CharField(max_length=256, blank=True)
passed = models.NullBooleanField(default=False)

View file

@ -37,7 +37,8 @@ def create_person(group, role_name, name=None, username=None, email_address=None
return person
def create_group(**kwargs):
return Group.objects.create(state_id="active", **kwargs)
group, created = Group.objects.get_or_create(state_id="active", **kwargs)
return group
def make_immutable_base_data():
"""Some base data (groups, etc.) that doesn't need to be modified by

View file

@ -51,10 +51,10 @@ from fnmatch import fnmatch
from coverage.report import Reporter
from coverage.results import Numbers
from coverage.misc import NotPython
from optparse import make_option
from django.conf import settings
from django.template import TemplateDoesNotExist
from django.template.loaders.base import Loader as BaseLoader
from django.test.runner import DiscoverRunner
from django.core.management import call_command
from django.core.urlresolvers import RegexURLResolver
@ -86,7 +86,7 @@ def safe_create_1(self, verbosity, *args, **kwargs):
if settings.GLOBAL_TEST_FIXTURES:
print " Loading global test fixtures: %s" % ", ".join(settings.GLOBAL_TEST_FIXTURES)
loadable = [f for f in settings.GLOBAL_TEST_FIXTURES if "." not in f]
call_command('loaddata', *loadable, verbosity=0, commit=False, database="default")
call_command('loaddata', *loadable, verbosity=verbosity, commit=False, database="default")
for f in settings.GLOBAL_TEST_FIXTURES:
if f not in loadable:
@ -108,11 +108,14 @@ def safe_destroy_0_1(*args, **kwargs):
settings.DATABASES["default"]["NAME"] = test_database_name
return old_destroy(*args, **kwargs)
def template_coverage_loader(template_name, dirs):
class TemplateCoverageLoader(BaseLoader):
is_usable = True
def load_template_source(self, template_name, dirs):
if template_coverage_collection == True:
loaded_templates.add(str(template_name))
raise TemplateDoesNotExist
template_coverage_loader.is_usable = True
load_template_source.is_usable = True
class RecordUrlsMiddleware(object):
def process_request(self, request):
@ -333,19 +336,18 @@ class CoverageTest(TestCase):
self.skipTest("Coverage switched off with --skip-coverage")
class IetfTestRunner(DiscoverRunner):
option_list = (
make_option('--skip-coverage',
action='store_true', dest='skip_coverage', default=False,
help='Skip test coverage measurements for code, templates, and URLs. '
),
make_option('--save-version-coverage',
action='store', dest='save_version_coverage', default=False,
help='Save test coverage data under the given version label'),
make_option('--save-testresult',
@classmethod
def add_arguments(cls, parser):
parser.add_argument('--skip-coverage',
action='store_true', dest='skip_coverage', default=False,
help='Skip test coverage measurements for code, templates, and URLs. ' )
parser.add_argument('--save-version-coverage',
action='store', dest='save_version_coverage', default=False,
help='Save test coverage data under the given version label')
parser.add_argument('--save-testresult',
action='store_true', dest='save_testresult', default=False,
help='Save short test result data in %s/.testresult' % os.path.dirname(os.path.dirname(settings.BASE_DIR))),
)
def __init__(self, skip_coverage=False, save_version_coverage=None, **kwargs):
#
@ -393,7 +395,7 @@ class IetfTestRunner(DiscoverRunner):
},
}
settings.TEMPLATE_LOADERS = ('ietf.utils.test_runner.template_coverage_loader',) + settings.TEMPLATE_LOADERS
settings.TEMPLATE_LOADERS = ('ietf.utils.test_runner.TemplateCoverageLoader',) + settings.TEMPLATE_LOADERS
template_coverage_collection = True
settings.MIDDLEWARE_CLASSES = ('ietf.utils.test_runner.RecordUrlsMiddleware',) + settings.MIDDLEWARE_CLASSES

View file

@ -16,8 +16,8 @@ from django.conf import settings
from django.core.management import call_command
from django.template import Context
from django.template.defaulttags import URLNode
from django.template.loader import get_template
from django.templatetags.static import StaticNode
from django.template.loaders.filesystem import Loader
from django.test import TestCase
import debug # pyflakes:ignore
@ -111,12 +111,11 @@ class TemplateChecksTestCase(TestCase):
templates = {}
def setUp(self):
self.loader = Loader()
self.paths = list(get_template_paths())
self.paths.sort()
for path in self.paths:
try:
self.templates[path], _ = self.loader.load_template(path)
self.templates[path] = get_template(path).template
except Exception:
pass
@ -132,7 +131,7 @@ class TemplateChecksTestCase(TestCase):
if not path in self.templates:
try:
self.loader.load_template(path)
get_template(path)
except Exception as e:
errors.append((path, e))
if errors:

View file

@ -6,8 +6,9 @@ coverage>=4.0.1,!=4.0.2
#cssselect>=0.6.1 # for PyQuery
decorator>=3.4.0
defusedxml>=0.4.1 # for TastyPie when ussing xml; not a declared dependency
Django>=1.7.10,<1.8
Django>=1.8.16,<1.9
django-bootstrap3>=5.1.1,<7.0.0 # django-bootstrap 7.0 requires django 1.8
django-formtools>=1.0 # instead of django.contrib.formtools in 1.8
django-markup>=1.1
django-tastypie>=0.13.1
django-widget-tweaks>=1.3