Skip to content

Commit

Permalink
Merge Release v6.16.0 into main (#1506)
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 (#1470)

* readd SF name/abbr to book detail (#1472)

* Tweaks to improve blog search results (#1471)

* Tweaks to improve blog search results

* Added subjects, categories and collections to search

* Order by title (#1473)

* Added write for us and editorial calendar to sitemap (#1474)

* Added footer fields to news index page (#1475)

* Modified errata query to prefetch book, removed review totals from Partners (#1476)

* Modified errata query to prefetch book, removed review totals from Partners

* Fixed query

* undo last commit

* Import working for non-book pages (#1478)

* Handle exporting non-book pages

* Changed content type check

* improvements for non-book pages

* Import working for non-book pages

* added missing function and removed unused function

* Removed print statements

* Removed openstax logo fields from ally logos page (#1481)

* Added book_uuid field and copied cnx_id value into it (#1482)

* Only return live blog posts when querying by subject, collection or content type (#1483)

* Updated packages (#1484)

* Improved blog search results (#1486)

* Fixed n+1 query issue on news search (#1487)

* Webinars page (#1488)

* Added collections and search to webinar page

* Fixed search and search url

* Removed print stmts and added test for search

* Removed unneeded import

* Removed websearch parameter

* Added tests for 2 pages

* changed name of webinar search API

* K12 sitemap fix (#1490)

* Sitemap fix for k12 and new subjects page

* fixed k12 sitemap

* New subjects page is in sitemap if flag is set to display

* Now deals with -books on subject slugs correctly

* Added missing Page tests (#1494)

* added tests for 7 pages

* added several more tests

* Added Assignable snippet (#1495)

* Started adding snippet

* Added assignable available snippet

* Added missing snippets tests (#1496)

* Fix for docker on new macs (#1499)

---------

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 Sep 22, 2023
1 parent 20935c1 commit cd23122
Show file tree
Hide file tree
Showing 10 changed files with 446 additions and 8 deletions.
1 change: 0 additions & 1 deletion news/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def search(request):
search=vector,
).filter(rank__gte=0.3,live=True).order_by('-date', 'rank')


if ('collection' in request.GET) and request.GET['collection'].strip():
collection_name = request.GET['collection']
types = []
Expand Down
291 changes: 290 additions & 1 deletion pages/tests.py

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions snippets/migrations/0029_assignableavailable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 4.0.8 on 2023-08-22 20:00

from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

dependencies = [
('wagtailimages', '0024_index_image_file_hash'),
('wagtailcore', '0069_log_entry_jsonfield'),
('snippets', '0028_webinarcollection'),
]

operations = [
migrations.CreateModel(
name='AssignableAvailable',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('translation_key', models.UUIDField(default=uuid.uuid4, editable=False)),
('name', models.CharField(blank=True, max_length=255, null=True)),
('assignable_description', models.TextField(default='')),
('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
('locale', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale')),
],
options={
'abstract': False,
'unique_together': {('translation_key', 'locale')},
},
),
]
32 changes: 32 additions & 0 deletions snippets/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,3 +431,35 @@ def __str__(self):

register_snippet(WebinarCollection)


class AssignableAvailable(TranslatableMixin, models.Model):
name = models.CharField(max_length=255, null=True, blank=True)
assignable_description = models.TextField(default='')
image = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)

def get_assignable_available_image(self):
return build_image_url(self.image)

assignable_available_image = property(get_assignable_available_image)

api_fields = ('assignable_description',
'assignable_available_image')

panels = [
FieldPanel('name'),
FieldPanel('assignable_description'),
FieldPanel('image'),
]

def __str__(self):
return self.name


register_snippet(AssignableAvailable)

9 changes: 8 additions & 1 deletion snippets/serializers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .models import Role, Subject, K12Subject, ErrataContent, SubjectCategory, GiveBanner, BlogContentType, \
BlogCollection, NoWebinarMessage, WebinarCollection
BlogCollection, NoWebinarMessage, WebinarCollection, AssignableAvailable

from rest_framework import serializers, generics

Expand Down Expand Up @@ -92,3 +92,10 @@ class Meta:
'description',
'collection_image')


class AssignableAvailableSerializer(serializers.ModelSerializer):
class Meta:
model = AssignableAvailable
fields = ('assignable_description',
'assignable_available_image')

8 changes: 7 additions & 1 deletion snippets/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from global_settings.functions import invalidate_cloudfront_caches
from snippets.models import Subject, Role, ErrataContent, SubjectCategory, GiveBanner, BlogContentType, BlogCollection, \
WebinarCollection
WebinarCollection, AssignableAvailable


@receiver(post_save, sender=Subject)
Expand Down Expand Up @@ -44,3 +44,9 @@ def clear_cloudfront_on_blog_collection_save(sender, **kwargs):
@receiver(post_save, sender=WebinarCollection)
def clear_cloudfront_on_webinar_collection_save(sender, **kwargs):
invalidate_cloudfront_caches('snippets/webinarcollection')


@receiver(post_save, sender=AssignableAvailable)
def clear_cloudfront_on_assignable_available_save(sender, **kwargs):
invalidate_cloudfront_caches('snippets/assignableavailable')

70 changes: 69 additions & 1 deletion snippets/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
from django.conf import settings
from django.urls import reverse

from snippets.models import Subject, ErrataContent, GiveBanner, BlogContentType, NoWebinarMessage
from snippets.models import Subject, ErrataContent, GiveBanner, BlogContentType, NoWebinarMessage, K12Subject, \
FacultyResource, StudentResource, Role, SharedContent, NewsSource, SubjectCategory, BlogCollection, AssignableAvailable
import snippets


class SnippetsTestCase(TestCase):
Expand Down Expand Up @@ -39,6 +41,35 @@ def setUp(self):
self.no_webinar_message = NoWebinarMessage(no_webinar_message="No webinars currently scheduled. In the meantime, please watch any of our past webinars.")
self.no_webinar_message.save()

self.k12subject = K12Subject(name="Test Subject", intro_text='Intro text',subject_link="https://example.com/openstaxk12")
self.k12subject.save()

self.faculty_resource = FacultyResource(heading="Faculty Resource", description='resource description',unlocked_resource=True)
self.faculty_resource.save()

self.student_resource = StudentResource(heading="Student Resource", description='resource description',
unlocked_resource=True)
self.student_resource.save()

self.role = Role(display_name="role display name", salesforce_name='role salesforce name')
self.role.save()

self.shared_content = SharedContent(title="shared content", heading='shared content heading', content='shared content')
self.shared_content.save()

self.news_source = NewsSource(name="news source")
self.news_source.save()

self.subject_category = SubjectCategory(subject_category="subject category", description='subject category description')
self.subject_category.save()

self.blog_collection = BlogCollection(name="blog collection", description='blog collection description')
self.blog_collection.save()

self.assignable_available = AssignableAvailable(
assignable_description="Assignable is ...")
self.assignable_available.save()

def test_can_create_subject(self):
subject = Subject(name="Science", page_content="Science page content.", seo_title="Science SEO Title",
search_description="Science page description.")
Expand Down Expand Up @@ -75,3 +106,40 @@ def test_can_fetch_all_blog_content_types(self):
def test_can_fetch_no_webinar_message(self):
response = self.client.get('/apps/cms/api/snippets/nowebinarmessage/?format=json')
self.assertIn(b"No webinars currently scheduled", response.content)

def test_can_fetch_k12_subject(self):
response = self.client.get('/apps/cms/api/snippets/k12subjects/?format=json')
self.assertIn(b"https://example.com/openstaxk12", response.content)

def test_can_fetch_faculty_resource(self):
faculty_resource = FacultyResource.objects.all()[0]
self.assertEquals(True, faculty_resource.unlocked_resource)

def test_can_fetch_student_resource(self):
student_resource = StudentResource.objects.all()[0]
self.assertEquals(True, student_resource.unlocked_resource)

def test_can_fetch_role(self):
response = self.client.get('/apps/cms/api/snippets/roles/?format=json')
self.assertIn(b"role display name", response.content)

def test_can_fetch_shared_content(self):
shared_content = SharedContent.objects.all()[0]
self.assertEquals('shared content', shared_content.title)

def test_can_fetch_news_source(self):
news_source = NewsSource.objects.all()[0]
self.assertEquals('news source', news_source.name)

def test_can_fetch_subject_category(self):
response = self.client.get('/apps/cms/api/snippets/subjectcategory/?format=json')
self.assertIn(b"subject category description", response.content)

def test_can_fetch_blog_collection(self):
response = self.client.get('/apps/cms/api/snippets/blogcollection/?format=json')
self.assertIn(b"blog collection description", response.content)

def test_can_fetch_assignable_available(self):
response = self.client.get('/apps/cms/api/snippets/assignableavailable/?format=json')
self.assertIn(b"Assignable is ...", response.content)

1 change: 1 addition & 0 deletions snippets/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
router.register('blogcollection', views.BlogCollectionViewSet, basename="BlogCollection")
router.register('nowebinarmessage', views.NoWebinarMessageViewSet, basename="NoWebinarMessage")
router.register('webinarcollection', views.WebinarCollectionViewSet, basename="WebinarCollection")
router.register('assignableavailable', views.AssignableAvailableViewSet, basename="AssignableAvailable")
urlpatterns = router.urls
9 changes: 7 additions & 2 deletions snippets/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from rest_framework import viewsets

from .models import Role, Subject, K12Subject, ErrataContent, SubjectCategory, GiveBanner, BlogContentType, \
BlogCollection, NoWebinarMessage, WebinarCollection
BlogCollection, NoWebinarMessage, WebinarCollection, AssignableAvailable
from .serializers import RoleSerializer, SubjectSerializer, K12SubjectSerializer, ErrataContentSerializer, \
SubjectCategorySerializer, \
GiveBannerSerializer, BlogContentTypeSerializer, BlogCollectionSerializer, NoWebinarMessageSerializer, \
WebinarCollectionSerializer
WebinarCollectionSerializer, AssignableAvailableSerializer

from rest_framework import generics, viewsets
from django_filters.rest_framework import DjangoFilterBackend
Expand Down Expand Up @@ -104,6 +104,11 @@ class WebinarCollectionViewSet(viewsets.ModelViewSet):
serializer_class = WebinarCollectionSerializer


class AssignableAvailableViewSet(viewsets.ModelViewSet):
queryset = AssignableAvailable.objects.all()
serializer_class = AssignableAvailableSerializer


def convert_locale(locale):
if locale == 'es':
return SPANISH_LOCALE_ID
Expand Down
1 change: 0 additions & 1 deletion wagtailimportexport/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,3 @@ def content_type_by_model(model):
return None
else:
return str(content_type[0].pk)

0 comments on commit cd23122

Please sign in to comment.