-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updates Django Admin fields for models.DefaultEnterpriseEnrollmentIntention * Ensures DefaultEnterpriseEnrollmentIntentionAdmin uses SoftDeletableModel's all_objects model manager to be able to view/restore soft-deleted instances. * Adds help text in Django Admin for SoftDeletableModel's is_removed boolean field. * Alters content_type model field to allow blank/null. * Adds unique constraint for enterprise_customer and content_key to prevent duplicates. * Remove `current_*` prefixes on computed properties since a configured content_key might not be the *current* course run. * Updates models.DefaultEnterpriseEnrollmentIntention `clean` method to check for soft-deleted duplicates to raise ValidationError. * Ensures `self.content_type` is already updated on save, even if already set (e.g., if content_key changes to a different content type). * Updates related tests.
- Loading branch information
1 parent
749651f
commit 3f31174
Showing
7 changed files
with
252 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...prise/migrations/0225_alter_defaultenterpriseenrollmentintention_content_type_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 4.2.16 on 2024-10-22 18:19 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('enterprise', '0224_alter_enterprisegroup_applies_to_all_contexts_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='defaultenterpriseenrollmentintention', | ||
name='content_type', | ||
field=models.CharField(blank=True, choices=[('course', 'Course'), ('course_run', 'Course Run')], help_text='The type of content (e.g. a course vs. a course run).', max_length=127, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='historicaldefaultenterpriseenrollmentintention', | ||
name='content_type', | ||
field=models.CharField(blank=True, choices=[('course', 'Course'), ('course_run', 'Course Run')], help_text='The type of content (e.g. a course vs. a course run).', max_length=127, null=True), | ||
), | ||
migrations.AddConstraint( | ||
model_name='defaultenterpriseenrollmentintention', | ||
constraint=models.UniqueConstraint(fields=('enterprise_customer', 'content_key'), name='unique_default_enrollment_intention'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.