Skip to content

Commit

Permalink
Merge Release v6.18.0 into main (#1512)
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)

* Update models.py (#1502)

* Update models.py

* Create 0054_alter_errata_resource.py

---------

Co-authored-by: Staxly <[email protected]>

* Added other missing tests (#1500)

* Webview settings test and start of press pages tests

* Tests for allies

* Additional tests for import-export

* Added test for admin filter

* Tests for mock functions

* tests for Press pages

* modify to test press page creation

* Cleaned up news test code

---------

Co-authored-by: Michael Harrison <[email protected]>

* adding Assignable source to autofill (#1504)

Co-authored-by: Staxly <[email protected]>

* Comment out events code and remove events models from db (#1505)

* Update models.py (#1509)

* Update models.py

removing three fields from errata view via model

* Create 0055_remove_errata_accounts_user_email_and_more.py

adding migration

* Update admin.py

removing fields from search (this never worked anway)

---------

Co-authored-by: Staxly <[email protected]>

---------

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]>
Co-authored-by: Staxly <[email protected]>
  • Loading branch information
11 people authored Oct 6, 2023
1 parent 0ea6f6d commit 8e0972e
Show file tree
Hide file tree
Showing 12 changed files with 328 additions and 281 deletions.
9 changes: 1 addition & 8 deletions errata/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ class Media:
'detail',
'location',
'additional_location_information',
'accounts_user_name',
'accounts_user_email')
)
formfield_overrides = {
models.ManyToManyField: {'widget': CheckboxSelectMultiple},
}
Expand Down Expand Up @@ -179,18 +178,12 @@ def get_form(self, request, obj=None, **kwargs):
'accounts_link',
'file_1',
'file_2',
'accounts_user_name',
'accounts_user_email',
'accounts_user_faculty_status',
'archived',
'junk',
] # fields to show on the actual form
self.readonly_fields = ['id',
'created',
'modified',
'accounts_user_name',
'accounts_user_email',
'accounts_user_faculty_status',
'accounts_link',
]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.1.7 on 2023-09-25 19:06

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("errata", "0054_alter_errata_resource"),
]

operations = [
migrations.RemoveField(
model_name="errata",
name="accounts_user_email",
),
migrations.RemoveField(
model_name="errata",
name="accounts_user_faculty_status",
),
migrations.RemoveField(
model_name="errata",
name="accounts_user_name",
),
]
3 changes: 0 additions & 3 deletions errata/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@ class Errata(models.Model):
resource_other = models.CharField(max_length=255, blank=True, null=True)

submitted_by_account_id = models.IntegerField(blank=True, null=True, validators=[MinValueValidator(0), is_user_blocked])
accounts_user_email = models.CharField(max_length=255, null=True, blank=True)
accounts_user_name = models.CharField(max_length=255, null=True, blank=True)
accounts_user_faculty_status = models.CharField(max_length=255, null=True, blank=True)

file_1 = models.FileField(upload_to='errata/user_uploads/1/', blank=True, null=True)
file_2 = models.FileField(upload_to='errata/user_uploads/2/', blank=True, null=True)
Expand Down
90 changes: 45 additions & 45 deletions events/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,48 @@
from django.contrib import admin, messages
from django.utils import timezone

from .models import Event, Session, Registration

class SessionAdmin(admin.ModelAdmin):
list_display = ['name', 'date', 'location', 'seats_remaining']
list_filter = ('location', 'date')
search_fields = ['name', ]


class RegistrationResource(resources.ModelResource):
class Meta:
model = Registration
fields = ('first_name', 'last_name', 'registration_email', 'session__name', 'checked_in')

class RegistrationAdmin(ExportActionModelAdmin):
list_display = ('full_name', 'registration_email', 'checked_in')
search_fields = ('last_name', 'registration_email')
list_filter = ['session', ]
resource_class = RegistrationResource

inline_actions = ['toggle_check_in',]

def toggle_check_in(self, request, obj, parent_obj=None):
if not obj.checked_in:
obj.checked_in = timezone.now()
else:
obj.checked_in = None
obj.save()

if obj.checked_in:
messages.success(request, "User marked as checked in.")
else:
messages.warning(request, "User marked as not checked in.")

def get_toggle_check_in_label(self, obj):
if not obj.checked_in:
return 'Check In'
return 'Uncheck In'

class Media:
js = ('js/custom_admin.js', )


admin.site.register(Event)
admin.site.register(Session, SessionAdmin)
admin.site.register(Registration, RegistrationAdmin)
# from .models import Event, Session, Registration
#
# class SessionAdmin(admin.ModelAdmin):
# list_display = ['name', 'date', 'location', 'seats_remaining']
# list_filter = ('location', 'date')
# search_fields = ['name', ]
#
#
# class RegistrationResource(resources.ModelResource):
# class Meta:
# model = Registration
# fields = ('first_name', 'last_name', 'registration_email', 'session__name', 'checked_in')
#
# class RegistrationAdmin(ExportActionModelAdmin):
# list_display = ('full_name', 'registration_email', 'checked_in')
# search_fields = ('last_name', 'registration_email')
# list_filter = ['session', ]
# resource_class = RegistrationResource
#
# inline_actions = ['toggle_check_in',]
#
# def toggle_check_in(self, request, obj, parent_obj=None):
# if not obj.checked_in:
# obj.checked_in = timezone.now()
# else:
# obj.checked_in = None
# obj.save()
#
# if obj.checked_in:
# messages.success(request, "User marked as checked in.")
# else:
# messages.warning(request, "User marked as not checked in.")
#
# def get_toggle_check_in_label(self, obj):
# if not obj.checked_in:
# return 'Check In'
# return 'Uncheck In'
#
# class Media:
# js = ('js/custom_admin.js', )
#
#
# admin.site.register(Event)
# admin.site.register(Session, SessionAdmin)
# admin.site.register(Registration, RegistrationAdmin)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 4.0.8 on 2023-09-14 15:24

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('events', '0005_session_description'),
]

operations = [
migrations.RemoveField(
model_name='registration',
name='session',
),
migrations.RemoveField(
model_name='session',
name='event',
),
migrations.DeleteModel(
name='CreatorFestSession',
),
migrations.DeleteModel(
name='Event',
),
migrations.DeleteModel(
name='Registration',
),
migrations.DeleteModel(
name='Session',
),
]
86 changes: 43 additions & 43 deletions events/models.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
from django.db import models
from wagtail.core.models import Page

class Event(models.Model):
eventbrite_event_id = models.CharField(max_length=255)

def __str__(self):
return self.eventbrite_event_id


class Session(models.Model):
event = models.ForeignKey(Event, on_delete=models.PROTECT)
name = models.CharField(max_length=255)
description = models.TextField(null=True, blank=True)
date = models.DateTimeField()
location = models.CharField(max_length=255, null=True, blank=True)
seats_remaining = models.SmallIntegerField()

def __str__(self):
return self.name


class Registration(models.Model):
session = models.ForeignKey(Session, on_delete=models.PROTECT)
first_name = models.CharField(max_length=255)
last_name = models.CharField(max_length=255)
registration_email = models.EmailField(max_length=255)
checked_in = models.DateTimeField(blank=True, null=True)

@property
def full_name(self):
return '%s %s' % (self.first_name, self.last_name)

def __str__(self):
return self.full_name

def save(self, *args, **kwargs):
if not self.pk:
# reduce the number of seats on the session if this is a new registration
self.session.seats_remaining = self.session.seats_remaining - 1
self.session.save()
super(Registration, self).save(*args, **kwargs)


class CreatorFestSession(Page):
pass
# class Event(models.Model):
# eventbrite_event_id = models.CharField(max_length=255)
#
# def __str__(self):
# return self.eventbrite_event_id
#
#
# class Session(models.Model):
# event = models.ForeignKey(Event, on_delete=models.PROTECT)
# name = models.CharField(max_length=255)
# description = models.TextField(null=True, blank=True)
# date = models.DateTimeField()
# location = models.CharField(max_length=255, null=True, blank=True)
# seats_remaining = models.SmallIntegerField()
#
# def __str__(self):
# return self.name
#
#
# class Registration(models.Model):
# session = models.ForeignKey(Session, on_delete=models.PROTECT)
# first_name = models.CharField(max_length=255)
# last_name = models.CharField(max_length=255)
# registration_email = models.EmailField(max_length=255)
# checked_in = models.DateTimeField(blank=True, null=True)
#
# @property
# def full_name(self):
# return '%s %s' % (self.first_name, self.last_name)
#
# def __str__(self):
# return self.full_name
#
# def save(self, *args, **kwargs):
# if not self.pk:
# # reduce the number of seats on the session if this is a new registration
# self.session.seats_remaining = self.session.seats_remaining - 1
# self.session.save()
# super(Registration, self).save(*args, **kwargs)
#
#
# class CreatorFestSession(Page):
# pass

66 changes: 33 additions & 33 deletions events/serializers.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
from .models import Session, Registration
from .functions import check_eventbrite_registration
#from .models import Session, Registration
#from .functions import check_eventbrite_registration

from rest_framework import serializers


class SessionSerializer(serializers.ModelSerializer):
def __init__(self, *args, **kwargs):
super(SessionSerializer, self).__init__(*args, **kwargs)

for field in self.fields:
self.fields[field].read_only = True

class Meta:
model = Session
fields = '__all__'


class RegistrationSerializer(serializers.ModelSerializer):

class Meta:
model = Registration
fields = ('session', 'first_name', 'last_name', 'registration_email')

def validate(self, data):
if check_eventbrite_registration(data['registration_email']):
try:
Registration.objects.get(registration_email=data['registration_email'])
raise serializers.ValidationError("You can only register for one session.")
except Registration.DoesNotExist:
return data
else:
raise serializers.ValidationError("Email address not registered for event.")

def create(self, validated_data):
registration_instance = Registration.objects.create(**validated_data)
return registration_instance
# class SessionSerializer(serializers.ModelSerializer):
# def __init__(self, *args, **kwargs):
# super(SessionSerializer, self).__init__(*args, **kwargs)
#
# for field in self.fields:
# self.fields[field].read_only = True
#
# class Meta:
# model = Session
# fields = '__all__'
#
#
# class RegistrationSerializer(serializers.ModelSerializer):
#
# class Meta:
# model = Registration
# fields = ('session', 'first_name', 'last_name', 'registration_email')
#
# def validate(self, data):
# if check_eventbrite_registration(data['registration_email']):
# try:
# Registration.objects.get(registration_email=data['registration_email'])
# raise serializers.ValidationError("You can only register for one session.")
# except Registration.DoesNotExist:
# return data
# else:
# raise serializers.ValidationError("Email address not registered for event.")
#
# def create(self, validated_data):
# registration_instance = Registration.objects.create(**validated_data)
# return registration_instance

Loading

0 comments on commit 8e0972e

Please sign in to comment.