diff --git a/src/fellchensammlung/migrations/0032_searchsubscription_created_at_and_more.py b/src/fellchensammlung/migrations/0032_searchsubscription_created_at_and_more.py new file mode 100644 index 0000000..8b7dfbb --- /dev/null +++ b/src/fellchensammlung/migrations/0032_searchsubscription_created_at_and_more.py @@ -0,0 +1,25 @@ +# Generated by Django 5.1.4 on 2025-01-01 22:04 + +import django.utils.timezone +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fellchensammlung', '0031_alter_searchsubscription_location_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='searchsubscription', + name='created_at', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + migrations.AddField( + model_name='searchsubscription', + name='updated_at', + field=models.DateTimeField(auto_now=True), + ), + ] diff --git a/src/fellchensammlung/models.py b/src/fellchensammlung/models.py index 74d763e..7a56f30 100644 --- a/src/fellchensammlung/models.py +++ b/src/fellchensammlung/models.py @@ -572,6 +572,8 @@ class SearchSubscription(models.Model): location = models.ForeignKey(Location, on_delete=models.PROTECT, null=True) sex = models.CharField(max_length=20, choices=SexChoicesWithAll.choices) max_distance = models.IntegerField(choices=DistanceChoices.choices, null=True) + updated_at = models.DateTimeField(auto_now=True) + created_at = models.DateTimeField(auto_now_add=True) def __str__(self): if self.location and self.max_distance: