Skip to content

Commit

Permalink
Merge Release 6.10.0 into main (#1477)
Browse files Browse the repository at this point in the history
* Added Ally Logo page (#1354)

* Removed dbbackup because it does not solve to intended problem (#1355)

* Removed ScoutAPM since it is no longer used (#1360)

* only upload book data if the resource has a salesforce abbr (#1364)

* Added cache clearing for general pages and fixed sticky note (#1365)

* Changed query to sort by title instead of path (#1368)

* Updated Partner query, removed reviews and updated tests (#1371)

* Updated partner query, removed review sync and made all visible on website

* Removed reviews and updated tests

* Bump pillow from 9.1.1 to 9.3.0 in /requirements (#1366)

Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.1.1 to 9.3.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](python-pillow/Pillow@9.1.1...9.3.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Volo <[email protected]>

* adding k12 pages, subjects

* Add check on queryset for Resources (#1375)

* Add check on queryset for Resources

* Added test for bad slug

* Removed Testimonial fields from School listing (#1377)

* Clear resources on page save (#1381)

* Added checks for book before creating resource download or sending to Salesforce (#1384)

* Added checks for book before creating or sending to Salesforce

* Edited if statement

* Model and migration for new learning research page

* Add new research page to home subpages

* Add page to test

* Python spacing

* Update help text for some fields

* fix class naming convention

* added student and instructor resources to k12 subject pages

* Tidy pages/model.py

* Remove old research page in favor of new learning-research page

* Remove unused field

* remove seo title and search description from snippets/models

* reverted update_partners.py

* Added Ally Logo page (#1354)

* Added cache clearing for general pages and fixed sticky note (#1365)

* Ne wmigration for learningresearch page

* Upgrade to Wagtail 3 (#1398)

* Added Ally Logo page (#1354)

* Changed wagtail.core to wagtail

* Changed wagtail.tests to wagtail.test

* Set StreamField to have use_json_field parameter

* FieldPanel changes

* Update to Wagtail 3.0.3

* merge migrations after rebase

* Updated merged code for Wagtail 3

* Updated base.txt and locked-requirements.txt

* Updated mapbox to 0.18.1 (#1403)

* change schools/mapbox to sync monthly instead of daily (#1404)

* Merge migration per wagtail

* Remove all geneeral pages from sitemap except kinetic (#1402)

* adjusting k12 data for frontend needs (#1405)

* adjusting data for frontend needs

- add label to subject dropdown
- split name field in testimonials
- fix images coming from snippets
- modify subject category labels
- add titles and icons to resources
- move resources to book level

* fix resource icons for k12 pages

* add link_document_url to k12 subject pages

* Added links to documentation in Confluence, Added Contributing file (#1414)

* Fix import export (#1415)

* Fixed translation and locale in export

* More improvements

* Lookup documents by title when importing

* Uncommented save of a page

* All documents now included

* sort by book and git ignore icloud files (#1418)

* subject sort in release added to development (#1420)

* Errata form hotfix (#1423)

* Removed /general/ from kinetic page sitemap entry (#1421)

* Link preview fix (#1416)

* Added page template to blog posts

* Added page template to news app

* Moved page template to blog folder

* Folder to match FE URL with page template

* Removed folders that did not work and put page template under news

* middleware to create link preview

* All bots working now

* Added ua_parser to base.txt

* Looked up correct object based on url path

* Home page working and wrote tests

* Removed NewsArticle use of template since it is not needed

* Cleaned up template HTML

* Improved HTML formatting

* Remove all isbn 10 fields from books (#1428)

* K12 tags fix into development (#1429)

* Assignable page added to CMS (#1430)

* First pass at assignables page

* Assignable page added

* Tweaked Assignable fields based on new text document (#1431)

* Tweaked fields based on new text document

* Latest round of changes

* renamed book columns

* Remove reference to assignable_book_link

* Errata Export hotfix in development branch (#1440)

* add resource_unlocked to k12 faculty resource lists (#1436)

* Remove one page limitation on FAQ (#1441)

* Replaced heading with heading_title_image (#1442)

* Added add assignable cta fields (#1443)

* Added add assignable cta fields

* Added FAQ section

* update readme versions and docker configs (#1447)

* add cnx_id to book data (#1446)

* Added field to resource API to match old Book API resource field (#1445)

* Added resource_category field to resource snippets (#1448)

* Added resource_category field to resource snippets

* Added missing resource category on FacultyResource model for books

* adding assignable resource (#1452)

* adding assignable resource

* Update 0053_alter_errata_resource.py

* Update query for Opps to fetch UUID through the contact (#1453)

* Added image carousel for Assignable (#1454)

* Snippet for no webinar message (#1455)

* update Book relationship query (#1459)

* Fixed object structure from Salesforce (#1460)

* remove student numbers from opp query (#1461)

* Menus (#1462)

* Code for adding menus for site to CMS

* Menus working, but improvements needed

* Made cleaner json

* Added tests

* Added new fields to Press page (#1463)

* Resource external link no longer required (#1464)

* Resource external link no longer required

* Made link text not required

* Improve handling pf privacy policy and encoded slugs (#1466)

* Fixed resource link still being required (#1467)

* Fixed resource link still being required

* Fixed menu change

* Removed validation errors on resources

* Added About field

* Removed locked-requirements.txt to prevent dependabot PRs

* Add K12 and Research CTAs to home page

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Michael Volo <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dmoreno <[email protected]>
Co-authored-by: Chris Bendel <[email protected]>
Co-authored-by: dmoreno27 <[email protected]>
Co-authored-by: Devynn Moreno <[email protected]>
Co-authored-by: Colby <[email protected]>
Co-authored-by: Devynn Moreno <[email protected]>
Co-authored-by: Thomas Woodward <[email protected]>
  • Loading branch information
10 people authored Jun 15, 2023
1 parent 7da0719 commit 2399fa0
Show file tree
Hide file tree
Showing 25 changed files with 401 additions and 277 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 4.0.8 on 2023-06-01 15:07

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('books', '0145_remove_book_assignable_book_link'),
]

operations = [
migrations.AlterField(
model_name='facultyresources',
name='link_external',
field=models.URLField(blank=True, help_text='Provide an external URL starting with https:// (or fill out either one of the following two).', null=True, verbose_name='External link'),
),
migrations.AlterField(
model_name='facultyresources',
name='link_text',
field=models.CharField(blank=True, help_text='Call to Action Text', max_length=255, null=True),
),
migrations.AlterField(
model_name='studentresources',
name='link_external',
field=models.URLField(blank=True, help_text='Provide an external URL starting with http:// (or fill out either one of the following two).', null=True, verbose_name='External link'),
),
migrations.AlterField(
model_name='studentresources',
name='link_text',
field=models.CharField(blank=True, help_text='Call to Action Text', max_length=255, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.0.8 on 2023-06-02 16:22

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('books', '0146_alter_facultyresources_link_external_and_more'),
]

operations = [
migrations.AlterField(
model_name='facultyresources',
name='link_external',
field=models.URLField(blank=True, default='', help_text='Provide an external URL starting with https:// (or fill out either one of the following two).', verbose_name='External link'),
),
migrations.AlterField(
model_name='studentresources',
name='link_external',
field=models.URLField(blank=True, default='', help_text='Provide an external URL starting with http:// (or fill out either one of the following two).', verbose_name='External link'),
),
]
31 changes: 4 additions & 27 deletions books/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def get_resource_creator_fest_resource(self):
return self.resource.creator_fest_resource
creator_fest_resource = property(get_resource_creator_fest_resource)

link_external = models.URLField("External link", blank=True, help_text="Provide an external URL starting with https:// (or fill out either one of the following two).")
link_external = models.URLField("External link", default='', blank=True, help_text="Provide an external URL starting with https:// (or fill out either one of the following two).")
link_page = models.ForeignKey(
'wagtailcore.Page',
null=True,
Expand All @@ -188,7 +188,7 @@ def get_document_title(self):
return self.link_document.title
link_document_title = property(get_document_title)

link_text = models.CharField(max_length=255, help_text="Call to Action Text")
link_text = models.CharField(max_length=255, null=True, blank=True, help_text="Call to Action Text")
coming_soon_text = models.CharField(max_length=255, null=True, blank=True, help_text="If there is text in this field a coming soon banner will be added with this description.")
video_reference_number = models.IntegerField(blank=True, null=True)
updated = models.DateTimeField(blank=True, null=True, help_text='Late date resource was updated')
Expand Down Expand Up @@ -220,7 +220,6 @@ def get_resource_category(self):
APIField('display_on_k12'),
APIField('print_link'),
APIField('resource_category')

]

panels = [
Expand All @@ -238,17 +237,6 @@ def get_resource_category(self):
FieldPanel('print_link')
]

def clean(self):
errors = {}
external = self.link_external
page = self.link_page
document = self.link_document
if not external and not page and not document:
errors.setdefault('link_external', []).append('One of these fields must be populated: External link, Link page or Link document.')

if errors:
raise ValidationError(errors)


class StudentResources(models.Model):
resource = models.ForeignKey(
Expand All @@ -275,7 +263,7 @@ def get_resource_icon(self):
return self.resource.resource_icon
resource_icon = property(get_resource_icon)

link_external = models.URLField("External link", blank=True, help_text="Provide an external URL starting with http:// (or fill out either one of the following two).")
link_external = models.URLField("External link", default='', blank=True, help_text="Provide an external URL starting with http:// (or fill out either one of the following two).")
link_page = models.ForeignKey(
'wagtailcore.Page',
null=True,
Expand All @@ -301,7 +289,7 @@ def get_document_title(self):
return self.link_document.title
link_document_title = property(get_document_title)

link_text = models.CharField(max_length=255, help_text="Call to Action Text")
link_text = models.CharField(max_length=255, null=True, blank=True, help_text="Call to Action Text")
coming_soon_text = models.CharField(max_length=255, null=True, blank=True, help_text="If there is text in this field a coming soon banner will be added with this description.")
updated = models.DateTimeField(blank=True, null=True, help_text='Late date resource was updated')
print_link = models.URLField(blank=True, null=True, help_text="Link for Buy Print link on resource")
Expand Down Expand Up @@ -341,17 +329,6 @@ def get_resource_category(self):
FieldPanel('display_on_k12')
]

def clean(self):
errors = {}
external = self.link_external
page = self.link_page
document = self.link_document
if not external and not page and not document:
errors.setdefault('link_external', []).append('One of these fields must be populated: External link, Link page or Link document.')

if errors:
raise ValidationError(errors)


class Authors(models.Model):
name = models.CharField(max_length=255, help_text="Full name of the author.")
Expand Down
1 change: 0 additions & 1 deletion errata/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def book_title(self, obj):

book_title.admin_order_field = 'book__title'


"""Model permissions"""
@method_decorator(csrf_protect)
def changelist_view(self, request, extra_context=None):
Expand Down
1 change: 1 addition & 0 deletions global_settings/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ def ready(self):
import webinars.signals
import snippets.signals
import salesforce.signals
import oxmenus.signals
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated by Django 4.0.8 on 2023-06-01 13:44

from django.db import migrations, models
import django.db.models.deletion
import pages.custom_blocks
import wagtail.blocks
import wagtail.documents.blocks
import wagtail.fields


class Migration(migrations.Migration):

dependencies = [
('wagtailimages', '0024_index_image_file_hash'),
('news', '0047_alter_newsarticle_article_subjects_and_more'),
]

operations = [
migrations.AddField(
model_name='pressindex',
name='faqs',
field=wagtail.fields.StreamField([('faq', wagtail.blocks.StructBlock([('question', wagtail.blocks.RichTextBlock(required=True)), ('slug', wagtail.blocks.CharBlock(required=True)), ('answer', wagtail.blocks.RichTextBlock(required=True)), ('document', wagtail.documents.blocks.DocumentChooserBlock(required=False))]))], blank=True, null=True, use_json_field=True),
),
migrations.AddField(
model_name='pressindex',
name='infographic_image',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
),
migrations.AddField(
model_name='pressindex',
name='infographic_text',
field=models.TextField(blank=True, default=''),
),
migrations.AddField(
model_name='pressindex',
name='testimonials',
field=wagtail.fields.StreamField([('testimonial', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('image', pages.custom_blocks.APIImageChooserBlock(required=False)), ('testimonial', wagtail.blocks.TextBlock(required=False))])))], blank=True, null=True, use_json_field=True),
),
]
27 changes: 27 additions & 0 deletions news/migrations/0049_pressindex_about_alter_pressindex_mentions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 4.0.8 on 2023-06-05 13:00

from django.db import migrations
import news.models
import snippets.models
import wagtail.blocks
import wagtail.fields


class Migration(migrations.Migration):

dependencies = [
('news', '0048_pressindex_faqs_pressindex_infographic_image_and_more'),
]

operations = [
migrations.AddField(
model_name='pressindex',
name='about',
field=wagtail.fields.RichTextField(blank=True, null=True),
),
migrations.AlterField(
model_name='pressindex',
name='mentions',
field=wagtail.fields.StreamField([('mention', wagtail.blocks.StructBlock([('source', news.models.NewsMentionChooserBlock(snippets.models.NewsSource)), ('url', wagtail.blocks.URLBlock()), ('headline', wagtail.blocks.CharBlock()), ('date', wagtail.blocks.DateBlock()), ('featured_in', wagtail.blocks.BooleanBlock(default=False, help_text='Check if displayed in Featured In section', required=False))], icon='document'))], null=True, use_json_field=True),
),
]
30 changes: 30 additions & 0 deletions news/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from taggit.models import TaggedItemBase
from openstax.functions import build_image_url
from snippets.models import NewsSource, BlogContentType, BlogCollection, Subject
from pages.custom_blocks import APIImageChooserBlock, FAQBlock


class ImageChooserBlock(ImageChooserBlock):
Expand Down Expand Up @@ -476,6 +477,7 @@ class NewsMentionBlock(blocks.StructBlock):
url = blocks.URLBlock()
headline = blocks.CharBlock()
date = blocks.DateBlock()
featured_in = blocks.BooleanBlock(required=False, default=False, help_text="Check if displayed in Featured In section")

class Meta:
icon = 'document'
Expand Down Expand Up @@ -504,11 +506,29 @@ def get_press_kit(self):
return build_image_url(self.press_kit)
press_kit_url = property(get_press_kit)

about = RichTextField(blank=True, null=True)
press_inquiry_name = models.CharField(max_length=255, blank=True, null=True)
press_inquiry_phone = models.CharField(max_length=255)
press_inquiry_email = models.EmailField()
experts_heading = models.CharField(max_length=255)
experts_blurb = models.TextField()
infographic_image = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+',
)
infographic_text = models.TextField(default='', blank=True)
testimonials = StreamField(
blocks.StreamBlock([
('testimonial', blocks.ListBlock(blocks.StructBlock([
('image', APIImageChooserBlock(required=False)),
('testimonial', blocks.TextBlock(required=False)),
])))]), blank=True, null=True, use_json_field=True)
faqs = StreamField([
('faq', FAQBlock()),
], blank=True, null=True, use_json_field=True)
mentions = StreamField([
('mention', NewsMentionBlock(icon='document')),
], null=True, use_json_field=True)
Expand Down Expand Up @@ -544,12 +564,17 @@ def releases(self):

content_panels = Page.content_panels + [
FieldPanel('press_kit'),
FieldPanel('about'),
FieldPanel('press_inquiry_name'),
FieldPanel('press_inquiry_phone'),
FieldPanel('press_inquiry_email'),
FieldPanel('experts_heading'),
FieldPanel('experts_blurb'),
InlinePanel('experts_bios', label="Experts"),
FieldPanel('infographic_image'),
FieldPanel('infographic_text'),
FieldPanel('testimonials'),
FieldPanel('faqs'),
FieldPanel('mentions'),
InlinePanel('mission_statements', label="Mission Statement"),
]
Expand All @@ -564,6 +589,7 @@ def releases(self):
api_fields = [
APIField('press_kit'),
APIField('press_kit_url'),
APIField('about'),
APIField('releases'),
APIField('slug'),
APIField('seo_title'),
Expand All @@ -572,6 +598,10 @@ def releases(self):
APIField('experts_heading'),
APIField('experts_blurb'),
APIField('experts_bios'),
APIField('infographic_image'),
APIField('infographic_text'),
APIField('testimonials'),
APIField('faqs'),
APIField('mentions'),
APIField('mission_statements'),
APIField('press_inquiry_name'),
Expand Down
16 changes: 10 additions & 6 deletions openstax/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse
from django.http import HttpResponse
from urllib.parse import unquote
from books.models import Book
from openstax.functions import build_image_url
from news.models import NewsArticle
from pages.models import HomePage, Supporters
from pages.models import HomePage, Supporters, GeneralPage, PrivacyPolicy


class HttpSmartRedirectResponse(HttpResponsePermanentRedirect):
Expand Down Expand Up @@ -67,9 +68,9 @@ def __call__(self, request, *args, **kwargs):
user_agent = user_agent_parser.ParseUserAgent(request.META["HTTP_USER_AGENT"])
if user_agent['family'].lower() in self.OG_USER_AGENTS:
# url path minus the trailing /
url_path = request.get_full_path()[:-1]
url_path = unquote(request.get_full_path()[:-1])

full_url = request.build_absolute_uri()
full_url = unquote(request.build_absolute_uri())

# imdex of last / to find slug, except when there isn't a last /
if url_path == '':
Expand All @@ -85,9 +86,11 @@ def __call__(self, request, *args, **kwargs):

# look up correct object based on path
if '/details/books/' in url_path:
page = Book.objects.filter(slug = page_slug)
page = Book.objects.filter(slug=page_slug)
elif '/blog/' in url_path:
page = NewsArticle.objects.filter(slug = page_slug)
page = NewsArticle.objects.filter(slug=page_slug)
elif '/privacy' in url_path:
page = PrivacyPolicy.objects.filter(slug='privacy-policy')
else:
page = self.page_by_slug(page_slug)

Expand Down Expand Up @@ -120,7 +123,8 @@ def build_template(self, page, page_url):
return template

def redirect_path_found(self, url_path):
if '/blog/' in url_path or '/details/books/' in url_path or '/foundation' in url_path or '' == url_path:
if '/blog/' in url_path or '/details/books/' in url_path or '/foundation' in url_path or '/privacy' in url_path or '' == url_path:

return True
else:
return False
Expand Down
1 change: 1 addition & 0 deletions openstax/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
'donations',
'wagtailimportexport',
'versions',
'oxmenus',
# wagtail
'wagtail',
'wagtail.admin',
Expand Down
1 change: 1 addition & 0 deletions openstax/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
path('apps/cms/api/events/', include('events.urls')),
path('apps/cms/api/webinars/', include('webinars.urls')),
path('apps/cms/api/donations/', include('donations.urls')),
path('apps/cms/api/oxmenus/', include('oxmenus.urls')),

# route everything to /api/spike also...
path('apps/cms/api/spike/', include(wagtail_urls)),
Expand Down
Empty file added oxmenus/__init__.py
Empty file.
24 changes: 24 additions & 0 deletions oxmenus/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.0.8 on 2023-05-31 16:09

from django.db import migrations, models
import wagtail.blocks
import wagtail.fields


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Menus',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('menu', wagtail.fields.StreamField([('menus', wagtail.blocks.StructBlock([('menu_items', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(max_length=255)), ('partial_url', wagtail.blocks.CharBlock(max_length=255))], required=True)))], required=True))], use_json_field=True)),
],
),
]
Empty file added oxmenus/migrations/__init__.py
Empty file.
Loading

0 comments on commit 2399fa0

Please sign in to comment.