Merge pull request #1350 from umap-project/map-created-at

Finally add Map.create_at field
This commit is contained in:
Yohan Boniface 2023-09-27 22:39:20 +02:00 committed by GitHub
commit 63c515d537
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,23 @@
# Generated by Django 4.2.2 on 2023-09-27 08:50
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
("umap", "0013_datalayer_edit_status"),
]
operations = [
migrations.AddField(
model_name="map",
name="created_at",
field=models.DateTimeField(
auto_now_add=True, default=django.utils.timezone.now
),
preserve_default=False,
),
# Did not find a way to provide default from a column in the field creation
migrations.RunSQL("UPDATE umap_map SET created_at=modified_at;"),
]

View file

@ -163,6 +163,7 @@ class Map(NamedModel):
on_delete=models.SET_DEFAULT,
default=get_default_licence,
)
created_at = models.DateTimeField(auto_now_add=True)
modified_at = models.DateTimeField(auto_now=True)
owner = models.ForeignKey(
settings.AUTH_USER_MODEL,