Skip to content

Commit

Permalink
Remove the autonow_add feature
Browse files Browse the repository at this point in the history
- only during the migration
  • Loading branch information
tudoramariei committed Feb 20, 2024
1 parent 97a7601 commit f8f0507
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.10 on 2024-02-20 10:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("donations", "0003_alter_ngo_name_alter_ngo_slug"),
]

operations = [
migrations.AlterField(
model_name="donor",
name="date_created",
field=models.DateTimeField(db_index=True, verbose_name="date created"),
),
migrations.AlterField(
model_name="ngo",
name="date_created",
field=models.DateTimeField(db_index=True, verbose_name="date created"),
),
]
4 changes: 2 additions & 2 deletions backend/donations/models/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,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, auto_now_add=timezone.now)
date_created = models.DateTimeField(verbose_name=_("date created"), db_index=True)
date_updated = models.DateTimeField(verbose_name=_("date updated"), db_index=True, auto_now=timezone.now)

objects = models.Manager()
Expand Down Expand Up @@ -275,7 +275,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, auto_now_add=timezone.now)
date_created = models.DateTimeField(verbose_name=_("date created"), db_index=True)

class Meta:
verbose_name = _("donor")
Expand Down
18 changes: 18 additions & 0 deletions backend/users/migrations/0003_alter_user_date_created.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.10 on 2024-02-20 10:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("users", "0002_user_date_created_user_date_updated_and_more"),
]

operations = [
migrations.AlterField(
model_name="user",
name="date_created",
field=models.DateTimeField(verbose_name="date created"),
),
]
2 changes: 1 addition & 1 deletion backend/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ 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"), auto_now_add=timezone.now, db_index=True)
date_created = models.DateTimeField(verbose_name=_("date created"))
date_updated = models.DateTimeField(verbose_name=_("date updated"), auto_now=timezone.now, db_index=True)

objects = CustomUserManager()
Expand Down

0 comments on commit f8f0507

Please sign in to comment.