Skip to content

Commit

Permalink
Merge branch 'main' into group-listing-block-link-update
Browse files Browse the repository at this point in the history
  • Loading branch information
robdivincenzo authored Jul 16, 2024
2 parents 5372b9a + 53801a3 commit 827318d
Show file tree
Hide file tree
Showing 25 changed files with 40,800 additions and 54 deletions.
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ coverage[toml]==7.4.1
# via pytest-cov
cssbeautifier==1.14.7
# via djlint
django==4.2.11
django==4.2.14
# via
# -c requirements.txt
# django-debug-toolbar
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

24 changes: 21 additions & 3 deletions network-api/networkapi/utility/faker/streamfield_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,13 @@ def generate_dark_quote_field():

def generate_video_field():
caption = fake.paragraph(nb_sentences=1, variable_nb_sentences=False)
captionURL = fake.url(schemes=["https"])

caption_external_url = [
{
"link_to": "external_url",
"external_url": fake.url(schemes=["https"]),
"new_window": True,
}
]
return generate_field(
"video",
{
Expand All @@ -205,7 +210,7 @@ def generate_video_field():
# See details: https://github.com/mozilla/foundation.mozilla.org/issues/3833#issuecomment-562240677
"url": "https://www.youtube.com/embed/83fk3RT8318",
"caption": caption,
"captionURL": captionURL,
"caption_url": caption_external_url,
"video_width": "full_width",
},
)
Expand Down Expand Up @@ -675,6 +680,18 @@ def generate_mixed_content_field():
)


def generate_app_install_download_button_field():
return generate_field(
"button",
{
"link_to": "external_url",
"external_url": fake.url(schemes=["https"]),
"label": " ".join(fake.words(nb=2)),
"new_window": True,
},
)


class StreamfieldProvider(BaseProvider):
"""
A custom Faker Provider for relative image urls, for use with factory_boy
Expand Down Expand Up @@ -734,6 +751,7 @@ def streamfield(self, fields=None):
"profiles": generate_profiles_field,
"newsletter_signup": generate_newsletter_signup_with_background_field,
"mixed_content": generate_mixed_content_field,
"app_install_download_button": generate_app_install_download_button_field,
}

streamfield_data = []
Expand Down
2 changes: 2 additions & 0 deletions network-api/networkapi/wagtailpages/factory/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from networkapi.wagtailpages.factory.libraries import rcc, research_hub

from . import (
app_install_page,
bannered_campaign_page,
blog,
buyersguide,
Expand Down Expand Up @@ -50,6 +51,7 @@ def generate(seed):
rcc.generate(seed)
# homepage_cause_statement_link requires child pages of homepage to exist
homepage_cause_statement_link.generate(seed)
app_install_page.generate(seed)


__all__ = [
Expand Down
39 changes: 39 additions & 0 deletions network-api/networkapi/wagtailpages/factory/app_install_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from factory import Faker, SubFactory
from wagtail_factories import PageFactory

from networkapi.utility.faker.helpers import reseed
from networkapi.wagtailpages import models as pagemodels
from networkapi.wagtailpages.factory import image_factory
from networkapi.wagtailpages.models import AppInstallPage

from .petition import PetitionFactory


class AppInstallPageFactory(PageFactory):
class Meta:
model = AppInstallPage
exclude = (
"title_text",
"header_text",
"header",
)

title = "Regrets Reporter Page"
slug = "regretsreporter"
hero_heading = Faker("text", max_nb_chars=50)
hero_subheading = Faker("text", max_nb_chars=50)
hero_background = SubFactory(image_factory.ImageFactory)
download_buttons = Faker("streamfield", fields=["app_install_download_button"] * 2)
cta = SubFactory(PetitionFactory)
body = Faker("streamfield", fields=["header", "paragraph", "image", "spacer", "image_text", "quote"])


def generate(seed):
reseed(seed)

print("Generating PNI Homepage")
AppInstallPageFactory.create(
parent=pagemodels.Homepage.objects.first(),
title="App Install Page",
slug="app-install-page",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.11 on 2024-07-02 19:55

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("wagtailpages", "0143_delete_youtuberegretsreporterextensionpage"),
]

operations = [
migrations.AlterField(
model_name="appinstallpage",
name="hero_heading",
field=models.CharField(help_text="Hero story headline", max_length=250),
),
migrations.AlterField(
model_name="appinstallpage",
name="hero_subheading",
field=models.CharField(blank=True, help_text="Hero story subheadline", max_length=250),
),
]

Large diffs are not rendered by default.

Loading

0 comments on commit 827318d

Please sign in to comment.