- Remove escaping in display_name_with_default
- Move escaped version to deprecated display_name_with_default_escaped
- Does not include any other changes to remove double-escaping
Thanks to agaylard who initiated this work:
https://github.com/edx/edx-platform/pull/10756
TNL-3425
Course teams occasionally upload very large files as their course
image. Before this commit, those images would be used directly in
the student's dashboard, sometimes leading to MBs worth of image
data on that page. With this commit, we now auto-generate small
and large thumbnails of configurable size. The Student Dashboard
and Course About pages will make use of this new functionality
(CourseOverview.image_urls), but the behavior of
CourseOverview.course_image_url will not change.
Note that the thumbnails are still created in the contentstore,
and sit alongside their originals.
What's included:
1. Multiple sizes, currently starting with "raw", "small", and
"large". This falls back to the current behavior automatically in
the case where thumbnails don't exist or this feature has been
disabled in configuration.
2. Django admin based configuration for image sizes and whether
to enable the functionality at all. Note that to regenerate
images, you'd need to wipe the CourseOverviewImageSet model
rows -- it doesn't do that automatically. This is partly because
it's a very rare operation, and partly because I'm not entirely
sure what the longer term invalidation strategy should be in a
world where we might potentially have multiple themes. The
flexible configuration was intended to allow better customization
and theming.
3. The Course About pages also use the new thumbnail functionality,
as an example of "large". This is in addition to the "small"
used on the student dashboard.
Things I'm punting on for now (followup PRs welcome!):
1. Bringing the thumbnails to course discovery. A quick attempt
to do so showed that it wasn't getting properly invalidated
and updated when publishes happen (so the old image still showed
up). It probably has something to do with when we do the
re-indexing because it stores this data in elasticsearch, but
I'm not going to chase it down right now.
2. Center-cropping. While this is a nice-to-have feature, the
behavior in this PR is no worse than what already exists in
master in terms of image distortion (letting the browser handle
it).
3. Automated invalidation of the images when a new config is
created.
Added the following fields to CourseOverview:
announcement
catalog_visibility
course_video_url
effort
short_description
Now requires CourseOverview models for each course in the system:
Introduced a CourseOverviewGeneratedHistory model to keep track of
when the CourseOverview table was seeded. The seeding can be
done preemptively by calling the generate_course_overview management
command. Otherwise, it is lazily computed, when needed.
- The permission now checks the correct request attribute (GET instead of data).
- The Credit API view test has been updated to check for the positive access instead of just denial.
ECOM-3096
Turns out if the string literal starts on the next line after the
translation function, then the translator comment is lost. So, either
close up short strings, or add a dummy empty string on the first line to
concatenate with the real string.
Ugh.
There are 3 main changes in this commit:
* CohortFactory now sets up memberships properly, so consuming tests do not
need to explicitly touch CourseUserGroup.users to add() users.
* test_get_cohort_sql_queries has been updated to 3 and 9 queries when using
and not using the cache, respectively. This is needed due to each operation
needing an extra queery to get the CourseUserGroup from the CohortMembership.
* Adding remove_user_from_cohort(), the counterpart to add_user_to_cohort().
This is also to keep tests from touching the users field directly, and keep
CohortMembership data in sync.
An issue arose recently due to ATOMIC_REQUESTS being turned on by default. It
turns out that CohortMemberships had been somewhat relying on the old default
transaction handling in order to keep CohortMemberships and the underlying
CourseUserGroup.users values in-sync.
To fix this, I've made all updates to Cohortmemberships go through an
outer_atomic(read_committed=True) block. This, is conjunction with the already
present select_for_update(), will no longer allow 2 simultaneous requests to
modify objects in memory without sharing them. Only one process will be
touching a given CohortMembership at any given time, and all changes will be
immediately comitted to the database, where the other process will see them.
I've also included some changes to get_cohort(), add_user_to_cohort(), and
remove_user_from_cohort() in order to properly make use of the new
CohortMembership system.
* Catalog results are now paginated
* Implements the new namespaced pagination described at
https://openedx.atlassian.net/wiki/pages/viewpage.action?pageId=47481813
* API level code returns pythonic business objects
* View layer performs serialize at the view layer
* Convert views to use DRF generic views
* Removes an unintentional authentication decorator that caused
the detail endpoint to return a 401 for anonymous users
MA-1724