diff --git a/enterprise_catalog/apps/academy/__init__.py b/enterprise_catalog/apps/academy/__init__.py new file mode 100644 index 000000000..1caefce5a --- /dev/null +++ b/enterprise_catalog/apps/academy/__init__.py @@ -0,0 +1,3 @@ +""" +Academy app to handle implementation for academies. +""" diff --git a/enterprise_catalog/apps/academy/admin.py b/enterprise_catalog/apps/academy/admin.py new file mode 100644 index 000000000..a2eac01b7 --- /dev/null +++ b/enterprise_catalog/apps/academy/admin.py @@ -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', ) diff --git a/enterprise_catalog/apps/academy/apps.py b/enterprise_catalog/apps/academy/apps.py new file mode 100644 index 000000000..beed99444 --- /dev/null +++ b/enterprise_catalog/apps/academy/apps.py @@ -0,0 +1,9 @@ +""" +Academy app to handle implementation for academies. +""" +from django.apps import AppConfig + + +class AcademyConfig(AppConfig): + name = 'academy' + default = False diff --git a/enterprise_catalog/apps/academy/migrations/0001_initial.py b/enterprise_catalog/apps/academy/migrations/0001_initial.py new file mode 100644 index 000000000..35bb5c40c --- /dev/null +++ b/enterprise_catalog/apps/academy/migrations/0001_initial.py @@ -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', + }, + ), + ] diff --git a/enterprise_catalog/apps/academy/migrations/__init__.py b/enterprise_catalog/apps/academy/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/enterprise_catalog/apps/academy/models.py b/enterprise_catalog/apps/academy/models.py new file mode 100644 index 000000000..e309dd8a6 --- /dev/null +++ b/enterprise_catalog/apps/academy/models.py @@ -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'' diff --git a/enterprise_catalog/apps/catalog/migrations/0037_alter_historicalcontentmetadata_options_and_more.py b/enterprise_catalog/apps/catalog/migrations/0037_alter_historicalcontentmetadata_options_and_more.py new file mode 100644 index 000000000..4ba1a1c3a --- /dev/null +++ b/enterprise_catalog/apps/catalog/migrations/0037_alter_historicalcontentmetadata_options_and_more.py @@ -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), + ), + ] diff --git a/enterprise_catalog/apps/curation/migrations/0003_alter_historicalenterprisecurationconfig_options_and_more.py b/enterprise_catalog/apps/curation/migrations/0003_alter_historicalenterprisecurationconfig_options_and_more.py new file mode 100644 index 000000000..0d78bced5 --- /dev/null +++ b/enterprise_catalog/apps/curation/migrations/0003_alter_historicalenterprisecurationconfig_options_and_more.py @@ -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), + ), + ] diff --git a/enterprise_catalog/settings/base.py b/enterprise_catalog/settings/base.py index 5bfb3fa8a..a187f4c43 100644 --- a/enterprise_catalog/settings/base.py +++ b/enterprise_catalog/settings/base.py @@ -64,6 +64,7 @@ 'enterprise_catalog.apps.catalog', 'enterprise_catalog.apps.curation', 'enterprise_catalog.apps.api', + 'enterprise_catalog.apps.academy', ) INSTALLED_APPS += THIRD_PARTY_APPS