Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Upgrade wagtail v2.8 and django V3.0.3 #3536

Closed
wants to merge 11 commits into from
Closed
2 changes: 1 addition & 1 deletion fec/extend_admin/wagtailadmin/widgets/chooser.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- {% extends "wagtailadmin/widgets/chooser.html" %}
{% load staticfiles %}
{% load static %}
-->


Expand Down
31 changes: 22 additions & 9 deletions fec/fec/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,36 @@
'extend_admin',
)

MIDDLEWARE_CLASSES = (
# MIDDLEWARE_CLASSES = (
# 'django.contrib.sessions.middleware.SessionMiddleware',
# 'django.middleware.common.CommonMiddleware',
# 'django.middleware.csrf.CsrfViewMiddleware',
# 'django.contrib.auth.middleware.AuthenticationMiddleware',
# 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
# 'fec.middleware.AddSecureHeaders', # custom response headers
# 'uaa_client.middleware.UaaRefreshMiddleware',
# 'django.contrib.messages.middleware.MessageMiddleware',
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
# 'django.middleware.security.SecurityMiddleware',

# 'wagtail.core.middleware.SiteMiddleware',
# 'wagtail.contrib.redirects.middleware.RedirectMiddleware',

# # logs
# 'audit_log.middleware.UserLoggingMiddleware',
# )

MIDDLEWARE = (
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'fec.middleware.AddSecureHeaders', # custom response headers
'uaa_client.middleware.UaaRefreshMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',

'fec.middleware.AddSecureHeaders', # custom response headers
'wagtail.core.middleware.SiteMiddleware',
'wagtail.contrib.redirects.middleware.RedirectMiddleware',

# logs
'audit_log.middleware.UserLoggingMiddleware',
)

CSRF_TRUSTED_ORIGINS = ["fec.gov", "app.cloud.gov"]
Expand Down
2 changes: 1 addition & 1 deletion fec/fec/templates/long_page.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% load staticfiles %}
{% load static %}
{% block body_class %}template-{{ self.get_verbose_name | slugify }}{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion fec/fec/tests/test_robots.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from django.test import TestCase
from django.conf import settings
from django.core.urlresolvers import clear_url_caches
from django.urls import clear_url_caches
from importlib import reload, import_module


Expand Down
2 changes: 1 addition & 1 deletion fec/fec/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

# hide django-admin unless DEBUG=True
urlpatterns.insert(1, url(r'^django-admin/', include(admin.site.urls)))
urlpatterns.insert(1, url(r'^django-admin/', admin.site.urls))
4 changes: 3 additions & 1 deletion fec/home/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from django.db import models, migrations

import django.db.models.deletion

class Migration(migrations.Migration):

Expand All @@ -18,7 +19,8 @@ class Migration(migrations.Migration):
auto_created=True,
primary_key=True,
serialize=False,
to='wagtailcore.Page')),
to='wagtailcore.Page',
on_delete=django.db.models.deletion.SET_NULL)),
],
options={
'abstract': False,
Expand Down
6 changes: 3 additions & 3 deletions fec/home/migrations/0003_auto_20150819_0342.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import models, migrations
import wagtail.images.blocks
import wagtail.core.fields
Expand All @@ -18,7 +18,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='CustomPage',
fields=[
('page_ptr', models.OneToOneField(serialize=False, primary_key=True, auto_created=True, parent_link=True, to='wagtailcore.Page')),
('page_ptr', models.OneToOneField(serialize=False, primary_key=True, auto_created=True, parent_link=True, to='wagtailcore.Page', on_delete=django.db.models.deletion.SET_NULL)),
('author', models.CharField(max_length=255)),
('date', models.DateField(verbose_name='Post date')),
('body', wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.core.blocks.RichTextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock())))),
Expand All @@ -31,7 +31,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='LandingPage',
fields=[
('page_ptr', models.OneToOneField(serialize=False, primary_key=True, auto_created=True, parent_link=True, to='wagtailcore.Page')),
('page_ptr', models.OneToOneField(serialize=False, primary_key=True, auto_created=True, parent_link=True, to='wagtailcore.Page', on_delete=django.db.models.deletion.SET_NULL)),
('body', wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.core.blocks.RichTextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock())))),
],
options={
Expand Down
4 changes: 2 additions & 2 deletions fec/home/migrations/0004_checklistpage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import models, migrations
import wagtail.core.fields
import wagtail.images.blocks
Expand All @@ -18,7 +18,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='ChecklistPage',
fields=[
('page_ptr', models.OneToOneField(to='wagtailcore.Page', serialize=False, primary_key=True, parent_link=True, auto_created=True)),
('page_ptr', models.OneToOneField(to='wagtailcore.Page', serialize=False, primary_key=True, parent_link=True, auto_created=True, on_delete=django.db.models.deletion.SET_NULL)),
('body', wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.core.blocks.RichTextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock())))),
],
options={
Expand Down
4 changes: 2 additions & 2 deletions fec/home/migrations/0006_auto_20150819_0546.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import models, migrations
import wagtail.core.blocks
import wagtail.core.fields
Expand All @@ -18,7 +18,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='OptionsPage',
fields=[
('page_ptr', models.OneToOneField(to='wagtailcore.Page', primary_key=True, auto_created=True, serialize=False, parent_link=True)),
('page_ptr', models.OneToOneField(to='wagtailcore.Page', primary_key=True, auto_created=True, serialize=False, parent_link=True, on_delete=django.db.models.deletion.SET_NULL)),
('body', wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.core.blocks.RichTextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock())))),
],
options={
Expand Down
4 changes: 2 additions & 2 deletions fec/home/migrations/0009_contactpage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import migrations, models
import wagtail.core.fields
import wagtail.images.blocks
Expand All @@ -18,7 +18,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='ContactPage',
fields=[
('page_ptr', models.OneToOneField(to='wagtailcore.Page', auto_created=True, primary_key=True, parent_link=True, serialize=False)),
('page_ptr', models.OneToOneField(to='wagtailcore.Page', auto_created=True, primary_key=True, parent_link=True, serialize=False, on_delete=django.db.models.deletion.SET_NULL)),
('body', wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.core.blocks.RichTextBlock()), ('html', wagtail.core.blocks.RawHTMLBlock()), ('image', wagtail.images.blocks.ImageChooserBlock())), blank=True, null=True)),
],
options={
Expand Down
4 changes: 2 additions & 2 deletions fec/home/migrations/0010_calendarpage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import migrations, models
import wagtail.images.blocks
import wagtail.core.fields
Expand All @@ -18,7 +18,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='CalendarPage',
fields=[
('page_ptr', models.OneToOneField(to='wagtailcore.Page', parent_link=True, auto_created=True, serialize=False, primary_key=True)),
('page_ptr', models.OneToOneField(to='wagtailcore.Page', parent_link=True, auto_created=True, serialize=False, primary_key=True, on_delete=django.db.models.deletion.SET_NULL)),
('body', wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.core.blocks.RichTextBlock()), ('html', wagtail.core.blocks.RawHTMLBlock()), ('image', wagtail.images.blocks.ImageChooserBlock())), blank=True, null=True)),
],
options={
Expand Down
4 changes: 2 additions & 2 deletions fec/home/migrations/0011_ssfchecklistpage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import migrations, models
import wagtail.core.fields
import wagtail.core.blocks
Expand All @@ -18,7 +18,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='SSFChecklistPage',
fields=[
('page_ptr', models.OneToOneField(primary_key=True, auto_created=True, to='wagtailcore.Page', serialize=False, parent_link=True)),
('page_ptr', models.OneToOneField(primary_key=True, auto_created=True, to='wagtailcore.Page', serialize=False, parent_link=True, on_delete=django.db.models.deletion.SET_NULL)),
('body', wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.core.blocks.RichTextBlock()), ('html', wagtail.core.blocks.RawHTMLBlock()), ('image', wagtail.images.blocks.ImageChooserBlock())), blank=True, null=True)),
],
options={
Expand Down
4 changes: 2 additions & 2 deletions fec/home/migrations/0012_partychecklistpage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import migrations, models
import wagtail.core.fields
import wagtail.core.blocks
Expand All @@ -18,7 +18,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='PartyChecklistPage',
fields=[
('page_ptr', models.OneToOneField(primary_key=True, auto_created=True, to='wagtailcore.Page', serialize=False, parent_link=True)),
('page_ptr', models.OneToOneField(primary_key=True, auto_created=True, to='wagtailcore.Page', serialize=False, parent_link=True, on_delete=django.db.models.deletion.SET_NULL)),
('body', wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.core.blocks.RichTextBlock()), ('html', wagtail.core.blocks.RawHTMLBlock()), ('image', wagtail.images.blocks.ImageChooserBlock())), blank=True, null=True)),
],
options={
Expand Down
4 changes: 2 additions & 2 deletions fec/home/migrations/0014_nonconnectedchecklistpage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import migrations, models
import wagtail.core.fields
import wagtail.core.blocks
Expand All @@ -18,7 +18,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='NonconnectedChecklistPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, parent_link=True, primary_key=True, to='wagtailcore.Page', serialize=False)),
('page_ptr', models.OneToOneField(auto_created=True, parent_link=True, primary_key=True, to='wagtailcore.Page', serialize=False, on_delete=django.db.models.deletion.SET_NULL)),
('body', wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.core.blocks.RichTextBlock()), ('html', wagtail.core.blocks.RawHTMLBlock()), ('image', wagtail.images.blocks.ImageChooserBlock())), blank=True, null=True)),
],
options={
Expand Down
40 changes: 40 additions & 0 deletions fec/home/migrations/0109_auto_20200206_1847.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generated by Django 3.0.3 on 2020-02-06 23:47

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('wagtailcore', '0045_assign_unlock_grouppagepermission'),
('home', '0108_fullwidthpage_citations'),
]

operations = [
migrations.AlterField(
model_name='custompage',
name='page_ptr',
field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page'),
),
migrations.AlterField(
model_name='digestpageauthors',
name='author',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='home.Author'),
),
migrations.AlterField(
model_name='homepage',
name='page_ptr',
field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page'),
),
migrations.AlterField(
model_name='pressreleasepageauthors',
name='author',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='home.Author'),
),
migrations.AlterField(
model_name='recordpageauthors',
name='author',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='home.Author'),
),
]
10 changes: 5 additions & 5 deletions fec/home/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model

from audit_log.models.fields import LastUserField
from audit_log.models.managers import AuditLog
# from audit_log.models.fields import LastUserField
# from audit_log.models.managers import AuditLog

from modelcluster.fields import ParentalKey
from modelcluster.contrib.taggit import ClusterTaggableManager
Expand All @@ -29,7 +29,7 @@
from wagtail.documents.edit_handlers import DocumentChooserPanel
from wagtail.documents.models import Document

from django.utils.encoding import python_2_unicode_compatible
# from django.utils.encoding import python_2_unicode_compatible
from wagtail.snippets.models import register_snippet

from wagtail.search import index
Expand Down Expand Up @@ -179,7 +179,7 @@ def log_user_save(sender, **kwargs):
else:
logger.info("User change: username {0} by instance {1}".format(kwargs.get('instance').get_username(),
kwargs.get('instance')))
audit_log = AuditLog() #currently not used, will attempt to use for future PR adding admin logging
# audit_log = AuditLog() #currently not used, will attempt to use for future PR adding admin logging


@receiver(pre_delete, sender=PageRevision)
Expand Down Expand Up @@ -255,7 +255,7 @@ class PageAuthors(models.Model):
This is made concrete by mixing into a model with a ParentalKey, see
RecordPageAuthors below.
"""
author = models.ForeignKey(Author, related_name='+')
author = models.ForeignKey(Author, related_name='+', null=True, on_delete=models.SET_NULL)
role = models.CharField(max_length=255,
choices=constants.author_roles.items(),
default='author')
Expand Down
2 changes: 1 addition & 1 deletion fec/home/templates/blocks/related-media.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load wagtailcore_tags %}
{% load wagtailimages_tags %}
{% load staticfiles %}
{% load static %}

<div class="content__section--ruled content__section">
<div class="grid grid--3-wide">
Expand Down
2 changes: 1 addition & 1 deletion fec/home/templates/blocks/reporting-example-cards.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load wagtailcore_tags %}
{% load wagtailimages_tags %}
{% load staticfiles %}
{% load static %}

<div class="row grid--{{ self.card_width }}-wide">
{% for card in self.cards %}
Expand Down
2 changes: 1 addition & 1 deletion fec/home/templates/home/about_landing_page.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% load staticfiles %}
{% load static %}
{% load updates %}
{% block body_class %}template-{{ self.get_verbose_name | slugify }}{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion fec/home/templates/home/alert_for_emergency_use_only.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% load staticfiles %}
{% load static %}
{% load home_page %}
{% load filters %}
{% block body_class %}template-{{ self.get_verbose_name | slugify }}{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion fec/home/templates/home/calendar.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% load staticfiles %}
{% load static %}
{% load filters %}
{% load compress %}
{% block body_class %}template-{{ self.get_verbose_name | slugify }}{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% load staticfiles %}
{% load static %}
{% block content %}

<nav class="page-header page-header--secondary">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% load filters %}
{% load staticfiles %}
{% load static %}
{% load updates %}
{% load tips_for_treasurers %}

Expand Down
2 changes: 1 addition & 1 deletion fec/home/templates/home/collection_page.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "long_page.html" %}
{% load wagtailcore_tags %}
{% load staticfiles %}
{% load static %}
{% block body_class %}template-{{ self.get_verbose_name | slugify }}{% endblock %}

{% block breadcrumbs %}
Expand Down
2 changes: 1 addition & 1 deletion fec/home/templates/home/commission_meetings.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% load staticfiles %}
{% load static %}
{% load filters %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion fec/home/templates/home/commissioner_page.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% load wagtailimages_tags %}
{% load staticfiles %}
{% load static %}

{% block content %}
{% include 'partials/breadcrumbs.html' with page=self links=ancestors style='secondary' %}
Expand Down
Loading