Merge pull request #1350 from umap-project/map-created-at
Finally add Map.create_at field
This commit is contained in:
commit
63c515d537
2 changed files with 24 additions and 0 deletions
23
umap/migrations/0014_map_created_at.py
Normal file
23
umap/migrations/0014_map_created_at.py
Normal 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;"),
|
||||
]
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue