From 728846b8c68dda82ec2cd0ac779c1733087755be Mon Sep 17 00:00:00 2001 From: Muhammad Asif Date: Wed, 5 Jul 2023 13:50:14 +0500 Subject: [PATCH] Added field updated_at in Device model --- push_notifications/admin.py | 2 +- .../migrations/0010_auto_20230705_0813.py | 33 +++++++++++++++++++ push_notifications/models.py | 3 ++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 push_notifications/migrations/0010_auto_20230705_0813.py diff --git a/push_notifications/admin.py b/push_notifications/admin.py index 477156b0..fd92e6a7 100644 --- a/push_notifications/admin.py +++ b/push_notifications/admin.py @@ -128,7 +128,7 @@ def disable(self, request, queryset): class GCMDeviceAdmin(DeviceAdmin): list_display = ( - "__str__", "user", "active", "date_created", "cloud_message_type" + "__str__", "user", "active", "date_created","updated_at","cloud_message_type" ) list_filter = ("active", "cloud_message_type") search_fields = ("registration_id", "user__username", "user__email") diff --git a/push_notifications/migrations/0010_auto_20230705_0813.py b/push_notifications/migrations/0010_auto_20230705_0813.py new file mode 100644 index 00000000..736d6bb3 --- /dev/null +++ b/push_notifications/migrations/0010_auto_20230705_0813.py @@ -0,0 +1,33 @@ +# Generated by Django 3.2.17 on 2023-07-05 08:13 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('push_notifications', '0009_alter_apnsdevice_device_id'), + ] + + operations = [ + migrations.AddField( + model_name='apnsdevice', + name='updated_at', + field=models.DateTimeField(auto_now=True, null=True, verbose_name='Update date'), + ), + migrations.AddField( + model_name='gcmdevice', + name='updated_at', + field=models.DateTimeField(auto_now=True, null=True, verbose_name='Update date'), + ), + migrations.AddField( + model_name='webpushdevice', + name='updated_at', + field=models.DateTimeField(auto_now=True, null=True, verbose_name='Update date'), + ), + migrations.AddField( + model_name='wnsdevice', + name='updated_at', + field=models.DateTimeField(auto_now=True, null=True, verbose_name='Update date'), + ), + ] diff --git a/push_notifications/models.py b/push_notifications/models.py index d9e1174a..71080ca2 100644 --- a/push_notifications/models.py +++ b/push_notifications/models.py @@ -38,6 +38,9 @@ class Device(models.Model): ), blank=True, null=True ) + updated_at = models.DateTimeField( + verbose_name=_("Update date"), auto_now=True, null=True + ) class Meta: abstract = True