-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added new app academy with related models
- Loading branch information
1 parent
201b3fe
commit bb0d990
Showing
9 changed files
with
198 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
""" | ||
Academy app to handle implementation for academies. | ||
""" |
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,16 @@ | ||
""" | ||
Admin for academy models. | ||
""" | ||
from django.contrib import admin | ||
from simple_history.admin import SimpleHistoryAdmin | ||
|
||
from enterprise_catalog.apps.academy.models import Academy | ||
|
||
|
||
@admin.register(Academy) | ||
class AcademyAdmin(SimpleHistoryAdmin): | ||
""" | ||
Django admin for Academy. | ||
""" | ||
list_display = ('uuid', 'title', 'created', 'modified', ) | ||
search_fields = ('title', ) |
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,9 @@ | ||
""" | ||
Academy app to handle implementation for academies. | ||
""" | ||
from django.apps import AppConfig | ||
|
||
|
||
class AcademyConfig(AppConfig): | ||
name = 'academy' | ||
default = False |
57 changes: 57 additions & 0 deletions
57
enterprise_catalog/apps/academy/migrations/0001_initial.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,57 @@ | ||
# Generated by Django 4.2.5 on 2023-10-30 09:00 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import django.utils.timezone | ||
import model_utils.fields | ||
import simple_history.models | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('catalog', '0037_alter_historicalcontentmetadata_options_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='HistoricalAcademy', | ||
fields=[ | ||
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')), | ||
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')), | ||
('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False)), | ||
('title', models.CharField(help_text='Academy title', max_length=255)), | ||
('history_id', models.AutoField(primary_key=True, serialize=False)), | ||
('history_date', models.DateTimeField(db_index=True)), | ||
('history_change_reason', models.CharField(max_length=100, null=True)), | ||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), | ||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'verbose_name': 'historical Academy', | ||
'verbose_name_plural': 'historical Academies', | ||
'ordering': ('-history_date', '-history_id'), | ||
'get_latest_by': ('history_date', 'history_id'), | ||
}, | ||
bases=(simple_history.models.HistoricalChanges, models.Model), | ||
), | ||
migrations.CreateModel( | ||
name='Academy', | ||
fields=[ | ||
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')), | ||
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')), | ||
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), | ||
('title', models.CharField(help_text='Academy title', max_length=255)), | ||
('enterprise_catalogs', models.ManyToManyField(to='catalog.enterprisecatalog')), | ||
], | ||
options={ | ||
'verbose_name': 'Academy', | ||
'verbose_name_plural': 'Academies', | ||
}, | ||
), | ||
] |
Empty file.
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,36 @@ | ||
""" | ||
Models for academy app. | ||
""" | ||
from uuid import uuid4 | ||
|
||
from django.db import models | ||
from django.utils.translation import gettext as _ | ||
from model_utils.models import TimeStampedModel | ||
from simple_history.models import HistoricalRecords | ||
|
||
from enterprise_catalog.apps.catalog.models import EnterpriseCatalog | ||
|
||
|
||
class Academy(TimeStampedModel): | ||
""" | ||
Model for storing academy related information. | ||
.. no_pii: | ||
""" | ||
uuid = models.UUIDField(primary_key=True, default=uuid4, editable=False) | ||
title = models.CharField(max_length=255, help_text=_('Academy title')) | ||
enterprise_catalogs = models.ManyToManyField(EnterpriseCatalog) | ||
|
||
history = HistoricalRecords() | ||
|
||
class Meta: | ||
verbose_name = _('Academy') | ||
verbose_name_plural = _('Academies') | ||
app_label = 'academy' | ||
|
||
def __str__(self): | ||
""" | ||
Return human-readable string representation. | ||
""" | ||
|
||
return f'<Academy UUID="{self.uuid}">' |
36 changes: 36 additions & 0 deletions
36
..._catalog/apps/catalog/migrations/0037_alter_historicalcontentmetadata_options_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,36 @@ | ||
# Generated by Django 4.2.5 on 2023-10-30 07:39 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('catalog', '0036_auto_20230306_1550'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='historicalcontentmetadata', | ||
options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical Content Metadata', 'verbose_name_plural': 'historical Content Metadata'}, | ||
), | ||
migrations.AlterModelOptions( | ||
name='historicalenterprisecatalog', | ||
options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical Enterprise Catalog', 'verbose_name_plural': 'historical Enterprise Catalogs'}, | ||
), | ||
migrations.AlterField( | ||
model_name='contentmetadata', | ||
name='associated_content_metadata', | ||
field=models.ManyToManyField(blank=True, to='catalog.contentmetadata'), | ||
), | ||
migrations.AlterField( | ||
model_name='historicalcontentmetadata', | ||
name='history_date', | ||
field=models.DateTimeField(db_index=True), | ||
), | ||
migrations.AlterField( | ||
model_name='historicalenterprisecatalog', | ||
name='history_date', | ||
field=models.DateTimeField(db_index=True), | ||
), | ||
] |
40 changes: 40 additions & 0 deletions
40
...pps/curation/migrations/0003_alter_historicalenterprisecurationconfig_options_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,40 @@ | ||
# Generated by Django 4.2.5 on 2023-10-30 07:39 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('curation', '0002_add_can_only_view_highlight_sets'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='historicalenterprisecurationconfig', | ||
options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical Enterprise curation', 'verbose_name_plural': 'historical Enterprise curations'}, | ||
), | ||
migrations.AlterModelOptions( | ||
name='historicalhighlightedcontent', | ||
options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical highlighted content', 'verbose_name_plural': 'historical highlighted contents'}, | ||
), | ||
migrations.AlterModelOptions( | ||
name='historicalhighlightset', | ||
options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical highlight set', 'verbose_name_plural': 'historical highlight sets'}, | ||
), | ||
migrations.AlterField( | ||
model_name='historicalenterprisecurationconfig', | ||
name='history_date', | ||
field=models.DateTimeField(db_index=True), | ||
), | ||
migrations.AlterField( | ||
model_name='historicalhighlightedcontent', | ||
name='history_date', | ||
field=models.DateTimeField(db_index=True), | ||
), | ||
migrations.AlterField( | ||
model_name='historicalhighlightset', | ||
name='history_date', | ||
field=models.DateTimeField(db_index=True), | ||
), | ||
] |
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