diff options
Diffstat (limited to 'archaeological_warehouse')
3 files changed, 53 insertions, 3 deletions
| diff --git a/archaeological_warehouse/migrations/0019_warehouse_documents.py b/archaeological_warehouse/migrations/0019_warehouse_documents.py new file mode 100644 index 000000000..08ee5cb34 --- /dev/null +++ b/archaeological_warehouse/migrations/0019_warehouse_documents.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.10 on 2018-05-30 19:00 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('ishtar_common', '0055_auto_20180530_1900'), +        ('archaeological_warehouse', '0018_auto_20180528_1141'), +    ] + +    operations = [ +        migrations.AddField( +            model_name='warehouse', +            name='documents', +            field=models.ManyToManyField(blank=True, related_name='warehouses', to='ishtar_common.Document', verbose_name='Documents'), +        ), +    ] diff --git a/archaeological_warehouse/migrations/0020_migrate_source_and_image.py b/archaeological_warehouse/migrations/0020_migrate_source_and_image.py new file mode 100644 index 000000000..1db07eee4 --- /dev/null +++ b/archaeological_warehouse/migrations/0020_migrate_source_and_image.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.10 on 2018-05-30 19:38 +from __future__ import unicode_literals + +from django.db import migrations + + +from ishtar_common.utils_migrations import migrate_images + + +def migrate_source_and_image(apps, schema_editor): +    Warehouse = apps.get_model( +        'archaeological_warehouse', 'Warehouse') +    WarehouseImage = apps.get_model( +        'archaeological_warehouse', 'WarehouseImage') +    migrate_images(apps, Warehouse, WarehouseImage) + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('archaeological_warehouse', '0019_warehouse_documents'), +    ] + +    operations = [ +        migrations.RunPython(migrate_source_and_image) +    ] diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 40de49d60..30c117fc2 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -27,11 +27,10 @@ from django.template.defaultfilters import slugify  from django.utils.translation import ugettext_lazy as _  from ishtar_common.data_importer import post_importer_action -from ishtar_common.utils import cached_label_changed - -from ishtar_common.models import GeneralType, get_external_id, \ +from ishtar_common.models import Document, GeneralType, get_external_id, \      LightHistorizedItem, OwnPerms, Address, Person, post_save_cache, \      ImageModel, DashboardFormItem, IshtarImage, ThroughImage +from ishtar_common.utils import cached_label_changed  class WarehouseType(GeneralType): @@ -63,6 +62,9 @@ class Warehouse(Address, DashboardFormItem, OwnPerms):          'WarehouseDivision', verbose_name=_("Divisions"), blank=True,          through='WarehouseDivisionLink'      ) +    documents = models.ManyToManyField( +        Document, related_name='warehouses', verbose_name=_(u"Documents"), +        blank=True)      images = models.ManyToManyField(IshtarImage, verbose_name=_(u"Images"),                                      through='WarehouseImage', blank=True)      external_id = models.TextField(_(u"External ID"), blank=True, null=True) | 
