Skip to content

Commit

Permalink
Merge pull request cfpb#7957 from cfpb/deprecate/repaying-student-deb…
Browse files Browse the repository at this point in the history
…t-page

Deprecate RepayingStudentDebtPage
chosak authored Sep 13, 2023
2 parents b6637d5 + 9b7e270 commit f29ccd9
Showing 4 changed files with 37 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.20 on 2023-09-13 18:04

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('wagtailcore', '0078_referenceindex'),
('wagtailforms', '0005_alter_formsubmission_form_data'),
('wagtailinventory', '0003_pageblock_id_bigautofield'),
('v1', '0008_deprecate_heading_related_posts_in_sidebar_breakout'),
('wagtailredirects', '0008_add_verbose_name_plural'),
('paying_for_college', '0002_deprecate_iug_sharing'),
]

operations = [
migrations.DeleteModel(
name='RepayingStudentDebtPage',
),
]
5 changes: 1 addition & 4 deletions cfgov/paying_for_college/models/__init__.py
Original file line number Diff line number Diff line change
@@ -23,7 +23,4 @@
get_region,
make_divisible_by_6,
)
from paying_for_college.models.pages import (
CollegeCostsPage,
RepayingStudentDebtPage,
)
from paying_for_college.models.pages import CollegeCostsPage
74 changes: 15 additions & 59 deletions cfgov/paying_for_college/models/pages.py
Original file line number Diff line number Diff line change
@@ -6,59 +6,27 @@
from v1.models import CFGOVPage


class PayingForCollegePage(CFGOVPage):
"""A base class for our suite of PFC pages."""
class CollegeCostsPage(CFGOVPage):
"""Breaking down financial aid and loans for prospective students."""

header = StreamField(
[
("hero", molecules.Hero()),
("text_introduction", molecules.TextIntroduction()),
("featured_content", organisms.FeaturedContent()),
],
blank=True,
use_json_field=True,
)

content_panels = CFGOVPage.content_panels + [
FieldPanel("header"),
FieldPanel("content"),
]
# Tab handler interface
edit_handler = TabbedInterface(
[
ObjectList(content_panels, heading="General Content"),
ObjectList(CFGOVPage.sidefoot_panels, heading="Sidebar"),
ObjectList(CFGOVPage.settings_panels, heading="Configuration"),
]
)

class Meta:
abstract = True

def get_context(self, request, *args, **kwargs):
context = super().get_context(request)
context["return_user"] = "iped" in request.GET and request.GET["iped"]
return context


class PayingForCollegeContent(blocks.StreamBlock):
"""A base content block for PFC pages."""

full_width_text = organisms.FullWidthText()
info_unit_group = organisms.InfoUnitGroup()
expandable_group = organisms.ExpandableGroup()
expandable = organisms.Expandable()
well = organisms.Well()
raw_html_block = blocks.RawHTMLBlock(label="Raw HTML block")


class CollegeCostsPage(PayingForCollegePage):
"""Breaking down financial aid and loans for prospective students."""

header = StreamField(
content = StreamField(
[
("hero", molecules.Hero()),
("text_introduction", molecules.TextIntroduction()),
("featured_content", organisms.FeaturedContent()),
("full_width_text", organisms.FullWidthText()),
("info_unit_group", organisms.InfoUnitGroup()),
("expandable_group", organisms.ExpandableGroup()),
("expandable", organisms.Expandable()),
("well", organisms.Well()),
("raw_html_block", blocks.RawHTMLBlock(label="Raw HTML block")),
],
blank=True,
use_json_field=True,
@@ -69,28 +37,16 @@ class CollegeCostsPage(PayingForCollegePage):
FieldPanel("content"),
]

# Tab handler interface
edit_handler = TabbedInterface(
[
ObjectList(content_panels, heading="General Content"),
# ObjectList(, heading='School and living situation'),
ObjectList(CFGOVPage.settings_panels, heading="Configuration"),
]
)
content = StreamField(
PayingForCollegeContent,
blank=True,
use_json_field=True,
)
template = "paying-for-college/college-costs.html"


class RepayingStudentDebtPage(PayingForCollegePage):
"""A page to serve static subpages in the paying-for-college suite."""
template = "paying-for-college/college-costs.html"

content = StreamField(
PayingForCollegeContent,
blank=True,
use_json_field=True,
)
template = "paying-for-college/repaying-student-debt.html"
def get_context(self, request, *args, **kwargs):
context = super().get_context(request)
context["return_user"] = "iped" in request.GET and request.GET["iped"]
return context
26 changes: 0 additions & 26 deletions cfgov/paying_for_college/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -11,19 +11,16 @@
from paying_for_college.apps import PayingForCollegeConfig
from paying_for_college.models import (
Alias,
CollegeCostsPage,
ConstantCap,
ConstantRate,
Contact,
Nickname,
Notification,
Program,
RepayingStudentDebtPage,
School,
get_region,
make_divisible_by_6,
)
from v1.models import HomePage


class MakeDivisibleTest(TestCase):
@@ -40,29 +37,6 @@ def test_make_divisible(self):
self.assertTrue(make_divisible_by_6(test_value) == 48)


class PageModelsTest(TestCase):
def setUp(self):
def create_page(model, title, slug, parent):
new_page = model(live=False, title=title, slug=slug)
parent.add_child(instance=new_page)
new_page.save()
return new_page

self.ROOT_PAGE = HomePage.objects.get(slug="cfgov")
self.debt_page = create_page(
RepayingStudentDebtPage,
"Repaying student debt",
"repaying-student-debt",
self.ROOT_PAGE,
)
self.college_costs_page = create_page(
CollegeCostsPage,
"Understanding college costs",
"college-costs",
self.ROOT_PAGE,
)


class SchoolRegionTest(TestCase):
def test_get_region(self):
school = School(school_id="123456", state="NE")

0 comments on commit f29ccd9

Please sign in to comment.