This commit is contained in:
Tibor Leupold 2022-11-29 10:44:47 -08:00
Родитель 4348819572
Коммит 7fe49eb52e
250 изменённых файлов: 710 добавлений и 750 удалений

Просмотреть файл

@ -1,10 +1,6 @@
from django.urls import re_path
from networkapi.campaign.views import (
petition_submission_view,
signup_submission_view,
)
from networkapi.campaign.views import petition_submission_view, signup_submission_view
urlpatterns = [
re_path(

Просмотреть файл

@ -1,15 +1,16 @@
from rest_framework import status
from django.core.exceptions import ObjectDoesNotExist
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_http_methods
from django.conf import settings
import json
import logging
from datetime import datetime
from django.http import JsonResponse
import basket
import boto3
import logging
import json
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_http_methods
from rest_framework import status
from networkapi.wagtailpages.models import Petition, Signup

Просмотреть файл

@ -1,4 +1,5 @@
import re
from django.conf import settings
from django.utils import translation

Просмотреть файл

@ -1,12 +1,12 @@
import json
from unittest import mock
from django.urls import reverse
from django.test import RequestFactory, TestCase
from django.urls import reverse
from .views import tito_ticket_completed
from .utils import sign_tito_request
from .factory import TitoEventFactory
from .utils import sign_tito_request
from .views import tito_ticket_completed
class TitoTicketCompletedTest(TestCase):

Просмотреть файл

@ -2,8 +2,7 @@ import json
import logging
import basket
from django.http import HttpResponseBadRequest, HttpResponse
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST

Просмотреть файл

@ -1,10 +1,10 @@
from django.contrib import admin
from adminsortable.admin import SortableAdmin
from networkapi.highlights.models import Highlight
from networkapi.highlights.forms import HighlightAdminForm
from django.contrib import admin
from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register
from networkapi.highlights.forms import HighlightAdminForm
from networkapi.highlights.models import Highlight
class HighlightAdmin(SortableAdmin):
form = HighlightAdminForm

Просмотреть файл

@ -1,17 +1,12 @@
from datetime import timezone
from factory import (
Faker,
Trait,
LazyAttribute,
post_generation,
)
from factory import Faker, LazyAttribute, Trait, post_generation
from factory.django import DjangoModelFactory
from wagtail_factories import ImageFactory
from networkapi.highlights.models import Highlight
from networkapi.utility.faker import generate_fake_data
from networkapi.utility.faker.helpers import reseed
from networkapi.highlights.models import Highlight
class HighlightFactory(DjangoModelFactory):

Просмотреть файл

@ -1,6 +1,6 @@
from django import forms
from django.utils import timezone
from django.contrib.admin.widgets import AdminSplitDateTime
from django.utils import timezone
from networkapi.highlights.models import Highlight

Просмотреть файл

@ -2,9 +2,10 @@
# Generated by Django 1.11.14 on 2018-07-23 17:33
from __future__ import unicode_literals
from django.db import migrations, models
import networkapi.highlights.models
import wagtail.core.fields
from django.db import migrations, models
import networkapi.highlights.models
class Migration(migrations.Migration):

Просмотреть файл

@ -1,6 +1,7 @@
# Generated by Django 2.2.16 on 2020-09-30 20:19
from django.db import migrations, models
import networkapi.highlights.models

Просмотреть файл

@ -1,7 +1,7 @@
# Generated by Django 2.2.17 on 2021-04-08 19:00
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,7 @@
# Generated by Django 3.1.11 on 2021-05-31 17:35
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

Просмотреть файл

@ -1,9 +1,10 @@
# Generated by Django 3.1.11 on 2021-05-31 18:02
from django.db import migrations, models
import django.db.models.deletion
import uuid
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

Просмотреть файл

@ -1,14 +1,12 @@
from django.utils import timezone
from adminsortable.models import SortableMixin
from django.db import models
from django.db.models import Q
from adminsortable.models import SortableMixin
from django.utils import timezone
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.core.fields import RichTextField
from wagtail.core.models import TranslatableMixin
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.snippets.models import register_snippet
from wagtail_localize.fields import TranslatableField
from networkapi.utility.images import get_image_upload_path

Просмотреть файл

@ -1,4 +1,5 @@
from datetime import datetime, timezone
from django.test import TestCase
from networkapi.highlights.factory import HighlightFactory

Просмотреть файл

@ -2,6 +2,7 @@ import json
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from networkapi.highlights.factory import HighlightFactory
from networkapi.highlights.views import HighlightListView, HighlightView

Просмотреть файл

@ -1,8 +1,6 @@
from django.urls import re_path
from networkapi.highlights.views import (
HighlightListView,
HighlightView,
)
from networkapi.highlights.views import HighlightListView, HighlightView
urlpatterns = [
re_path("^$", HighlightListView.as_view(), name="highlight-list"),

Просмотреть файл

@ -1,5 +1,4 @@
from django.core.management.base import BaseCommand
from wagtail.core.models import Collection
from wagtail.images.models import Image

Просмотреть файл

@ -1,7 +1,8 @@
from datetime import datetime
from django.contrib.auth.models import User, Group
from django.db.models import Q
from django.contrib.auth.models import Group, User
from django.core.management.base import BaseCommand
from django.db.models import Q
def delete_non_staff():

Просмотреть файл

@ -1,7 +1,8 @@
from django.core.management.base import BaseCommand
# Models
from wagtail.core.models import Page as WagtailPage, Site as WagtailSite
from wagtail.core.models import Page as WagtailPage
from wagtail.core.models import Site as WagtailSite
from wagtail.images.models import Image
from networkapi.highlights.models import Highlight

Просмотреть файл

@ -1,22 +1,20 @@
import factory
import random
from os.path import abspath, dirname, join
from django.core.management.base import BaseCommand
from django.core.management import call_command
import factory
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand
from taggit.models import Tag
# Factories
import networkapi.highlights.factory as highlights_factory
import networkapi.mozfest.factory as mozfest_factory
import networkapi.news.factory as news_factory
import networkapi.wagtailpages.factory as wagtailpages_factory
import networkapi.mozfest.factory as mozfest_factory
from networkapi.utility.faker.helpers import reseed
from networkapi.wagtailpages.factory.image_factory import ImageFactory
from networkapi.wagtailpages.utils import create_wagtail_image
from networkapi.utility.faker.helpers import reseed
class Command(BaseCommand):

Просмотреть файл

@ -2,12 +2,11 @@
Management command called during the Heroku Review App post-deployment phase.
Creates an admin user and prints the password to the build logs.
"""
import requests
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from django.conf import settings
import requests
from faker import Faker # note: NOT from factory, but from faker. Different Faker!
faker = Faker()

Просмотреть файл

@ -1,9 +1,9 @@
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
import os
import heroku3
import requests
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from wagtail.core.models import Site
REVIEW_APP_DOMAIN = settings.REVIEW_APP_DOMAIN

Просмотреть файл

@ -1,12 +1,15 @@
from django.conf import settings
from wagtail.core.models import Page as WagtailPage, Site as WagtailSite
from factory import Faker, LazyAttribute, SubFactory
from wagtail.core.models import Page as WagtailPage
from wagtail.core.models import Site as WagtailSite
from wagtail_factories import PageFactory
from factory import Faker, SubFactory, LazyAttribute
from networkapi.wagtailpages.factory.image_factory import ImageFactory
from networkapi.wagtailpages.factory.signup import SignupFactory
from .models import MozfestHomepage, MozfestPrimaryPage
from networkapi.utility.faker import StreamfieldProvider
from networkapi.utility.faker.helpers import reseed
from networkapi.wagtailpages.factory.image_factory import ImageFactory
from networkapi.wagtailpages.factory.signup import SignupFactory
from .models import MozfestHomepage, MozfestPrimaryPage
streamfield_fields = ["paragraph", "image", "spacer", "quote"]
Faker.add_provider(StreamfieldProvider)

Просмотреть файл

@ -1,9 +1,6 @@
# Generated by Django 3.1.11 on 2022-02-18 19:16
from django.db import migrations, models
import django.db.models.deletion
import networkapi.wagtailpages.pagemodels.customblocks.video_block
import networkapi.wagtailpages.pagemodels.mixin.foundation_banner_inheritance
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -13,6 +10,10 @@ import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
import wagtailmetadata.models
from django.db import migrations, models
import networkapi.wagtailpages.pagemodels.customblocks.video_block
import networkapi.wagtailpages.pagemodels.mixin.foundation_banner_inheritance
class Migration(migrations.Migration):

Просмотреть файл

@ -1,6 +1,5 @@
# Generated by Django 3.1.11 on 2022-02-22 20:22
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -9,6 +8,7 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
class Migration(migrations.Migration):

Просмотреть файл

@ -1,6 +1,5 @@
# Generated by Django 3.2.13 on 2022-04-13 23:10
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -9,6 +8,7 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
class Migration(migrations.Migration):

Просмотреть файл

@ -5,7 +5,6 @@
# As this caused us to lose the data set for the URL field. We are now reverting back to
# 'URL', but updating the label in the CMS to be 'embed URL' to preserve existing videos.
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -14,6 +13,7 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
class Migration(migrations.Migration):

Просмотреть файл

@ -1,6 +1,5 @@
# Generated by Django 3.2.13 on 2022-05-26 01:18
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -9,6 +8,7 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
class Migration(migrations.Migration):

Просмотреть файл

@ -1,6 +1,5 @@
# Generated by Django 3.2.13 on 2022-10-05 07:05
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -9,6 +8,7 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,5 @@
# Generated by Django 3.2.13 on 2022-10-07 07:45
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -10,6 +8,9 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,5 @@
# Generated by Django 3.2.13 on 2022-10-09 19:47
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -10,6 +8,9 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,7 @@
# Generated by Django 3.2.13 on 2022-10-14 01:01
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,5 @@
# Generated by Django 3.2.13 on 2022-10-26 09:06
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -10,6 +8,9 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,5 @@
# Generated by Django 3.2.13 on 2022-10-20 12:41
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -10,6 +8,9 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,5 @@
# Generated by Django 3.2.13 on 2022-10-21 10:58
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -10,6 +8,9 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,5 @@
# Generated by Django 3.2.13 on 2022-10-20 12:41
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -10,6 +8,9 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,5 @@
# Generated by Django 3.2.13 on 2022-10-21 14:17
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -10,6 +8,9 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,5 @@
# Generated by Django 3.2.13 on 2022-10-27 13:34
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -10,6 +8,9 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,5 @@
# Generated by Django 3.2.13 on 2022-10-25 13:49
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -10,6 +8,9 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,5 @@
# Generated by Django 3.2.13 on 2022-10-27 13:56
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -10,6 +8,9 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,5 @@
# Generated by Django 3.2.16 on 2022-10-27 17:53
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -10,6 +8,9 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,7 +1,5 @@
# Generated by Django 3.2.16 on 2022-11-02 19:18
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -10,6 +8,9 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,8 +1,5 @@
# Generated by Django 3.2.16 on 2022-11-08 01:58
from django.db import migrations
import networkapi.wagtailpages.pagemodels.blog.blog_topic
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -11,6 +8,10 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.blog.blog_topic
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,8 +1,5 @@
# Generated by Django 3.2.16 on 2022-11-10 18:33
from django.db import migrations
import networkapi.wagtailpages.pagemodels.blog.blog_topic
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -11,6 +8,10 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.blog.blog_topic
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,8 +1,5 @@
# Generated by Django 3.2.16 on 2022-11-15 14:25
from django.db import migrations
import networkapi.wagtailpages.pagemodels.blog.blog_topic
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -11,6 +8,10 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.blog.blog_topic
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,8 +1,5 @@
# Generated by Django 3.2.16 on 2022-11-18 08:55
from django.db import migrations
import networkapi.wagtailpages.pagemodels.blog.blog_topic
import networkapi.wagtailpages.pagemodels.profiles
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
@ -11,6 +8,10 @@ import wagtail.embeds.blocks
import wagtail.images.blocks
import wagtail.snippets.blocks
import wagtailmedia.blocks
from django.db import migrations
import networkapi.wagtailpages.pagemodels.blog.blog_topic
import networkapi.wagtailpages.pagemodels.profiles
class Migration(migrations.Migration):

Просмотреть файл

@ -1,23 +1,23 @@
from django import forms
from django.db import models
from wagtail.admin.edit_handlers import FieldPanel, MultiFieldPanel, StreamFieldPanel
from wagtail.core.fields import StreamField, RichTextField
from wagtail.core.fields import RichTextField, StreamField
from wagtail.core.models import Page
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.snippets.edit_handlers import SnippetChooserPanel
from wagtail_localize.fields import SynchronizedField, TranslatableField
from networkapi.wagtailpages.utils import (
set_main_site_nav_information,
get_page_tree_information,
)
from networkapi.wagtailpages.models import (
FoundationMetadataPageMixin,
FoundationBannerInheritanceMixin,
FoundationMetadataPageMixin,
Signup,
)
from networkapi.wagtailpages.pagemodels import customblocks
from networkapi.wagtailpages.pagemodels.customblocks.base_fields import base_fields
from networkapi.wagtailpages.utils import (
get_page_tree_information,
set_main_site_nav_information,
)
class MozfestPrimaryPage(FoundationMetadataPageMixin, FoundationBannerInheritanceMixin, Page):

Просмотреть файл

@ -1,9 +1,9 @@
from django.contrib import admin
from networkapi.news.models import News
from networkapi.news.forms import NewsAdminForm
from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register
from networkapi.news.forms import NewsAdminForm
from networkapi.news.models import News
class NewsAdmin(admin.ModelAdmin):
form = NewsAdminForm

Просмотреть файл

@ -1,19 +1,13 @@
from datetime import timezone
from random import shuffle
from factory import (
Faker,
post_generation,
Trait,
LazyAttribute,
)
from django.conf import settings
from factory import Faker, LazyAttribute, Trait, post_generation
from factory.django import DjangoModelFactory
from networkapi.news.models import News
from networkapi.utility.faker import generate_fake_data
from networkapi.utility.faker.helpers import reseed
from networkapi.news.models import News
from django.conf import settings
RANDOM_SEED = settings.RANDOM_SEED
TESTING = settings.TESTING

Просмотреть файл

@ -1,8 +1,9 @@
from django import forms
from django.forms.widgets import SelectDateWidget
from datetime import date
from django.utils import timezone
from django import forms
from django.contrib.admin.widgets import AdminSplitDateTime
from django.forms.widgets import SelectDateWidget
from django.utils import timezone
from networkapi.news.models import News

Просмотреть файл

@ -3,6 +3,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import networkapi.news.models

Просмотреть файл

@ -1,7 +1,7 @@
# Generated by Django 3.1.11 on 2021-05-31 17:35
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

Просмотреть файл

@ -1,9 +1,10 @@
# Generated by Django 3.1.11 on 2021-05-31 18:02
from django.db import migrations, models
import django.db.models.deletion
import uuid
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

Просмотреть файл

@ -1,10 +1,10 @@
from django.utils import timezone
from django.db import models
from django.db.models import Q
from django.utils import timezone
from wagtail.core.models import TranslatableMixin
from wagtail.snippets.models import register_snippet
from networkapi.utility.images import get_image_upload_path
from wagtail.snippets.models import register_snippet
from wagtail.core.models import TranslatableMixin
def get_thumbnail_upload_path(instance, filename):

Просмотреть файл

@ -1,4 +1,5 @@
from rest_framework import serializers
from networkapi.news.models import News

Просмотреть файл

@ -1,4 +1,5 @@
from datetime import datetime, timezone
from django.test import TestCase
from networkapi.news.factory import NewsFactory

Просмотреть файл

@ -1,9 +1,6 @@
from django.urls import re_path
from networkapi.news.views import (
NewsListView,
NewsView,
)
from networkapi.news.views import NewsListView, NewsView
urlpatterns = [
re_path("^$", NewsListView.as_view(), name="news-list"),

Просмотреть файл

@ -1,7 +1,8 @@
# Generated by Django 2.2.12 on 2020-06-04 23:51
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
import networkapi.people.models

Просмотреть файл

@ -6,13 +6,13 @@ Gnerated by 'django-admin startproject' using Django 1.10.3.
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import logging.config
import os
import sys
from typing import Dict, Literal
import os
import environ
import logging.config
import dj_database_url
import environ
from django.utils.translation import gettext_lazy
from wagtail.embeds.oembed_providers import youtube

Просмотреть файл

@ -1,7 +1,7 @@
# Solution came from Aleksi44 on Github:
# https://github.com/wagtail/wagtail/issues/6583#issuecomment-798960446
from django.contrib.sitemaps import views as sitemap_views
from django.conf import settings
from django.contrib.sitemaps import views as sitemap_views
from django.shortcuts import render
from wagtail.contrib.sitemaps.sitemap_generator import Sitemap

Просмотреть файл

@ -1,30 +1,24 @@
from datetime import date, datetime, timezone
from io import StringIO
from os.path import join, abspath, dirname
from os.path import abspath, dirname, join
from unittest import skip
from unittest.mock import MagicMock
from django.contrib.auth.models import User, Group
from django.contrib.auth.models import Group, User
from django.core.management import call_command
from django.test import TestCase, RequestFactory
from django.test import RequestFactory, TestCase
from django.urls import reverse
from django.utils import translation
from django.utils.translation.trans_real import (
to_language as django_to_language,
parse_accept_lang_header as django_parse_accept_lang_header,
)
# from django.test.utils import override_settings
from unittest.mock import MagicMock
from unittest import skip
from django.utils.translation.trans_real import to_language as django_to_language
from wagtail.core.models import Collection, Site
from wagtail.images.models import Image
from wagtail_factories import SiteFactory
from networkapi.utility.redirects import redirect_to_default_cms_site
from networkapi.utility.middleware import ReferrerMiddleware, XRobotsTagMiddleware
from networkapi.utility.redirects import redirect_to_default_cms_site
from networkapi.wagtailpages import (
language_code_to_iso_3166,
parse_accept_lang_header,
@ -37,6 +31,12 @@ from networkapi.wagtailpages.factory.buyersguide import (
from networkapi.wagtailpages.pagemodels.base import Homepage
from networkapi.wagtailpages.utils import create_wagtail_image
# from django.test.utils import override_settings
class ReferrerMiddlewareTests(TestCase):
def setUp(self):

Просмотреть файл

@ -4,15 +4,27 @@ from django.conf.urls.static import static
from django.contrib import admin
from django.http import HttpResponse
from django.shortcuts import render
from django.urls import path, re_path, include
from django.urls import include, path, re_path
from django.views.decorators.cache import cache_page
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import TemplateView
from django.views.generic.base import RedirectView
from django.views.i18n import set_language, JavaScriptCatalog
from django.views.i18n import JavaScriptCatalog, set_language
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.documents import urls as wagtaildocs_urls
from wagtail_footnotes import urls as footnotes_urls
from networkapi.redirects import foundation_redirects
from networkapi.views import EnvVariablesView, review_app_help_view
from networkapi.wagtailcustomization.image_url_tag_urls import (
urlpatterns as image_url_tag_urls,
)
from networkapi.wagtailpages.rss import AtomFeed, RSSFeed
from .sitemaps import sitemap, sitemap_index
# from wagtail.core import urls as wagtail_urls
from .utility import watail_core_url_override as wagtail_urls
# The following line is commented off in favour of the utility import,
# to allow better URL matching by wagtail (which, by default only
@ -20,17 +32,7 @@ from wagtail.documents import urls as wagtaildocs_urls
#
# See https://github.com/mozilla/foundation.mozilla.org/issues/6464
# from wagtail.core import urls as wagtail_urls
from .utility import watail_core_url_override as wagtail_urls
from .sitemaps import sitemap, sitemap_index
from wagtail_footnotes import urls as footnotes_urls
from networkapi.wagtailcustomization.image_url_tag_urls import (
urlpatterns as image_url_tag_urls,
)
from networkapi.views import EnvVariablesView, review_app_help_view
from networkapi.wagtailpages.rss import RSSFeed, AtomFeed
from networkapi.redirects import foundation_redirects
admin.autodiscover()

Просмотреть файл

@ -1,5 +1,6 @@
import sys
import traceback
from django.http import HttpResponse

Просмотреть файл

@ -1,5 +1,5 @@
from .helpers import generate_fake_data
from .image_provider import ImageProvider
from .streamfield_provider import StreamfieldProvider
from .helpers import generate_fake_data
__all__ = ["ImageProvider", "StreamfieldProvider", "generate_fake_data"]

Просмотреть файл

@ -1,9 +1,9 @@
from itertools import chain, combinations
import random
from itertools import chain, combinations
from typing import Union
from django.db import models
import factory
from django.db import models
from networkapi.wagtailpages.models import Homepage

Просмотреть файл

@ -1,12 +1,12 @@
import json
from random import choice, randint, random
from random import randint, choice, random
from django.conf import settings
from faker import Faker
from faker.providers import BaseProvider
from wagtail.images.models import Image
from networkapi.wagtailpages.models import BlogPage, BlogPageTopic
from networkapi.wagtailpages.models import BlogPage, BlogPageTopic
seed = randint(0, 5000000)
if settings.RANDOM_SEED is not None:

Просмотреть файл

@ -1,6 +1,7 @@
from slugify import slugify
from datetime import datetime, timezone
import os
from datetime import datetime, timezone
from slugify import slugify
def get_image_upload_path(app_name, prop_name, instance, current_filename, suffix=""):

Просмотреть файл

@ -1,5 +1,5 @@
from django.http.response import HttpResponseRedirectBase
from django.conf import settings
from django.http.response import HttpResponseRedirectBase
hostnames = settings.TARGET_DOMAINS

Просмотреть файл

@ -1,5 +1,5 @@
from django import template
from bs4 import BeautifulSoup
from django import template
register = template.Library()

Просмотреть файл

@ -4,11 +4,9 @@
from django.conf import settings
from django.contrib.auth import views as auth_views
from django.urls import path, re_path
from wagtail.core import views
from wagtail.core.utils import WAGTAIL_APPEND_SLASH
if WAGTAIL_APPEND_SLASH:
# If WAGTAIL_APPEND_SLASH is True (the default value), we match a
# (possibly empty) list of path segments ending in slashes.

Просмотреть файл

@ -1,5 +1,5 @@
from django.conf import settings
from django.http import JsonResponse, HttpResponse
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
from django.views import View

Просмотреть файл

@ -1,6 +1,5 @@
from django.templatetags.static import static
from django.utils.html import format_html
from wagtail.core import hooks

Просмотреть файл

@ -4,7 +4,6 @@ Ever other page should accept CSRF as normal.
"""
from django.middleware.csrf import CsrfViewMiddleware
from wagtail.core.views import serve
from networkapi.wagtailpages.pagemodels.buyersguide.products import ProductPage

Просмотреть файл

@ -24,7 +24,6 @@ Non-block image rendition example: {% image_url product.image 'fill-250x250
from django.urls import re_path
from wagtail.images.views.serve import ServeView
urlpatterns = [
re_path(
r"^images/([^/]*)/(\d*)/([^/]*)/[^/]*$",

Просмотреть файл

@ -1,4 +1,5 @@
from urllib.parse import urlencode
from wagtail.contrib.redirects import middleware
from wagtail.contrib.redirects.models import Redirect

Просмотреть файл

@ -1,9 +1,10 @@
import re
import html
import re
from django import template
from django.utils.text import slugify
from django.utils.html import strip_tags
from django.utils.safestring import SafeText
from django.utils.text import slugify
from wagtail.core.rich_text import RichText
# We don't actually register any tags: the idea is to tap into

Просмотреть файл

@ -1,6 +1,6 @@
from django.test import TestCase
from wagtail.contrib.redirects.models import Redirect
from django.test.utils import override_settings
from wagtail.contrib.redirects.models import Redirect
# Safeguard against the fact that static assets and views might be hosted remotely,

Просмотреть файл

@ -1,9 +1,8 @@
import django
import functools
import django
from django.utils.translation.trans_real import accept_language_re
# WARNING: this is not necessarily a good idea, but is the only way to override
# Django's default behaviour of requiring language codes to be lowercased.
# We have to modify the core Django method, because we have no way to replace

Просмотреть файл

@ -1,10 +1,8 @@
from django.db import models
from modelcluster.fields import ParentalKey
from wagtail.core.models import TranslatableMixin
from wagtail.snippets.edit_handlers import SnippetChooserPanel
from wagtail.snippets.models import register_snippet
from modelcluster.fields import ParentalKey
from wagtail_localize.fields import TranslatableField

Просмотреть файл

@ -3,19 +3,19 @@ from . import (
blog,
buyersguide,
campaign_page,
profiles,
dear_internet_page,
homepage,
homepage_cause_statement_link,
homepage_features,
homepage_partner_logos,
homepage_take_action,
homepage_usable_news,
homepage,
initiatives_page,
locale,
opportunity,
participate_page_featured_highlights,
participate_page,
participate_page_featured_highlights,
profiles,
publication,
research_hub,
styleguide,

Просмотреть файл

@ -1,6 +1,7 @@
from factory import Faker, LazyAttribute
from factory.django import DjangoModelFactory
from wagtail_factories import PageFactory
from factory import Faker, LazyAttribute
from networkapi.utility.faker import StreamfieldProvider
streamfield_fields = ["header", "paragraph", "image", "spacer", "image_text", "quote"]

Просмотреть файл

@ -1,13 +1,13 @@
from factory import Faker, Trait, SubFactory
from factory import Faker, SubFactory, Trait
from wagtail.core.models import Page as WagtailPage
from networkapi.utility.faker.helpers import get_homepage, reseed
from networkapi.wagtailpages.models import BanneredCampaignPage
from networkapi.utility.faker.helpers import reseed, get_homepage
from .abstract import CMSPageFactory
from .campaign_page import CampaignIndexPageFactory
from .petition import PetitionFactory
from .signup import SignupFactory
from .campaign_page import CampaignIndexPageFactory
from .abstract import CMSPageFactory
from .tagging import add_tags

Просмотреть файл

@ -2,27 +2,24 @@ from datetime import timezone
from random import choice
from django.conf import settings
from factory import Faker, LazyAttribute
from factory.django import DjangoModelFactory
from wagtail.core.models import Page as WagtailPage
from wagtail_factories import PageFactory
from factory import (
Faker,
LazyAttribute,
)
from factory.django import DjangoModelFactory
from networkapi.utility.faker.helpers import get_homepage, get_random_objects, reseed
from networkapi.wagtailpages.models import (
BlogAuthors,
BlogIndexPage,
BlogPage,
BlogPageTopic,
BlogIndexPage,
Profile,
)
from networkapi.wagtailpages.pagemodels.blog import blog_index
from networkapi.utility.faker.helpers import get_homepage, get_random_objects, reseed
from .index_page import IndexPageFactory
from .tagging import add_tags
RANDOM_SEED = settings.RANDOM_SEED
TESTING = settings.TESTING
blog_body_streamfield_fields = [

Просмотреть файл

@ -1,25 +1,20 @@
# TODO: Move these factories to the wagtailpages app.
# To avoid too many code conflicts, this should happen after PR 6433 is merged
from random import randint, random, choice, randrange, shuffle
from datetime import date, datetime, timezone, timedelta
from datetime import date, datetime, timedelta, timezone
from random import choice, randint, random, randrange, shuffle
from factory import (
Faker,
LazyFunction,
SubFactory,
post_generation,
)
from factory import Faker, LazyFunction, SubFactory, post_generation
from factory.django import DjangoModelFactory
from wagtail.images.models import Image
from wagtail_factories import PageFactory
from networkapi.utility.faker import ImageProvider, generate_fake_data
from networkapi.utility.faker.helpers import get_random_objects, reseed
from networkapi.wagtailpages import models as pagemodels
from networkapi.wagtailpages.factory import profiles as profile_factories
from networkapi.wagtailpages.factory.donation import DonationModalFactory
from networkapi.wagtailpages.factory.image_factory import ImageFactory
from networkapi.wagtailpages.factory.petition import PetitionFactory
from networkapi.wagtailpages import models as pagemodels
from networkapi.utility.faker import ImageProvider, generate_fake_data
from networkapi.utility.faker.helpers import reseed, get_random_objects
Faker.add_provider(ImageProvider)

Просмотреть файл

@ -1,17 +1,13 @@
from factory import Trait, SubFactory
from factory import SubFactory, Trait
from wagtail.core.models import Page as WagtailPage
from networkapi.wagtailpages.models import (
CampaignPage,
CampaignIndexPage,
)
from networkapi.utility.faker.helpers import get_homepage, reseed
from networkapi.wagtailpages.models import CampaignIndexPage, CampaignPage
from networkapi.utility.faker.helpers import reseed, get_homepage
from .petition import PetitionFactory
from .index_page import IndexPageFactory
from .donation import DonationModalsFactory
from .abstract import CMSPageFactory
from .donation import DonationModalsFactory
from .index_page import IndexPageFactory
from .petition import PetitionFactory
class CampaignIndexPageFactory(IndexPageFactory):

Просмотреть файл

@ -1,9 +1,11 @@
from factory import Faker
from wagtail.core.models import Page as WagtailPage
from networkapi.wagtailpages.models import DearInternetPage
from wagtail_factories import PageFactory
from networkapi.utility.faker.helpers import get_homepage, reseed
from networkapi.wagtailpages.models import DearInternetPage
from .campaign_page import CampaignIndexPageFactory
from networkapi.utility.faker.helpers import reseed, get_homepage
class DearInternetPageFactory(PageFactory):

Просмотреть файл

@ -1,5 +1,5 @@
from factory import Faker, SubFactory, django
import wagtail_factories
from factory import Faker, SubFactory, django
class CollectionFactory(wagtail_factories.CollectionFactory):

Просмотреть файл

@ -1,7 +1,8 @@
from networkapi.wagtailpages.donation_modal import DonationModal, DonationModals
from factory import Faker, SubFactory
from factory.django import DjangoModelFactory
from networkapi.wagtailpages.donation_modal import DonationModal, DonationModals
class DonationModalFactory(DjangoModelFactory):
class Meta:

Просмотреть файл

@ -1,13 +1,14 @@
from django.conf import settings
from factory import Faker, SubFactory
from wagtail_factories import PageFactory
from wagtail.core.models import Site as WagtailSite, Page as WagtailPage
from wagtail.core.models import Page as WagtailPage
from wagtail.core.models import Site as WagtailSite
from wagtail.images.models import Image
from wagtail_factories import PageFactory
from networkapi.utility.faker.helpers import get_homepage, reseed
from networkapi.wagtailpages.factory.image_factory import ImageFactory
from networkapi.wagtailpages.models import Homepage, FocusArea
from networkapi.utility.faker.helpers import reseed, get_homepage
from networkapi.wagtailpages.models import FocusArea, Homepage
from .primary_page import PrimaryPageFactory
if settings.HEROKU_APP_NAME:

Просмотреть файл

@ -1,8 +1,9 @@
from random import choice
from networkapi.utility.faker.helpers import reseed, get_homepage
from faker import Faker # note: NOT from factory, but from faker. Different Faker!
from networkapi.utility.faker.helpers import get_homepage, reseed
faker = Faker()

Просмотреть файл

@ -1,14 +1,13 @@
from random import choice
from networkapi.utility.faker.helpers import get_homepage, reseed
from networkapi.wagtailpages.models import (
BlogPage,
FocusArea,
HomepageFocusAreas,
HomepageSpotlightPosts,
BlogPage,
)
from networkapi.utility.faker.helpers import reseed, get_homepage
def generate(seed):
print("Generating Homepage Focus Areas and Spotlights")

Просмотреть файл

@ -1,14 +1,10 @@
from random import choice
from faker import Faker # note: NOT from factory, but from faker. Different Faker!
from wagtail.images.models import Image
from networkapi.wagtailpages.models import (
PartnerLogos,
)
from networkapi.utility.faker.helpers import reseed, get_homepage
from faker import Faker # note: NOT from factory, but from faker. Different Faker!
from networkapi.utility.faker.helpers import get_homepage, reseed
from networkapi.wagtailpages.models import PartnerLogos
faker = Faker()

Просмотреть файл

@ -1,11 +1,11 @@
from random import choice
from wagtail.images.models import Image
from wagtail.core.models import Page
from networkapi.wagtailpages.pagemodels.base import HomepageTakeActionCards
from networkapi.utility.faker.helpers import reseed, get_homepage
from faker import Faker # note: NOT from factory, but from faker. Different Faker!
from wagtail.core.models import Page
from wagtail.images.models import Image
from networkapi.utility.faker.helpers import get_homepage, reseed
from networkapi.wagtailpages.pagemodels.base import HomepageTakeActionCards
faker = Faker()

Просмотреть файл

@ -1,8 +1,9 @@
from factory import SubFactory
from factory.django import DjangoModelFactory
from networkapi.wagtailpages.models import HomepageNewsYouCanUse, BlogPage
from networkapi.utility.faker.helpers import reseed, get_homepage
from networkapi.utility.faker.helpers import get_homepage, reseed
from networkapi.wagtailpages.models import BlogPage, HomepageNewsYouCanUse
from .blog import BlogPageFactory
from .homepage import WagtailHomepageFactory

Просмотреть файл

@ -1,7 +1,6 @@
from factory.django import DjangoModelFactory, ImageField
from wagtail.images import get_image_model
from wagtail.core.models import Collection
from wagtail.images import get_image_model
# Slightly modify the wagtail_factories ImageFactory so that it
# always generates images in the Root collection:

Просмотреть файл

@ -1,6 +1,7 @@
from networkapi.wagtailpages.models import IndexPage
from wagtail_factories import PageFactory
from networkapi.wagtailpages.models import IndexPage
class IndexPageFactory(PageFactory):
class Meta:

Просмотреть файл

@ -1,8 +1,8 @@
from networkapi.wagtailpages.models import InitiativesPage
from wagtail_factories import PageFactory
from wagtail.core.models import Page as WagtailPage
from wagtail_factories import PageFactory
from networkapi.utility.faker.helpers import reseed, get_homepage
from networkapi.utility.faker.helpers import get_homepage, reseed
from networkapi.wagtailpages.models import InitiativesPage
class InitiativesPageFactory(PageFactory):

Просмотреть файл

@ -1,6 +1,7 @@
from networkapi.wagtailpages.models import MiniSiteNameSpace
from wagtail_factories import PageFactory
from networkapi.wagtailpages.models import MiniSiteNameSpace
class MiniSiteNamespaceFactory(PageFactory):
class Meta:

Просмотреть файл

@ -1,8 +1,9 @@
from wagtail.core.models import Page as WagtailPage
from networkapi.wagtailpages.models import OpportunityPage, InitiativesPage
from wagtail_factories import PageFactory
from networkapi.utility.faker.helpers import get_homepage, reseed
from networkapi.wagtailpages.models import InitiativesPage, OpportunityPage
from .abstract import CMSPageFactory

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше