This commit is contained in:
Daniel Miranda 2022-12-01 15:34:31 -08:00
Родитель 6b39b9e071 ca3e8cf3a5
Коммит aa60c12109
269 изменённых файлов: 8306 добавлений и 787 удалений

6
.github/workflows/continous-integration.yml поставляемый
Просмотреть файл

@ -2,7 +2,7 @@ name: Continuous Integration
on:
push:
branches: ["main", "pni-2022"]
branches: ["main"]
paths-ignore:
- maintenance/**/*.*
pull_request:
@ -91,7 +91,8 @@ jobs:
python network-api/manage.py compilemessages
- name: Run linting
run: |
flake8 tasks.py network-api/
flake8 .
isort . --check-only
black . --check
- name: Run type checks
run: mypy network-api
@ -103,6 +104,7 @@ jobs:
test_percy:
name: Percy CI
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-20.04
services:
postgres:

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

@ -3,6 +3,7 @@ black
coveralls
django-debug-toolbar
flake8
isort
mypy
ptvsd
types-python-slugify

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

@ -49,6 +49,8 @@ idna==3.3
# -c requirements.txt
# requests
# urllib3
isort==5.10.1
# via -r dev-requirements.in
mccabe==0.6.1
# via flake8
mypy==0.971

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

@ -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
@ -30,6 +30,8 @@ env = environ.Env(
AIRTABLE_ENABLED=(bool, False),
ALLOWED_HOSTS=(list, []),
APP_ENVIRONMENT=(str, ""),
APPLE_PAY_DOMAIN_ASSOCIATION_KEY_FOUNDATION=(str, ""),
APPLE_PAY_DOMAIN_ASSOCIATION_KEY_MOZFEST=(str, ""),
ASSET_DOMAIN=(str, ""),
AWS_LOCATION=(str, ""),
BASKET_URL=(str, ""),
@ -125,6 +127,11 @@ if SENTRY_DSN:
REVIEW_APP = env("REVIEW_APP", default=False)
APP_ENVIRONMENT = env("APP_ENVIRONMENT")
# Apple Pay domain association
APPLE_PAY_DOMAIN_ASSOCIATION_KEY_FOUNDATION = env("APPLE_PAY_DOMAIN_ASSOCIATION_KEY_FOUNDATION")
APPLE_PAY_DOMAIN_ASSOCIATION_KEY_MOZFEST = env("APPLE_PAY_DOMAIN_ASSOCIATION_KEY_MOZFEST")
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = root()

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

@ -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

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

@ -37,15 +37,11 @@
{{ featured_article.title }}
</h2>
<div class="tw-space-x-1 tw-text-black tw-font-sans tw-font-extrabold tw-text-sm">
{% trans "By" %}
{% with author_profiles=featured_article.get_author_profiles %}
{% if author_profiles %}
{% for author_profile in author_profiles %}
<span>{{ author_profile.name }}</span>
{% endfor %}
{% endif %}
{% endwith %}
<div class="tw-text-black tw-font-sans tw-font-extrabold tw-text-sm">
{% spaceless %}
<span>{% trans "By" context "Article author attribution" %} </span>
{% include "fragments/profile_names_list.html" with profiles=featured_article.get_author_profiles %}
{% endspaceless %}
</div>
</a>

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

@ -1,6 +1,8 @@
{% load i18n %}
{% for profile in profiles %}
{% if not forloop.first %}{% if not forloop.last %}<span class="tw-font-extrabold">, </span>{% else %}<span> {% trans "and" %} </span>{% endif %}{% endif %}
<span class="tw-font-extrabold">{{ profile.name }}</span>
{% endfor %}
{% spaceless %}
{% for profile in profiles %}
{% if not forloop.first %}{% if not forloop.last %}<span class="tw-font-extrabold">, </span>{% else %}<span> {% trans "and" %} </span>{% endif %}{% endif %}
<span class="tw-font-extrabold">{{ profile.name }}</span>
{% endfor %}
{% endspaceless %}

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

@ -153,10 +153,10 @@
</div>
</div>
<div class="tw-container tw-mt-7 tw-grid tw-grid-cols-1 medium:tw-grid-cols-2 large:tw-grid-cols-3 tw-grid-rows-3 medium:tw-grid-rows-2 large:tw-grid-rows-[min-content_1fr] tw-gap-7">
<div class="tw-container tw-mt-7 tw-grid tw-grid-cols-1 medium:tw-grid-cols-2 large:tw-grid-cols-3 tw-auto-rows-min tw-gap-7">
{% with product_updates=product.updates.all %}
{% if product_updates %}
<div class="tw-col-span-full medium:tw-col-span-1 large:tw-row-span-2">
<div class="tw-col-span-full medium:tw-col-span-1 tw-row-span-1 large:tw-row-span-3">
{% include "fragments/buyersguide/dive_deeper.html" with updates=product_updates %}
</div>
{% endif %}

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

@ -0,0 +1,86 @@
from django.conf import settings
from django.test import TestCase
from wagtail.core.models import Site
from networkapi.mozfest.factory import MozfestHomepageFactory
from networkapi.wagtailpages.factory.blog import BlogPageFactory
from networkapi.wagtailpages.factory.homepage import WagtailHomepageFactory
class TestApplePayDomainAssociationView(TestCase):
def setUp(self):
self.site = Site.objects.first()
self.foundation_homepage = WagtailHomepageFactory()
self.mozfest_homepage = MozfestHomepageFactory()
self.blog_page = BlogPageFactory()
self.view_url = "/.well-known/apple-developer-merchantid-domain-association"
def test_foundation_site_request(self):
"""
Make sure the view returns the foundation specific key,
when a request is made from the foundation site.
"""
settings.APPLE_PAY_DOMAIN_ASSOCIATION_KEY_FOUNDATION = "test_foundation_key"
self.site.root_page = self.foundation_homepage
self.site.save()
response = self.client.get(self.view_url)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content.decode(), "test_foundation_key")
def test_foundation_site_request_with_no_key_set(self):
"""
If no foundation site key is set, the view should return a
'key not found' error message.
"""
settings.APPLE_PAY_DOMAIN_ASSOCIATION_KEY_FOUNDATION = None
self.site.root_page = self.foundation_homepage
self.site.save()
response = self.client.get(self.view_url)
self.assertEqual(response.status_code, 501)
self.assertEqual(response.content.decode(), "Key not found. Please check environment variables.")
def test_mozfest_site_request(self):
"""
Make sure the view returns the mozfest specific key,
when a request is made from the mozfest site.
"""
settings.APPLE_PAY_DOMAIN_ASSOCIATION_KEY_MOZFEST = "test_mozfest_key"
self.site.root_page = self.mozfest_homepage
self.site.save()
response = self.client.get(self.view_url)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content.decode(), "test_mozfest_key")
def test_mozfest_site_request_with_no_key_set(self):
"""
If no mozfest site key is set, the view should return a
'key not found' error message.
"""
settings.APPLE_PAY_DOMAIN_ASSOCIATION_KEY_MOZFEST = None
self.site.root_page = self.foundation_homepage
self.site.save()
response = self.client.get(self.view_url)
self.assertEqual(response.status_code, 501)
self.assertEqual(response.content.decode(), "Key not found. Please check environment variables.")
def test_request_from_other_site(self):
"""
Making sure that any request from a site that has neither a
'WagtailHomePage' or a 'MozfestHomePage' set as the root,
returns a 400 error.
"""
self.site.root_page = self.blog_page
self.site.save()
response = self.client.get(self.view_url)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.content.decode(), "Request site is not recognized.")

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

@ -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,8 @@ 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):
@ -411,7 +407,7 @@ class TestPNIAirtableConnections(TestCase):
class TestCreateWagtailImageUtility(TestCase):
def setUp(self):
self.image_path = abspath(join(dirname(__file__), "../media/images/placeholders/products/teddy.jpg"))
self.image_path = abspath(join(dirname(__file__), "../../media/images/placeholders/products/teddy.jpg"))
def create_new_image(self):
"""A generic test to ensure the image is created properly."""

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

@ -4,15 +4,31 @@ 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,
apple_pay_domain_association_view,
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 +36,6 @@ 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()
@ -78,6 +83,8 @@ urlpatterns = list(
),
name="googled2a9d510ca850787.html",
),
# Apple Pay domain association
path(".well-known/apple-developer-merchantid-domain-association", apple_pay_domain_association_view),
# social-sign-on routes so that Google auth works
re_path(r"^soc/", include("social_django.urls", namespace="social")),
# CSRF endpoint

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

@ -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,7 +1,12 @@
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
from django.views.decorators.http import require_GET
from wagtail.core.models import Site
from networkapi.mozfest.models import MozfestHomepage
from networkapi.wagtailpages.models import Homepage
class EnvVariablesView(View):
@ -19,3 +24,37 @@ def review_app_help_view(request):
return render(request, "reviewapp-help.html")
else:
return HttpResponse(status=404)
@require_GET
def apple_pay_domain_association_view(request):
"""
Returns string needed for Apple Pay domain association/verification,
based on which site is making the request.
"""
request_site_root = Site.find_for_request(request).root_page.specific
mozfest_key = settings.APPLE_PAY_DOMAIN_ASSOCIATION_KEY_MOZFEST
foundation_key = settings.APPLE_PAY_DOMAIN_ASSOCIATION_KEY_FOUNDATION
key_not_found_message = "Key not found. Please check environment variables."
if isinstance(request_site_root, MozfestHomepage):
if mozfest_key:
response_contents = mozfest_key
status_code = 200
else:
response_contents = key_not_found_message
status_code = 501
elif isinstance(request_site_root, Homepage):
if foundation_key:
response_contents = foundation_key
status_code = 200
else:
response_contents = key_not_found_message
status_code = 501
else:
response_contents = "Request site not recognized."
status_code = 400
return HttpResponse(response_contents, status=status_code, content_type="text/plain; charset=utf-8")

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

@ -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()

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