diff --git a/backend/donations/migrations/0010_alter_donor_date_created_alter_ngo_date_created.py b/backend/donations/migrations/0010_alter_donor_date_created_alter_ngo_date_created.py new file mode 100644 index 00000000..5a74dc3e --- /dev/null +++ b/backend/donations/migrations/0010_alter_donor_date_created_alter_ngo_date_created.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.10 on 2024-02-23 09:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("donations", "0009_alter_donor_date_created_alter_ngo_date_created"), + ] + + operations = [ + migrations.AlterField( + model_name="donor", + name="date_created", + field=models.DateTimeField(auto_now_add=True, db_index=True, verbose_name="date created"), + ), + migrations.AlterField( + model_name="ngo", + name="date_created", + field=models.DateTimeField(auto_now_add=True, db_index=True, verbose_name="date created"), + ), + ] diff --git a/backend/donations/models/main.py b/backend/donations/models/main.py index 7c631ebd..81348f9a 100644 --- a/backend/donations/models/main.py +++ b/backend/donations/models/main.py @@ -189,7 +189,7 @@ class Ngo(models.Model): upload_to=partial(year_ngo_directory_path, "ngo-forms"), ) - date_created = models.DateTimeField(verbose_name=_("date created"), db_index=True) + date_created = models.DateTimeField(verbose_name=_("date created"), db_index=True, auto_now_add=timezone.now) date_updated = models.DateTimeField(verbose_name=_("date updated"), db_index=True, auto_now=timezone.now) objects = models.Manager() @@ -293,7 +293,7 @@ class Donor(models.Model): upload_to=partial(year_ngo_donor_directory_path, "donation-forms"), ) - date_created = models.DateTimeField(verbose_name=_("date created"), db_index=True) + date_created = models.DateTimeField(verbose_name=_("date created"), db_index=True, auto_now_add=timezone.now) class Meta: verbose_name = _("donor") diff --git a/backend/users/migrations/0006_alter_user_date_created.py b/backend/users/migrations/0006_alter_user_date_created.py new file mode 100644 index 00000000..f0154ed1 --- /dev/null +++ b/backend/users/migrations/0006_alter_user_date_created.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.10 on 2024-02-23 09:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("users", "0005_alter_user_date_created"), + ] + + operations = [ + migrations.AlterField( + model_name="user", + name="date_created", + field=models.DateTimeField(auto_now_add=True, db_index=True, verbose_name="date created"), + ), + ] diff --git a/backend/users/models.py b/backend/users/models.py index 65af9f3c..e0320b66 100644 --- a/backend/users/models.py +++ b/backend/users/models.py @@ -83,8 +83,8 @@ class User(AbstractUser): old_password = models.CharField(verbose_name=_("old password"), max_length=128, blank=True, null=True) - date_created = models.DateTimeField(verbose_name=_("date created"), db_index=True) - date_updated = models.DateTimeField(verbose_name=_("date updated"), auto_now=timezone.now, db_index=True) + date_created = models.DateTimeField(verbose_name=_("date created"), db_index=True, auto_now_add=timezone.now) + date_updated = models.DateTimeField(verbose_name=_("date updated"), db_index=True, auto_now=timezone.now) objects = CustomUserManager()