diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-04 14:51:54 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-04 14:51:54 +0200 |
commit | 6f487e1b480365ff4a64500dc40ff2da6d92d5b2 (patch) | |
tree | ce53c3f49edd931596dacbdd85da510a1f326576 /archaeological_context_records | |
parent | c83b3c1e68cb478f9a2c7ba226c56cfdb793fc2c (diff) | |
download | Ishtar-6f487e1b480365ff4a64500dc40ff2da6d92d5b2.tar.bz2 Ishtar-6f487e1b480365ff4a64500dc40ff2da6d92d5b2.zip |
Use UUID for operations and datings
Diffstat (limited to 'archaeological_context_records')
-rw-r--r-- | archaeological_context_records/migrations/0050_dating_uuid.py | 30 | ||||
-rw-r--r-- | archaeological_context_records/models.py | 2 |
2 files changed, 32 insertions, 0 deletions
diff --git a/archaeological_context_records/migrations/0050_dating_uuid.py b/archaeological_context_records/migrations/0050_dating_uuid.py new file mode 100644 index 000000000..c2413bd2d --- /dev/null +++ b/archaeological_context_records/migrations/0050_dating_uuid.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-09-04 14:23 +from __future__ import unicode_literals + +import uuid + +from django.db import migrations, models + +from ishtar_common.utils_migrations import set_uuid_helper + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_context_records', '0049_auto_20190711_1401'), + ] + operations = [ + migrations.AddField( + model_name='dating', + name='uuid', + field=models.UUIDField(blank=True, null=True), + ), + migrations.RunPython(set_uuid_helper('archaeological_context_records', + 'Dating')), + migrations.AlterField( + model_name='dating', + name='uuid', + field=models.UUIDField(default=uuid.uuid4), + ), + ] diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 3b236346d..4588e6465 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -18,6 +18,7 @@ # See the file COPYING for details. from collections import OrderedDict +import uuid from django.conf import settings from django.contrib.gis.db import models @@ -67,6 +68,7 @@ post_delete.connect(post_save_cache, sender=DatingQuality) class Dating(models.Model): + uuid = models.UUIDField(default=uuid.uuid4) period = models.ForeignKey(Period, verbose_name=_("Period")) start_date = models.IntegerField(_("Start date"), blank=True, null=True) end_date = models.IntegerField(_("End date"), blank=True, null=True) |