diff --git a/profiles/admin.py b/profiles/admin.py index f7fc71a9d3b7986b4b743f0b447cbac778d6b89a..6aefa1a15a823939b603430a933abd9852706f31 100644 --- a/profiles/admin.py +++ b/profiles/admin.py @@ -50,4 +50,5 @@ class StudentAdmin(ProfileAdminMixin, admin.ModelAdmin,ExportCsvMixin): list_filter = (('school',MultiSelectFieldListFilter), 'year', 'registration__validated') class Meta: # noqa model = Student + ordering = ['updated_date'] actions = ["export_as_csv"] \ No newline at end of file diff --git a/profiles/migrations/0015_student_updated_date.py b/profiles/migrations/0015_student_updated_date.py new file mode 100644 index 0000000000000000000000000000000000000000..4e672b5fbb499a6886e6d4868f6ae9ccc47f8d35 --- /dev/null +++ b/profiles/migrations/0015_student_updated_date.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2 on 2021-01-15 17:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('profiles', '0014_auto_20201116_1118'), + ] + + operations = [ + migrations.AddField( + model_name='student', + name='updated_date', + field=models.DateTimeField(auto_now=True), + ), + ] diff --git a/profiles/models.py b/profiles/models.py index 20952a31436e83bbaeed223aad3fbd091638b319..4c9d912bbe6d1fb16a44290e0d73de85c898c5d1 100644 --- a/profiles/models.py +++ b/profiles/models.py @@ -38,6 +38,8 @@ class Student(ProfileMixin, models.Model): detail_view_name = 'api:student-detail' + updated_date = models.DateTimeField(auto_now=True) + user = models.OneToOneField( 'users.User', on_delete=models.CASCADE,