-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: django admin for content_assignments
- Loading branch information
1 parent
e7309d5
commit c64d714
Showing
4 changed files
with
79 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,6 +140,7 @@ dmypy.json | |
|
||
# emacs | ||
*~ | ||
.projectile | ||
|
||
# VSCode | ||
.vscode | ||
|
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,54 @@ | ||
""" Admin configuration for content_assignment models. """ | ||
|
||
from django.contrib import admin | ||
from djangoql.admin import DjangoQLSearchMixin | ||
from simple_history.admin import SimpleHistoryAdmin | ||
|
||
from enterprise_access.apps.content_assignments import models | ||
|
||
|
||
@admin.register(models.AssignmentConfiguration) | ||
class AssignmentConfigurationAdmin(DjangoQLSearchMixin, SimpleHistoryAdmin): | ||
list_display = ( | ||
'enterprise_customer_uuid', | ||
'uuid', | ||
'active', | ||
'modified', | ||
) | ||
search_fields = ( | ||
'uuid', | ||
'enterprise_customer_uuid', | ||
) | ||
list_filter = ('active',) | ||
ordering = ['-modified'] | ||
read_only_fields = ( | ||
'created', | ||
'modified', | ||
) | ||
|
||
|
||
@admin.register(models.LearnerContentAssignment) | ||
class LearnerContentAssignment(DjangoQLSearchMixin, SimpleHistoryAdmin): | ||
list_display = ( | ||
'assignment_configuration', | ||
'learner_email', | ||
'lms_user_id', | ||
'content_key', | ||
'state', | ||
'content_quantity', | ||
'modified', | ||
) | ||
ordering = ['-modified'] | ||
search_fields = ( | ||
'uuid', | ||
'learner_email', | ||
'lms_user_id', | ||
) | ||
list_filter = ('state',) | ||
read_only_fields = ( | ||
'last_notification_at', | ||
'created', | ||
'modified', | ||
'lms_user_id', | ||
'assignment_configuration', | ||
) |
23 changes: 23 additions & 0 deletions
23
enterprise_access/apps/content_assignments/migrations/0007_index_assignment_state.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,23 @@ | ||
# Generated by Django 3.2.21 on 2023-09-19 15:20 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('content_assignments', '0006_unique_assignments'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='historicallearnercontentassignment', | ||
name='state', | ||
field=models.CharField(choices=[('allocated', 'Allocated'), ('accepted', 'Accepted'), ('cancelled', 'Cancelled'), ('errored', 'Errored')], db_index=True, default='allocated', help_text="The current state of the LearnerContentAssignment. One of: ['allocated', 'accepted', 'cancelled', 'errored']", max_length=255), | ||
), | ||
migrations.AlterField( | ||
model_name='learnercontentassignment', | ||
name='state', | ||
field=models.CharField(choices=[('allocated', 'Allocated'), ('accepted', 'Accepted'), ('cancelled', 'Cancelled'), ('errored', 'Errored')], db_index=True, default='allocated', help_text="The current state of the LearnerContentAssignment. One of: ['allocated', 'accepted', 'cancelled', 'errored']", max_length=255), | ||
), | ||
] |
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