summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/__init__.py2
-rw-r--r--ishtar_common/admin.py10
-rw-r--r--ishtar_common/backend.py8
-rw-r--r--ishtar_common/context_processors.py3
-rw-r--r--ishtar_common/data_importer.py10
-rw-r--r--ishtar_common/forms.py4
-rw-r--r--ishtar_common/forms_common.py4
-rw-r--r--ishtar_common/management/commands/ishtar_migrate_odts.py91
-rw-r--r--ishtar_common/menus.py3
-rw-r--r--ishtar_common/migrations/0001_initial.py1238
-rw-r--r--ishtar_common/migrations/0002_change_ishtaruser_management.py25
-rw-r--r--ishtar_common/migrations/0003_auto_20170421_1613.py20
-rw-r--r--ishtar_common/migrations/0077_auto__add_administrationscript__add_administrationtask.py530
-rw-r--r--ishtar_common/model_merging.py22
-rw-r--r--ishtar_common/models.py260
-rw-r--r--ishtar_common/old_migrations/0001_initial.py408
-rw-r--r--ishtar_common/old_migrations/0002_auto__chg_field_person_surname.py (renamed from ishtar_common/migrations/0002_auto__chg_field_person_surname.py)0
-rw-r--r--ishtar_common/old_migrations/0003_auto__del_field_person_person_type.py (renamed from ishtar_common/migrations/0003_auto__del_field_person_person_type.py)0
-rw-r--r--ishtar_common/old_migrations/0004_auto.py (renamed from ishtar_common/migrations/0004_auto.py)0
-rw-r--r--ishtar_common/old_migrations/0005_auto__add_documenttemplate.py (renamed from ishtar_common/migrations/0005_auto__add_documenttemplate.py)0
-rw-r--r--ishtar_common/old_migrations/0006_auto__chg_field_organization_name__chg_field_historicalorganization_na.py (renamed from ishtar_common/migrations/0006_auto__chg_field_organization_name__chg_field_historicalorganization_na.py)0
-rw-r--r--ishtar_common/old_migrations/0007_auto__add_field_organization_history_creator__add_field_historicalorga.py (renamed from ishtar_common/migrations/0007_auto__add_field_organization_history_creator__add_field_historicalorga.py)0
-rw-r--r--ishtar_common/old_migrations/0008_init_history_creator.py (renamed from ishtar_common/migrations/0008_init_history_creator.py)0
-rw-r--r--ishtar_common/old_migrations/0009_auto__add_field_organization_email__add_field_historicalorganization_e.py (renamed from ishtar_common/migrations/0009_auto__add_field_organization_email__add_field_historicalorganization_e.py)0
-rw-r--r--ishtar_common/old_migrations/0010_auto__del_wizardstep__del_wizard__add_globalvar__chg_field_person_atta.py (renamed from ishtar_common/migrations/0010_auto__del_wizardstep__del_wizard__add_globalvar__chg_field_person_atta.py)0
-rw-r--r--ishtar_common/old_migrations/0011_auto__chg_field_person_surname__chg_field_person_name.py (renamed from ishtar_common/migrations/0011_auto__chg_field_person_surname__chg_field_person_name.py)0
-rw-r--r--ishtar_common/old_migrations/0012_auto__add_field_person_raw_name__chg_field_person_name.py (renamed from ishtar_common/migrations/0012_auto__add_field_person_raw_name__chg_field_person_name.py)0
-rw-r--r--ishtar_common/old_migrations/0013_auto__add_field_organization_merge_key__add_field_historicalorganizati.py (renamed from ishtar_common/migrations/0013_auto__add_field_organization_merge_key__add_field_historicalorganizati.py)0
-rw-r--r--ishtar_common/old_migrations/0014_auto__chg_field_organization_history_creator__chg_field_organization_h.py (renamed from ishtar_common/migrations/0014_auto__chg_field_organization_history_creator__chg_field_organization_h.py)0
-rw-r--r--ishtar_common/old_migrations/0015_auto__chg_field_organization_town__chg_field_historicalorganization_to.py (renamed from ishtar_common/migrations/0015_auto__chg_field_organization_town__chg_field_historicalorganization_to.py)0
-rw-r--r--ishtar_common/old_migrations/0016_auto__add_import.py (renamed from ishtar_common/migrations/0016_auto__add_import.py)0
-rw-r--r--ishtar_common/old_migrations/0017_auto__add_supporttype__add_format.py (renamed from ishtar_common/migrations/0017_auto__add_supporttype__add_format.py)0
-rw-r--r--ishtar_common/old_migrations/0018_auto__add_itemkey.py (renamed from ishtar_common/migrations/0018_auto__add_itemkey.py)0
-rw-r--r--ishtar_common/old_migrations/0019_auto__add_field_itemkey_importer.py (renamed from ishtar_common/migrations/0019_auto__add_field_itemkey_importer.py)0
-rw-r--r--ishtar_common/old_migrations/0020_auto__chg_field_person_title.py (renamed from ishtar_common/migrations/0020_auto__chg_field_person_title.py)0
-rw-r--r--ishtar_common/old_migrations/0021_auto__add_importerdefault__add_importertype__add_importtarget__add_for.py (renamed from ishtar_common/migrations/0021_auto__add_importerdefault__add_importertype__add_importtarget__add_for.py)0
-rw-r--r--ishtar_common/old_migrations/0022_auto__add_field_import_importer_type.py (renamed from ishtar_common/migrations/0022_auto__add_field_import_importer_type.py)0
-rw-r--r--ishtar_common/old_migrations/0023_auto__add_importerdefaultvalues__del_field_importerdefault_value.py (renamed from ishtar_common/migrations/0023_auto__add_importerdefaultvalues__del_field_importerdefault_value.py)0
-rw-r--r--ishtar_common/old_migrations/0024_auto__add_importerduplicatefield__chg_field_importerdefault_target__ad.py (renamed from ishtar_common/migrations/0024_auto__add_importerduplicatefield__chg_field_importerdefault_target__ad.py)0
-rw-r--r--ishtar_common/old_migrations/0025_auto__add_unique_formatertype_formater_type_many_split_options.py (renamed from ishtar_common/migrations/0025_auto__add_unique_formatertype_formater_type_many_split_options.py)0
-rw-r--r--ishtar_common/old_migrations/0026_auto__add_targetkey__add_unique_targetkey_target_value__add_field_impo.py (renamed from ishtar_common/migrations/0026_auto__add_targetkey__add_unique_targetkey_target_value__add_field_impo.py)0
-rw-r--r--ishtar_common/old_migrations/0027_auto__chg_field_targetkey_target.py (renamed from ishtar_common/migrations/0027_auto__chg_field_targetkey_target.py)0
-rw-r--r--ishtar_common/old_migrations/0028_auto__chg_field_targetkey_key__chg_field_targetkey_value.py (renamed from ishtar_common/migrations/0028_auto__chg_field_targetkey_key__chg_field_targetkey_value.py)0
-rw-r--r--ishtar_common/old_migrations/0029_auto.py (renamed from ishtar_common/migrations/0029_auto.py)0
-rw-r--r--ishtar_common/old_migrations/0030_auto__add_state__chg_field_sourcetype_txt_idx__chg_field_authortype_tx.py (renamed from ishtar_common/migrations/0030_auto__add_state__chg_field_sourcetype_txt_idx__chg_field_authortype_tx.py)0
-rw-r--r--ishtar_common/old_migrations/0031_auto__del_unique_targetkey_target_value__add_unique_targetkey_target_k.py (renamed from ishtar_common/migrations/0031_auto__del_unique_targetkey_target_value__add_unique_targetkey_target_k.py)0
-rw-r--r--ishtar_common/old_migrations/0033_auto__add_field_targetkey_associated_import__add_field_targetkey_assoc.py (renamed from ishtar_common/migrations/0033_auto__add_field_targetkey_associated_import__add_field_targetkey_assoc.py)0
-rw-r--r--ishtar_common/old_migrations/0034_auto__add_field_import_encoding.py (renamed from ishtar_common/migrations/0034_auto__add_field_import_encoding.py)0
-rw-r--r--ishtar_common/old_migrations/0035_auto__add_field_importtarget_force_new__add_field_importerduplicatefie.py (renamed from ishtar_common/migrations/0035_auto__add_field_importtarget_force_new__add_field_importerduplicatefie.py)0
-rw-r--r--ishtar_common/old_migrations/0036_auto__add_field_import_imported_images.py (renamed from ishtar_common/migrations/0036_auto__add_field_import_imported_images.py)0
-rw-r--r--ishtar_common/old_migrations/0037_auto__add_field_importertype_slug.py (renamed from ishtar_common/migrations/0037_auto__add_field_importertype_slug.py)0
-rw-r--r--ishtar_common/old_migrations/0038_auto__add_field_importtarget_comment.py (renamed from ishtar_common/migrations/0038_auto__add_field_importtarget_comment.py)0
-rw-r--r--ishtar_common/old_migrations/0039_auto__add_field_import_match_file.py (renamed from ishtar_common/migrations/0039_auto__add_field_import_match_file.py)0
-rw-r--r--ishtar_common/old_migrations/0040_auto__chg_field_person_title.py (renamed from ishtar_common/migrations/0040_auto__chg_field_person_title.py)0
-rw-r--r--ishtar_common/old_migrations/0041_auto__add_field_importertype_unicity_keys__add_field_importtarget_conc.py (renamed from ishtar_common/migrations/0041_auto__add_field_importertype_unicity_keys__add_field_importtarget_conc.py)0
-rw-r--r--ishtar_common/old_migrations/0042_auto__add_field_importtarget_concat_str__add_unique_importercolumn_col.py (renamed from ishtar_common/migrations/0042_auto__add_field_importtarget_concat_str__add_unique_importercolumn_col.py)0
-rw-r--r--ishtar_common/old_migrations/0043_auto__add_field_importerduplicatefield_concat__add_field_importerdupli.py (renamed from ishtar_common/migrations/0043_auto__add_field_importerduplicatefield_concat__add_field_importerdupli.py)0
-rw-r--r--ishtar_common/old_migrations/0044_auto__add_operationtype.py (renamed from ishtar_common/migrations/0044_auto__add_operationtype.py)0
-rw-r--r--ishtar_common/old_migrations/0045_auto__chg_field_person_merge_key__chg_field_historicalorganization_mer.py (renamed from ishtar_common/migrations/0045_auto__chg_field_person_merge_key__chg_field_historicalorganization_mer.py)0
-rw-r--r--ishtar_common/old_migrations/0046_auto__add_field_person_exclude_from_merge__add_field_historicalorganiz.py (renamed from ishtar_common/migrations/0046_auto__add_field_person_exclude_from_merge__add_field_historicalorganiz.py)0
-rw-r--r--ishtar_common/old_migrations/0047_auto__chg_field_person_exclude_from_merge__chg_field_historicalorganiz.py (renamed from ishtar_common/migrations/0047_auto__chg_field_person_exclude_from_merge__chg_field_historicalorganiz.py)0
-rw-r--r--ishtar_common/old_migrations/0048_auto__add_ishtarsiteprofile.py (renamed from ishtar_common/migrations/0048_auto__add_ishtarsiteprofile.py)0
-rw-r--r--ishtar_common/old_migrations/0049_auto__add_field_person_alt_address__add_field_person_alt_address_compl.py (renamed from ishtar_common/migrations/0049_auto__add_field_person_alt_address__add_field_person_alt_address_compl.py)0
-rw-r--r--ishtar_common/old_migrations/0050_auto__chg_field_person_phone_desc3__chg_field_person_phone_desc2__chg_.py (renamed from ishtar_common/migrations/0050_auto__chg_field_person_phone_desc3__chg_field_person_phone_desc2__chg_.py)0
-rw-r--r--ishtar_common/old_migrations/0051_auto__add_field_ishtarsiteprofile_homepage.py (renamed from ishtar_common/migrations/0051_auto__add_field_ishtarsiteprofile_homepage.py)0
-rw-r--r--ishtar_common/old_migrations/0052_auto__add_field_ishtarsiteprofile_file_external_id__add_field_ishtarsi.py (renamed from ishtar_common/migrations/0052_auto__add_field_ishtarsiteprofile_file_external_id__add_field_ishtarsi.py)0
-rw-r--r--ishtar_common/old_migrations/0053_auto__add_field_ishtarsiteprofile_currency.py (renamed from ishtar_common/migrations/0053_auto__add_field_ishtarsiteprofile_currency.py)0
-rw-r--r--ishtar_common/old_migrations/0054_auto__add_field_ishtarsiteprofile_person_raw_name.py (renamed from ishtar_common/migrations/0054_auto__add_field_ishtarsiteprofile_person_raw_name.py)0
-rw-r--r--ishtar_common/old_migrations/0055_auto.py (renamed from ishtar_common/migrations/0055_auto.py)0
-rw-r--r--ishtar_common/old_migrations/0056_auto__add_titletype__add_field_person_pretitle.py (renamed from ishtar_common/migrations/0056_auto__add_titletype__add_field_person_pretitle.py)0
-rw-r--r--ishtar_common/old_migrations/0057_rename_pretitle_old_title.py (renamed from ishtar_common/migrations/0057_rename_pretitle_old_title.py)0
-rw-r--r--ishtar_common/old_migrations/0058_generate_title.py (renamed from ishtar_common/migrations/0058_generate_title.py)0
-rw-r--r--ishtar_common/old_migrations/0059_rename_exc_from_merge_to_archived.py (renamed from ishtar_common/migrations/0059_rename_exc_from_merge_to_archived.py)0
-rw-r--r--ishtar_common/old_migrations/0060_auto__add_historicalperson.py (renamed from ishtar_common/migrations/0060_auto__add_historicalperson.py)0
-rw-r--r--ishtar_common/old_migrations/0061_auto__add_field_historicalperson_salutation__add_field_person_salutati.py (renamed from ishtar_common/migrations/0061_auto__add_field_historicalperson_salutation__add_field_person_salutati.py)0
-rw-r--r--ishtar_common/old_migrations/0062_remove_ishtar_local_prefix.py (renamed from ishtar_common/migrations/0062_remove_ishtar_local_prefix.py)0
-rw-r--r--ishtar_common/old_migrations/0063_auto__add_field_ishtaruser_advanced_shortcut_menu.py (renamed from ishtar_common/migrations/0063_auto__add_field_ishtaruser_advanced_shortcut_menu.py)0
-rw-r--r--ishtar_common/old_migrations/0064_auto__add_field_importercolumn_label.py (renamed from ishtar_common/migrations/0064_auto__add_field_importercolumn_label.py)0
-rw-r--r--ishtar_common/old_migrations/0065_auto__add_spatialreferencesystem__add_field_ishtarsiteprofile_mapping.py (renamed from ishtar_common/migrations/0065_auto__add_spatialreferencesystem__add_field_ishtarsiteprofile_mapping.py)0
-rw-r--r--ishtar_common/old_migrations/0066_auto__add_field_ishtarsiteprofile_base_color__add_field_ishtarsiteprof.py (renamed from ishtar_common/migrations/0066_auto__add_field_ishtarsiteprofile_base_color__add_field_ishtarsiteprof.py)0
-rw-r--r--ishtar_common/old_migrations/0067_auto__add_field_ishtarsiteprofile_container_external_id__add_field_ish.py (renamed from ishtar_common/migrations/0067_auto__add_field_ishtarsiteprofile_container_external_id__add_field_ish.py)0
-rw-r--r--ishtar_common/old_migrations/0068_auto__add_field_spatialreferencesystem_auth_name.py (renamed from ishtar_common/migrations/0068_auto__add_field_spatialreferencesystem_auth_name.py)0
-rw-r--r--ishtar_common/old_migrations/0069_auto__chg_field_import_error_file__chg_field_import_match_file__chg_fi.py (renamed from ishtar_common/migrations/0069_auto__chg_field_import_error_file__chg_field_import_match_file__chg_fi.py)0
-rw-r--r--ishtar_common/old_migrations/0070_auto__add_importermodel__add_field_importertype_new_associated_models.py (renamed from ishtar_common/migrations/0070_auto__add_importermodel__add_field_importertype_new_associated_models.py)0
-rw-r--r--ishtar_common/old_migrations/0071_migrate_importermodels.py (renamed from ishtar_common/migrations/0071_migrate_importermodels.py)0
-rw-r--r--ishtar_common/old_migrations/0072_auto__del_field_importertype_new_associated_models__chg_field_importer.py (renamed from ishtar_common/migrations/0072_auto__del_field_importertype_new_associated_models__chg_field_importer.py)0
-rw-r--r--ishtar_common/old_migrations/0073_auto__add_field_importercolumn_export_field_name.py (renamed from ishtar_common/migrations/0073_auto__add_field_importercolumn_export_field_name.py)0
-rw-r--r--ishtar_common/old_migrations/0074_auto__add_field_import_name.py (renamed from ishtar_common/migrations/0074_auto__add_field_import_name.py)0
-rw-r--r--ishtar_common/old_migrations/0075_auto__add_field_authortype_order.py (renamed from ishtar_common/migrations/0075_auto__add_field_authortype_order.py)0
-rw-r--r--ishtar_common/old_migrations/0076_auto__add_field_ishtarsiteprofile_find_index.py (renamed from ishtar_common/migrations/0076_auto__add_field_ishtarsiteprofile_find_index.py)0
-rw-r--r--ishtar_common/old_migrations/__init__.py0
-rw-r--r--ishtar_common/ooo_replace.py218
-rw-r--r--ishtar_common/ooo_translation.py38
-rw-r--r--ishtar_common/templates/base.html2
-rw-r--r--ishtar_common/templates/blocks/JQueryAdvancedTown.html2
-rw-r--r--ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html1
-rw-r--r--ishtar_common/templates/ishtar/blocks/shortcut_menu.html1
-rw-r--r--ishtar_common/templates/ishtar/blocks/window_nav.html1
-rw-r--r--ishtar_common/templates/ishtar/dashboards/dashboard_main.html1
-rw-r--r--ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html1
-rw-r--r--ishtar_common/templates/ishtar/import_delete.html1
-rw-r--r--ishtar_common/templates/ishtar/import_list.html1
-rw-r--r--ishtar_common/templates/ishtar/manage_basket.html1
-rw-r--r--ishtar_common/templates/ishtar/merge.html1
-rw-r--r--ishtar_common/templates/ishtar/merge_organization.html1
-rw-r--r--ishtar_common/templates/ishtar/merge_person.html1
-rw-r--r--ishtar_common/templates/ishtar/organization_form.html2
-rw-r--r--ishtar_common/templates/ishtar/organization_person_form.html2
-rw-r--r--ishtar_common/templates/ishtar/person_form.html2
-rw-r--r--ishtar_common/templates/ishtar/sheet_organization.html2
-rw-r--r--ishtar_common/templates/ishtar/sheet_source.html4
-rw-r--r--ishtar_common/templates/ishtar/wizard/default_wizard.html1
-rw-r--r--ishtar_common/templates/ishtar/wizard/validation_bar.html1
-rw-r--r--ishtar_common/templates/registration/activation_complete.html1
-rw-r--r--ishtar_common/templates/registration/login.html4
-rw-r--r--ishtar_common/templates/welcome.html1
-rw-r--r--ishtar_common/templatetags/link_to_window.py10
-rw-r--r--ishtar_common/templatetags/window_field.py6
-rw-r--r--ishtar_common/tests.py171
-rw-r--r--ishtar_common/tests/old.odtbin0 -> 9048 bytes
-rw-r--r--ishtar_common/urls.py8
-rw-r--r--ishtar_common/utils.py19
-rw-r--r--ishtar_common/views.py127
-rw-r--r--ishtar_common/widgets.py2
-rw-r--r--ishtar_common/wizards.py73
125 files changed, 1850 insertions, 1495 deletions
diff --git a/ishtar_common/__init__.py b/ishtar_common/__init__.py
index 5d2eadd7d..2b432d908 100644
--- a/ishtar_common/__init__.py
+++ b/ishtar_common/__init__.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2015 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
-from django.utils.translation import ugettext as _
+from django.utils.translation import ugettext_lazy as _
# overload of translation of registration module
_(u"username")
diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py
index adf006502..9f8265033 100644
--- a/ishtar_common/admin.py
+++ b/ishtar_common/admin.py
@@ -97,7 +97,7 @@ def export_as_csv_action(description=_(u"Export selected as CSV file"),
excludeset = set(exclude)
field_names = field_names - excludeset
- response = HttpResponse(mimetype='text/csv')
+ response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=%s.csv' % \
unicode(opts).replace('.', '_')
@@ -300,12 +300,6 @@ class SpatialReferenceSystemAdmin(GeneralTypeAdmin):
admin.site.register(models.SpatialReferenceSystem, SpatialReferenceSystemAdmin)
-class IshtarUserAdmin(admin.ModelAdmin):
- readonly_fields = ('password',)
-
-admin.site.register(models.IshtarUser, IshtarUserAdmin)
-
-
class ItemKeyAdmin(admin.ModelAdmin):
list_display = ('content_type', 'key', 'content_object', 'importer')
search_fields = ('key', )
@@ -338,7 +332,7 @@ class AdministrationTaskAdmin(admin.ModelAdmin):
admin.site.register(models.AdministrationTask, AdministrationTaskAdmin)
-basic_models = [models.DocumentTemplate]
+basic_models = [models.DocumentTemplate, models.IshtarUser]
if settings.COUNTRY == 'fr':
basic_models += [models.Arrondissement, models.Canton]
diff --git a/ishtar_common/backend.py b/ishtar_common/backend.py
index f48e6ddec..261e4dc6f 100644
--- a/ishtar_common/backend.py
+++ b/ishtar_common/backend.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2010-2013 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2010-2017 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -23,7 +23,7 @@ Permission backend to manage "own" objects
from django.contrib.auth.backends import ModelBackend
from django.core.exceptions import ObjectDoesNotExist
-from django.db.models.loading import cache
+from django.apps import apps
import models
@@ -55,8 +55,8 @@ class ObjectPermBackend(ModelBackend):
if obj is None:
model_name = perm.split('_')[-1].lower()
model = None
- for app in cache.get_apps():
- for modl in cache.get_models(app):
+ for app in apps.get_apps():
+ for modl in apps.get_models(app):
if modl.__name__.lower() == model_name:
model = modl
if not model:
diff --git a/ishtar_common/context_processors.py b/ishtar_common/context_processors.py
index 5050d667e..1c3babb8f 100644
--- a/ishtar_common/context_processors.py
+++ b/ishtar_common/context_processors.py
@@ -50,8 +50,7 @@ def get_base_context(request):
menu.init()
if menu.selected_idx is not None:
dct['current_theme'] = "theme-%d" % (menu.selected_idx + 1)
- request.session['MENU'] = menu
- dct['MENU'] = request.session['MENU']
+ dct['MENU'] = menu
dct['JQUERY_URL'] = settings.JQUERY_URL
dct['JQUERY_UI_URL'] = settings.JQUERY_UI_URL
dct['COUNTRY'] = settings.COUNTRY
diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py
index e11e72449..76b186038 100644
--- a/ishtar_common/data_importer.py
+++ b/ishtar_common/data_importer.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2013-2015 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2013-2017 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -342,7 +342,7 @@ class StrChoiceFormater(Formater, ChoiceChecker):
if hasattr(value, 'pk'):
value = value.pk
q['value'] = value
- with transaction.commit_on_success():
+ with transaction.atomic():
try:
t, created = TargetKey.objects.get_or_create(**q)
except IntegrityError:
@@ -404,7 +404,7 @@ class StrChoiceFormater(Formater, ChoiceChecker):
target.is_set = True
target.save()
else:
- with transaction.commit_on_success():
+ with transaction.atomic():
q['value'] = self.equiv_dict[value]
q['is_set'] = True
try:
@@ -418,7 +418,7 @@ class StrChoiceFormater(Formater, ChoiceChecker):
'associated_import': import_instance}
if TargetKey.objects.filter(**q).count():
continue
- with transaction.commit_on_success():
+ with transaction.atomic():
try:
TargetKey.objects.create(**q)
except IntegrityError:
@@ -811,7 +811,7 @@ class Importer(object):
self.output = output
if not self.history_modifier:
if self.import_instance:
- self.history_modifier = self.import_instance.user
+ self.history_modifier = self.import_instance.user.user_ptr
else:
# import made by the CLI: get the first admin
self.history_modifier = User.objects.filter(
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py
index 7eb36f6cc..4e5a8bd1c 100644
--- a/ishtar_common/forms.py
+++ b/ishtar_common/forms.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2010-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2010-2017 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -159,7 +159,7 @@ class FormSet(BaseFormSet):
class TableSelect(forms.Form):
def __init__(self, *args, **kwargs):
super(TableSelect, self).__init__(*args, **kwargs)
- key = self.fields.keyOrder[0]
+ key = self.fields.keys()[0]
self.fields[key].widget.attrs['autofocus'] = 'autofocus'
def get_input_ids(self):
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index 44af3a588..4d14e4544 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -585,7 +585,7 @@ class AccountForm(forms.Form):
if 'initial' in kwargs and 'pk' in kwargs['initial']:
try:
person = models.Person.objects.get(pk=kwargs['initial']['pk'])
- account = models.IshtarUser.objects.get(person=person)
+ account = models.IshtarUser.objects.get(person=person).user_ptr
if not kwargs['initial'].get('username'):
kwargs['initial']['username'] = account.username
if not kwargs['initial'].get('email'):
@@ -613,7 +613,7 @@ class AccountForm(forms.Form):
u"password."))
# check username unicity
q = models.IshtarUser.objects.filter(
- username=cleaned_data.get('username'))
+ user_ptr__username=cleaned_data.get('username'))
if cleaned_data.get('pk'):
q = q.exclude(person__pk=cleaned_data.get('pk'))
if q.count():
diff --git a/ishtar_common/management/commands/ishtar_migrate_odts.py b/ishtar_common/management/commands/ishtar_migrate_odts.py
new file mode 100644
index 000000000..49ed9f2d8
--- /dev/null
+++ b/ishtar_common/management/commands/ishtar_migrate_odts.py
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2017 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# See the file COPYING for details.
+
+from django.core.management.base import BaseCommand
+from optparse import make_option
+import sys
+
+from ishtar_common.models import DocumentTemplate
+from ishtar_common.utils import BColors
+
+try:
+ input = raw_input
+except NameError:
+ pass
+
+
+class Command(BaseCommand):
+ help = "Update ODT templates from v1 to v2"
+ option_list = BaseCommand.option_list + (
+ make_option('--quiet',
+ action='store_true',
+ dest='quiet',
+ default=False,
+ help='Proceed silently with no interactive input.'),
+ )
+
+ def interactive_start(self):
+ sys.stdout.write(
+ BColors.HEADER + BColors.BOLD +
+ "Update ODT templates from v1 to v2\n")
+ sys.stdout.write(
+ BColors.ENDC + BColors.WARNING +
+ "This script need to be run only once. Running it on already "
+ "migrated ODT files may be a source of error.\n")
+ sys.stdout.write(BColors.ENDC)
+ yes = None
+ while yes != "yes":
+ sys.stdout.write(
+ "Are you sure you want to proceed? (yes/[n])\n")
+ yes = input()
+ if not yes or yes == "n":
+ sys.stdout.write(BColors.FAIL + "Aborting\n")
+ sys.stdout.write(BColors.ENDC)
+ sys.exit()
+
+ def handle(self, *args, **options):
+ quiet = options['quiet']
+ if not quiet:
+ self.interactive_start()
+ q = DocumentTemplate.objects
+ nb = q.count()
+ len_of_nb = str(len(str(nb)))
+ if not quiet:
+ sys.stdout.write(BColors.OKGREEN)
+
+ errors = []
+ for idx, document in enumerate(q.all()):
+ if not quiet:
+ sys.stdout.write(
+ ("Processing {:" + len_of_nb + "d}/{}\r").format(
+ idx + 1, nb))
+ sys.stdout.flush()
+ try:
+ document.convert_from_v1()
+ except IOError as e:
+ errors.append("Document ({}): ".format(document.pk) +
+ str(e))
+ if errors:
+ sys.stdout.write(BColors.FAIL + "Error while processing:\n")
+ for error in errors:
+ sys.stdout.write("* {}\n".format(error))
+
+ sys.stdout.write(BColors.ENDC)
+ print("\n\n")
+
diff --git a/ishtar_common/menus.py b/ishtar_common/menus.py
index 36b53b162..7d24b0fd2 100644
--- a/ishtar_common/menus.py
+++ b/ishtar_common/menus.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2010-2013 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2010-2017 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -23,7 +23,6 @@ Menus
from django.conf import settings
-
_extra_menus = []
# collect menu from INSTALLED_APPS
for app in settings.INSTALLED_APPS:
diff --git a/ishtar_common/migrations/0001_initial.py b/ishtar_common/migrations/0001_initial.py
index fc22881bc..7b46a3ea5 100644
--- a/ishtar_common/migrations/0001_initial.py
+++ b/ishtar_common/migrations/0001_initial.py
@@ -1,408 +1,836 @@
# -*- coding: utf-8 -*-
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-
-class Migration(SchemaMigration):
-
- def forwards(self, orm):
- # Adding model 'Wizard'
- db.create_table('ishtar_common_wizard', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('url_name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
- ))
- db.send_create_signal('ishtar_common', ['Wizard'])
-
- # Adding model 'WizardStep'
- db.create_table('ishtar_common_wizardstep', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('order', self.gf('django.db.models.fields.IntegerField')()),
- ('wizard', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Wizard'])),
- ('url_name', self.gf('django.db.models.fields.CharField')(max_length=128)),
- ('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
- ))
- db.send_create_signal('ishtar_common', ['WizardStep'])
-
- # Adding model 'Department'
- db.create_table('ishtar_common_department', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('label', self.gf('django.db.models.fields.CharField')(max_length=30)),
- ('number', self.gf('django.db.models.fields.CharField')(unique=True, max_length=3)),
- ))
- db.send_create_signal('ishtar_common', ['Department'])
-
- # Adding model 'OrganizationType'
- db.create_table('ishtar_common_organizationtype', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
- ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
- ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
- ))
- db.send_create_signal('ishtar_common', ['OrganizationType'])
-
- # Adding model 'HistoricalOrganization'
- db.create_table('ishtar_common_historicalorganization', (
- ('id', self.gf('django.db.models.fields.IntegerField')(db_index=True, blank=True)),
- ('history_modifier_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
- ('address', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ('address_complement', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ('postal_code', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)),
- ('town', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
- ('country', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
- ('phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
- ('mobile_phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
- ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
- ('organization_type_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
- ('history_id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('history_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
- ('history_user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True)),
- ('history_type', self.gf('django.db.models.fields.CharField')(max_length=1)),
- ))
- db.send_create_signal('ishtar_common', ['HistoricalOrganization'])
-
- # Adding model 'Organization'
- db.create_table('ishtar_common_organization', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('history_modifier', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['auth.User'])),
- ('address', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ('address_complement', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ('postal_code', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)),
- ('town', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
- ('country', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
- ('phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
- ('mobile_phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
- ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
- ('organization_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.OrganizationType'])),
- ))
- db.send_create_signal('ishtar_common', ['Organization'])
-
- # Adding model 'PersonType'
- db.create_table('ishtar_common_persontype', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
- ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
- ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
- ))
- db.send_create_signal('ishtar_common', ['PersonType'])
-
- # Adding M2M table for field rights on 'PersonType'
- db.create_table('ishtar_common_persontype_rights', (
- ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
- ('persontype', models.ForeignKey(orm['ishtar_common.persontype'], null=False)),
- ('wizardstep', models.ForeignKey(orm['ishtar_common.wizardstep'], null=False))
- ))
- db.create_unique('ishtar_common_persontype_rights', ['persontype_id', 'wizardstep_id'])
-
- # Adding model 'Person'
- db.create_table('ishtar_common_person', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('history_modifier', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['auth.User'])),
- ('address', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ('address_complement', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ('postal_code', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)),
- ('town', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
- ('country', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
- ('phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
- ('mobile_phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
- ('title', self.gf('django.db.models.fields.CharField')(max_length=2)),
- ('surname', self.gf('django.db.models.fields.CharField')(max_length=20)),
- ('name', self.gf('django.db.models.fields.CharField')(max_length=30)),
- ('email', self.gf('django.db.models.fields.CharField')(max_length=40, null=True, blank=True)),
- ('person_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.PersonType'])),
- ('attached_to', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Organization'], null=True, blank=True)),
- ))
- db.send_create_signal('ishtar_common', ['Person'])
-
- # Adding model 'IshtarUser'
- db.create_table('ishtar_common_ishtaruser', (
- ('user_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['auth.User'], unique=True, primary_key=True)),
- ('person', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Person'], unique=True)),
- ))
- db.send_create_signal('ishtar_common', ['IshtarUser'])
-
- # Adding model 'AuthorType'
- db.create_table('ishtar_common_authortype', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
- ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
- ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
- ))
- db.send_create_signal('ishtar_common', ['AuthorType'])
-
- # Adding model 'Author'
- db.create_table('ishtar_common_author', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('person', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Person'])),
- ('author_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.AuthorType'])),
- ))
- db.send_create_signal('ishtar_common', ['Author'])
-
- # Adding model 'SourceType'
- db.create_table('ishtar_common_sourcetype', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
- ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
- ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
- ))
- db.send_create_signal('ishtar_common', ['SourceType'])
-
- # Adding model 'Arrondissement'
- db.create_table('ishtar_common_arrondissement', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('name', self.gf('django.db.models.fields.CharField')(max_length=30)),
- ('department', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Department'])),
- ))
- db.send_create_signal('ishtar_common', ['Arrondissement'])
-
- # Adding model 'Canton'
- db.create_table('ishtar_common_canton', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('name', self.gf('django.db.models.fields.CharField')(max_length=30)),
- ('arrondissement', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Arrondissement'])),
- ))
- db.send_create_signal('ishtar_common', ['Canton'])
-
- # Adding model 'Town'
- db.create_table('ishtar_common_town', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
- ('surface', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
- ('center', self.gf('django.contrib.gis.db.models.fields.PointField')(srid=27572, null=True, blank=True)),
- ('numero_insee', self.gf('django.db.models.fields.CharField')(unique=True, max_length=6)),
- ('departement', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Department'], null=True, blank=True)),
- ('canton', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Canton'], null=True, blank=True)),
- ))
- db.send_create_signal('ishtar_common', ['Town'])
+from __future__ import unicode_literals
+import datetime
- def backwards(self, orm):
- # Deleting model 'Wizard'
- db.delete_table('ishtar_common_wizard')
-
- # Deleting model 'WizardStep'
- db.delete_table('ishtar_common_wizardstep')
-
- # Deleting model 'Department'
- db.delete_table('ishtar_common_department')
-
- # Deleting model 'OrganizationType'
- db.delete_table('ishtar_common_organizationtype')
-
- # Deleting model 'HistoricalOrganization'
- db.delete_table('ishtar_common_historicalorganization')
-
- # Deleting model 'Organization'
- db.delete_table('ishtar_common_organization')
-
- # Deleting model 'PersonType'
- db.delete_table('ishtar_common_persontype')
-
- # Removing M2M table for field rights on 'PersonType'
- db.delete_table('ishtar_common_persontype_rights')
-
- # Deleting model 'Person'
- db.delete_table('ishtar_common_person')
-
- # Deleting model 'IshtarUser'
- db.delete_table('ishtar_common_ishtaruser')
-
- # Deleting model 'AuthorType'
- db.delete_table('ishtar_common_authortype')
-
- # Deleting model 'Author'
- db.delete_table('ishtar_common_author')
-
- # Deleting model 'SourceType'
- db.delete_table('ishtar_common_sourcetype')
-
- # Deleting model 'Arrondissement'
- db.delete_table('ishtar_common_arrondissement')
-
- # Deleting model 'Canton'
- db.delete_table('ishtar_common_canton')
-
- # Deleting model 'Town'
- db.delete_table('ishtar_common_town')
-
-
- models = {
- 'auth.group': {
- 'Meta': {'object_name': 'Group'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
- 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
- },
- 'auth.permission': {
- 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
- 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
- },
- 'auth.user': {
- 'Meta': {'object_name': 'User'},
- 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
- 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
- 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
- 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
- },
- 'contenttypes.contenttype': {
- 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
- 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
- },
- 'ishtar_common.arrondissement': {
- 'Meta': {'object_name': 'Arrondissement'},
- 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
- },
- 'ishtar_common.author': {
- 'Meta': {'object_name': 'Author'},
- 'author_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.AuthorType']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']"})
- },
- 'ishtar_common.authortype': {
- 'Meta': {'object_name': 'AuthorType'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
- },
- 'ishtar_common.canton': {
- 'Meta': {'object_name': 'Canton'},
- 'arrondissement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Arrondissement']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
- },
- 'ishtar_common.department': {
- 'Meta': {'ordering': "['number']", 'object_name': 'Department'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
- 'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'})
- },
- 'ishtar_common.historicalorganization': {
- 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalOrganization'},
- 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
- 'history_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
- 'history_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'history_modifier_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'history_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
- 'history_user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}),
- 'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
- 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'organization_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.ishtaruser': {
- 'Meta': {'object_name': 'IshtarUser', '_ormbases': ['auth.User']},
- 'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']", 'unique': 'True'}),
- 'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
- },
- 'ishtar_common.organization': {
- 'Meta': {'object_name': 'Organization'},
- 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
- 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'organization_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.OrganizationType']"}),
- 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.organizationtype': {
- 'Meta': {'object_name': 'OrganizationType'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
- },
- 'ishtar_common.person': {
- 'Meta': {'object_name': 'Person'},
- 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'attached_to': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Organization']", 'null': 'True', 'blank': 'True'}),
- 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
- 'email': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
- 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
- 'person_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.PersonType']"}),
- 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
- 'title': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
- 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.persontype': {
- 'Meta': {'object_name': 'PersonType'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'rights': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.WizardStep']", 'symmetrical': 'False'}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
- },
- 'ishtar_common.sourcetype': {
- 'Meta': {'object_name': 'SourceType'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
- },
- 'ishtar_common.town': {
- 'Meta': {'ordering': "['numero_insee']", 'object_name': 'Town'},
- 'canton': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Canton']", 'null': 'True', 'blank': 'True'}),
- 'center': ('django.contrib.gis.db.models.fields.PointField', [], {'srid': '27572', 'null': 'True', 'blank': 'True'}),
- 'departement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'numero_insee': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '6'}),
- 'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.wizard': {
- 'Meta': {'ordering': "['url_name']", 'object_name': 'Wizard'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'url_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
- },
- 'ishtar_common.wizardstep': {
- 'Meta': {'ordering': "['wizard', 'order']", 'object_name': 'WizardStep'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
- 'order': ('django.db.models.fields.IntegerField', [], {}),
- 'url_name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
- 'wizard': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Wizard']"})
- }
- }
-
- complete_apps = ['ishtar_common'] \ No newline at end of file
+from django.db import models, migrations
+import re
+import django.contrib.gis.db.models.fields
+import ishtar_common.models
+import django.contrib.auth.models
+import django.db.models.deletion
+from django.conf import settings
+import django.core.validators
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('contenttypes', '0002_remove_content_type_name'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ # ('auth', 'ishtar_profile'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Arrondissement',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(max_length=30, verbose_name='Nom')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Author',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ],
+ options={
+ 'ordering': ('author_type__order', 'person__name'),
+ 'verbose_name': 'Author',
+ 'verbose_name_plural': 'Authors',
+ 'permissions': (('view_author', 'Can view all Authors'), ('view_own_author', 'Can view own Author'), ('add_own_author', 'Can add own Author'), ('change_own_author', 'Can change own Author'), ('delete_own_author', 'Can delete own Author')),
+ },
+ ),
+ migrations.CreateModel(
+ name='AuthorType',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.CharField(max_length=100, verbose_name='Label')),
+ ('txt_idx', models.CharField(unique=True, max_length=100, verbose_name='Textual ID', validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+$'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')])),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('available', models.BooleanField(default=True, verbose_name='Available')),
+ ('order', models.IntegerField(default=1, verbose_name='Order')),
+ ],
+ options={
+ 'ordering': ['order', 'label'],
+ 'verbose_name': 'Author type',
+ 'verbose_name_plural': 'Author types',
+ },
+ bases=(ishtar_common.models.Cached, models.Model),
+ ),
+ migrations.CreateModel(
+ name='Canton',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(max_length=30, verbose_name='Nom')),
+ ('arrondissement', models.ForeignKey(verbose_name='Arrondissement', to='ishtar_common.Arrondissement')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Department',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.CharField(max_length=30, verbose_name='Label')),
+ ('number', models.CharField(unique=True, max_length=3, verbose_name='Number')),
+ ],
+ options={
+ 'ordering': ['number'],
+ 'verbose_name': 'Department',
+ 'verbose_name_plural': 'Departments',
+ },
+ ),
+ migrations.CreateModel(
+ name='DocumentTemplate',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(max_length=100, verbose_name='Name')),
+ ('template', models.FileField(upload_to=b'upload/templates/', verbose_name='Template')),
+ ('associated_object_name', models.CharField(max_length=100, verbose_name='Associated object', choices=[(b'archaeological_operations.models.AdministrativeAct', 'Administrative Act')])),
+ ('available', models.BooleanField(default=True, verbose_name='Available')),
+ ],
+ options={
+ 'ordering': ['associated_object_name', 'name'],
+ 'verbose_name': 'Document template',
+ 'verbose_name_plural': 'Document templates',
+ },
+ ),
+ migrations.CreateModel(
+ name='Format',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.CharField(max_length=100, verbose_name='Label')),
+ ('txt_idx', models.CharField(unique=True, max_length=100, verbose_name='Textual ID', validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+$'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')])),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('available', models.BooleanField(default=True, verbose_name='Available')),
+ ],
+ options={
+ 'ordering': ['label'],
+ 'verbose_name': 'Format type',
+ 'verbose_name_plural': 'Format types',
+ },
+ bases=(ishtar_common.models.Cached, models.Model),
+ ),
+ migrations.CreateModel(
+ name='FormaterType',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('formater_type', models.CharField(max_length=20, verbose_name='Formater type', choices=[(b'IntegerFormater', 'Integer'), (b'FloatFormater', 'Float'), (b'UnicodeFormater', 'String'), (b'DateFormater', 'Date'), (b'TypeFormater', 'Type'), (b'YearFormater', 'Year'), (b'StrToBoolean', 'String to boolean'), (b'FileFormater', 'File'), (b'UnknowType', 'Unknow type')])),
+ ('options', models.CharField(max_length=500, null=True, verbose_name='Options', blank=True)),
+ ('many_split', models.CharField(max_length=10, null=True, verbose_name='Split character(s)', blank=True)),
+ ],
+ options={
+ 'ordering': ('formater_type', 'options'),
+ 'verbose_name': 'Importer - Formater type',
+ 'verbose_name_plural': 'Importer - Formater types',
+ },
+ ),
+ migrations.CreateModel(
+ name='GlobalVar',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('slug', models.SlugField(unique=True, verbose_name='Variable name')),
+ ('description', models.TextField(null=True, verbose_name='Description of the variable', blank=True)),
+ ('value', models.TextField(null=True, verbose_name='Value', blank=True)),
+ ],
+ options={
+ 'ordering': ['slug'],
+ 'verbose_name': 'Global variable',
+ 'verbose_name_plural': 'Global variables',
+ },
+ bases=(models.Model, ishtar_common.models.Cached),
+ ),
+ migrations.CreateModel(
+ name='HistoricalOrganization',
+ fields=[
+ ('id', models.IntegerField(verbose_name='ID', db_index=True, auto_created=True, blank=True)),
+ ('address', models.TextField(null=True, verbose_name='Address', blank=True)),
+ ('address_complement', models.TextField(null=True, verbose_name='Address complement', blank=True)),
+ ('postal_code', models.CharField(max_length=10, null=True, verbose_name='Postal code', blank=True)),
+ ('town', models.CharField(max_length=70, null=True, verbose_name='Town', blank=True)),
+ ('country', models.CharField(max_length=30, null=True, verbose_name='Country', blank=True)),
+ ('alt_address', models.TextField(null=True, verbose_name='Other address: address', blank=True)),
+ ('alt_address_complement', models.TextField(null=True, verbose_name='Other address: address complement', blank=True)),
+ ('alt_postal_code', models.CharField(max_length=10, null=True, verbose_name='Other address: postal code', blank=True)),
+ ('alt_town', models.CharField(max_length=70, null=True, verbose_name='Other address: town', blank=True)),
+ ('alt_country', models.CharField(max_length=30, null=True, verbose_name='Other address: country', blank=True)),
+ ('phone', models.CharField(max_length=18, null=True, verbose_name='Phone', blank=True)),
+ ('phone_desc', models.CharField(max_length=300, null=True, verbose_name='Phone description', blank=True)),
+ ('phone2', models.CharField(max_length=18, null=True, verbose_name='Phone description 2', blank=True)),
+ ('phone_desc2', models.CharField(max_length=300, null=True, verbose_name='Phone description 2', blank=True)),
+ ('phone3', models.CharField(max_length=18, null=True, verbose_name='Phone 3', blank=True)),
+ ('phone_desc3', models.CharField(max_length=300, null=True, verbose_name='Phone description 3', blank=True)),
+ ('raw_phone', models.TextField(null=True, verbose_name='Raw phone', blank=True)),
+ ('mobile_phone', models.CharField(max_length=18, null=True, verbose_name='Mobile phone', blank=True)),
+ ('email', models.EmailField(max_length=300, null=True, verbose_name='Email', blank=True)),
+ ('alt_address_is_prefered', models.BooleanField(default=False, verbose_name='Alternative address is prefered')),
+ ('merge_key', models.TextField(null=True, verbose_name='Merge key', blank=True)),
+ ('archived', models.NullBooleanField(default=False)),
+ ('name', models.CharField(max_length=500, verbose_name='Name')),
+ ('history_id', models.AutoField(serialize=False, primary_key=True)),
+ ('history_date', models.DateTimeField()),
+ ('history_type', models.CharField(max_length=1, choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')])),
+ ],
+ options={
+ 'ordering': ('-history_date', '-history_id'),
+ 'get_latest_by': 'history_date',
+ 'verbose_name': 'historical Organization',
+ },
+ ),
+ migrations.CreateModel(
+ name='HistoricalPerson',
+ fields=[
+ ('id', models.IntegerField(verbose_name='ID', db_index=True, auto_created=True, blank=True)),
+ ('address', models.TextField(null=True, verbose_name='Address', blank=True)),
+ ('address_complement', models.TextField(null=True, verbose_name='Address complement', blank=True)),
+ ('postal_code', models.CharField(max_length=10, null=True, verbose_name='Postal code', blank=True)),
+ ('town', models.CharField(max_length=70, null=True, verbose_name='Town', blank=True)),
+ ('country', models.CharField(max_length=30, null=True, verbose_name='Country', blank=True)),
+ ('alt_address', models.TextField(null=True, verbose_name='Other address: address', blank=True)),
+ ('alt_address_complement', models.TextField(null=True, verbose_name='Other address: address complement', blank=True)),
+ ('alt_postal_code', models.CharField(max_length=10, null=True, verbose_name='Other address: postal code', blank=True)),
+ ('alt_town', models.CharField(max_length=70, null=True, verbose_name='Other address: town', blank=True)),
+ ('alt_country', models.CharField(max_length=30, null=True, verbose_name='Other address: country', blank=True)),
+ ('phone', models.CharField(max_length=18, null=True, verbose_name='Phone', blank=True)),
+ ('phone_desc', models.CharField(max_length=300, null=True, verbose_name='Phone description', blank=True)),
+ ('phone2', models.CharField(max_length=18, null=True, verbose_name='Phone description 2', blank=True)),
+ ('phone_desc2', models.CharField(max_length=300, null=True, verbose_name='Phone description 2', blank=True)),
+ ('phone3', models.CharField(max_length=18, null=True, verbose_name='Phone 3', blank=True)),
+ ('phone_desc3', models.CharField(max_length=300, null=True, verbose_name='Phone description 3', blank=True)),
+ ('raw_phone', models.TextField(null=True, verbose_name='Raw phone', blank=True)),
+ ('mobile_phone', models.CharField(max_length=18, null=True, verbose_name='Mobile phone', blank=True)),
+ ('email', models.EmailField(max_length=300, null=True, verbose_name='Email', blank=True)),
+ ('alt_address_is_prefered', models.BooleanField(default=False, verbose_name='Alternative address is prefered')),
+ ('merge_key', models.TextField(null=True, verbose_name='Merge key', blank=True)),
+ ('archived', models.NullBooleanField(default=False)),
+ ('old_title', models.CharField(blank=True, max_length=100, null=True, verbose_name='Title', choices=[(b'Mr', 'Mr'), (b'Ms', 'Miss'), (b'Mr and Miss', 'Mr and Mrs'), (b'Md', 'Mrs'), (b'Dr', 'Doctor')])),
+ ('salutation', models.CharField(max_length=200, null=True, verbose_name='Salutation', blank=True)),
+ ('surname', models.CharField(max_length=50, null=True, verbose_name='Surname', blank=True)),
+ ('name', models.CharField(max_length=200, null=True, verbose_name='Name', blank=True)),
+ ('raw_name', models.CharField(max_length=300, null=True, verbose_name='Raw name', blank=True)),
+ ('contact_type', models.CharField(max_length=300, null=True, verbose_name='Contact type', blank=True)),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('history_id', models.AutoField(serialize=False, primary_key=True)),
+ ('history_date', models.DateTimeField()),
+ ('history_type', models.CharField(max_length=1, choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')])),
+ ],
+ options={
+ 'ordering': ('-history_date', '-history_id'),
+ 'get_latest_by': 'history_date',
+ 'verbose_name': 'historical Person',
+ },
+ ),
+ migrations.CreateModel(
+ name='Import',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(max_length=500, null=True, verbose_name='Name', blank=True)),
+ ('imported_file', models.FileField(upload_to=b'upload/imports/', max_length=220, verbose_name='Imported file')),
+ ('imported_images', models.FileField(max_length=220, upload_to=b'upload/imports/', null=True, verbose_name='Associated images (zip file)', blank=True)),
+ ('encoding', models.CharField(default=b'utf-8', max_length=15, verbose_name='Encoding', choices=[(b'windows-1252', b'windows-1252'), (b'ISO-8859-15', b'ISO-8859-15'), (b'utf-8', b'utf-8')])),
+ ('skip_lines', models.IntegerField(default=1, verbose_name='Skip lines')),
+ ('error_file', models.FileField(max_length=255, upload_to=b'upload/imports/', null=True, verbose_name='Error file', blank=True)),
+ ('result_file', models.FileField(max_length=255, upload_to=b'upload/imports/', null=True, verbose_name='Result file', blank=True)),
+ ('match_file', models.FileField(max_length=255, upload_to=b'upload/imports/', null=True, verbose_name='Match file', blank=True)),
+ ('state', models.CharField(default=b'C', max_length=2, verbose_name='State', choices=[(b'C', 'Created'), (b'AP', 'Analyse in progress'), (b'A', 'Analysed'), (b'P', 'Import pending'), (b'IP', 'Import in progress'), (b'FE', 'Finished with errors'), (b'F', 'Finished'), (b'AC', 'Archived')])),
+ ('conservative_import', models.BooleanField(default=False, help_text=b'If set to true, do not overload existing values', verbose_name='Conservative import')),
+ ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation date', null=True)),
+ ('end_date', models.DateTimeField(verbose_name='End date', null=True, editable=False, blank=True)),
+ ('seconds_remaining', models.IntegerField(verbose_name='Remaining seconds', null=True, editable=False, blank=True)),
+ ],
+ options={
+ 'verbose_name': 'Import',
+ 'verbose_name_plural': 'Imports',
+ },
+ ),
+ migrations.CreateModel(
+ name='ImporterColumn',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.CharField(max_length=200, null=True, verbose_name='Label', blank=True)),
+ ('col_number', models.IntegerField(default=1, verbose_name='Column number')),
+ ('description', models.TextField(null=True, verbose_name='Description', blank=True)),
+ ('required', models.BooleanField(default=False, verbose_name='Required')),
+ ('export_field_name', models.CharField(help_text='Fill this field if the field name is ambiguous for export. For instance: concatenated fields.', max_length=200, null=True, verbose_name='Export field name', blank=True)),
+ ],
+ options={
+ 'ordering': ('importer_type', 'col_number'),
+ 'verbose_name': 'Importer - Column',
+ 'verbose_name_plural': 'Importer - Columns',
+ },
+ ),
+ migrations.CreateModel(
+ name='ImporterDefault',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('target', models.CharField(max_length=500, verbose_name='Target')),
+ ],
+ options={
+ 'verbose_name': 'Importer - Default',
+ 'verbose_name_plural': 'Importer - Defaults',
+ },
+ ),
+ migrations.CreateModel(
+ name='ImporterDefaultValues',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('target', models.CharField(max_length=500, verbose_name='Target')),
+ ('value', models.CharField(max_length=500, verbose_name='Value')),
+ ('default_target', models.ForeignKey(related_name='default_values', to='ishtar_common.ImporterDefault')),
+ ],
+ options={
+ 'verbose_name': 'Importer - Default value',
+ 'verbose_name_plural': 'Importer - Default values',
+ },
+ ),
+ migrations.CreateModel(
+ name='ImporterDuplicateField',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('field_name', models.CharField(max_length=200, null=True, verbose_name='Field name', blank=True)),
+ ('force_new', models.BooleanField(default=False, verbose_name='Force creation of new items')),
+ ('concat', models.BooleanField(default=False, verbose_name='Concatenate with existing')),
+ ('concat_str', models.CharField(max_length=5, null=True, verbose_name='Concatenate character', blank=True)),
+ ('column', models.ForeignKey(related_name='duplicate_fields', to='ishtar_common.ImporterColumn')),
+ ],
+ options={
+ 'verbose_name': 'Importer - Duplicate field',
+ 'verbose_name_plural': 'Importer - Duplicate fields',
+ },
+ ),
+ migrations.CreateModel(
+ name='ImporterModel',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(max_length=200, verbose_name='Name')),
+ ('klass', models.CharField(max_length=200, verbose_name='Class name')),
+ ],
+ options={
+ 'ordering': ('name',),
+ 'verbose_name': 'Importer - Model',
+ 'verbose_name_plural': 'Importer - Models',
+ },
+ ),
+ migrations.CreateModel(
+ name='ImporterType',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(max_length=100, null=True, verbose_name='Name', blank=True)),
+ ('slug', models.SlugField(null=True, max_length=100, blank=True, unique=True, verbose_name='Slug')),
+ ('description', models.CharField(max_length=500, null=True, verbose_name='Description', blank=True)),
+ ('is_template', models.BooleanField(default=False, verbose_name='Is template')),
+ ('unicity_keys', models.CharField(max_length=500, null=True, verbose_name='Unicity keys (separator ";")', blank=True)),
+ ('associated_models', models.ForeignKey(related_name='+', verbose_name='Associated model', blank=True, to='ishtar_common.ImporterModel', null=True)),
+ ('created_models', models.ManyToManyField(help_text='Leave blank for no restrictions', related_name='+', verbose_name='Models that can accept new items', to='ishtar_common.ImporterModel', blank=True)),
+ ],
+ options={
+ 'ordering': ('name',),
+ 'verbose_name': 'Importer - Type',
+ 'verbose_name_plural': 'Importer - Types',
+ },
+ ),
+ migrations.CreateModel(
+ name='ImportTarget',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('target', models.CharField(max_length=500, verbose_name='Target')),
+ ('force_new', models.BooleanField(default=False, verbose_name='Force creation of new items')),
+ ('concat', models.BooleanField(default=False, verbose_name='Concatenate with existing')),
+ ('concat_str', models.CharField(max_length=5, null=True, verbose_name='Concatenate character', blank=True)),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('column', models.ForeignKey(related_name='targets', to='ishtar_common.ImporterColumn')),
+ ('formater_type', models.ForeignKey(to='ishtar_common.FormaterType')),
+ ],
+ options={
+ 'verbose_name': 'Importer - Target',
+ 'verbose_name_plural': 'Importer - Targets',
+ },
+ ),
+ migrations.CreateModel(
+ name='IshtarSiteProfile',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.TextField(verbose_name='Name')),
+ ('slug', models.SlugField(unique=True, verbose_name='Slug')),
+ ('description', models.TextField(null=True, verbose_name='Description', blank=True)),
+ ('base_color', models.CharField(default=b'rgba(0, 0, 0, 0)', max_length=200, verbose_name='CSS color code for base module')),
+ ('files', models.BooleanField(default=False, verbose_name='Files module')),
+ ('files_color', models.CharField(default=b'rgba(0, 32, 210, 0.1)', max_length=200, verbose_name='CSS color code for files module')),
+ ('context_record', models.BooleanField(default=False, verbose_name='Context records module')),
+ ('context_record_color', models.CharField(default=b'rgba(210,200,0,0.2)', max_length=200, verbose_name='CSS color code for context record module')),
+ ('find', models.BooleanField(default=False, help_text='Need context records module', verbose_name='Finds module')),
+ ('find_index', models.CharField(default=b'O', help_text='To prevent irrelevant indexes, change this parameter only if there is no find in the database', max_length=2, verbose_name='Find index is based on', choices=[('O', 'Operations'), ('CR', 'Context records')])),
+ ('find_color', models.CharField(default=b'rgba(210,0,0,0.15)', max_length=200, verbose_name='CSS color code for find module')),
+ ('warehouse', models.BooleanField(default=False, help_text='Need finds module', verbose_name='Warehouses module')),
+ ('warehouse_color', models.CharField(default=b'rgba(10,20,200,0.15)', max_length=200, verbose_name='CSS code for warehouse module')),
+ ('mapping', models.BooleanField(default=False, verbose_name='Mapping module')),
+ ('mapping_color', models.CharField(default=b'rgba(72, 236, 0, 0.15)', max_length=200, verbose_name='CSS code for mapping module')),
+ ('homepage', models.TextField(help_text='Homepage of Ishtar - if not defined a default homepage will appear. Use the markdown syntax. {random_image} can be used to display a random image.', null=True, verbose_name='Home page', blank=True)),
+ ('file_external_id', models.TextField(default=b'{year}-{numeric_reference}', help_text='Formula to manage file external ID. Change this with care. With incorrect formula, the application might be unusable and import of external data can be destructive.', verbose_name='File external id')),
+ ('parcel_external_id', models.TextField(default=b'{associated_file__external_id}{operation__code_patriarche}-{town__numero_insee}-{section}{parcel_number}', help_text='Formula to manage parcel external ID. Change this with care. With incorrect formula, the application might be unusable and import of external data can be destructive.', verbose_name='Parcel external id')),
+ ('context_record_external_id', models.TextField(default=b'{parcel__external_id}-{label}', help_text='Formula to manage context record external ID. Change this with care. With incorrect formula, the application might be unusable and import of external data can be destructive.', verbose_name='Context record external id')),
+ ('base_find_external_id', models.TextField(default=b'{context_record__external_id}-{label}', help_text='Formula to manage base find external ID. Change this with care. With incorrect formula, the application might be unusable and import of external data can be destructive.', verbose_name='Base find external id')),
+ ('find_external_id', models.TextField(default=b'{get_first_base_find__context_record__external_id}-{label}', help_text='Formula to manage find external ID. Change this with care. With incorrect formula, the application might be unusable and import of external data can be destructive.', verbose_name='Find external id')),
+ ('container_external_id', models.TextField(default=b'{responsible__external_id}-{index}', help_text='Formula to manage container external ID. Change this with care. With incorrect formula, the application might be unusable and import of external data can be destructive.', verbose_name='Container external id')),
+ ('warehouse_external_id', models.TextField(default=b'{name|slug}', help_text='Formula to manage warehouse external ID. Change this with care. With incorrect formula, the application might be unusable and import of external data can be destructive.', verbose_name='Warehouse external id')),
+ ('person_raw_name', models.TextField(default=b'{name|upper} {surname}', help_text='Formula to manage person raw_name. Change this with care. With incorrect formula, the application might be unusable and import of external data can be destructive.', verbose_name='Raw name for person')),
+ ('active', models.BooleanField(default=False, verbose_name='Current active')),
+ ('currency', models.CharField(default='\u20ac', max_length=b'5', verbose_name='Currency', choices=[('\u20ac', 'Euro'), ('$', 'US dollar')])),
+ ],
+ options={
+ 'ordering': ['label'],
+ 'verbose_name': 'Ishtar site profile',
+ 'verbose_name_plural': 'Ishtar site profiles',
+ },
+ bases=(models.Model, ishtar_common.models.Cached),
+ ),
+ migrations.CreateModel(
+ name='IshtarUser',
+ fields=[
+ ('user_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
+ ('advanced_shortcut_menu', models.BooleanField(default=False, verbose_name='Advanced shortcut menu')),
+ ],
+ options={
+ 'verbose_name': 'Ishtar user',
+ 'verbose_name_plural': 'Ishtar users',
+ },
+ bases=('auth.user',),
+ managers=[
+ (b'objects', django.contrib.auth.models.UserManager()),
+ ],
+ ),
+ migrations.CreateModel(
+ name='ItemKey',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('key', models.CharField(max_length=100, verbose_name='Key')),
+ ('object_id', models.PositiveIntegerField()),
+ ('content_type', models.ForeignKey(to='contenttypes.ContentType')),
+ ('importer', models.ForeignKey(blank=True, to='ishtar_common.Import', help_text='Specific key to an import', null=True)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='OperationType',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.CharField(max_length=100, verbose_name='Label')),
+ ('txt_idx', models.CharField(unique=True, max_length=100, verbose_name='Textual ID', validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+$'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')])),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('available', models.BooleanField(default=True, verbose_name='Available')),
+ ('order', models.IntegerField(default=1, verbose_name='Order')),
+ ('preventive', models.BooleanField(default=True, verbose_name='Is preventive')),
+ ],
+ options={
+ 'ordering': ['-preventive', 'order', 'label'],
+ 'verbose_name': 'Operation type',
+ 'verbose_name_plural': 'Operation types',
+ },
+ bases=(ishtar_common.models.Cached, models.Model),
+ ),
+ migrations.CreateModel(
+ name='Organization',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('address', models.TextField(null=True, verbose_name='Address', blank=True)),
+ ('address_complement', models.TextField(null=True, verbose_name='Address complement', blank=True)),
+ ('postal_code', models.CharField(max_length=10, null=True, verbose_name='Postal code', blank=True)),
+ ('town', models.CharField(max_length=70, null=True, verbose_name='Town', blank=True)),
+ ('country', models.CharField(max_length=30, null=True, verbose_name='Country', blank=True)),
+ ('alt_address', models.TextField(null=True, verbose_name='Other address: address', blank=True)),
+ ('alt_address_complement', models.TextField(null=True, verbose_name='Other address: address complement', blank=True)),
+ ('alt_postal_code', models.CharField(max_length=10, null=True, verbose_name='Other address: postal code', blank=True)),
+ ('alt_town', models.CharField(max_length=70, null=True, verbose_name='Other address: town', blank=True)),
+ ('alt_country', models.CharField(max_length=30, null=True, verbose_name='Other address: country', blank=True)),
+ ('phone', models.CharField(max_length=18, null=True, verbose_name='Phone', blank=True)),
+ ('phone_desc', models.CharField(max_length=300, null=True, verbose_name='Phone description', blank=True)),
+ ('phone2', models.CharField(max_length=18, null=True, verbose_name='Phone description 2', blank=True)),
+ ('phone_desc2', models.CharField(max_length=300, null=True, verbose_name='Phone description 2', blank=True)),
+ ('phone3', models.CharField(max_length=18, null=True, verbose_name='Phone 3', blank=True)),
+ ('phone_desc3', models.CharField(max_length=300, null=True, verbose_name='Phone description 3', blank=True)),
+ ('raw_phone', models.TextField(null=True, verbose_name='Raw phone', blank=True)),
+ ('mobile_phone', models.CharField(max_length=18, null=True, verbose_name='Mobile phone', blank=True)),
+ ('email', models.EmailField(max_length=300, null=True, verbose_name='Email', blank=True)),
+ ('alt_address_is_prefered', models.BooleanField(default=False, verbose_name='Alternative address is prefered')),
+ ('merge_key', models.TextField(null=True, verbose_name='Merge key', blank=True)),
+ ('archived', models.NullBooleanField(default=False)),
+ ('name', models.CharField(max_length=500, verbose_name='Name')),
+ ('history_creator', models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Creator', blank=True, to=settings.AUTH_USER_MODEL, null=True)),
+ ('history_modifier', models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Last editor', blank=True, to=settings.AUTH_USER_MODEL, null=True)),
+ ('imports', models.ManyToManyField(related_name='imported_ishtar_common_organization', to='ishtar_common.Import', blank=True)),
+ ('merge_candidate', models.ManyToManyField(related_name='merge_candidate_rel_+', to='ishtar_common.Organization', blank=True)),
+ ('merge_exclusion', models.ManyToManyField(related_name='merge_exclusion_rel_+', to='ishtar_common.Organization', blank=True)),
+ ],
+ options={
+ 'verbose_name': 'Organization',
+ 'verbose_name_plural': 'Organizations',
+ 'permissions': (('view_organization', 'Peut voir toutes les Organisations'), ('view_own_organization', 'Peut voir sa propre Organisation'), ('add_own_organization', 'Peut ajouter sa propre Organisation'), ('change_own_organization', 'Peut modifier sa propre Organisation'), ('delete_own_organization', 'Peut supprimer sa propre Organisation')),
+ },
+ bases=(models.Model, ishtar_common.models.OwnPerms, ishtar_common.models.ValueGetter),
+ ),
+ migrations.CreateModel(
+ name='OrganizationType',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.CharField(max_length=100, verbose_name='Label')),
+ ('txt_idx', models.CharField(unique=True, max_length=100, verbose_name='Textual ID', validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+$'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')])),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('available', models.BooleanField(default=True, verbose_name='Available')),
+ ],
+ options={
+ 'ordering': ('label',),
+ 'verbose_name': 'Organization type',
+ 'verbose_name_plural': 'Organization types',
+ },
+ bases=(ishtar_common.models.Cached, models.Model),
+ ),
+ migrations.CreateModel(
+ name='Person',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('address', models.TextField(null=True, verbose_name='Address', blank=True)),
+ ('address_complement', models.TextField(null=True, verbose_name='Address complement', blank=True)),
+ ('postal_code', models.CharField(max_length=10, null=True, verbose_name='Postal code', blank=True)),
+ ('town', models.CharField(max_length=70, null=True, verbose_name='Town', blank=True)),
+ ('country', models.CharField(max_length=30, null=True, verbose_name='Country', blank=True)),
+ ('alt_address', models.TextField(null=True, verbose_name='Other address: address', blank=True)),
+ ('alt_address_complement', models.TextField(null=True, verbose_name='Other address: address complement', blank=True)),
+ ('alt_postal_code', models.CharField(max_length=10, null=True, verbose_name='Other address: postal code', blank=True)),
+ ('alt_town', models.CharField(max_length=70, null=True, verbose_name='Other address: town', blank=True)),
+ ('alt_country', models.CharField(max_length=30, null=True, verbose_name='Other address: country', blank=True)),
+ ('phone', models.CharField(max_length=18, null=True, verbose_name='Phone', blank=True)),
+ ('phone_desc', models.CharField(max_length=300, null=True, verbose_name='Phone description', blank=True)),
+ ('phone2', models.CharField(max_length=18, null=True, verbose_name='Phone description 2', blank=True)),
+ ('phone_desc2', models.CharField(max_length=300, null=True, verbose_name='Phone description 2', blank=True)),
+ ('phone3', models.CharField(max_length=18, null=True, verbose_name='Phone 3', blank=True)),
+ ('phone_desc3', models.CharField(max_length=300, null=True, verbose_name='Phone description 3', blank=True)),
+ ('raw_phone', models.TextField(null=True, verbose_name='Raw phone', blank=True)),
+ ('mobile_phone', models.CharField(max_length=18, null=True, verbose_name='Mobile phone', blank=True)),
+ ('email', models.EmailField(max_length=300, null=True, verbose_name='Email', blank=True)),
+ ('alt_address_is_prefered', models.BooleanField(default=False, verbose_name='Alternative address is prefered')),
+ ('merge_key', models.TextField(null=True, verbose_name='Merge key', blank=True)),
+ ('archived', models.NullBooleanField(default=False)),
+ ('old_title', models.CharField(blank=True, max_length=100, null=True, verbose_name='Title', choices=[(b'Mr', 'Mr'), (b'Ms', 'Miss'), (b'Mr and Miss', 'Mr and Mrs'), (b'Md', 'Mrs'), (b'Dr', 'Doctor')])),
+ ('salutation', models.CharField(max_length=200, null=True, verbose_name='Salutation', blank=True)),
+ ('surname', models.CharField(max_length=50, null=True, verbose_name='Surname', blank=True)),
+ ('name', models.CharField(max_length=200, null=True, verbose_name='Name', blank=True)),
+ ('raw_name', models.CharField(max_length=300, null=True, verbose_name='Raw name', blank=True)),
+ ('contact_type', models.CharField(max_length=300, null=True, verbose_name='Contact type', blank=True)),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('attached_to', models.ForeignKey(related_name='members', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Is attached to', blank=True, to='ishtar_common.Organization', null=True)),
+ ('history_creator', models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Creator', blank=True, to=settings.AUTH_USER_MODEL, null=True)),
+ ('history_modifier', models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Last editor', blank=True, to=settings.AUTH_USER_MODEL, null=True)),
+ ('imports', models.ManyToManyField(related_name='imported_ishtar_common_person', to='ishtar_common.Import', blank=True)),
+ ('merge_candidate', models.ManyToManyField(related_name='merge_candidate_rel_+', to='ishtar_common.Person', blank=True)),
+ ('merge_exclusion', models.ManyToManyField(related_name='merge_exclusion_rel_+', to='ishtar_common.Person', blank=True)),
+ ],
+ options={
+ 'verbose_name': 'Person',
+ 'verbose_name_plural': 'Persons',
+ 'permissions': (('view_person', 'Peut voir toutes les Personnes'), ('view_own_person', 'Peut voir sa propre Personne'), ('add_own_person', 'Peut ajouter sa propre Personne'), ('change_own_person', 'Peut modifier sa propre Personne'), ('delete_own_person', 'Peut supprimer sa propre Personne')),
+ },
+ bases=(models.Model, ishtar_common.models.OwnPerms, ishtar_common.models.ValueGetter),
+ ),
+ migrations.CreateModel(
+ name='PersonType',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.CharField(max_length=100, verbose_name='Label')),
+ ('txt_idx', models.CharField(unique=True, max_length=100, verbose_name='Textual ID', validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+$'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')])),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('available', models.BooleanField(default=True, verbose_name='Available')),
+ ('groups', models.ManyToManyField(to='auth.Group', verbose_name='Groups', blank=True)),
+ ],
+ options={
+ 'ordering': ('label',),
+ 'verbose_name': 'Person type',
+ 'verbose_name_plural': 'Person types',
+ },
+ bases=(ishtar_common.models.Cached, models.Model),
+ ),
+ migrations.CreateModel(
+ name='Regexp',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(max_length=100, verbose_name='Name')),
+ ('description', models.CharField(max_length=500, null=True, verbose_name='Description', blank=True)),
+ ('regexp', models.CharField(max_length=500, verbose_name='Regular expression')),
+ ],
+ options={
+ 'verbose_name': 'Importer - Regular expression',
+ 'verbose_name_plural': 'Importer - Regular expressions',
+ },
+ ),
+ migrations.CreateModel(
+ name='SourceType',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.CharField(max_length=100, verbose_name='Label')),
+ ('txt_idx', models.CharField(unique=True, max_length=100, verbose_name='Textual ID', validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+$'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')])),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('available', models.BooleanField(default=True, verbose_name='Available')),
+ ],
+ options={
+ 'ordering': ['label'],
+ 'verbose_name': 'Source type',
+ 'verbose_name_plural': 'Source types',
+ },
+ bases=(ishtar_common.models.Cached, models.Model),
+ ),
+ migrations.CreateModel(
+ name='SpatialReferenceSystem',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.CharField(max_length=100, verbose_name='Label')),
+ ('txt_idx', models.CharField(unique=True, max_length=100, verbose_name='Textual ID', validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+$'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')])),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('available', models.BooleanField(default=True, verbose_name='Available')),
+ ('order', models.IntegerField(default=10, verbose_name='Order')),
+ ('auth_name', models.CharField(default=b'EPSG', max_length=256, verbose_name='Authority name')),
+ ('srid', models.IntegerField(verbose_name='Authority SRID')),
+ ],
+ options={
+ 'ordering': ('label',),
+ 'verbose_name': 'Spatial reference system',
+ 'verbose_name_plural': 'Spatial reference systems',
+ },
+ bases=(ishtar_common.models.Cached, models.Model),
+ ),
+ migrations.CreateModel(
+ name='State',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.CharField(max_length=30, verbose_name='Label')),
+ ('number', models.CharField(unique=True, max_length=3, verbose_name='Number')),
+ ],
+ options={
+ 'ordering': ['number'],
+ 'verbose_name': 'State',
+ },
+ ),
+ migrations.CreateModel(
+ name='SupportType',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.CharField(max_length=100, verbose_name='Label')),
+ ('txt_idx', models.CharField(unique=True, max_length=100, verbose_name='Textual ID', validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+$'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')])),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('available', models.BooleanField(default=True, verbose_name='Available')),
+ ],
+ options={
+ 'verbose_name': 'Support type',
+ 'verbose_name_plural': 'Support types',
+ },
+ bases=(ishtar_common.models.Cached, models.Model),
+ ),
+ migrations.CreateModel(
+ name='TargetKey',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('key', models.TextField(verbose_name='Key')),
+ ('value', models.TextField(null=True, verbose_name='Value', blank=True)),
+ ('is_set', models.BooleanField(default=False, verbose_name='Is set')),
+ ('associated_import', models.ForeignKey(blank=True, to='ishtar_common.Import', null=True)),
+ ('associated_user', models.ForeignKey(blank=True, to='ishtar_common.IshtarUser', null=True)),
+ ('target', models.ForeignKey(related_name='keys', to='ishtar_common.ImportTarget')),
+ ],
+ options={
+ 'verbose_name': 'Importer - Target key',
+ 'verbose_name_plural': 'Importer - Targets keys',
+ },
+ ),
+ migrations.CreateModel(
+ name='TitleType',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('label', models.CharField(max_length=100, verbose_name='Label')),
+ ('txt_idx', models.CharField(unique=True, max_length=100, verbose_name='Textual ID', validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+$'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')])),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('available', models.BooleanField(default=True, verbose_name='Available')),
+ ],
+ options={
+ 'ordering': ('label',),
+ 'verbose_name': 'Title type',
+ 'verbose_name_plural': 'Title types',
+ },
+ bases=(ishtar_common.models.Cached, models.Model),
+ ),
+ migrations.CreateModel(
+ name='Town',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(max_length=100, verbose_name='Name')),
+ ('surface', models.IntegerField(null=True, verbose_name='Surface (m2)', blank=True)),
+ ('center', django.contrib.gis.db.models.fields.PointField(srid=27572, null=True, verbose_name='Localisation', blank=True)),
+ ('numero_insee', models.CharField(unique=True, max_length=6, verbose_name='Num\xe9ro INSEE')),
+ ('canton', models.ForeignKey(verbose_name='Canton', blank=True, to='ishtar_common.Canton', null=True)),
+ ('departement', models.ForeignKey(verbose_name='D\xe9partement', blank=True, to='ishtar_common.Department', null=True)),
+ ('imports', models.ManyToManyField(related_name='imported_ishtar_common_town', to='ishtar_common.Import', blank=True)),
+ ],
+ options={
+ 'ordering': ['numero_insee'],
+ 'verbose_name': 'Town',
+ 'verbose_name_plural': 'Towns',
+ },
+ ),
+ migrations.AddField(
+ model_name='person',
+ name='person_types',
+ field=models.ManyToManyField(to='ishtar_common.PersonType', verbose_name='Types'),
+ ),
+ migrations.AddField(
+ model_name='person',
+ name='title',
+ field=models.ForeignKey(verbose_name='Title', blank=True, to='ishtar_common.TitleType', null=True),
+ ),
+ migrations.AddField(
+ model_name='organization',
+ name='organization_type',
+ field=models.ForeignKey(verbose_name='Type', to='ishtar_common.OrganizationType'),
+ ),
+ migrations.AddField(
+ model_name='ishtaruser',
+ name='person',
+ field=models.OneToOneField(related_name='ishtaruser', verbose_name='Person', to='ishtar_common.Person'),
+ ),
+ migrations.AddField(
+ model_name='importtarget',
+ name='regexp_filter',
+ field=models.ForeignKey(blank=True, to='ishtar_common.Regexp', null=True),
+ ),
+ migrations.AddField(
+ model_name='importertype',
+ name='users',
+ field=models.ManyToManyField(to='ishtar_common.IshtarUser', verbose_name='Users', blank=True),
+ ),
+ migrations.AddField(
+ model_name='importerdefault',
+ name='importer_type',
+ field=models.ForeignKey(related_name='defaults', to='ishtar_common.ImporterType'),
+ ),
+ migrations.AddField(
+ model_name='importercolumn',
+ name='importer_type',
+ field=models.ForeignKey(related_name='columns', to='ishtar_common.ImporterType'),
+ ),
+ migrations.AddField(
+ model_name='importercolumn',
+ name='regexp_pre_filter',
+ field=models.ForeignKey(blank=True, to='ishtar_common.Regexp', null=True),
+ ),
+ migrations.AddField(
+ model_name='import',
+ name='importer_type',
+ field=models.ForeignKey(to='ishtar_common.ImporterType'),
+ ),
+ migrations.AddField(
+ model_name='import',
+ name='user',
+ field=models.ForeignKey(to='ishtar_common.IshtarUser'),
+ ),
+ migrations.AddField(
+ model_name='historicalperson',
+ name='attached_to',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='ishtar_common.Organization', null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalperson',
+ name='history_creator',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to=settings.AUTH_USER_MODEL, null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalperson',
+ name='history_modifier',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to=settings.AUTH_USER_MODEL, null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalperson',
+ name='history_user',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalperson',
+ name='title',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='ishtar_common.TitleType', null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalorganization',
+ name='history_creator',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to=settings.AUTH_USER_MODEL, null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalorganization',
+ name='history_modifier',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to=settings.AUTH_USER_MODEL, null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalorganization',
+ name='history_user',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalorganization',
+ name='organization_type',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='ishtar_common.OrganizationType', null=True),
+ ),
+ migrations.AlterUniqueTogether(
+ name='formatertype',
+ unique_together=set([('formater_type', 'options', 'many_split')]),
+ ),
+ migrations.AddField(
+ model_name='department',
+ name='state',
+ field=models.ForeignKey(verbose_name='State', blank=True, to='ishtar_common.State', null=True),
+ ),
+ migrations.AddField(
+ model_name='author',
+ name='author_type',
+ field=models.ForeignKey(verbose_name='Author type', to='ishtar_common.AuthorType'),
+ ),
+ migrations.AddField(
+ model_name='author',
+ name='person',
+ field=models.ForeignKey(related_name='author', verbose_name='Person', to='ishtar_common.Person'),
+ ),
+ migrations.AddField(
+ model_name='arrondissement',
+ name='department',
+ field=models.ForeignKey(verbose_name='D\xe9partement', to='ishtar_common.Department'),
+ ),
+ migrations.AlterUniqueTogether(
+ name='targetkey',
+ unique_together=set([('target', 'key', 'associated_user', 'associated_import')]),
+ ),
+ migrations.AlterUniqueTogether(
+ name='importercolumn',
+ unique_together=set([('importer_type', 'col_number')]),
+ ),
+ migrations.CreateModel(
+ name='AdministrationScript',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('path', models.CharField(max_length=30, verbose_name='Filename')),
+ ('name', models.TextField(null=True, verbose_name='Name', blank=True)),
+ ],
+ options={
+ 'ordering': ['name'],
+ 'verbose_name': 'Administration script',
+ 'verbose_name_plural': 'Administration scripts',
+ },
+ ),
+ migrations.CreateModel(
+ name='AdministrationTask',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('state', models.CharField(default=b'S', max_length=2, verbose_name='State', choices=[(b'S', 'Scheduled'), (b'P', 'In progress'), (b'FE', 'Finished with errors'), (b'F', 'Finished')])),
+ ('creation_date', models.DateTimeField(default=datetime.datetime.now)),
+ ('launch_date', models.DateTimeField(null=True, blank=True)),
+ ('finished_date', models.DateTimeField(null=True, blank=True)),
+ ('result', models.TextField(null=True, verbose_name='Result', blank=True)),
+ ('script', models.ForeignKey(to='ishtar_common.AdministrationScript')),
+ ],
+ options={
+ 'ordering': ['script'],
+ 'verbose_name': 'Administration task',
+ 'verbose_name_plural': 'Administration tasks',
+ },
+ ),
+ ]
diff --git a/ishtar_common/migrations/0002_change_ishtaruser_management.py b/ishtar_common/migrations/0002_change_ishtaruser_management.py
new file mode 100644
index 000000000..3dda6d7cb
--- /dev/null
+++ b/ishtar_common/migrations/0002_change_ishtaruser_management.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+from django.conf import settings
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('ishtar_common', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterModelManagers(
+ name='ishtaruser',
+ managers=[
+ ],
+ ),
+ migrations.AlterField(
+ model_name='ishtaruser',
+ name='user_ptr',
+ field=models.OneToOneField(primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL),
+ ),
+ ]
diff --git a/ishtar_common/migrations/0003_auto_20170421_1613.py b/ishtar_common/migrations/0003_auto_20170421_1613.py
new file mode 100644
index 000000000..f82860ff3
--- /dev/null
+++ b/ishtar_common/migrations/0003_auto_20170421_1613.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+from django.conf import settings
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('ishtar_common', '0002_change_ishtaruser_management'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='ishtaruser',
+ name='user_ptr',
+ field=models.OneToOneField(related_name='ishtaruser', primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL),
+ ),
+ ]
diff --git a/ishtar_common/migrations/0077_auto__add_administrationscript__add_administrationtask.py b/ishtar_common/migrations/0077_auto__add_administrationscript__add_administrationtask.py
deleted file mode 100644
index b6f2680e6..000000000
--- a/ishtar_common/migrations/0077_auto__add_administrationscript__add_administrationtask.py
+++ /dev/null
@@ -1,530 +0,0 @@
-# -*- coding: utf-8 -*-
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-
-class Migration(SchemaMigration):
-
- def forwards(self, orm):
- # Adding model 'AdministrationScript'
- db.create_table('ishtar_common_administrationscript', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('path', self.gf('django.db.models.fields.CharField')(max_length=30)),
- ('name', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ))
- db.send_create_signal('ishtar_common', ['AdministrationScript'])
-
- # Adding model 'AdministrationTask'
- db.create_table('ishtar_common_administrationtask', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('script', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.AdministrationScript'])),
- ('state', self.gf('django.db.models.fields.CharField')(default='S', max_length=2)),
- ('creation_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
- ('launch_date', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
- ('finished_date', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
- ('result', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ))
- db.send_create_signal('ishtar_common', ['AdministrationTask'])
-
-
- def backwards(self, orm):
- # Deleting model 'AdministrationScript'
- db.delete_table('ishtar_common_administrationscript')
-
- # Deleting model 'AdministrationTask'
- db.delete_table('ishtar_common_administrationtask')
-
-
- models = {
- 'auth.group': {
- 'Meta': {'object_name': 'Group'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
- 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
- },
- 'auth.permission': {
- 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
- 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
- },
- 'auth.user': {
- 'Meta': {'object_name': 'User'},
- 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
- 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
- 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
- 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
- },
- 'contenttypes.contenttype': {
- 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
- 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
- },
- 'ishtar_common.administrationscript': {
- 'Meta': {'ordering': "['name']", 'object_name': 'AdministrationScript'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'path': ('django.db.models.fields.CharField', [], {'max_length': '30'})
- },
- 'ishtar_common.administrationtask': {
- 'Meta': {'ordering': "['script']", 'object_name': 'AdministrationTask'},
- 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'finished_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'launch_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
- 'result': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'script': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.AdministrationScript']"}),
- 'state': ('django.db.models.fields.CharField', [], {'default': "'S'", 'max_length': '2'})
- },
- 'ishtar_common.arrondissement': {
- 'Meta': {'object_name': 'Arrondissement'},
- 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
- },
- 'ishtar_common.author': {
- 'Meta': {'ordering': "('author_type__order', 'person__name')", 'object_name': 'Author'},
- 'author_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.AuthorType']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'person': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'author'", 'to': "orm['ishtar_common.Person']"})
- },
- 'ishtar_common.authortype': {
- 'Meta': {'ordering': "['order', 'label']", 'object_name': 'AuthorType'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
- },
- 'ishtar_common.canton': {
- 'Meta': {'object_name': 'Canton'},
- 'arrondissement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Arrondissement']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
- },
- 'ishtar_common.department': {
- 'Meta': {'ordering': "['number']", 'object_name': 'Department'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
- 'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'}),
- 'state': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.State']", 'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.documenttemplate': {
- 'Meta': {'ordering': "['associated_object_name', 'name']", 'object_name': 'DocumentTemplate'},
- 'associated_object_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'template': ('django.db.models.fields.files.FileField', [], {'max_length': '100'})
- },
- 'ishtar_common.format': {
- 'Meta': {'ordering': "['label']", 'object_name': 'Format'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
- },
- 'ishtar_common.formatertype': {
- 'Meta': {'ordering': "('formater_type', 'options')", 'unique_together': "(('formater_type', 'options', 'many_split'),)", 'object_name': 'FormaterType'},
- 'formater_type': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'many_split': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'options': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.globalvar': {
- 'Meta': {'ordering': "['slug']", 'object_name': 'GlobalVar'},
- 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
- 'value': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.historicalorganization': {
- 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalOrganization'},
- 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'alt_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'alt_address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'alt_address_is_prefered': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'alt_country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
- 'alt_postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'alt_town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}),
- 'archived': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
- 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
- 'email': ('django.db.models.fields.EmailField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'history_creator_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'history_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
- 'history_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'history_modifier_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'history_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
- 'history_user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}),
- 'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
- 'merge_key': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
- 'organization_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'phone2': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'phone3': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'phone_desc': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'phone_desc2': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'phone_desc3': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'raw_phone': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.historicalperson': {
- 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalPerson'},
- 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'alt_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'alt_address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'alt_address_is_prefered': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'alt_country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
- 'alt_postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'alt_town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}),
- 'archived': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
- 'attached_to_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'contact_type': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
- 'email': ('django.db.models.fields.EmailField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'history_creator_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'history_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
- 'history_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'history_modifier_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'history_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
- 'history_user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}),
- 'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
- 'merge_key': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
- 'old_title': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
- 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'phone2': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'phone3': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'phone_desc': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'phone_desc2': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'phone_desc3': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'raw_name': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'raw_phone': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'salutation': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
- 'surname': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
- 'title_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.import': {
- 'Meta': {'object_name': 'Import'},
- 'conservative_import': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
- 'encoding': ('django.db.models.fields.CharField', [], {'default': "'utf-8'", 'max_length': '15'}),
- 'end_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
- 'error_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'imported_file': ('django.db.models.fields.files.FileField', [], {'max_length': '220'}),
- 'imported_images': ('django.db.models.fields.files.FileField', [], {'max_length': '220', 'null': 'True', 'blank': 'True'}),
- 'importer_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.ImporterType']"}),
- 'match_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}),
- 'result_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
- 'seconds_remaining': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
- 'skip_lines': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
- 'state': ('django.db.models.fields.CharField', [], {'default': "'C'", 'max_length': '2'}),
- 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.IshtarUser']"})
- },
- 'ishtar_common.importercolumn': {
- 'Meta': {'ordering': "('importer_type', 'col_number')", 'unique_together': "(('importer_type', 'col_number'),)", 'object_name': 'ImporterColumn'},
- 'col_number': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
- 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'export_field_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'importer_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'columns'", 'to': "orm['ishtar_common.ImporterType']"}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
- 'regexp_pre_filter': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Regexp']", 'null': 'True', 'blank': 'True'}),
- 'required': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
- },
- 'ishtar_common.importerdefault': {
- 'Meta': {'object_name': 'ImporterDefault'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'importer_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'defaults'", 'to': "orm['ishtar_common.ImporterType']"}),
- 'target': ('django.db.models.fields.CharField', [], {'max_length': '500'})
- },
- 'ishtar_common.importerdefaultvalues': {
- 'Meta': {'object_name': 'ImporterDefaultValues'},
- 'default_target': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'default_values'", 'to': "orm['ishtar_common.ImporterDefault']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'target': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
- 'value': ('django.db.models.fields.CharField', [], {'max_length': '500'})
- },
- 'ishtar_common.importerduplicatefield': {
- 'Meta': {'object_name': 'ImporterDuplicateField'},
- 'column': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'duplicate_fields'", 'to': "orm['ishtar_common.ImporterColumn']"}),
- 'concat': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'concat_str': ('django.db.models.fields.CharField', [], {'max_length': '5', 'null': 'True', 'blank': 'True'}),
- 'field_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
- 'force_new': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
- },
- 'ishtar_common.importermodel': {
- 'Meta': {'ordering': "('name',)", 'object_name': 'ImporterModel'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'klass': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'})
- },
- 'ishtar_common.importertype': {
- 'Meta': {'ordering': "('name',)", 'object_name': 'ImporterType'},
- 'associated_models': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.ImporterModel']"}),
- 'created_models': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.ImporterModel']"}),
- 'description': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'is_template': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
- 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '100', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
- 'unicity_keys': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}),
- 'users': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['ishtar_common.IshtarUser']", 'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.importtarget': {
- 'Meta': {'object_name': 'ImportTarget'},
- 'column': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'targets'", 'to': "orm['ishtar_common.ImporterColumn']"}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'concat': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'concat_str': ('django.db.models.fields.CharField', [], {'max_length': '5', 'null': 'True', 'blank': 'True'}),
- 'force_new': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'formater_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.FormaterType']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'regexp_filter': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Regexp']", 'null': 'True', 'blank': 'True'}),
- 'target': ('django.db.models.fields.CharField', [], {'max_length': '500'})
- },
- 'ishtar_common.ishtarsiteprofile': {
- 'Meta': {'ordering': "['label']", 'object_name': 'IshtarSiteProfile'},
- 'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'base_color': ('django.db.models.fields.CharField', [], {'default': "'rgba(0, 0, 0, 0)'", 'max_length': '200'}),
- 'base_find_external_id': ('django.db.models.fields.TextField', [], {'default': "'{context_record__external_id}-{label}'"}),
- 'container_external_id': ('django.db.models.fields.TextField', [], {'default': "'{responsible__external_id}-{index}'"}),
- 'context_record': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'context_record_color': ('django.db.models.fields.CharField', [], {'default': "'rgba(210,200,0,0.2)'", 'max_length': '200'}),
- 'context_record_external_id': ('django.db.models.fields.TextField', [], {'default': "'{parcel__external_id}-{label}'"}),
- 'currency': ('django.db.models.fields.CharField', [], {'default': "u'\\u20ac'", 'max_length': "'5'"}),
- 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'file_external_id': ('django.db.models.fields.TextField', [], {'default': "'{year}-{numeric_reference}'"}),
- 'files': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'files_color': ('django.db.models.fields.CharField', [], {'default': "'rgba(0, 32, 210, 0.1)'", 'max_length': '200'}),
- 'find': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'find_color': ('django.db.models.fields.CharField', [], {'default': "'rgba(210,0,0,0.15)'", 'max_length': '200'}),
- 'find_external_id': ('django.db.models.fields.TextField', [], {'default': "'{get_first_base_find__context_record__external_id}-{label}'"}),
- 'find_index': ('django.db.models.fields.CharField', [], {'default': "'O'", 'max_length': '2'}),
- 'homepage': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.TextField', [], {}),
- 'mapping': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'mapping_color': ('django.db.models.fields.CharField', [], {'default': "'rgba(72, 236, 0, 0.15)'", 'max_length': '200'}),
- 'parcel_external_id': ('django.db.models.fields.TextField', [], {'default': "'{associated_file__external_id}{operation__code_patriarche}-{town__numero_insee}-{section}{parcel_number}'"}),
- 'person_raw_name': ('django.db.models.fields.TextField', [], {'default': "'{name|upper} {surname}'"}),
- 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
- 'warehouse': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'warehouse_color': ('django.db.models.fields.CharField', [], {'default': "'rgba(10,20,200,0.15)'", 'max_length': '200'}),
- 'warehouse_external_id': ('django.db.models.fields.TextField', [], {'default': "'{name|slug}'"})
- },
- 'ishtar_common.ishtaruser': {
- 'Meta': {'object_name': 'IshtarUser', '_ormbases': ['auth.User']},
- 'advanced_shortcut_menu': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'person': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ishtaruser'", 'unique': 'True', 'to': "orm['ishtar_common.Person']"}),
- 'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
- },
- 'ishtar_common.itemkey': {
- 'Meta': {'object_name': 'ItemKey'},
- 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'importer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Import']", 'null': 'True', 'blank': 'True'}),
- 'key': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {})
- },
- 'ishtar_common.operationtype': {
- 'Meta': {'ordering': "['-preventive', 'order', 'label']", 'object_name': 'OperationType'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
- 'preventive': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
- },
- 'ishtar_common.organization': {
- 'Meta': {'object_name': 'Organization'},
- 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'alt_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'alt_address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'alt_address_is_prefered': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'alt_country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
- 'alt_postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'alt_town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}),
- 'archived': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
- 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
- 'email': ('django.db.models.fields.EmailField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}),
- 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_ishtar_common_organization'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}),
- 'merge_candidate': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_candidate_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}),
- 'merge_exclusion': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_exclusion_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}),
- 'merge_key': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
- 'organization_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.OrganizationType']"}),
- 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'phone2': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'phone3': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'phone_desc': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'phone_desc2': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'phone_desc3': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'raw_phone': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.organizationtype': {
- 'Meta': {'ordering': "('label',)", 'object_name': 'OrganizationType'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
- },
- 'ishtar_common.person': {
- 'Meta': {'object_name': 'Person'},
- 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'alt_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'alt_address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'alt_address_is_prefered': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'alt_country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
- 'alt_postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'alt_town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}),
- 'archived': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
- 'attached_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'members'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'contact_type': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
- 'email': ('django.db.models.fields.EmailField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}),
- 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_ishtar_common_person'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}),
- 'merge_candidate': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_candidate_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}),
- 'merge_exclusion': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_exclusion_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}),
- 'merge_key': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
- 'old_title': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
- 'person_types': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.PersonType']", 'symmetrical': 'False'}),
- 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'phone2': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'phone3': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
- 'phone_desc': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'phone_desc2': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'phone_desc3': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'raw_name': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
- 'raw_phone': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'salutation': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
- 'surname': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
- 'title': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.TitleType']", 'null': 'True', 'blank': 'True'}),
- 'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.persontype': {
- 'Meta': {'ordering': "('label',)", 'object_name': 'PersonType'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.Group']", 'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
- },
- 'ishtar_common.regexp': {
- 'Meta': {'object_name': 'Regexp'},
- 'description': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'regexp': ('django.db.models.fields.CharField', [], {'max_length': '500'})
- },
- 'ishtar_common.sourcetype': {
- 'Meta': {'ordering': "['label']", 'object_name': 'SourceType'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
- },
- 'ishtar_common.spatialreferencesystem': {
- 'Meta': {'ordering': "('label',)", 'object_name': 'SpatialReferenceSystem'},
- 'auth_name': ('django.db.models.fields.CharField', [], {'default': "'EPSG'", 'max_length': '256'}),
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'order': ('django.db.models.fields.IntegerField', [], {'default': '10'}),
- 'srid': ('django.db.models.fields.IntegerField', [], {}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
- },
- 'ishtar_common.state': {
- 'Meta': {'ordering': "['number']", 'object_name': 'State'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
- 'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'})
- },
- 'ishtar_common.supporttype': {
- 'Meta': {'object_name': 'SupportType'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
- },
- 'ishtar_common.targetkey': {
- 'Meta': {'unique_together': "(('target', 'key', 'associated_user', 'associated_import'),)", 'object_name': 'TargetKey'},
- 'associated_import': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Import']", 'null': 'True', 'blank': 'True'}),
- 'associated_user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.IshtarUser']", 'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'is_set': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'key': ('django.db.models.fields.TextField', [], {}),
- 'target': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'keys'", 'to': "orm['ishtar_common.ImportTarget']"}),
- 'value': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})
- },
- 'ishtar_common.titletype': {
- 'Meta': {'ordering': "('label',)", 'object_name': 'TitleType'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
- },
- 'ishtar_common.town': {
- 'Meta': {'ordering': "['numero_insee']", 'object_name': 'Town'},
- 'canton': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Canton']", 'null': 'True', 'blank': 'True'}),
- 'center': ('django.contrib.gis.db.models.fields.PointField', [], {'srid': '27572', 'null': 'True', 'blank': 'True'}),
- 'departement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_ishtar_common_town'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'numero_insee': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '6'}),
- 'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
- }
- }
-
- complete_apps = ['ishtar_common'] \ No newline at end of file
diff --git a/ishtar_common/model_merging.py b/ishtar_common/model_merging.py
index c577a8cf1..be2867cb6 100644
--- a/ishtar_common/model_merging.py
+++ b/ishtar_common/model_merging.py
@@ -1,11 +1,22 @@
# from https://djangosnippets.org/snippets/2283/
+from django.apps import apps
from django.db import transaction
-from django.db.models import get_models, Model
-from django.contrib.contenttypes.generic import GenericForeignKey
+from django.db.models import Model
+from django.contrib.contenttypes.fields import GenericForeignKey
+from django.core.exceptions import ObjectDoesNotExist
-@transaction.commit_on_success
+def get_models():
+ _apps = apps.app_configs.items()
+ models = []
+ for app_name, app_config in _apps:
+ models += [apps.get_model(app_name, m)
+ for m in apps.get_app_config(app_name).models]
+ return models
+
+
+@transaction.atomic
def merge_model_objects(primary_object, alias_objects=[], keep_old=False):
"""
Use this function to merge model objects (i.e. Users, Organizations, Polls,
@@ -63,7 +74,10 @@ def merge_model_objects(primary_object, alias_objects=[], keep_old=False):
alias_varname = related_object.get_accessor_name()
# The variable name on the related model.
obj_varname = related_object.field.name
- related_objects = getattr(alias_object, alias_varname)
+ try:
+ related_objects = getattr(alias_object, alias_varname)
+ except ObjectDoesNotExist:
+ continue
for obj in related_objects.all():
setattr(obj, obj_varname, primary_object)
obj.save()
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 7f79df72f..01b46b7ae 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -30,9 +30,11 @@ import logging
import os
from os.path import isfile, join
import re
+from secretary import Renderer as SecretaryRenderer
import shutil
from subprocess import Popen, PIPE
import tempfile
+import time
import unicodecsv
import zipfile
@@ -57,38 +59,29 @@ from django.template.defaultfilters import slugify
from django.contrib.auth.models import User, Group
from django.contrib.contenttypes.models import ContentType
-from django.contrib.contenttypes import generic
+from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.gis.db import models
from simple_history.models import HistoricalRecords as BaseHistoricalRecords
-from ishtar_common.ooo_replace import ooo_replace
from ishtar_common.model_merging import merge_model_objects
from ishtar_common.utils import get_cache, disable_for_loaddata
from ishtar_common.data_importer import Importer, ImportFormater, \
IntegerFormater, FloatFormater, UnicodeFormater, DateFormater, \
TypeFormater, YearFormater, StrToBoolean, FileFormater
-
logger = logging.getLogger(__name__)
def post_save_user(sender, **kwargs):
user = kwargs['instance']
- try:
- q = IshtarUser.objects.filter(username=user.username)
- if not q.count():
- ishtaruser = IshtarUser.create_from_user(user)
- else:
- ishtaruser = q.all()[0]
- administrator, created = PersonType.objects.get_or_create(
- txt_idx='administrator')
- if ishtaruser.is_superuser \
- and not ishtaruser.has_right('administrator'):
- ishtaruser.person.person_types.add(administrator)
- except DatabaseError: # manage when db is not synced
- pass
+ if kwargs["created"]:
+ try:
+ IshtarUser.create_from_user(user)
+ except DatabaseError: # manage when db is not synced
+ pass
+ IshtarUser.set_superuser(user)
post_save.connect(post_save_user, sender=User)
@@ -132,7 +125,7 @@ def check_model_access_control(request, model, available_perms=None):
class Imported(models.Model):
imports = models.ManyToManyField(
- 'Import', blank=True, null=True,
+ 'Import', blank=True,
related_name="imported_%(app_label)s_%(class)s")
class Meta:
@@ -158,6 +151,15 @@ class ValueGetter(object):
values[prefix + field_name] = value
for extra_field in self.GET_VALUES_EXTRA:
values[prefix + extra_field] = getattr(self, extra_field) or ''
+ for key in values.keys():
+ val = values[key]
+ if val is None:
+ val = ''
+ else:
+ val = unicode(val)
+ if val.endswith('.None'):
+ val = ''
+ values[key] = val
values['KEYS'] = u'\n'.join(values.keys())
value_list = []
for key in values.keys():
@@ -187,7 +189,7 @@ class HistoricalRecords(BaseHistoricalRecords):
history_modifier = getattr(instance, 'history_modifier', None)
assert history_modifier
except (User.DoesNotExist, AssertionError):
- # on batch removing of users, user could have disapeared
+ # on batch removing of users, user could have disappeared
return
manager = getattr(instance, self.manager_name)
attrs = {}
@@ -197,7 +199,8 @@ class HistoricalRecords(BaseHistoricalRecords):
.filter(history_modifier_id=history_modifier.pk)\
.order_by('-history_date', '-history_id')
if not q_history.count():
- manager.create(history_type=type, **attrs)
+ manager.create(history_type=type,
+ history_date=datetime.datetime.now(), **attrs)
return
old_instance = q_history.all()[0]
# multiple saving by the same user in a very short time are generaly
@@ -210,6 +213,8 @@ class HistoricalRecords(BaseHistoricalRecords):
if q.count():
return
+ if 'history_date' not in attrs or not attrs['history_date']:
+ attrs['history_date'] = datetime.datetime.now()
# record a new version only if data have been changed
for field in instance._meta.fields:
if getattr(old_instance, field.attname) != attrs[field.attname]:
@@ -253,7 +258,7 @@ def is_unique(cls, field):
return func
-class OwnPerms:
+class OwnPerms(object):
"""
Manage special permissions for object's owner
"""
@@ -315,13 +320,13 @@ class OwnPerms:
"""
Get Own items
"""
- if isinstance(user, User):
- user = IshtarUser.objects.get(user_ptr=user)
- if user.is_anonymous():
+ if hasattr(user, 'is_authenticated') and not user.is_authenticated():
returned = cls.objects.filter(pk__isnull=True)
if values:
returned = []
return returned
+ if isinstance(user, User):
+ user = IshtarUser.objects.get(user_ptr=user)
items = []
if hasattr(cls, 'BASKET_MODEL'):
items = list(cls.BASKET_MODEL.objects.filter(user=user).all())
@@ -774,7 +779,7 @@ class ItemKey(models.Model):
key = models.CharField(_(u"Key"), max_length=100)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
- content_object = generic.GenericForeignKey('content_type', 'object_id')
+ content_object = GenericForeignKey('content_type', 'object_id')
importer = models.ForeignKey(
'Import', null=True, blank=True,
help_text=_(u"Specific key to an import"))
@@ -869,6 +874,28 @@ class HistoryError(Exception):
PRIVATE_FIELDS = ('id', 'history_modifier', 'order')
+class BulkUpdatedItem(object):
+ @classmethod
+ def bulk_recursion(cls, transaction_id, extra_args):
+ """
+ Prevent infinite recursion. Should not happen but wrong manipulation
+ in the database or messy imports can generate circular relations
+
+ :param transaction_id: current transaction ID (unix time) - if null
+ a transaction ID is generated
+ :param extra_args: arguments dealing with
+ :return: (transaction ID, is a recursion)
+ """
+ if not transaction_id:
+ transaction_id = unicode(time.time())
+ args = ['cached_label_bulk_update', transaction_id] + extra_args
+ key, val = get_cache(cls, args)
+ if val:
+ return transaction_id, True
+ cache.set(key, 1, settings.CACHE_SMALLTIMEOUT)
+ return transaction_id, False
+
+
class BaseHistorizedItem(Imported):
IS_BASKET = False
history_modifier = models.ForeignKey(
@@ -1163,16 +1190,16 @@ class IshtarSiteProfile(models.Model, Cached):
description = models.TextField(_(u"Description"), null=True, blank=True)
base_color = models.CharField(
_(u"CSS color code for base module"),
- default='rgba(0, 0, 0, 0)', max_length=200)
+ default=u'rgba(0, 0, 0, 0)', max_length=200)
files = models.BooleanField(_(u"Files module"), default=False)
files_color = models.CharField(
_(u"CSS color code for files module"),
- default='rgba(0, 32, 210, 0.1)', max_length=200)
+ default=u'rgba(0, 32, 210, 0.1)', max_length=200)
context_record = models.BooleanField(_(u"Context records module"),
default=False)
context_record_color = models.CharField(
_(u"CSS color code for context record module"),
- default='rgba(210,200,0,0.2)', max_length=200)
+ default=u'rgba(210,200,0,0.2)', max_length=200)
find = models.BooleanField(_(u"Finds module"), default=False,
help_text=_(u"Need context records module"))
find_index = models.CharField(
@@ -1182,16 +1209,16 @@ class IshtarSiteProfile(models.Model, Cached):
u"only if there is no find in the database"))
find_color = models.CharField(
_(u"CSS color code for find module"),
- default='rgba(210,0,0,0.15)', max_length=200)
+ default=u'rgba(210,0,0,0.15)', max_length=200)
warehouse = models.BooleanField(
_(u"Warehouses module"), default=False,
help_text=_(u"Need finds module"))
warehouse_color = models.CharField(
- _(u"CSS code for warehouse module"), default='rgba(10,20,200,0.15)',
+ _(u"CSS code for warehouse module"), default=u'rgba(10,20,200,0.15)',
max_length=200)
mapping = models.BooleanField(_(u"Mapping module"), default=False)
mapping_color = models.CharField(
- _(u"CSS code for mapping module"), default='rgba(72, 236, 0, 0.15)',
+ _(u"CSS code for mapping module"), default=u'rgba(72, 236, 0, 0.15)',
max_length=200)
homepage = models.TextField(
_(u"Home page"), null=True, blank=True,
@@ -1200,57 +1227,57 @@ class IshtarSiteProfile(models.Model, Cached):
u"can be used to display a random image."))
file_external_id = models.TextField(
_(u"File external id"),
- default="{year}-{numeric_reference}",
+ default=u"{year}-{numeric_reference}",
help_text=_(u"Formula to manage file external ID. "
u"Change this with care. With incorrect formula, the "
u"application might be unusable and import of external "
u"data can be destructive."))
parcel_external_id = models.TextField(
_(u"Parcel external id"),
- default="{associated_file__external_id}{operation__code_patriarche}-"
- "{town__numero_insee}-{section}{parcel_number}",
+ default=u"{associated_file__external_id}{operation__code_patriarche}-"
+ u"{town__numero_insee}-{section}{parcel_number}",
help_text=_(u"Formula to manage parcel external ID. "
u"Change this with care. With incorrect formula, the "
u"application might be unusable and import of external "
u"data can be destructive."))
context_record_external_id = models.TextField(
_(u"Context record external id"),
- default="{parcel__external_id}-{label}",
+ default=u"{parcel__external_id}-{label}",
help_text=_(u"Formula to manage context record external ID. "
u"Change this with care. With incorrect formula, the "
u"application might be unusable and import of external "
u"data can be destructive."))
base_find_external_id = models.TextField(
_(u"Base find external id"),
- default="{context_record__external_id}-{label}",
+ default=u"{context_record__external_id}-{label}",
help_text=_(u"Formula to manage base find external ID. "
u"Change this with care. With incorrect formula, the "
u"application might be unusable and import of external "
u"data can be destructive."))
find_external_id = models.TextField(
_(u"Find external id"),
- default="{get_first_base_find__context_record__external_id}-{label}",
+ default=u"{get_first_base_find__context_record__external_id}-{label}",
help_text=_(u"Formula to manage find external ID. "
u"Change this with care. With incorrect formula, the "
u"application might be unusable and import of external "
u"data can be destructive."))
container_external_id = models.TextField(
_(u"Container external id"),
- default="{responsible__external_id}-{index}",
+ default=u"{responsible__external_id}-{index}",
help_text=_(u"Formula to manage container external ID. "
u"Change this with care. With incorrect formula, the "
u"application might be unusable and import of external "
u"data can be destructive."))
warehouse_external_id = models.TextField(
_(u"Warehouse external id"),
- default="{name|slug}",
+ default=u"{name|slug}",
help_text=_(u"Formula to manage warehouse external ID. "
u"Change this with care. With incorrect formula, the "
u"application might be unusable and import of external "
u"data can be destructive."))
person_raw_name = models.TextField(
_(u"Raw name for person"),
- default="{name|upper} {surname}",
+ default=u"{name|upper} {surname}",
help_text=_(u"Formula to manage person raw_name. "
u"Change this with care. With incorrect formula, the "
u"application might be unusable and import of external "
@@ -1584,7 +1611,50 @@ class DocumentTemplate(models.Model):
datetime.date.today().strftime('%Y-%m-%d') +\
u"." + self.template.name.split('.')[-1]
values = c_object.get_values()
+ engine = SecretaryRenderer()
+ result = engine.render(self.template, **values)
+ output = open(output_name, 'wb')
+ output.write(result)
+ return output_name
+
+ def convert_from_v1(self):
+ """
+ Convert the current template from v1 to v2.
+ """
+ from old.ooo_replace import ooo_replace
+ from archaeological_operations.models import AdministrativeAct
+
+ old_dir = settings.MEDIA_ROOT + "/upload/templates/v1/"
+ if not os.path.exists(old_dir):
+ os.makedirs(old_dir)
+ shutil.copy(settings.MEDIA_ROOT + self.template.name, old_dir)
+
+ tempdir = tempfile.mkdtemp("-ishtardocs")
+ output_name = tempdir + os.path.sep + self.template.name.split(
+ os.sep)[-1]
+
+ objects = []
+ filters = [
+ {'operation__isnull': False},
+ {'associated_file__isnull': False},
+ {'treatment_file__isnull': False},
+ {'treatment__isnull': False},
+ ]
+ for filtr in filters:
+ q = AdministrativeAct.objects.filter(**filtr)
+ if q.count():
+ objects.append(q.all()[0])
+
+ if not objects:
+ return
+ values = {}
+ for obj in objects:
+ values.update(obj.get_values())
+ for key in values:
+ values[key] = "{{ " + key + " }}"
+
ooo_replace(self.template, output_name, values)
+ shutil.move(output_name, settings.MEDIA_ROOT + self.template.name)
return output_name
@@ -1704,10 +1774,8 @@ class Address(BaseHistorizedItem):
class Merge(models.Model):
merge_key = models.TextField(_("Merge key"), blank=True, null=True)
- merge_candidate = models.ManyToManyField("self",
- blank=True, null=True)
- merge_exclusion = models.ManyToManyField("self",
- blank=True, null=True)
+ merge_candidate = models.ManyToManyField("self", blank=True)
+ merge_exclusion = models.ManyToManyField("self", blank=True)
archived = models.NullBooleanField(default=False,
blank=True, null=True)
# 1 for one word similarity, 2 for two word similarity, etc.
@@ -1846,13 +1914,13 @@ class ImporterType(models.Model):
description = models.CharField(_(u"Description"), blank=True, null=True,
max_length=500)
users = models.ManyToManyField('IshtarUser', verbose_name=_(u"Users"),
- blank=True, null=True)
+ blank=True)
associated_models = models.ForeignKey(
ImporterModel, verbose_name=_(u"Associated model"),
related_name='+', blank=True, null=True)
created_models = models.ManyToManyField(
ImporterModel, verbose_name=_(u"Models that can accept new items"),
- blank=True, null=True, help_text=_(u"Leave blank for no restrictions"),
+ blank=True, help_text=_(u"Leave blank for no restrictions"),
related_name='+')
is_template = models.BooleanField(_(u"Is template"), default=False)
unicity_keys = models.CharField(_(u"Unicity keys (separator \";\")"),
@@ -2366,7 +2434,7 @@ class Import(models.Model):
_(u"Associated images (zip file)"), upload_to="upload/imports/",
blank=True, null=True, max_length=220)
encoding = models.CharField(_(u"Encoding"), choices=ENCODINGS,
- default='utf-8', max_length=15)
+ default=u'utf-8', max_length=15)
skip_lines = models.IntegerField(_(u"Skip lines"), default=1)
error_file = models.FileField(_(u"Error file"),
upload_to="upload/imports/",
@@ -2378,7 +2446,7 @@ class Import(models.Model):
upload_to="upload/imports/",
blank=True, null=True, max_length=255)
state = models.CharField(_(u"State"), max_length=2, choices=IMPORT_STATE,
- default='C')
+ default=u'C')
conservative_import = models.BooleanField(
_(u"Conservative import"), default=False,
help_text='If set to true, do not overload existing values')
@@ -2572,13 +2640,11 @@ class Organization(Address, Merge, OwnPerms, ValueGetter):
verbose_name = _(u"Organization")
verbose_name_plural = _(u"Organizations")
permissions = (
- ("view_organization", ugettext(u"Can view all Organizations")),
- ("view_own_organization", ugettext(u"Can view own Organization")),
- ("add_own_organization", ugettext(u"Can add own Organization")),
- ("change_own_organization",
- ugettext(u"Can change own Organization")),
- ("delete_own_organization",
- ugettext(u"Can delete own Organization")),
+ ("view_organization", u"Can view all Organizations"),
+ ("view_own_organization", u"Can view own Organization"),
+ ("add_own_organization", u"Can add own Organization"),
+ ("change_own_organization", u"Can change own Organization"),
+ ("delete_own_organization", u"Can delete own Organization"),
)
def simple_lbl(self):
@@ -2614,7 +2680,7 @@ class Organization(Address, Merge, OwnPerms, ValueGetter):
class PersonType(GeneralType):
# rights = models.ManyToManyField(WizardStep, verbose_name=_(u"Rights"))
groups = models.ManyToManyField(Group, verbose_name=_(u"Groups"),
- blank=True, null=True)
+ blank=True)
class Meta:
verbose_name = _(u"Person type")
@@ -2689,11 +2755,11 @@ class Person(Address, Merge, OwnPerms, ValueGetter):
verbose_name = _(u"Person")
verbose_name_plural = _(u"Persons")
permissions = (
- ("view_person", ugettext(u"Can view all Persons")),
- ("view_own_person", ugettext(u"Can view own Person")),
- ("add_own_person", ugettext(u"Can add own Person")),
- ("change_own_person", ugettext(u"Can change own Person")),
- ("delete_own_person", ugettext(u"Can delete own Person")),
+ ("view_person", u"Can view all Persons"),
+ ("view_own_person", u"Can view own Person"),
+ ("add_own_person", u"Can add own Person"),
+ ("change_own_person", u"Can change own Person"),
+ ("delete_own_person", u"Can delete own Person"),
)
@property
@@ -2781,21 +2847,21 @@ class Person(Address, Merge, OwnPerms, ValueGetter):
txt_idx__in=right_name).count()) or \
bool(self.person_types.filter(
groups__permissions__codename__in=right_name).count()) or\
- bool(self.ishtaruser.filter(
- groups__permissions__codename__in=right_name
+ bool(self.ishtaruser.user_ptr.groups.filter(
+ permissions__codename__in=right_name
).count()) or\
- bool(self.ishtaruser.filter(
- user_permissions__codename__in=right_name).count())
+ bool(self.ishtaruser.user_ptr.user_permissions.filter(
+ codename__in=right_name).count())
# or self.person_types.filter(wizard__url_name__in=right_name).count())
else:
res = bool(self.person_types.filter(txt_idx=right_name).count()) or \
bool(self.person_types.filter(
groups__permissions__codename=right_name).count()) or \
- bool(self.ishtaruser.filter(
- groups__permissions__codename__in=[right_name]
- ).count()) or\
- bool(self.ishtaruser.filter(
- user_permissions__codename__in=[right_name]).count())
+ bool(self.ishtaruser.user_ptr.groups.filter(
+ permissions__codename__in=[right_name]
+ ).count()) or \
+ bool(self.ishtaruser.user_ptr.user_permissions.filter(
+ codename__in=[right_name]).count())
# or self.person_types.filter(wizard__url_name=right_name).count())
if session:
cache.set(cache_key, res, settings.CACHE_SMALLTIMEOUT)
@@ -2862,7 +2928,7 @@ class Person(Address, Merge, OwnPerms, ValueGetter):
=user.ishtaruser)
-class IshtarUser(User):
+class IshtarUser(models.Model):
TABLE_COLS = ('username', 'person__name', 'person__surname',
'person__email', 'person__person_types_list',
'person__attached_to')
@@ -2879,8 +2945,10 @@ class IshtarUser(User):
}
# fields
- person = models.ForeignKey(Person, verbose_name=_(u"Person"), unique=True,
- related_name='ishtaruser')
+ user_ptr = models.OneToOneField(User, primary_key=True,
+ related_name='ishtaruser')
+ person = models.OneToOneField(Person, verbose_name=_(u"Person"),
+ related_name='ishtaruser')
advanced_shortcut_menu = models.BooleanField(
_(u"Advanced shortcut menu"), default=False)
@@ -2889,6 +2957,20 @@ class IshtarUser(User):
verbose_name_plural = _(u"Ishtar users")
@classmethod
+ def set_superuser(cls, user):
+ q = cls.objects.filter(user_ptr=user)
+ if not q.count():
+ return
+ ishtaruser = q.all()[0]
+ admin, created = PersonType.objects.get_or_create(
+ txt_idx='administrator')
+ person = ishtaruser.person
+ if user.is_superuser:
+ person.person_types.add(admin)
+ elif admin in person.person_types.all():
+ person.person_types.remove(admin)
+
+ @classmethod
def create_from_user(cls, user):
default = user.username
surname = user.first_name or default
@@ -2897,13 +2979,7 @@ class IshtarUser(User):
person = Person.objects.create(surname=surname,
name=name, email=email,
history_modifier=user)
- if user.is_superuser:
- person_type, created = PersonType.objects.get_or_create(
- txt_idx='administrator')
- person.person_types.add(person_type)
- password = user.password
- isht_user = IshtarUser.objects.create(
- user_ptr=user, username=default, person=person, password=password)
+ isht_user = cls.objects.create(user_ptr=user, person=person)
return isht_user
def has_right(self, right_name, session=None):
@@ -2914,20 +2990,17 @@ class IshtarUser(User):
def has_perm(self, perm, model=None, session=None, obj=None):
if not session:
- return super(IshtarUser, self).has_perm(perm, model)
+ return self.user_ptr.has_perm(perm, model)
cache_key = 'usersession-{}-{}-{}-{}'.format(
session.session_key, perm, model.__name__ if model else 'no',
obj.pk if obj else 'no')
res = cache.get(cache_key)
if res in (True, False):
return res
- res = super(IshtarUser, self).has_perm(perm, model)
+ res = self.user_ptr.has_perm(perm, model)
cache.set(cache_key, res, settings.CACHE_SMALLTIMEOUT)
return res
-IshtarUser._meta.get_field('password').help_text = _(
- u"To modify the password use the form in Auth > User")
-
class AuthorType(GeneralType):
order = models.IntegerField(_(u"Order"), default=1)
@@ -2950,16 +3023,11 @@ class Author(models.Model):
verbose_name_plural = _(u"Authors")
ordering = ('author_type__order', 'person__name')
permissions = (
- ("view_author",
- ugettext(u"Can view all Authors")),
- ("view_own_author",
- ugettext(u"Can view own Author")),
- ("add_own_author",
- ugettext(u"Can add own Author")),
- ("change_own_author",
- ugettext(u"Can change own Author")),
- ("delete_own_author",
- ugettext(u"Can delete own Author")),
+ ("view_author", u"Can view all Authors"),
+ ("view_own_author", u"Can view own Author"),
+ ("add_own_author", u"Can add own Author"),
+ ("change_own_author", u"Can change own Author"),
+ ("delete_own_author", u"Can delete own Author"),
)
def __unicode__(self):
@@ -3017,7 +3085,7 @@ class Source(OwnPerms, ImageModel, models.Model):
authors = models.ManyToManyField(Author, verbose_name=_(u"Authors"),
related_name="%(class)s_related")
associated_url = models.URLField(
- verify_exists=False, blank=True, null=True,
+ blank=True, null=True,
verbose_name=_(u"Numerical ressource (web address)"))
receipt_date = models.DateField(blank=True, null=True,
verbose_name=_(u"Receipt date"))
@@ -3156,7 +3224,7 @@ post_delete.connect(post_save_cache, sender=OperationType)
class SpatialReferenceSystem(GeneralType):
order = models.IntegerField(_(u"Order"), default=10)
auth_name = models.CharField(
- _(u"Authority name"), default='EPSG', max_length=256)
+ _(u"Authority name"), default=u'EPSG', max_length=256)
srid = models.IntegerField(_(u"Authority SRID"))
class Meta:
diff --git a/ishtar_common/old_migrations/0001_initial.py b/ishtar_common/old_migrations/0001_initial.py
new file mode 100644
index 000000000..fc22881bc
--- /dev/null
+++ b/ishtar_common/old_migrations/0001_initial.py
@@ -0,0 +1,408 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding model 'Wizard'
+ db.create_table('ishtar_common_wizard', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('url_name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
+ ))
+ db.send_create_signal('ishtar_common', ['Wizard'])
+
+ # Adding model 'WizardStep'
+ db.create_table('ishtar_common_wizardstep', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('order', self.gf('django.db.models.fields.IntegerField')()),
+ ('wizard', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Wizard'])),
+ ('url_name', self.gf('django.db.models.fields.CharField')(max_length=128)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
+ ))
+ db.send_create_signal('ishtar_common', ['WizardStep'])
+
+ # Adding model 'Department'
+ db.create_table('ishtar_common_department', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=30)),
+ ('number', self.gf('django.db.models.fields.CharField')(unique=True, max_length=3)),
+ ))
+ db.send_create_signal('ishtar_common', ['Department'])
+
+ # Adding model 'OrganizationType'
+ db.create_table('ishtar_common_organizationtype', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
+ ))
+ db.send_create_signal('ishtar_common', ['OrganizationType'])
+
+ # Adding model 'HistoricalOrganization'
+ db.create_table('ishtar_common_historicalorganization', (
+ ('id', self.gf('django.db.models.fields.IntegerField')(db_index=True, blank=True)),
+ ('history_modifier_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('address', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('address_complement', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('postal_code', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)),
+ ('town', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('country', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('mobile_phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('organization_type_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('history_id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('history_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
+ ('history_user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True)),
+ ('history_type', self.gf('django.db.models.fields.CharField')(max_length=1)),
+ ))
+ db.send_create_signal('ishtar_common', ['HistoricalOrganization'])
+
+ # Adding model 'Organization'
+ db.create_table('ishtar_common_organization', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('history_modifier', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['auth.User'])),
+ ('address', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('address_complement', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('postal_code', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)),
+ ('town', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('country', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('mobile_phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('organization_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.OrganizationType'])),
+ ))
+ db.send_create_signal('ishtar_common', ['Organization'])
+
+ # Adding model 'PersonType'
+ db.create_table('ishtar_common_persontype', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
+ ))
+ db.send_create_signal('ishtar_common', ['PersonType'])
+
+ # Adding M2M table for field rights on 'PersonType'
+ db.create_table('ishtar_common_persontype_rights', (
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+ ('persontype', models.ForeignKey(orm['ishtar_common.persontype'], null=False)),
+ ('wizardstep', models.ForeignKey(orm['ishtar_common.wizardstep'], null=False))
+ ))
+ db.create_unique('ishtar_common_persontype_rights', ['persontype_id', 'wizardstep_id'])
+
+ # Adding model 'Person'
+ db.create_table('ishtar_common_person', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('history_modifier', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['auth.User'])),
+ ('address', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('address_complement', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('postal_code', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)),
+ ('town', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('country', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('mobile_phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('title', self.gf('django.db.models.fields.CharField')(max_length=2)),
+ ('surname', self.gf('django.db.models.fields.CharField')(max_length=20)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=30)),
+ ('email', self.gf('django.db.models.fields.CharField')(max_length=40, null=True, blank=True)),
+ ('person_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.PersonType'])),
+ ('attached_to', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Organization'], null=True, blank=True)),
+ ))
+ db.send_create_signal('ishtar_common', ['Person'])
+
+ # Adding model 'IshtarUser'
+ db.create_table('ishtar_common_ishtaruser', (
+ ('user_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['auth.User'], unique=True, primary_key=True)),
+ ('person', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Person'], unique=True)),
+ ))
+ db.send_create_signal('ishtar_common', ['IshtarUser'])
+
+ # Adding model 'AuthorType'
+ db.create_table('ishtar_common_authortype', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
+ ))
+ db.send_create_signal('ishtar_common', ['AuthorType'])
+
+ # Adding model 'Author'
+ db.create_table('ishtar_common_author', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('person', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Person'])),
+ ('author_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.AuthorType'])),
+ ))
+ db.send_create_signal('ishtar_common', ['Author'])
+
+ # Adding model 'SourceType'
+ db.create_table('ishtar_common_sourcetype', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
+ ))
+ db.send_create_signal('ishtar_common', ['SourceType'])
+
+ # Adding model 'Arrondissement'
+ db.create_table('ishtar_common_arrondissement', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=30)),
+ ('department', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Department'])),
+ ))
+ db.send_create_signal('ishtar_common', ['Arrondissement'])
+
+ # Adding model 'Canton'
+ db.create_table('ishtar_common_canton', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=30)),
+ ('arrondissement', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Arrondissement'])),
+ ))
+ db.send_create_signal('ishtar_common', ['Canton'])
+
+ # Adding model 'Town'
+ db.create_table('ishtar_common_town', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('surface', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('center', self.gf('django.contrib.gis.db.models.fields.PointField')(srid=27572, null=True, blank=True)),
+ ('numero_insee', self.gf('django.db.models.fields.CharField')(unique=True, max_length=6)),
+ ('departement', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Department'], null=True, blank=True)),
+ ('canton', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Canton'], null=True, blank=True)),
+ ))
+ db.send_create_signal('ishtar_common', ['Town'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'Wizard'
+ db.delete_table('ishtar_common_wizard')
+
+ # Deleting model 'WizardStep'
+ db.delete_table('ishtar_common_wizardstep')
+
+ # Deleting model 'Department'
+ db.delete_table('ishtar_common_department')
+
+ # Deleting model 'OrganizationType'
+ db.delete_table('ishtar_common_organizationtype')
+
+ # Deleting model 'HistoricalOrganization'
+ db.delete_table('ishtar_common_historicalorganization')
+
+ # Deleting model 'Organization'
+ db.delete_table('ishtar_common_organization')
+
+ # Deleting model 'PersonType'
+ db.delete_table('ishtar_common_persontype')
+
+ # Removing M2M table for field rights on 'PersonType'
+ db.delete_table('ishtar_common_persontype_rights')
+
+ # Deleting model 'Person'
+ db.delete_table('ishtar_common_person')
+
+ # Deleting model 'IshtarUser'
+ db.delete_table('ishtar_common_ishtaruser')
+
+ # Deleting model 'AuthorType'
+ db.delete_table('ishtar_common_authortype')
+
+ # Deleting model 'Author'
+ db.delete_table('ishtar_common_author')
+
+ # Deleting model 'SourceType'
+ db.delete_table('ishtar_common_sourcetype')
+
+ # Deleting model 'Arrondissement'
+ db.delete_table('ishtar_common_arrondissement')
+
+ # Deleting model 'Canton'
+ db.delete_table('ishtar_common_canton')
+
+ # Deleting model 'Town'
+ db.delete_table('ishtar_common_town')
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'ishtar_common.arrondissement': {
+ 'Meta': {'object_name': 'Arrondissement'},
+ 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
+ },
+ 'ishtar_common.author': {
+ 'Meta': {'object_name': 'Author'},
+ 'author_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.AuthorType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']"})
+ },
+ 'ishtar_common.authortype': {
+ 'Meta': {'object_name': 'AuthorType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.canton': {
+ 'Meta': {'object_name': 'Canton'},
+ 'arrondissement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Arrondissement']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
+ },
+ 'ishtar_common.department': {
+ 'Meta': {'ordering': "['number']", 'object_name': 'Department'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
+ 'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'})
+ },
+ 'ishtar_common.historicalorganization': {
+ 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalOrganization'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'history_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'history_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'history_modifier_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'history_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
+ 'history_user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}),
+ 'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'organization_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.ishtaruser': {
+ 'Meta': {'object_name': 'IshtarUser', '_ormbases': ['auth.User']},
+ 'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']", 'unique': 'True'}),
+ 'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
+ },
+ 'ishtar_common.organization': {
+ 'Meta': {'object_name': 'Organization'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'organization_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.OrganizationType']"}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.organizationtype': {
+ 'Meta': {'object_name': 'OrganizationType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.person': {
+ 'Meta': {'object_name': 'Person'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'attached_to': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Organization']", 'null': 'True', 'blank': 'True'}),
+ 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'email': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
+ 'person_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.PersonType']"}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.persontype': {
+ 'Meta': {'object_name': 'PersonType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'rights': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.WizardStep']", 'symmetrical': 'False'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.sourcetype': {
+ 'Meta': {'object_name': 'SourceType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.town': {
+ 'Meta': {'ordering': "['numero_insee']", 'object_name': 'Town'},
+ 'canton': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Canton']", 'null': 'True', 'blank': 'True'}),
+ 'center': ('django.contrib.gis.db.models.fields.PointField', [], {'srid': '27572', 'null': 'True', 'blank': 'True'}),
+ 'departement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'numero_insee': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '6'}),
+ 'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.wizard': {
+ 'Meta': {'ordering': "['url_name']", 'object_name': 'Wizard'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'url_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
+ },
+ 'ishtar_common.wizardstep': {
+ 'Meta': {'ordering': "['wizard', 'order']", 'object_name': 'WizardStep'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {}),
+ 'url_name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'wizard': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Wizard']"})
+ }
+ }
+
+ complete_apps = ['ishtar_common'] \ No newline at end of file
diff --git a/ishtar_common/migrations/0002_auto__chg_field_person_surname.py b/ishtar_common/old_migrations/0002_auto__chg_field_person_surname.py
index 105144aac..105144aac 100644
--- a/ishtar_common/migrations/0002_auto__chg_field_person_surname.py
+++ b/ishtar_common/old_migrations/0002_auto__chg_field_person_surname.py
diff --git a/ishtar_common/migrations/0003_auto__del_field_person_person_type.py b/ishtar_common/old_migrations/0003_auto__del_field_person_person_type.py
index 369568ecc..369568ecc 100644
--- a/ishtar_common/migrations/0003_auto__del_field_person_person_type.py
+++ b/ishtar_common/old_migrations/0003_auto__del_field_person_person_type.py
diff --git a/ishtar_common/migrations/0004_auto.py b/ishtar_common/old_migrations/0004_auto.py
index 074080757..074080757 100644
--- a/ishtar_common/migrations/0004_auto.py
+++ b/ishtar_common/old_migrations/0004_auto.py
diff --git a/ishtar_common/migrations/0005_auto__add_documenttemplate.py b/ishtar_common/old_migrations/0005_auto__add_documenttemplate.py
index 383ee5a32..383ee5a32 100644
--- a/ishtar_common/migrations/0005_auto__add_documenttemplate.py
+++ b/ishtar_common/old_migrations/0005_auto__add_documenttemplate.py
diff --git a/ishtar_common/migrations/0006_auto__chg_field_organization_name__chg_field_historicalorganization_na.py b/ishtar_common/old_migrations/0006_auto__chg_field_organization_name__chg_field_historicalorganization_na.py
index f852608a3..f852608a3 100644
--- a/ishtar_common/migrations/0006_auto__chg_field_organization_name__chg_field_historicalorganization_na.py
+++ b/ishtar_common/old_migrations/0006_auto__chg_field_organization_name__chg_field_historicalorganization_na.py
diff --git a/ishtar_common/migrations/0007_auto__add_field_organization_history_creator__add_field_historicalorga.py b/ishtar_common/old_migrations/0007_auto__add_field_organization_history_creator__add_field_historicalorga.py
index 5423b758e..5423b758e 100644
--- a/ishtar_common/migrations/0007_auto__add_field_organization_history_creator__add_field_historicalorga.py
+++ b/ishtar_common/old_migrations/0007_auto__add_field_organization_history_creator__add_field_historicalorga.py
diff --git a/ishtar_common/migrations/0008_init_history_creator.py b/ishtar_common/old_migrations/0008_init_history_creator.py
index c28292e61..c28292e61 100644
--- a/ishtar_common/migrations/0008_init_history_creator.py
+++ b/ishtar_common/old_migrations/0008_init_history_creator.py
diff --git a/ishtar_common/migrations/0009_auto__add_field_organization_email__add_field_historicalorganization_e.py b/ishtar_common/old_migrations/0009_auto__add_field_organization_email__add_field_historicalorganization_e.py
index 1ef247b56..1ef247b56 100644
--- a/ishtar_common/migrations/0009_auto__add_field_organization_email__add_field_historicalorganization_e.py
+++ b/ishtar_common/old_migrations/0009_auto__add_field_organization_email__add_field_historicalorganization_e.py
diff --git a/ishtar_common/migrations/0010_auto__del_wizardstep__del_wizard__add_globalvar__chg_field_person_atta.py b/ishtar_common/old_migrations/0010_auto__del_wizardstep__del_wizard__add_globalvar__chg_field_person_atta.py
index 4bba74da9..4bba74da9 100644
--- a/ishtar_common/migrations/0010_auto__del_wizardstep__del_wizard__add_globalvar__chg_field_person_atta.py
+++ b/ishtar_common/old_migrations/0010_auto__del_wizardstep__del_wizard__add_globalvar__chg_field_person_atta.py
diff --git a/ishtar_common/migrations/0011_auto__chg_field_person_surname__chg_field_person_name.py b/ishtar_common/old_migrations/0011_auto__chg_field_person_surname__chg_field_person_name.py
index a21e00efb..a21e00efb 100644
--- a/ishtar_common/migrations/0011_auto__chg_field_person_surname__chg_field_person_name.py
+++ b/ishtar_common/old_migrations/0011_auto__chg_field_person_surname__chg_field_person_name.py
diff --git a/ishtar_common/migrations/0012_auto__add_field_person_raw_name__chg_field_person_name.py b/ishtar_common/old_migrations/0012_auto__add_field_person_raw_name__chg_field_person_name.py
index 015956610..015956610 100644
--- a/ishtar_common/migrations/0012_auto__add_field_person_raw_name__chg_field_person_name.py
+++ b/ishtar_common/old_migrations/0012_auto__add_field_person_raw_name__chg_field_person_name.py
diff --git a/ishtar_common/migrations/0013_auto__add_field_organization_merge_key__add_field_historicalorganizati.py b/ishtar_common/old_migrations/0013_auto__add_field_organization_merge_key__add_field_historicalorganizati.py
index b0934572d..b0934572d 100644
--- a/ishtar_common/migrations/0013_auto__add_field_organization_merge_key__add_field_historicalorganizati.py
+++ b/ishtar_common/old_migrations/0013_auto__add_field_organization_merge_key__add_field_historicalorganizati.py
diff --git a/ishtar_common/migrations/0014_auto__chg_field_organization_history_creator__chg_field_organization_h.py b/ishtar_common/old_migrations/0014_auto__chg_field_organization_history_creator__chg_field_organization_h.py
index 86783b8fd..86783b8fd 100644
--- a/ishtar_common/migrations/0014_auto__chg_field_organization_history_creator__chg_field_organization_h.py
+++ b/ishtar_common/old_migrations/0014_auto__chg_field_organization_history_creator__chg_field_organization_h.py
diff --git a/ishtar_common/migrations/0015_auto__chg_field_organization_town__chg_field_historicalorganization_to.py b/ishtar_common/old_migrations/0015_auto__chg_field_organization_town__chg_field_historicalorganization_to.py
index d5d1c4742..d5d1c4742 100644
--- a/ishtar_common/migrations/0015_auto__chg_field_organization_town__chg_field_historicalorganization_to.py
+++ b/ishtar_common/old_migrations/0015_auto__chg_field_organization_town__chg_field_historicalorganization_to.py
diff --git a/ishtar_common/migrations/0016_auto__add_import.py b/ishtar_common/old_migrations/0016_auto__add_import.py
index f7d87ff13..f7d87ff13 100644
--- a/ishtar_common/migrations/0016_auto__add_import.py
+++ b/ishtar_common/old_migrations/0016_auto__add_import.py
diff --git a/ishtar_common/migrations/0017_auto__add_supporttype__add_format.py b/ishtar_common/old_migrations/0017_auto__add_supporttype__add_format.py
index 7ce790321..7ce790321 100644
--- a/ishtar_common/migrations/0017_auto__add_supporttype__add_format.py
+++ b/ishtar_common/old_migrations/0017_auto__add_supporttype__add_format.py
diff --git a/ishtar_common/migrations/0018_auto__add_itemkey.py b/ishtar_common/old_migrations/0018_auto__add_itemkey.py
index 4de340549..4de340549 100644
--- a/ishtar_common/migrations/0018_auto__add_itemkey.py
+++ b/ishtar_common/old_migrations/0018_auto__add_itemkey.py
diff --git a/ishtar_common/migrations/0019_auto__add_field_itemkey_importer.py b/ishtar_common/old_migrations/0019_auto__add_field_itemkey_importer.py
index 9206279d1..9206279d1 100644
--- a/ishtar_common/migrations/0019_auto__add_field_itemkey_importer.py
+++ b/ishtar_common/old_migrations/0019_auto__add_field_itemkey_importer.py
diff --git a/ishtar_common/migrations/0020_auto__chg_field_person_title.py b/ishtar_common/old_migrations/0020_auto__chg_field_person_title.py
index 8d4674ace..8d4674ace 100644
--- a/ishtar_common/migrations/0020_auto__chg_field_person_title.py
+++ b/ishtar_common/old_migrations/0020_auto__chg_field_person_title.py
diff --git a/ishtar_common/migrations/0021_auto__add_importerdefault__add_importertype__add_importtarget__add_for.py b/ishtar_common/old_migrations/0021_auto__add_importerdefault__add_importertype__add_importtarget__add_for.py
index 21f6e5f78..21f6e5f78 100644
--- a/ishtar_common/migrations/0021_auto__add_importerdefault__add_importertype__add_importtarget__add_for.py
+++ b/ishtar_common/old_migrations/0021_auto__add_importerdefault__add_importertype__add_importtarget__add_for.py
diff --git a/ishtar_common/migrations/0022_auto__add_field_import_importer_type.py b/ishtar_common/old_migrations/0022_auto__add_field_import_importer_type.py
index d5091b542..d5091b542 100644
--- a/ishtar_common/migrations/0022_auto__add_field_import_importer_type.py
+++ b/ishtar_common/old_migrations/0022_auto__add_field_import_importer_type.py
diff --git a/ishtar_common/migrations/0023_auto__add_importerdefaultvalues__del_field_importerdefault_value.py b/ishtar_common/old_migrations/0023_auto__add_importerdefaultvalues__del_field_importerdefault_value.py
index 74c5e0a1c..74c5e0a1c 100644
--- a/ishtar_common/migrations/0023_auto__add_importerdefaultvalues__del_field_importerdefault_value.py
+++ b/ishtar_common/old_migrations/0023_auto__add_importerdefaultvalues__del_field_importerdefault_value.py
diff --git a/ishtar_common/migrations/0024_auto__add_importerduplicatefield__chg_field_importerdefault_target__ad.py b/ishtar_common/old_migrations/0024_auto__add_importerduplicatefield__chg_field_importerdefault_target__ad.py
index d5d3293f0..d5d3293f0 100644
--- a/ishtar_common/migrations/0024_auto__add_importerduplicatefield__chg_field_importerdefault_target__ad.py
+++ b/ishtar_common/old_migrations/0024_auto__add_importerduplicatefield__chg_field_importerdefault_target__ad.py
diff --git a/ishtar_common/migrations/0025_auto__add_unique_formatertype_formater_type_many_split_options.py b/ishtar_common/old_migrations/0025_auto__add_unique_formatertype_formater_type_many_split_options.py
index 73c88ce1a..73c88ce1a 100644
--- a/ishtar_common/migrations/0025_auto__add_unique_formatertype_formater_type_many_split_options.py
+++ b/ishtar_common/old_migrations/0025_auto__add_unique_formatertype_formater_type_many_split_options.py
diff --git a/ishtar_common/migrations/0026_auto__add_targetkey__add_unique_targetkey_target_value__add_field_impo.py b/ishtar_common/old_migrations/0026_auto__add_targetkey__add_unique_targetkey_target_value__add_field_impo.py
index b4752a48e..b4752a48e 100644
--- a/ishtar_common/migrations/0026_auto__add_targetkey__add_unique_targetkey_target_value__add_field_impo.py
+++ b/ishtar_common/old_migrations/0026_auto__add_targetkey__add_unique_targetkey_target_value__add_field_impo.py
diff --git a/ishtar_common/migrations/0027_auto__chg_field_targetkey_target.py b/ishtar_common/old_migrations/0027_auto__chg_field_targetkey_target.py
index d6ea7e10a..d6ea7e10a 100644
--- a/ishtar_common/migrations/0027_auto__chg_field_targetkey_target.py
+++ b/ishtar_common/old_migrations/0027_auto__chg_field_targetkey_target.py
diff --git a/ishtar_common/migrations/0028_auto__chg_field_targetkey_key__chg_field_targetkey_value.py b/ishtar_common/old_migrations/0028_auto__chg_field_targetkey_key__chg_field_targetkey_value.py
index b99480a2b..b99480a2b 100644
--- a/ishtar_common/migrations/0028_auto__chg_field_targetkey_key__chg_field_targetkey_value.py
+++ b/ishtar_common/old_migrations/0028_auto__chg_field_targetkey_key__chg_field_targetkey_value.py
diff --git a/ishtar_common/migrations/0029_auto.py b/ishtar_common/old_migrations/0029_auto.py
index 9bcf818b5..9bcf818b5 100644
--- a/ishtar_common/migrations/0029_auto.py
+++ b/ishtar_common/old_migrations/0029_auto.py
diff --git a/ishtar_common/migrations/0030_auto__add_state__chg_field_sourcetype_txt_idx__chg_field_authortype_tx.py b/ishtar_common/old_migrations/0030_auto__add_state__chg_field_sourcetype_txt_idx__chg_field_authortype_tx.py
index cd5d06576..cd5d06576 100644
--- a/ishtar_common/migrations/0030_auto__add_state__chg_field_sourcetype_txt_idx__chg_field_authortype_tx.py
+++ b/ishtar_common/old_migrations/0030_auto__add_state__chg_field_sourcetype_txt_idx__chg_field_authortype_tx.py
diff --git a/ishtar_common/migrations/0031_auto__del_unique_targetkey_target_value__add_unique_targetkey_target_k.py b/ishtar_common/old_migrations/0031_auto__del_unique_targetkey_target_value__add_unique_targetkey_target_k.py
index 7fddc0fca..7fddc0fca 100644
--- a/ishtar_common/migrations/0031_auto__del_unique_targetkey_target_value__add_unique_targetkey_target_k.py
+++ b/ishtar_common/old_migrations/0031_auto__del_unique_targetkey_target_value__add_unique_targetkey_target_k.py
diff --git a/ishtar_common/migrations/0033_auto__add_field_targetkey_associated_import__add_field_targetkey_assoc.py b/ishtar_common/old_migrations/0033_auto__add_field_targetkey_associated_import__add_field_targetkey_assoc.py
index 2a6c8fc15..2a6c8fc15 100644
--- a/ishtar_common/migrations/0033_auto__add_field_targetkey_associated_import__add_field_targetkey_assoc.py
+++ b/ishtar_common/old_migrations/0033_auto__add_field_targetkey_associated_import__add_field_targetkey_assoc.py
diff --git a/ishtar_common/migrations/0034_auto__add_field_import_encoding.py b/ishtar_common/old_migrations/0034_auto__add_field_import_encoding.py
index 2774b3c15..2774b3c15 100644
--- a/ishtar_common/migrations/0034_auto__add_field_import_encoding.py
+++ b/ishtar_common/old_migrations/0034_auto__add_field_import_encoding.py
diff --git a/ishtar_common/migrations/0035_auto__add_field_importtarget_force_new__add_field_importerduplicatefie.py b/ishtar_common/old_migrations/0035_auto__add_field_importtarget_force_new__add_field_importerduplicatefie.py
index 2a396ee62..2a396ee62 100644
--- a/ishtar_common/migrations/0035_auto__add_field_importtarget_force_new__add_field_importerduplicatefie.py
+++ b/ishtar_common/old_migrations/0035_auto__add_field_importtarget_force_new__add_field_importerduplicatefie.py
diff --git a/ishtar_common/migrations/0036_auto__add_field_import_imported_images.py b/ishtar_common/old_migrations/0036_auto__add_field_import_imported_images.py
index d0741abca..d0741abca 100644
--- a/ishtar_common/migrations/0036_auto__add_field_import_imported_images.py
+++ b/ishtar_common/old_migrations/0036_auto__add_field_import_imported_images.py
diff --git a/ishtar_common/migrations/0037_auto__add_field_importertype_slug.py b/ishtar_common/old_migrations/0037_auto__add_field_importertype_slug.py
index c7bf06c5d..c7bf06c5d 100644
--- a/ishtar_common/migrations/0037_auto__add_field_importertype_slug.py
+++ b/ishtar_common/old_migrations/0037_auto__add_field_importertype_slug.py
diff --git a/ishtar_common/migrations/0038_auto__add_field_importtarget_comment.py b/ishtar_common/old_migrations/0038_auto__add_field_importtarget_comment.py
index a2cbe1579..a2cbe1579 100644
--- a/ishtar_common/migrations/0038_auto__add_field_importtarget_comment.py
+++ b/ishtar_common/old_migrations/0038_auto__add_field_importtarget_comment.py
diff --git a/ishtar_common/migrations/0039_auto__add_field_import_match_file.py b/ishtar_common/old_migrations/0039_auto__add_field_import_match_file.py
index 6df3e81a8..6df3e81a8 100644
--- a/ishtar_common/migrations/0039_auto__add_field_import_match_file.py
+++ b/ishtar_common/old_migrations/0039_auto__add_field_import_match_file.py
diff --git a/ishtar_common/migrations/0040_auto__chg_field_person_title.py b/ishtar_common/old_migrations/0040_auto__chg_field_person_title.py
index 2623f9eae..2623f9eae 100644
--- a/ishtar_common/migrations/0040_auto__chg_field_person_title.py
+++ b/ishtar_common/old_migrations/0040_auto__chg_field_person_title.py
diff --git a/ishtar_common/migrations/0041_auto__add_field_importertype_unicity_keys__add_field_importtarget_conc.py b/ishtar_common/old_migrations/0041_auto__add_field_importertype_unicity_keys__add_field_importtarget_conc.py
index 990f35efc..990f35efc 100644
--- a/ishtar_common/migrations/0041_auto__add_field_importertype_unicity_keys__add_field_importtarget_conc.py
+++ b/ishtar_common/old_migrations/0041_auto__add_field_importertype_unicity_keys__add_field_importtarget_conc.py
diff --git a/ishtar_common/migrations/0042_auto__add_field_importtarget_concat_str__add_unique_importercolumn_col.py b/ishtar_common/old_migrations/0042_auto__add_field_importtarget_concat_str__add_unique_importercolumn_col.py
index 7f8bac846..7f8bac846 100644
--- a/ishtar_common/migrations/0042_auto__add_field_importtarget_concat_str__add_unique_importercolumn_col.py
+++ b/ishtar_common/old_migrations/0042_auto__add_field_importtarget_concat_str__add_unique_importercolumn_col.py
diff --git a/ishtar_common/migrations/0043_auto__add_field_importerduplicatefield_concat__add_field_importerdupli.py b/ishtar_common/old_migrations/0043_auto__add_field_importerduplicatefield_concat__add_field_importerdupli.py
index efde90aca..efde90aca 100644
--- a/ishtar_common/migrations/0043_auto__add_field_importerduplicatefield_concat__add_field_importerdupli.py
+++ b/ishtar_common/old_migrations/0043_auto__add_field_importerduplicatefield_concat__add_field_importerdupli.py
diff --git a/ishtar_common/migrations/0044_auto__add_operationtype.py b/ishtar_common/old_migrations/0044_auto__add_operationtype.py
index f623809de..f623809de 100644
--- a/ishtar_common/migrations/0044_auto__add_operationtype.py
+++ b/ishtar_common/old_migrations/0044_auto__add_operationtype.py
diff --git a/ishtar_common/migrations/0045_auto__chg_field_person_merge_key__chg_field_historicalorganization_mer.py b/ishtar_common/old_migrations/0045_auto__chg_field_person_merge_key__chg_field_historicalorganization_mer.py
index 39114eba5..39114eba5 100644
--- a/ishtar_common/migrations/0045_auto__chg_field_person_merge_key__chg_field_historicalorganization_mer.py
+++ b/ishtar_common/old_migrations/0045_auto__chg_field_person_merge_key__chg_field_historicalorganization_mer.py
diff --git a/ishtar_common/migrations/0046_auto__add_field_person_exclude_from_merge__add_field_historicalorganiz.py b/ishtar_common/old_migrations/0046_auto__add_field_person_exclude_from_merge__add_field_historicalorganiz.py
index e0dbc9222..e0dbc9222 100644
--- a/ishtar_common/migrations/0046_auto__add_field_person_exclude_from_merge__add_field_historicalorganiz.py
+++ b/ishtar_common/old_migrations/0046_auto__add_field_person_exclude_from_merge__add_field_historicalorganiz.py
diff --git a/ishtar_common/migrations/0047_auto__chg_field_person_exclude_from_merge__chg_field_historicalorganiz.py b/ishtar_common/old_migrations/0047_auto__chg_field_person_exclude_from_merge__chg_field_historicalorganiz.py
index 4bc7b8a48..4bc7b8a48 100644
--- a/ishtar_common/migrations/0047_auto__chg_field_person_exclude_from_merge__chg_field_historicalorganiz.py
+++ b/ishtar_common/old_migrations/0047_auto__chg_field_person_exclude_from_merge__chg_field_historicalorganiz.py
diff --git a/ishtar_common/migrations/0048_auto__add_ishtarsiteprofile.py b/ishtar_common/old_migrations/0048_auto__add_ishtarsiteprofile.py
index 5a2c21bf1..5a2c21bf1 100644
--- a/ishtar_common/migrations/0048_auto__add_ishtarsiteprofile.py
+++ b/ishtar_common/old_migrations/0048_auto__add_ishtarsiteprofile.py
diff --git a/ishtar_common/migrations/0049_auto__add_field_person_alt_address__add_field_person_alt_address_compl.py b/ishtar_common/old_migrations/0049_auto__add_field_person_alt_address__add_field_person_alt_address_compl.py
index d64e3a964..d64e3a964 100644
--- a/ishtar_common/migrations/0049_auto__add_field_person_alt_address__add_field_person_alt_address_compl.py
+++ b/ishtar_common/old_migrations/0049_auto__add_field_person_alt_address__add_field_person_alt_address_compl.py
diff --git a/ishtar_common/migrations/0050_auto__chg_field_person_phone_desc3__chg_field_person_phone_desc2__chg_.py b/ishtar_common/old_migrations/0050_auto__chg_field_person_phone_desc3__chg_field_person_phone_desc2__chg_.py
index b68b3b9bb..b68b3b9bb 100644
--- a/ishtar_common/migrations/0050_auto__chg_field_person_phone_desc3__chg_field_person_phone_desc2__chg_.py
+++ b/ishtar_common/old_migrations/0050_auto__chg_field_person_phone_desc3__chg_field_person_phone_desc2__chg_.py
diff --git a/ishtar_common/migrations/0051_auto__add_field_ishtarsiteprofile_homepage.py b/ishtar_common/old_migrations/0051_auto__add_field_ishtarsiteprofile_homepage.py
index 7f8c65857..7f8c65857 100644
--- a/ishtar_common/migrations/0051_auto__add_field_ishtarsiteprofile_homepage.py
+++ b/ishtar_common/old_migrations/0051_auto__add_field_ishtarsiteprofile_homepage.py
diff --git a/ishtar_common/migrations/0052_auto__add_field_ishtarsiteprofile_file_external_id__add_field_ishtarsi.py b/ishtar_common/old_migrations/0052_auto__add_field_ishtarsiteprofile_file_external_id__add_field_ishtarsi.py
index 7b902a432..7b902a432 100644
--- a/ishtar_common/migrations/0052_auto__add_field_ishtarsiteprofile_file_external_id__add_field_ishtarsi.py
+++ b/ishtar_common/old_migrations/0052_auto__add_field_ishtarsiteprofile_file_external_id__add_field_ishtarsi.py
diff --git a/ishtar_common/migrations/0053_auto__add_field_ishtarsiteprofile_currency.py b/ishtar_common/old_migrations/0053_auto__add_field_ishtarsiteprofile_currency.py
index 04d293b04..04d293b04 100644
--- a/ishtar_common/migrations/0053_auto__add_field_ishtarsiteprofile_currency.py
+++ b/ishtar_common/old_migrations/0053_auto__add_field_ishtarsiteprofile_currency.py
diff --git a/ishtar_common/migrations/0054_auto__add_field_ishtarsiteprofile_person_raw_name.py b/ishtar_common/old_migrations/0054_auto__add_field_ishtarsiteprofile_person_raw_name.py
index 06e380189..06e380189 100644
--- a/ishtar_common/migrations/0054_auto__add_field_ishtarsiteprofile_person_raw_name.py
+++ b/ishtar_common/old_migrations/0054_auto__add_field_ishtarsiteprofile_person_raw_name.py
diff --git a/ishtar_common/migrations/0055_auto.py b/ishtar_common/old_migrations/0055_auto.py
index db41eb868..db41eb868 100644
--- a/ishtar_common/migrations/0055_auto.py
+++ b/ishtar_common/old_migrations/0055_auto.py
diff --git a/ishtar_common/migrations/0056_auto__add_titletype__add_field_person_pretitle.py b/ishtar_common/old_migrations/0056_auto__add_titletype__add_field_person_pretitle.py
index 6db62c107..6db62c107 100644
--- a/ishtar_common/migrations/0056_auto__add_titletype__add_field_person_pretitle.py
+++ b/ishtar_common/old_migrations/0056_auto__add_titletype__add_field_person_pretitle.py
diff --git a/ishtar_common/migrations/0057_rename_pretitle_old_title.py b/ishtar_common/old_migrations/0057_rename_pretitle_old_title.py
index 8a13b6c88..8a13b6c88 100644
--- a/ishtar_common/migrations/0057_rename_pretitle_old_title.py
+++ b/ishtar_common/old_migrations/0057_rename_pretitle_old_title.py
diff --git a/ishtar_common/migrations/0058_generate_title.py b/ishtar_common/old_migrations/0058_generate_title.py
index d30850cab..d30850cab 100644
--- a/ishtar_common/migrations/0058_generate_title.py
+++ b/ishtar_common/old_migrations/0058_generate_title.py
diff --git a/ishtar_common/migrations/0059_rename_exc_from_merge_to_archived.py b/ishtar_common/old_migrations/0059_rename_exc_from_merge_to_archived.py
index c329b76e2..c329b76e2 100644
--- a/ishtar_common/migrations/0059_rename_exc_from_merge_to_archived.py
+++ b/ishtar_common/old_migrations/0059_rename_exc_from_merge_to_archived.py
diff --git a/ishtar_common/migrations/0060_auto__add_historicalperson.py b/ishtar_common/old_migrations/0060_auto__add_historicalperson.py
index a1db55c37..a1db55c37 100644
--- a/ishtar_common/migrations/0060_auto__add_historicalperson.py
+++ b/ishtar_common/old_migrations/0060_auto__add_historicalperson.py
diff --git a/ishtar_common/migrations/0061_auto__add_field_historicalperson_salutation__add_field_person_salutati.py b/ishtar_common/old_migrations/0061_auto__add_field_historicalperson_salutation__add_field_person_salutati.py
index eb3b34a26..eb3b34a26 100644
--- a/ishtar_common/migrations/0061_auto__add_field_historicalperson_salutation__add_field_person_salutati.py
+++ b/ishtar_common/old_migrations/0061_auto__add_field_historicalperson_salutation__add_field_person_salutati.py
diff --git a/ishtar_common/migrations/0062_remove_ishtar_local_prefix.py b/ishtar_common/old_migrations/0062_remove_ishtar_local_prefix.py
index b1406a111..b1406a111 100644
--- a/ishtar_common/migrations/0062_remove_ishtar_local_prefix.py
+++ b/ishtar_common/old_migrations/0062_remove_ishtar_local_prefix.py
diff --git a/ishtar_common/migrations/0063_auto__add_field_ishtaruser_advanced_shortcut_menu.py b/ishtar_common/old_migrations/0063_auto__add_field_ishtaruser_advanced_shortcut_menu.py
index 19a076913..19a076913 100644
--- a/ishtar_common/migrations/0063_auto__add_field_ishtaruser_advanced_shortcut_menu.py
+++ b/ishtar_common/old_migrations/0063_auto__add_field_ishtaruser_advanced_shortcut_menu.py
diff --git a/ishtar_common/migrations/0064_auto__add_field_importercolumn_label.py b/ishtar_common/old_migrations/0064_auto__add_field_importercolumn_label.py
index 2f2b6efcc..2f2b6efcc 100644
--- a/ishtar_common/migrations/0064_auto__add_field_importercolumn_label.py
+++ b/ishtar_common/old_migrations/0064_auto__add_field_importercolumn_label.py
diff --git a/ishtar_common/migrations/0065_auto__add_spatialreferencesystem__add_field_ishtarsiteprofile_mapping.py b/ishtar_common/old_migrations/0065_auto__add_spatialreferencesystem__add_field_ishtarsiteprofile_mapping.py
index 2c1dc8a49..2c1dc8a49 100644
--- a/ishtar_common/migrations/0065_auto__add_spatialreferencesystem__add_field_ishtarsiteprofile_mapping.py
+++ b/ishtar_common/old_migrations/0065_auto__add_spatialreferencesystem__add_field_ishtarsiteprofile_mapping.py
diff --git a/ishtar_common/migrations/0066_auto__add_field_ishtarsiteprofile_base_color__add_field_ishtarsiteprof.py b/ishtar_common/old_migrations/0066_auto__add_field_ishtarsiteprofile_base_color__add_field_ishtarsiteprof.py
index 16baf8881..16baf8881 100644
--- a/ishtar_common/migrations/0066_auto__add_field_ishtarsiteprofile_base_color__add_field_ishtarsiteprof.py
+++ b/ishtar_common/old_migrations/0066_auto__add_field_ishtarsiteprofile_base_color__add_field_ishtarsiteprof.py
diff --git a/ishtar_common/migrations/0067_auto__add_field_ishtarsiteprofile_container_external_id__add_field_ish.py b/ishtar_common/old_migrations/0067_auto__add_field_ishtarsiteprofile_container_external_id__add_field_ish.py
index 2bff66138..2bff66138 100644
--- a/ishtar_common/migrations/0067_auto__add_field_ishtarsiteprofile_container_external_id__add_field_ish.py
+++ b/ishtar_common/old_migrations/0067_auto__add_field_ishtarsiteprofile_container_external_id__add_field_ish.py
diff --git a/ishtar_common/migrations/0068_auto__add_field_spatialreferencesystem_auth_name.py b/ishtar_common/old_migrations/0068_auto__add_field_spatialreferencesystem_auth_name.py
index a7f83884d..a7f83884d 100644
--- a/ishtar_common/migrations/0068_auto__add_field_spatialreferencesystem_auth_name.py
+++ b/ishtar_common/old_migrations/0068_auto__add_field_spatialreferencesystem_auth_name.py
diff --git a/ishtar_common/migrations/0069_auto__chg_field_import_error_file__chg_field_import_match_file__chg_fi.py b/ishtar_common/old_migrations/0069_auto__chg_field_import_error_file__chg_field_import_match_file__chg_fi.py
index 1fbccf642..1fbccf642 100644
--- a/ishtar_common/migrations/0069_auto__chg_field_import_error_file__chg_field_import_match_file__chg_fi.py
+++ b/ishtar_common/old_migrations/0069_auto__chg_field_import_error_file__chg_field_import_match_file__chg_fi.py
diff --git a/ishtar_common/migrations/0070_auto__add_importermodel__add_field_importertype_new_associated_models.py b/ishtar_common/old_migrations/0070_auto__add_importermodel__add_field_importertype_new_associated_models.py
index b78e71bbf..b78e71bbf 100644
--- a/ishtar_common/migrations/0070_auto__add_importermodel__add_field_importertype_new_associated_models.py
+++ b/ishtar_common/old_migrations/0070_auto__add_importermodel__add_field_importertype_new_associated_models.py
diff --git a/ishtar_common/migrations/0071_migrate_importermodels.py b/ishtar_common/old_migrations/0071_migrate_importermodels.py
index cc9b6f449..cc9b6f449 100644
--- a/ishtar_common/migrations/0071_migrate_importermodels.py
+++ b/ishtar_common/old_migrations/0071_migrate_importermodels.py
diff --git a/ishtar_common/migrations/0072_auto__del_field_importertype_new_associated_models__chg_field_importer.py b/ishtar_common/old_migrations/0072_auto__del_field_importertype_new_associated_models__chg_field_importer.py
index 9d1c9f55c..9d1c9f55c 100644
--- a/ishtar_common/migrations/0072_auto__del_field_importertype_new_associated_models__chg_field_importer.py
+++ b/ishtar_common/old_migrations/0072_auto__del_field_importertype_new_associated_models__chg_field_importer.py
diff --git a/ishtar_common/migrations/0073_auto__add_field_importercolumn_export_field_name.py b/ishtar_common/old_migrations/0073_auto__add_field_importercolumn_export_field_name.py
index a2b5ed719..a2b5ed719 100644
--- a/ishtar_common/migrations/0073_auto__add_field_importercolumn_export_field_name.py
+++ b/ishtar_common/old_migrations/0073_auto__add_field_importercolumn_export_field_name.py
diff --git a/ishtar_common/migrations/0074_auto__add_field_import_name.py b/ishtar_common/old_migrations/0074_auto__add_field_import_name.py
index 8374ce83f..8374ce83f 100644
--- a/ishtar_common/migrations/0074_auto__add_field_import_name.py
+++ b/ishtar_common/old_migrations/0074_auto__add_field_import_name.py
diff --git a/ishtar_common/migrations/0075_auto__add_field_authortype_order.py b/ishtar_common/old_migrations/0075_auto__add_field_authortype_order.py
index e768e57de..e768e57de 100644
--- a/ishtar_common/migrations/0075_auto__add_field_authortype_order.py
+++ b/ishtar_common/old_migrations/0075_auto__add_field_authortype_order.py
diff --git a/ishtar_common/migrations/0076_auto__add_field_ishtarsiteprofile_find_index.py b/ishtar_common/old_migrations/0076_auto__add_field_ishtarsiteprofile_find_index.py
index 84bf5f971..84bf5f971 100644
--- a/ishtar_common/migrations/0076_auto__add_field_ishtarsiteprofile_find_index.py
+++ b/ishtar_common/old_migrations/0076_auto__add_field_ishtarsiteprofile_find_index.py
diff --git a/ishtar_common/old_migrations/__init__.py b/ishtar_common/old_migrations/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ishtar_common/old_migrations/__init__.py
diff --git a/ishtar_common/ooo_replace.py b/ishtar_common/ooo_replace.py
deleted file mode 100644
index 18c4e1878..000000000
--- a/ishtar_common/ooo_replace.py
+++ /dev/null
@@ -1,218 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-# Copyright (C) 2013-2015 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# See the file COPYING for details.
-
-import locale
-import re
-from zipfile import ZipFile, ZIP_DEFLATED
-from cStringIO import StringIO
-from xml.etree.cElementTree import ElementTree, fromstring
-
-from django.conf import settings
-from ooo_translation import ooo_translation
-
-
-def translate_context(context, locale):
- if locale not in ooo_translation:
- return context
- new_context = {}
- for k in context:
- new_key = k
- if k in ooo_translation[locale]:
- new_key = ooo_translation[locale][k]
- new_context[new_key] = context[k]
- return new_context
-
-OOO_NS = "{urn:oasis:names:tc:opendocument:xmlns:text:1.0}"
-
-
-def _set_value_from_formula(value, context, default_value):
- value = value.strip()
- if value.startswith("ooow:") and len(value) >= 5:
- value = value[5:]
- if value.startswith('"') and value.endswith('"') and len(value) > 1:
- value = value[1:-1]
- elif value in context:
- value = _format_value(context[value], default_value)
- else:
- value = None
- return value
-
-
-def _parse_condition(condition, context, default_value):
- # parse only == and != operator
- operator = ""
- if "!=" in condition:
- operator = "!="
- elif "==" in condition:
- operator = "=="
- else:
- return
- var1, var2 = condition.split(operator)
- var1 = _set_value_from_formula(var1, context, default_value)
- var2 = _set_value_from_formula(var2, context, default_value)
- res = var1 == var2
- if operator == '!=':
- res = not res
- return res
-
-
-def _format_value(value, default_value):
- if hasattr(value, 'strftime'):
- c_locale = settings.LANGUAGE_CODE.split('-')
- if len(c_locale) == 2:
- c_locale[1] = c_locale[1].upper()
- c_locale = "_".join(c_locale)
- if locale.getlocale()[0] != c_locale:
- for loc in (c_locale, c_locale + '.utf8'):
- try:
- locale.setlocale(locale.LC_ALL, loc)
- break
- except:
- pass
- try:
- if settings.DATE_FORMAT:
- value = value.strftime(settings.DATE_FORMAT).lower()
- else:
- value = value.strftime('%x')
- except ValueError:
- value = unicode(value)
- if locale.getlocale()[1]:
- value = value.decode(locale.getlocale()[1])
- value = unicode(value) if value else default_value
- return value
-
-VAR_EXPR = u"###%sVAR %s###"
-WHOLE_KEY_FILTER = u"((?:(?: )*(?:<[^#>]*>)*(?: )*(?:[-a-zA-Z0-9_])*(?: )*)*)"
-WHOLE_KEY_FILTER = u"([^#]*)"
-RE_VAR = re.compile(VAR_EXPR % (WHOLE_KEY_FILTER, WHOLE_KEY_FILTER))
-IF_EXPR = u"###%sIF %s###(.*)###ENDIF###"
-RE_IF = re.compile(IF_EXPR % (WHOLE_KEY_FILTER, WHOLE_KEY_FILTER))
-TAG_FILTER = re.compile(u"(<[^<^>]*>)")
-KEY_FILTER = re.compile(u"([-a-zA-Z0-9_]*)")
-
-
-def _filter_key(base_key):
- # return (key, extra_marker)
- # manage strange key such as:
- # test_<text:span text:style-name="T1">date</text:span>
- key = base_key[:]
- key = key.strip()
- tags, new_key = '', key[:]
- for tag in TAG_FILTER.findall(key):
- tags += tag
- new_key = new_key.replace(tag, '')
- full_key = ''
- for k in KEY_FILTER.findall(new_key):
- if not k:
- continue
- full_key += k
- return full_key, tags
-
-
-def _custom_parsing(context, value, default_value=''):
- """
- ###VAR nom_var### for displaying a variable name
- ###IF nom_var### ###ENDIF### for conditionnal display
- Be carreful nested condition are not yet managed!
- """
- for regexp, sub_exp, if_cond in ((RE_IF, IF_EXPR, True),
- (RE_VAR, VAR_EXPR, False)):
- for base_key in regexp.findall(value[:]):
- v, val = "", None
- if if_cond: # the value inside the if is parsed
- pre_tag, base_key, val = base_key
- else:
- pre_tag, base_key = base_key
- key, extra_markers = _filter_key(base_key)
- v = ''
- if pre_tag:
- v = pre_tag
- if key in context and context[key]:
- if if_cond:
- v += _custom_parsing(context, val, default_value)
- else:
- v += _format_value(context[key], default_value)
- # to preserve a consistent OOO file put extra_markers
- if extra_markers:
- v += extra_markers
- value = re.sub(sub_exp % (pre_tag, base_key), v, value)
- return value
-
-
-def _ooo_replace(content, context, missing_keys, default_value=''):
-
- # regular ooo parsing
- for xp in ('variable-set', 'variable-get'):
- for p in content.findall(".//" + OOO_NS + xp):
- name = p.get(OOO_NS + "name")
- if name in context:
- value = context[name]
- p.text = _format_value(value, default_value)
- else:
- if default_value is not None:
- p.text = default_value
- missing_keys.add(name)
- for p in content.findall(".//" + OOO_NS + "conditional-text"):
- condition = p.get(OOO_NS + "condition")
- res = 'true' if _parse_condition(condition, context, default_value) \
- else 'false'
- value = p.get(OOO_NS + 'string-value-if-' + res)
- value = _format_value(value, default_value)
- if value.strip() in context:
- value = context[value.strip()]
- p.text = value
-
- # raw content parsing
- str_io = StringIO()
- content.write(str_io)
- value = str_io.getvalue()
- value = _custom_parsing(context, value, default_value).encode('utf-8')
- return value
-
-
-def ooo_replace(infile, outfile, context, default_value=''):
- inzip = ZipFile(infile, 'r', ZIP_DEFLATED)
- outzip = ZipFile(outfile, 'w', ZIP_DEFLATED)
-
- values = {}
- missing_keys = set()
- for xml_file in ('content.xml', 'styles.xml'):
- content = ElementTree(fromstring(inzip.read(xml_file)))
- values[xml_file] = _ooo_replace(content, context, missing_keys,
- default_value)
-
- for f in inzip.infolist():
- if f.filename in values:
- outzip.writestr(f.filename, values[f.filename])
- else:
- outzip.writestr(f, inzip.read(f.filename))
-
- inzip.close()
- outzip.close()
- return missing_keys
-
-if __name__ == '__main__':
- infile = "../archaeological_files/tests/"\
- "AR_dossier_DRAC_modele_ishtar_1-MOD.odt"
- outfile = "../archaeological_files/tests/"\
- "AR_dossier_DRAC_modele_ishtar-test.odt"
- rep = {"file_incharge_surname": u"Yann",
- "file_incharge_name": u"Le Jeune",
- "fileact_ref": u"ref"}
- ooo_replace(infile, outfile, rep, default_value="")
diff --git a/ishtar_common/ooo_translation.py b/ishtar_common/ooo_translation.py
deleted file mode 100644
index 5a3d4cb84..000000000
--- a/ishtar_common/ooo_translation.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-# Copyright (C) 2013-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# See the file COPYING for details.
-
-from django.conf import settings
-from django.utils import translation
-# from django.utils.translation import pgettext_lazy
-
-# [('study', pgettext_lazy('ooo key', u'study')),]
-
-TRANSLATION_STRINGS = []
-
-ooo_translation = {}
-cur_language = translation.get_language()
-
-try:
- for language, lbl in settings.LANGUAGES:
- translation.activate(language)
- ooo_translation[language] = {}
- for k, v in TRANSLATION_STRINGS:
- ooo_translation[language][k] = unicode(v)
-finally:
- translation.activate(cur_language)
diff --git a/ishtar_common/templates/base.html b/ishtar_common/templates/base.html
index b142c70c7..75e0e3740 100644
--- a/ishtar_common/templates/base.html
+++ b/ishtar_common/templates/base.html
@@ -1,4 +1,4 @@
-{% load i18n %}{% load url from future %}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+{% load i18n %}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{LANGUAGE_CODE}}" lang="{{LANGUAGE_CODE}}">
diff --git a/ishtar_common/templates/blocks/JQueryAdvancedTown.html b/ishtar_common/templates/blocks/JQueryAdvancedTown.html
index 5d6d93f30..b74bb6b68 100644
--- a/ishtar_common/templates/blocks/JQueryAdvancedTown.html
+++ b/ishtar_common/templates/blocks/JQueryAdvancedTown.html
@@ -1,4 +1,4 @@
-{% load i18n %}{% load url from future %}</td></tr>
+{% load i18n %}</td></tr>
<tr>
<td>{% trans "State" context "Region" %}</td>
<td>
diff --git a/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html b/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html
index 5cea8b5a7..cd7bf88f8 100644
--- a/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html
+++ b/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html
@@ -1,5 +1,4 @@
{% load i18n %}
-{% load url from future%}
{% if menu %}
<form method="post" action="{% url 'update-current-item' %}">
<fieldset id='shortcut-menu'>
diff --git a/ishtar_common/templates/ishtar/blocks/shortcut_menu.html b/ishtar_common/templates/ishtar/blocks/shortcut_menu.html
index c03cb3806..67f91dfea 100644
--- a/ishtar_common/templates/ishtar/blocks/shortcut_menu.html
+++ b/ishtar_common/templates/ishtar/blocks/shortcut_menu.html
@@ -1,5 +1,4 @@
{% load i18n %}
-{% load url from future%}
{% if current_menu %}
<form method="post" action="{% url 'update-current-item' %}">
<fieldset id="shortcut-menu">
diff --git a/ishtar_common/templates/ishtar/blocks/window_nav.html b/ishtar_common/templates/ishtar/blocks/window_nav.html
index 3c52063f4..f212ebff6 100644
--- a/ishtar_common/templates/ishtar/blocks/window_nav.html
+++ b/ishtar_common/templates/ishtar/blocks/window_nav.html
@@ -1,4 +1,3 @@
-{% load url from future %}
{% load i18n %}
{% if previous or next %}
<div class='tool-right'>
diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main.html
index 6a5a67a63..ed61d1265 100644
--- a/ishtar_common/templates/ishtar/dashboards/dashboard_main.html
+++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main.html
@@ -1,6 +1,5 @@
{% extends "base.html" %}
{% load i18n %}
-{% load url from future %}
{% block extra_head %}
{{form.media}}
<script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/jqplot/jquery.jqplot.min.js?ver={{VERSION}}"></script>
diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html
index 2650282ca..5ebb05af4 100644
--- a/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html
+++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html
@@ -1,5 +1,4 @@
{% load i18n date_formating humanize %}
-{% load url from future %}
<div class='dashboard' id="{{unique_id}}-tab">
<div>
<h4>{% trans "Numbers" %}</h4>
diff --git a/ishtar_common/templates/ishtar/import_delete.html b/ishtar_common/templates/ishtar/import_delete.html
index 4b48ebc8c..ef05a884c 100644
--- a/ishtar_common/templates/ishtar/import_delete.html
+++ b/ishtar_common/templates/ishtar/import_delete.html
@@ -1,6 +1,5 @@
{% extends "base.html" %}
{% load i18n inline_formset verbose_names %}
-{% load url from future %}
{% block content %}
<h2>{{page_name}}</h2>
<div class='form'>
diff --git a/ishtar_common/templates/ishtar/import_list.html b/ishtar_common/templates/ishtar/import_list.html
index 5dba51b6f..d5747fe88 100644
--- a/ishtar_common/templates/ishtar/import_list.html
+++ b/ishtar_common/templates/ishtar/import_list.html
@@ -1,6 +1,5 @@
{% extends "base.html" %}
{% load i18n inline_formset %}
-{% load url from future %}
{% block content %}
<h2>{{page_name}}</h2>
<div class='form'>
diff --git a/ishtar_common/templates/ishtar/manage_basket.html b/ishtar_common/templates/ishtar/manage_basket.html
index a6065a7c2..3292318ea 100644
--- a/ishtar_common/templates/ishtar/manage_basket.html
+++ b/ishtar_common/templates/ishtar/manage_basket.html
@@ -1,6 +1,5 @@
{% extends "base.html" %}
{% load i18n inline_formset %}
-{% load url from future %}
{% block content %}
<h2>{{page_name}}{% trans ":"%} {{basket}}</h2>
<form enctype="multipart/form-data" action="." method="post">{% csrf_token %}
diff --git a/ishtar_common/templates/ishtar/merge.html b/ishtar_common/templates/ishtar/merge.html
index 0e15da62a..de46e95c6 100644
--- a/ishtar_common/templates/ishtar/merge.html
+++ b/ishtar_common/templates/ishtar/merge.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load url from future %}
{% load i18n inline_formset %}
{% block content %}
<h2>{% trans "Merge" %}</h2>
diff --git a/ishtar_common/templates/ishtar/merge_organization.html b/ishtar_common/templates/ishtar/merge_organization.html
index 87eab7d53..10730e8c5 100644
--- a/ishtar_common/templates/ishtar/merge_organization.html
+++ b/ishtar_common/templates/ishtar/merge_organization.html
@@ -1,5 +1,4 @@
{% extends "ishtar/merge.html" %}
-{% load url from future %}
{% block merge_field_row %}
{% if form.non_field_errors %}<tr><td colspan='4'></td><td colspan='3' class='errorlist'>{% for error in form.non_field_errors %}{{error}} {% endfor%}</tr>{% endif %}
<tr>
diff --git a/ishtar_common/templates/ishtar/merge_person.html b/ishtar_common/templates/ishtar/merge_person.html
index 4e76c804b..0d03112c5 100644
--- a/ishtar_common/templates/ishtar/merge_person.html
+++ b/ishtar_common/templates/ishtar/merge_person.html
@@ -1,5 +1,4 @@
{% extends "ishtar/merge.html" %}
-{% load url from future %}
{% block merge_field_row %}
{% if form.non_field_errors %}<tr><td colspan='4'></td><td colspan='3' class='errorlist'>{% for error in form.non_field_errors %}{{error}} {% endfor%}</tr>{% endif %}
<tr>
diff --git a/ishtar_common/templates/ishtar/organization_form.html b/ishtar_common/templates/ishtar/organization_form.html
index 21d5ffa9e..828023908 100644
--- a/ishtar_common/templates/ishtar/organization_form.html
+++ b/ishtar_common/templates/ishtar/organization_form.html
@@ -1,4 +1,4 @@
-{% load i18n %}{% load url from future %}
+{% load i18n %}
<div id='orga-form'>
<form id='dyn-form-organization' method='post'>
{% csrf_token %}
diff --git a/ishtar_common/templates/ishtar/organization_person_form.html b/ishtar_common/templates/ishtar/organization_person_form.html
index 46f2cdc15..e258441b3 100644
--- a/ishtar_common/templates/ishtar/organization_person_form.html
+++ b/ishtar_common/templates/ishtar/organization_person_form.html
@@ -1,4 +1,4 @@
-{% load i18n %}{% load url from future %}
+{% load i18n %}
<div id='orga-person-form'>
<form id='dyn-form-person' method='post'>
{% csrf_token %}
diff --git a/ishtar_common/templates/ishtar/person_form.html b/ishtar_common/templates/ishtar/person_form.html
index 555aa1a5f..10a49cd52 100644
--- a/ishtar_common/templates/ishtar/person_form.html
+++ b/ishtar_common/templates/ishtar/person_form.html
@@ -1,4 +1,4 @@
-{% load i18n %}{% load url from future %}
+{% load i18n %}
<div id='person-form'>
<form id='dyn-form-person' method='post'>
{% csrf_token %}
diff --git a/ishtar_common/templates/ishtar/sheet_organization.html b/ishtar_common/templates/ishtar/sheet_organization.html
index 66048095b..525b69325 100644
--- a/ishtar_common/templates/ishtar/sheet_organization.html
+++ b/ishtar_common/templates/ishtar/sheet_organization.html
@@ -28,7 +28,7 @@
<td class='string'>{{person.name|default:""}}</td>
<td class='string'>{{person.surname|default:""}}</td>
<td>{% for type in person.person_types.all %}{% if forloop.counter0 %}, {% endif %}{{type.label}}{% endfor %}</td>
- <td class='link'><a class='display_details' href="#" onclick='load_window("{%url show-person person.pk ''%}")'><i class="fa fa-info-circle" aria-hidden="true"></i></a></td>
+ <td class='link'><a class='display_details' href="#" onclick='load_window("{% url "show-person" person.pk "" %}")'><i class="fa fa-info-circle" aria-hidden="true"></i></a></td>
</tr>
{% empty %}
<tr><td colspan="8" class='no_items'>{% trans "No person in this organization" %}</td></tr>
diff --git a/ishtar_common/templates/ishtar/sheet_source.html b/ishtar_common/templates/ishtar/sheet_source.html
index 244ca1be3..24477ce2c 100644
--- a/ishtar_common/templates/ishtar/sheet_source.html
+++ b/ishtar_common/templates/ishtar/sheet_source.html
@@ -19,8 +19,8 @@
{% field_li "Source type" item.source_type %}
{% field_li "Format type" item.format_type %}
{% field_li "Scale" item.scale %}
- {% trans "Web link" as weblink_label %}
- {% field_li_url weblink_label item.associated_url %}
+{% trans "Web link" as weblink_label %}
+{% field_li_url weblink_label item.associated_url %}
{% field_li "Item number" item.item_number %}
{% field_li "Ref." item.reference %}
{% field_li "Internal ref." item.internal_reference %}
diff --git a/ishtar_common/templates/ishtar/wizard/default_wizard.html b/ishtar_common/templates/ishtar/wizard/default_wizard.html
index 204feeebe..19076b0de 100644
--- a/ishtar_common/templates/ishtar/wizard/default_wizard.html
+++ b/ishtar_common/templates/ishtar/wizard/default_wizard.html
@@ -1,6 +1,5 @@
{% extends "base.html" %}
{% load i18n range table_form %}
-{% load url from future %}
{% block extra_head %}
{{form.media}}
{% endblock %}
diff --git a/ishtar_common/templates/ishtar/wizard/validation_bar.html b/ishtar_common/templates/ishtar/wizard/validation_bar.html
index a1590858f..b99b9e689 100644
--- a/ishtar_common/templates/ishtar/wizard/validation_bar.html
+++ b/ishtar_common/templates/ishtar/wizard/validation_bar.html
@@ -1,5 +1,4 @@
{% load i18n %}
-{% load url from future %}
<div id='validation-bar'>
<input type="submit" id="submit_form" name='validate' value="{% trans 'Validate' %}"/>
{% if last_step_is_available and next_steps %}
diff --git a/ishtar_common/templates/registration/activation_complete.html b/ishtar_common/templates/registration/activation_complete.html
index b243d22f2..7db8c186e 100644
--- a/ishtar_common/templates/registration/activation_complete.html
+++ b/ishtar_common/templates/registration/activation_complete.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load url from future %}
{% load i18n %}
{% block content %}
diff --git a/ishtar_common/templates/registration/login.html b/ishtar_common/templates/registration/login.html
index ada4f6aa9..e8122f150 100644
--- a/ishtar_common/templates/registration/login.html
+++ b/ishtar_common/templates/registration/login.html
@@ -13,7 +13,7 @@
</form>
</div>
<div class='info'>
-<p>{% trans "Forgot password?" %} <a href="{% url auth_password_reset %}">{% trans "Reset it" %}</a></p>
-<p>{% trans "Not member?" %} <a href="{% url registration_register %}">{% trans "Register" %}</a></p>
+<p>{% trans "Forgot password?" %} <a href="{% url 'auth_password_reset' %}">{% trans "Reset it" %}</a></p>
+<p>{% trans "Not member?" %} <a href="{% url 'registration_register' %}">{% trans "Register" %}</a></p>
</div>
{% endblock %}
diff --git a/ishtar_common/templates/welcome.html b/ishtar_common/templates/welcome.html
index 508f7be02..4b9f3b5c5 100644
--- a/ishtar_common/templates/welcome.html
+++ b/ishtar_common/templates/welcome.html
@@ -1,5 +1,4 @@
{% load i18n %}
-{% load url from future %}
<h2>{% trans "Welcome in Ishtar, open source software for management and inventory of archaeological data" %}</h2>
{{random_image}}
diff --git a/ishtar_common/templatetags/link_to_window.py b/ishtar_common/templatetags/link_to_window.py
index 14e4bd6c7..f157b6255 100644
--- a/ishtar_common/templatetags/link_to_window.py
+++ b/ishtar_common/templatetags/link_to_window.py
@@ -60,12 +60,16 @@ def add_links(items, extra_attr=''):
takes_context=True)
def modify_toolbar(context, item, action):
request = context.get('request')
- items_by_idx = request.session['MENU'].items_by_idx.keys()
+ menu = context.get('MENU', None)
+ print("TODO: link_to_window - check")
+ if not menu:
+ return {}
+ items_by_idx = menu.items_by_idx.keys()
if action not in items_by_idx:
return {}
- menu = request.session['MENU'].items_by_idx[action]
+ action = menu.items_by_idx[action]
user = request.user
if not hasattr(user, 'ishtaruser') or \
- not menu.is_available(user.ishtaruser, item):
+ not action.is_available(user.ishtaruser, item):
return {}
return {'item': item}
diff --git a/ishtar_common/templatetags/window_field.py b/ishtar_common/templatetags/window_field.py
index 5180955d8..022986493 100644
--- a/ishtar_common/templatetags/window_field.py
+++ b/ishtar_common/templatetags/window_field.py
@@ -25,10 +25,8 @@ def field_li(caption, data, pre_data='', post_data=''):
def field_url(caption, link, link_name='', li=False):
if link:
link = link.strip()
- if not link:
- return u''
- if not link.startswith('http://') and not link.startswith('https://'):
- link = 'http://' + link
+ if not link.startswith('http://') and not link.startswith('https://'):
+ link = 'http://' + link
return {'caption': caption, 'link': link, "link_name": link_name, 'li': li}
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index 536d6d4a8..464960b3a 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -27,59 +27,37 @@ from django.contrib.contenttypes.models import ContentType
from django.core.cache import cache
from django.core.exceptions import ValidationError
from django.core.files.base import File as DjangoFile
-from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.management import call_command
from django.core.urlresolvers import reverse
-from django.db import connection, transaction
from django.template.defaultfilters import slugify
from django.test import TestCase as BaseTestCase
from django.test.client import Client
-from django.test.simple import DjangoTestSuiteRunner
+from django.test.runner import DiscoverRunner
from ishtar_common import models
-from ishtar_common import forms_common
+from ishtar_common import views
from ishtar_common.utils import post_save_point
-from archaeological_context_records.models import CRBulkView
-from archaeological_finds.models import BFBulkView, FBulkView, FirstBaseFindView
-
-"""
-from django.conf import settings
-import tempfile, datetime
-from zipfile import ZipFile, ZIP_DEFLATED
-
-from oook_replace.oook_replace import oook_replace
-
-class OOOGenerationTest(TestCase):
- def testGeneration(self):
- context = {'test_var':u"Testé", 'test_var2':u"",
- "test_date":datetime.date(2015, 1, 1)}
- tmp = tempfile.TemporaryFile()
- oook_replace("../ishtar_common/tests/test-file.odt", tmp, context)
- inzip = ZipFile(tmp, 'r', ZIP_DEFLATED)
- value = inzip.read('content.xml')
- self.assertTrue(u"Testé" in value or "Test&#233;" in value)
- self.assertTrue("testé 2" not in value and "test&#233; 2" not in value)
- self.assertTrue("2015" in value)
- lg, ct = settings.LANGUAGE_CODE.split('-')
- if lg == 'fr':
- self.assertTrue('janvier' in value)
- if lg == 'en':
- self.assertTrue('january' in value)
-"""
-
def create_superuser():
username = 'username4277'
password = 'dcbqj756456!@%'
+ q = User.objects.filter(username=username)
+ if q.count():
+ return username, password, q.all()[0]
user = User.objects.create_superuser(username, "nomail@nomail.com",
password)
+ user.set_password(password)
+ user.save()
return username, password, user
def create_user():
username = 'username678'
- password = 'dcbqj756456!@%'
+ password = 'dcbqj756aaa456!@%'
+ q = User.objects.filter(username=username)
+ if q.count():
+ return username, password, q.all()[0]
user = User.objects.create_user(username, email="nomail2@nomail.com")
user.set_password(password)
user.save()
@@ -87,14 +65,7 @@ def create_user():
class TestCase(BaseTestCase):
- def _pre_setup(self):
- super(TestCase, self)._pre_setup()
- if settings.USE_SPATIALITE_FOR_TESTS:
- return
- c = connection.cursor()
- for view in [CRBulkView, FirstBaseFindView, BFBulkView, FBulkView]:
- c.execute(view.CREATE_SQL)
- transaction.commit_unless_managed()
+ pass
class CommandsTestCase(TestCase):
@@ -117,7 +88,7 @@ class WizardTestFormData(object):
"""
Test set to simulate wizard steps
"""
- def __init__(self, name, form_datas, ignored=[], pre_tests=[],
+ def __init__(self, name, form_datas={}, ignored=[], pre_tests=[],
extra_tests=[]):
"""
:param name: explicit name of the test
@@ -144,6 +115,8 @@ class WizardTestFormData(object):
:param value: value
:return: None
"""
+ if form_name not in self.form_datas:
+ self.form_datas[form_name] = {}
self.form_datas[form_name][field_name] = value
def append(self, form_name, value):
@@ -154,6 +127,8 @@ class WizardTestFormData(object):
:param value: value
:return: None
"""
+ if form_name not in self.form_datas:
+ self.form_datas[form_name] = {}
self.form_datas[form_name].append(value)
def inits(self, test_object):
@@ -167,7 +142,6 @@ class WizardTestFormData(object):
if suffix in form_name:
continue
self.form_datas[form_name + suffix] = self.form_datas.pop(form_name)
-
for pre in self.pre_tests:
pre(test_object)
@@ -179,15 +153,15 @@ class WizardTestFormData(object):
test(test_object, final_step_response)
-class ManagedModelTestRunner(DjangoTestSuiteRunner):
+class ManagedModelTestRunner(DiscoverRunner):
"""
Test runner that automatically makes all unmanaged models in your Django
project managed for the duration of the test run, so that one doesn't need
to execute the SQL manually to create them.
"""
def setup_test_environment(self, *args, **kwargs):
- from django.db.models.loading import get_models
- self.unmanaged_models = [m for m in get_models()
+ from django.apps import apps
+ self.unmanaged_models = [m for m in apps.get_models()
if not m._meta.managed]
for m in self.unmanaged_models:
m._meta.managed = True
@@ -268,8 +242,8 @@ class WizardTest(object):
next_form_is_checked = len(self.steps) > idx + 1 and \
self.steps[idx + 1][0] not in ignored
try:
- response = self.client.post(url, data,
- follow=not next_form_is_checked)
+ response = self.client.post(
+ url, data, follow=not next_form_is_checked)
except ValidationError as e:
msg = u"Errors: {} on {}. On \"ManagementForm data is " \
u"missing or...\" error verify the wizard_name or " \
@@ -332,8 +306,15 @@ class AccessControlTest(TestCase):
user, created = User.objects.get_or_create(username='myusername')
user.is_superuser = True
user.save()
- ishtar_user = models.IshtarUser.objects.get(username=user.username)
+ ishtar_user = models.IshtarUser.objects.get(
+ user_ptr__username='myusername')
self.assertIn(admin, ishtar_user.person.person_types.all())
+ user = ishtar_user.user_ptr
+ user.is_superuser = False
+ user.save()
+ ishtar_user = models.IshtarUser.objects.get(
+ user_ptr__username='myusername')
+ self.assertNotIn(admin, ishtar_user.person.person_types.all())
class AdminGenTypeTest(TestCase):
@@ -356,11 +337,14 @@ class AdminGenTypeTest(TestCase):
module_name = 'ishtar_common'
def setUp(self):
- password = 'mypassword'
- my_admin = User.objects.create_superuser(
- 'myuser', 'myemail@test.com', password)
+ self.password = 'mypassword'
+ self.username = "myuser"
+ user = User.objects.create_superuser(
+ self.username, 'myemail@test.com', self.password)
+ user.set_password(self.password)
+ user.save()
self.client = Client()
- self.client.login(username=my_admin.username, password=password)
+ self.client.login(username=self.username, password=self.password)
def test_listing_and_detail(self):
for model in self.models:
@@ -736,7 +720,8 @@ class ShortMenuTest(TestCase):
def test_treatment_file(self):
c = Client()
c.login(username=self.username, password=self.password)
- from archaeological_finds.models import TreatmentFile, TreatmentFileType
+ from archaeological_finds.models import TreatmentFile, \
+ TreatmentFileType
tf = TreatmentFile.objects.create(
type=TreatmentFileType.objects.create(),
year=2050
@@ -992,11 +977,12 @@ class IshtarSiteProfileTest(TestCase):
class IshtarBasicTest(TestCase):
def setUp(self):
- password = 'mypassword'
- my_admin = User.objects.create_superuser(
- 'myuser', 'myemail@test.com', password)
+ self.password = 'mypassword'
+ self.my_admin = User.objects.create_superuser(
+ 'myuser', 'myemail@test.com', self.password)
self.client = Client()
- self.client.login(username=my_admin.username, password=password)
+ self.client.login(username=self.my_admin.username,
+ password=self.password)
def test_status(self):
response = self.client.get(reverse('status'))
@@ -1009,6 +995,34 @@ class IshtarBasicTest(TestCase):
person.save()
self.assertEqual(person.raw_name, "WEASLEY George")
+ def test_show(self):
+ person = models.Person.objects.create(name="Weasley", surname="Bill")
+ orga_type = models.OrganizationType.objects.create(
+ txt_idx='test', label='testy')
+ company = models.Organization.objects.create(
+ history_modifier=self.my_admin, name='Franquin Comp.',
+ organization_type=orga_type)
+ c = Client()
+
+ response = c.get(reverse('show-person', kwargs={'pk': person.pk}))
+ self.assertEqual(response.status_code, 200)
+ # empty content when not allowed
+ self.assertEqual(response.content, "")
+ response = c.get(reverse('show-organization',
+ kwargs={'pk': company.pk}))
+ self.assertEqual(response.status_code, 200)
+ # empty content when not allowed
+ self.assertEqual(response.content, "")
+
+ c.login(username=self.my_admin.username, password=self.password)
+ response = c.get(reverse('show-person', kwargs={'pk': person.pk}))
+ self.assertEqual(response.status_code, 200)
+ self.assertIn('class="sheet"', response.content)
+ response = c.get(reverse('show-organization',
+ kwargs={'pk': company.pk}))
+ self.assertEqual(response.status_code, 200)
+ self.assertIn('class="sheet"', response.content)
+
class GeomaticTest(TestCase):
def test_post_save_point(self):
@@ -1035,3 +1049,44 @@ class GeomaticTest(TestCase):
post_save_point(None, instance=obj)
self.assertIsNotNone(obj.point_2d)
self.assertIsNotNone(obj.point)
+
+
+class AccountWizardTest(WizardTest, TestCase):
+ fixtures = [settings.ROOT_PATH +
+ '../fixtures/initial_data-auth-fr.json',
+ settings.ROOT_PATH +
+ '../ishtar_common/fixtures/initial_data-fr.json',]
+ url_name = 'account_management'
+ wizard_name = 'account_wizard'
+ steps = views.account_wizard_steps
+ form_datas = [
+ WizardTestFormData(
+ "Add an account",
+ form_datas={
+ 'account': {
+ 'username': "My username",
+ 'email': "test@example.com",
+ 'hidden_password': "my_pass",
+ 'hidden_password_confirm': "my_pass",
+ }
+ },
+ ),
+ ]
+
+ def pre_wizard(self):
+ self.person = models.Person.objects.create(
+ name='Boule', surname=' ',
+ )
+ self.form_datas[0].set('selec', 'pk', self.person.pk)
+ self.form_datas[0].set('account', 'pk', self.person.pk)
+
+ self.account_number = models.IshtarUser.objects.count()
+ super(AccountWizardTest, self).pre_wizard()
+
+ def post_wizard(self):
+ person = models.Person.objects.get(pk=self.person.pk)
+ user = person.ishtaruser.user_ptr
+ self.assertEqual(user.username, "My username")
+ self.assertEqual(user.email, "test@example.com")
+ self.assertEqual(models.IshtarUser.objects.count(),
+ self.account_number + 1)
diff --git a/ishtar_common/tests/old.odt b/ishtar_common/tests/old.odt
new file mode 100644
index 000000000..4d13ac834
--- /dev/null
+++ b/ishtar_common/tests/old.odt
Binary files differ
diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py
index 5abec4215..163fedeb9 100644
--- a/ishtar_common/urls.py
+++ b/ishtar_common/urls.py
@@ -18,9 +18,9 @@
# See the file COPYING for details.
from django.conf import settings
-from django.conf.urls.defaults import patterns, include, url
+from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
-from django.views.generic.simple import direct_to_template
+from django.views.generic import TemplateView
from menus import menu
@@ -33,8 +33,8 @@ from ishtar_common.wizards import check_rights
urlpatterns = patterns(
'',
url(r'^status/$', views.status, name='status'),
- url(r'^robots\.txt$', direct_to_template,
- {'template': 'robots.txt', 'mimetype': 'text/plain'}),
+ url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt',
+ content_type='text/plain')),
# internationalization
url(r'^i18n/', include('django.conf.urls.i18n')),
# General
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py
index f1e2e4b96..19ff16394 100644
--- a/ishtar_common/utils.py
+++ b/ishtar_common/utils.py
@@ -20,6 +20,7 @@
from functools import wraps
import hashlib
import random
+import datetime
from django import forms
from django.conf import settings
@@ -31,6 +32,24 @@ from django.utils.translation import ugettext_lazy as _, ugettext
from django.template.defaultfilters import slugify
+class BColors:
+ """
+ Bash colors. Don't forget to finish your colored string with ENDC.
+ """
+ HEADER = '\033[95m'
+ OKBLUE = '\033[94m'
+ OKGREEN = '\033[92m'
+ WARNING = '\033[93m'
+ FAIL = '\033[91m'
+ ENDC = '\033[0m'
+ BOLD = '\033[1m'
+ UNDERLINE = '\033[4m'
+
+
+def get_current_year():
+ return datetime.datetime.now().year
+
+
def get_cache(cls, extra_args=[]):
cache_key = u"{}-{}-{}".format(
settings.PROJECT_SLUG, cls._meta.app_label, cls.__name__)
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index 86c87d049..0f1397758 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -23,7 +23,11 @@ from copy import copy
import csv
import cStringIO as StringIO
import datetime
+
+import reportlab
+reportlab.Version = "2.2" # stupid hack for an old library...
import ho.pisa as pisa
+
import json
import logging
from markdown import markdown
@@ -186,10 +190,13 @@ organization_deletion_wizard = wizards.OrganizationDeletionWizard.as_view(
label=_(u"Organization deletion"),
url_name='organization_deletion',)
+account_wizard_steps = [
+ ('selec-account_management', forms.PersonUserFormSelection),
+ ('account-account_management', forms.AccountForm),
+ ('final-account_management', forms.FinalAccountForm)]
+
account_management_wizard = wizards.AccountWizard.as_view(
- [('selec-account_management', forms.PersonUserFormSelection),
- ('account-account_management', forms.AccountForm),
- ('final-account_management', forms.FinalAccountForm)],
+ account_wizard_steps,
label=_(u"Account management"),
url_name='account_management',)
@@ -214,44 +221,44 @@ def get_autocomplete_generic(model, extra={'available': True}):
else unicode(x)
data = json.dumps([{'id': obj.pk, 'value': get_label(obj)}
for obj in objects])
- return HttpResponse(data, mimetype='text/plain')
+ return HttpResponse(data, content_type='text/plain')
return func
def hide_shortcut_menu(request):
request.session['SHORTCUT_SHOW'] = 'off'
- return HttpResponse('OK', mimetype='text/plain')
+ return HttpResponse('OK', content_type='text/plain')
def show_shortcut_menu(request):
request.session['SHORTCUT_SHOW'] = 'on'
- return HttpResponse('OK', mimetype='text/plain')
+ return HttpResponse('OK', content_type='text/plain')
def activate_all_search(request):
request.session['SHORTCUT_SEARCH'] = 'all'
- return HttpResponse('OK', mimetype='text/plain')
+ return HttpResponse('OK', content_type='text/plain')
def activate_own_search(request):
request.session['SHORTCUT_SEARCH'] = 'own'
- return HttpResponse('OK', mimetype='text/plain')
+ return HttpResponse('OK', content_type='text/plain')
def activate_advanced_shortcut_menu(request):
if not hasattr(request.user, 'ishtaruser'):
- return HttpResponse('KO', mimetype='text/plain')
+ return HttpResponse('KO', content_type='text/plain')
request.user.ishtaruser.advanced_shortcut_menu = True
request.user.ishtaruser.save()
- return HttpResponse('OK', mimetype='text/plain')
+ return HttpResponse('OK', content_type='text/plain')
def activate_simple_shortcut_menu(request):
if not hasattr(request.user, 'ishtaruser'):
- return HttpResponse('KO', mimetype='text/plain')
+ return HttpResponse('KO', content_type='text/plain')
request.user.ishtaruser.advanced_shortcut_menu = False
request.user.ishtaruser.save()
- return HttpResponse('OK', mimetype='text/plain')
+ return HttpResponse('OK', content_type='text/plain')
def shortcut_menu(request):
@@ -462,7 +469,7 @@ def autocomplete_person(request, person_types=None, attached_to=None,
own_items = request.user.has_perm('ishtar_common.view_own_person',
models.Person)
if not all_items and not own_items or not request.GET.get('term'):
- return HttpResponse('[]', mimetype='text/plain')
+ return HttpResponse('[]', content_type='text/plain')
q = request.GET.get('term')
limit = request.GET.get('limit', 20)
try:
@@ -493,12 +500,12 @@ def autocomplete_person(request, person_types=None, attached_to=None,
persons = models.Person.objects.filter(query)[:limit]
data = json.dumps([{'id': person.pk, 'value': unicode(person)}
for person in persons if person])
- return HttpResponse(data, mimetype='text/plain')
+ return HttpResponse(data, content_type='text/plain')
def autocomplete_department(request):
if not request.GET.get('term'):
- return HttpResponse('[]', mimetype='text/plain')
+ return HttpResponse('[]', content_type='text/plain')
q = request.GET.get('term')
q = unicodedata.normalize("NFKD", q).encode('ascii', 'ignore')
query = Q()
@@ -509,12 +516,12 @@ def autocomplete_department(request):
departments = models.Department.objects.filter(query)[:limit]
data = json.dumps([{'id': department.pk, 'value': unicode(department)}
for department in departments])
- return HttpResponse(data, mimetype='text/plain')
+ return HttpResponse(data, content_type='text/plain')
def autocomplete_town(request):
if not request.GET.get('term'):
- return HttpResponse(mimetype='text/plain')
+ return HttpResponse(content_type='text/plain')
q = request.GET.get('term')
q = unicodedata.normalize("NFKD", q).encode('ascii', 'ignore')
query = Q()
@@ -527,12 +534,12 @@ def autocomplete_town(request):
towns = models.Town.objects.filter(query)[:limit]
data = json.dumps([{'id': town.pk, 'value': unicode(town)}
for town in towns])
- return HttpResponse(data, mimetype='text/plain')
+ return HttpResponse(data, content_type='text/plain')
def autocomplete_advanced_town(request, department_id=None, state_id=None):
if not request.GET.get('term'):
- return HttpResponse(mimetype='text/plain')
+ return HttpResponse(content_type='text/plain')
q = request.GET.get('term')
q = unicodedata.normalize("NFKD", q).encode('ascii', 'ignore')
query = Q()
@@ -556,7 +563,7 @@ def autocomplete_advanced_town(request, department_id=None, state_id=None):
val += " (%s)" % town.numero_insee
result.append({'id': town.pk, 'value': val})
data = json.dumps(result)
- return HttpResponse(data, mimetype='text/plain')
+ return HttpResponse(data, content_type='text/plain')
def department_by_state(request, state_id=''):
@@ -567,7 +574,7 @@ def department_by_state(request, state_id=''):
data = json.dumps([{'id': department.pk, 'number': department.number,
'value': unicode(department)}
for department in departments])
- return HttpResponse(data, mimetype='text/plain')
+ return HttpResponse(data, content_type='text/plain')
def format_val(val):
@@ -585,6 +592,23 @@ HIERARCHIC_FIELDS = ['periods', 'period', 'unit', 'material_types',
'material_type', 'conservatory_state']
+def _get_values(request, val):
+ if hasattr(val, 'all'): # manage related objects
+ vals = list(val.all())
+ else:
+ vals = [val]
+ new_vals = []
+ for v in vals:
+ if callable(v):
+ v = v()
+ if hasattr(v, 'url'):
+ v = request.is_secure() and \
+ 'https' or 'http' + '://' + \
+ request.get_host() + v.url
+ new_vals.append(v)
+ return new_vals
+
+
def get_item(model, func_name, default_name, extra_request_keys=[],
base_request=None, bool_fields=[], reversed_bool_fields=[],
dated_fields=[], associated_models=[], relative_session_names=[],
@@ -607,7 +631,7 @@ def get_item(model, func_name, default_name, extra_request_keys=[],
allowed, own = models.check_model_access_control(request, model,
available_perms)
if not allowed:
- return HttpResponse(EMPTY, mimetype='text/plain')
+ return HttpResponse(EMPTY, content_type='text/plain')
if force_own:
own = True
@@ -683,7 +707,7 @@ def get_item(model, func_name, default_name, extra_request_keys=[],
try:
old = 'old' in request_items and int(request_items['old'])
except ValueError:
- return HttpResponse('[]', mimetype='text/plain')
+ return HttpResponse('[]', content_type='text/plain')
# manage relations types
if 'relation_types' not in my_relation_types_prefix:
@@ -730,7 +754,7 @@ def get_item(model, func_name, default_name, extra_request_keys=[],
try:
dct = {"pk": request.session[default_name]}
pinned_search = unicode(model._meta.verbose_name)\
- + u" - " + unicode(
+ + u" - " + unicode(
model.objects.get(pk=dct["pk"]))
except model.DoesNotExist:
pass
@@ -856,7 +880,11 @@ def get_item(model, func_name, default_name, extra_request_keys=[],
query |= Q(**altor_dct)
if own:
- query = query & model.get_query_owns(request.user)
+ q = models.IshtarUser.objects.filter(user_ptr=request.user)
+ if q.count():
+ query = query & model.get_query_owns(q.all()[0])
+ else:
+ return HttpResponse(EMPTY, content_type='text/plain')
for and_req in and_reqs:
query = query & and_req
@@ -1007,23 +1035,11 @@ def get_item(model, func_name, default_name, extra_request_keys=[],
val = list(val.all())
for v in val:
v = getattr(v, ky)
- if callable(v):
- v = v()
- if hasattr(v, 'url'):
- v = request.is_secure() and \
- 'https' or 'http' + '://' + \
- request.get_host() + v.url
- new_vals.append(v)
+ new_vals += _get_values(request, v)
elif val:
try:
val = getattr(val, ky)
- if callable(val):
- val = val()
- if hasattr(val, 'url'):
- val = request.is_secure() and \
- 'https' or 'http' + '://' + \
- request.get_host() + val.url
- new_vals.append(val)
+ new_vals += _get_values(request, val)
except AttributeError:
# must be a query key such as "contains"
pass
@@ -1111,9 +1127,9 @@ def get_item(model, func_name, default_name, extra_request_keys=[],
"page": page_nb,
"total": (items_nb / row_nb + 1) if row_nb else items_nb,
})
- return HttpResponse(data, mimetype='text/plain')
+ return HttpResponse(data, content_type='text/plain')
elif data_type == "csv":
- response = HttpResponse(mimetype='text/csv')
+ response = HttpResponse(content_type='text/csv')
n = datetime.datetime.now()
filename = u'%s_%s.csv' % (default_name,
n.strftime('%Y%m%d-%H%M%S'))
@@ -1154,14 +1170,15 @@ def get_item(model, func_name, default_name, extra_request_keys=[],
val = data[1:][idx + delta].encode(
ENCODING, errors='replace')
if col_name and "|" in col_name[0]:
- for delta_idx in range(len(col_name[0].split('|')) - 1):
+ for delta_idx in range(
+ len(col_name[0].split('|')) - 1):
delta += 1
val += data[1:][idx + delta].encode(
ENCODING, errors='replace')
row.append(val)
writer.writerow(row)
return response
- return HttpResponse('{}', mimetype='text/plain')
+ return HttpResponse('{}', content_type='text/plain')
return func
@@ -1173,7 +1190,7 @@ def get_by_importer(request, slug, data_type='json', full=False,
res = ''
if data_type == "json":
res = '{}'
- return HttpResponse(res, mimetype='text/plain')
+ return HttpResponse(res, content_type='text/plain')
imp = q.all()[0].get_importer_class()
cols, col_names = [], []
for formater in imp.LINE_FORMAT:
@@ -1231,7 +1248,7 @@ def show_item(model, name, extra_dct=None):
item = item.get_previous(date=date)
assert item is not None
except (ValueError, AssertionError):
- return HttpResponse(None, mimetype='text/plain')
+ return HttpResponse(None, content_type='text/plain')
dct['previous'] = item._previous
dct['next'] = item._next
else:
@@ -1286,7 +1303,7 @@ def show_item(model, name, extra_dct=None):
except xhtml2odt.ODTExportError:
return HttpResponse(content, content_type="application/xhtml")
response = HttpResponse(
- mimetype='application/vnd.oasis.opendocument.text')
+ content_type='application/vnd.oasis.opendocument.text')
response['Content-Disposition'] = 'attachment; filename=%s.odt' % \
filename
response.write(odtfile)
@@ -1301,7 +1318,7 @@ def show_item(model, name, extra_dct=None):
pdf = pisa.pisaDocument(StringIO.StringIO(html), result,
encoding='utf-8')
response = HttpResponse(result.getvalue(),
- mimetype='application/pdf')
+ content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename=%s.pdf' % \
filename
if not pdf.err:
@@ -1321,8 +1338,8 @@ def revert_item(model):
date = datetime.datetime.strptime(date, '%Y-%m-%dT%H:%M:%S.%f')
item.rollback(date)
except (ObjectDoesNotExist, ValueError, HistoryError):
- return HttpResponse(None, mimetype='text/plain')
- return HttpResponse("True", mimetype='text/plain')
+ return HttpResponse(None, content_type='text/plain')
+ return HttpResponse("True", content_type='text/plain')
return func
@@ -1333,9 +1350,9 @@ def autocomplete_organization(request, orga_type=None):
models.Organization)
and not request.user.ishtaruser.has_right(
'person_search', session=request.session)):
- return HttpResponse('[]', mimetype='text/plain')
+ return HttpResponse('[]', content_type='text/plain')
if not request.GET.get('term'):
- return HttpResponse('[]', mimetype='text/plain')
+ return HttpResponse('[]', content_type='text/plain')
q = request.GET.get('term')
query = Q()
for q in q.split(' '):
@@ -1352,16 +1369,16 @@ def autocomplete_organization(request, orga_type=None):
organizations = models.Organization.objects.filter(query)[:limit]
data = json.dumps([{'id': org.pk, 'value': unicode(org)}
for org in organizations])
- return HttpResponse(data, mimetype='text/plain')
+ return HttpResponse(data, content_type='text/plain')
def autocomplete_author(request):
if not request.user.has_perm('ishtar_common.view_author', models.Author)\
and not request.user.has_perm('ishtar_common.view_own_author',
models.Author):
- return HttpResponse('[]', mimetype='text/plain')
+ return HttpResponse('[]', content_type='text/plain')
if not request.GET.get('term'):
- return HttpResponse('[]', mimetype='text/plain')
+ return HttpResponse('[]', content_type='text/plain')
q = request.GET.get('term')
query = Q()
for q in q.split(' '):
@@ -1374,7 +1391,7 @@ def autocomplete_author(request):
authors = models.Author.objects.filter(query)[:limit]
data = json.dumps([{'id': author.pk, 'value': unicode(author)}
for author in authors])
- return HttpResponse(data, mimetype='text/plain')
+ return HttpResponse(data, content_type='text/plain')
def new_item(model, frm, many=False):
diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py
index 42a93ddaa..0a80bb895 100644
--- a/ishtar_common/widgets.py
+++ b/ishtar_common/widgets.py
@@ -34,7 +34,7 @@ from django.utils.encoding import smart_unicode
from django.utils.functional import lazy
from django.utils.html import escape
from django.utils.safestring import mark_safe
-from django.utils.simplejson import JSONEncoder
+from json import JSONEncoder
from django.utils.translation import ugettext_lazy as _
from ishtar_common import models
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index 3f90f8c48..128833ad4 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2010-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2010-2017 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -22,14 +22,15 @@ import logging
# from functools import wraps
from django.conf import settings
-from django.contrib.formtools.wizard.views import NamedUrlWizardView, \
- normalize_name, get_storage, StepsHelper
+from formtools.wizard.views import NamedUrlWizardView, normalize_name, \
+ get_storage, StepsHelper
+
from django.contrib.sites.models import Site
from django.core.exceptions import ObjectDoesNotExist
from django.core.files.images import ImageFile
from django.core.files.storage import default_storage
from django.core.mail import send_mail
-from django.db.models.fields.files import FileField
+from django.db.models.fields.files import FileField, ImageFieldFile
from django.db.models.fields.related import ManyToManyField
from django.db.models.fields import NOT_PROVIDED
@@ -127,8 +128,7 @@ class Wizard(NamedUrlWizardView):
label = ''
translated_keys = []
modification = None # True when the wizard modify an item
- storage_name = \
- 'django.contrib.formtools.wizard.storage.session.SessionStorage'
+ storage_name = 'formtools.wizard.storage.session.SessionStorage'
wizard_done_template = 'ishtar/wizard/wizard_done.html'
wizard_done_window = ''
wizard_confirm = 'ishtar/wizard/confirm_wizard.html'
@@ -357,7 +357,7 @@ class Wizard(NamedUrlWizardView):
if form_datas:
form_datas.append(("", "", "spacer"))
items = hasattr(base_form, 'fields') and \
- base_form.fields.keyOrder or cleaned_data.keys()
+ base_form.fields.keys() or cleaned_data.keys()
for key in items:
lbl = None
if key.startswith('hidden_'):
@@ -368,7 +368,7 @@ class Wizard(NamedUrlWizardView):
if hasattr(base_form, 'associated_labels') \
and key in base_form.associated_labels:
lbl = base_form.associated_labels[key]
- if not lbl:
+ if not lbl or key not in cleaned_data:
continue
value = cleaned_data[key]
if value is None or value == '':
@@ -715,19 +715,22 @@ class Wizard(NamedUrlWizardView):
# check if there is no missing fields
# should be managed normally in forms but...
- if hasattr(model._meta, 'get_fields'): # django 1.8
- fields = model._meta.get_field()
- else:
- fields = model._meta.fields
+ fields = model._meta.get_fields()
- has_problemetic_null = [
- (field.name, field.default == NOT_PROVIDED)
- for field in fields
+
+ has_problemetic_null = False
+ for field in fields:
if (field.name not in value
- or not value[field.name])
- and not field.null and not field.blank
- and (not field.default
- or field.default == NOT_PROVIDED)]
+ or not value[field.name]) \
+ and (hasattr(field, 'null')
+ and not field.null) \
+ and (hasattr(field, 'blank')
+ and not field.blank) \
+ and (hasattr(field, 'default')
+ and (not field.default
+ or field.default == NOT_PROVIDED)):
+ has_problemetic_null = True
+ break
if has_problemetic_null:
continue
@@ -739,7 +742,9 @@ class Wizard(NamedUrlWizardView):
value.save() # force post_save
# check that an item is not add multiple times (forged forms)
if value not in related_model.all() and\
- hasattr(related_model, 'add'):
+ (not hasattr(related_model, 'through') or
+ not isinstance(value, related_model.through)):
+ # many to many and the value have been already managed
related_model.add(value)
# necessary to manage interaction between models like
# material_index management for baseitems
@@ -872,7 +877,7 @@ class Wizard(NamedUrlWizardView):
frm = form.forms[0]
if frm:
# autofocus on first field
- first_field = frm.fields[frm.fields.keyOrder[0]]
+ first_field = frm.fields[frm.fields.keys()[0]]
attrs = first_field.widget.attrs
attrs.update({'autofocus': "autofocus"})
first_field.widget.attrs = attrs
@@ -1108,7 +1113,13 @@ class Wizard(NamedUrlWizardView):
continue
if hasattr(value, 'pk'):
value = value.pk
- if value in (True, False) or \
+ if isinstance(value, ImageFieldFile) \
+ or isinstance(value, FileField):
+ try:
+ initial[base_field] = value.path
+ except ValueError:
+ pass
+ elif value in (True, False) or \
isinstance(value, FileField) or \
isinstance(value, ImageFile):
initial[base_field] = value
@@ -1160,8 +1171,7 @@ class SearchWizard(NamedUrlWizardView):
model = None
label = ''
modification = None # True when the wizard modify an item
- storage_name = \
- 'django.contrib.formtools.wizard.storage.session.SessionStorage'
+ storage_name = 'formtools.wizard.storage.session.SessionStorage'
def get_wizard_name(self):
"""
@@ -1373,17 +1383,24 @@ class AccountWizard(Wizard):
if key.startswith('hidden_password'):
dct['password'] = dct.pop(key)
try:
- account = models.IshtarUser.objects.get(person=person)
+ account = models.IshtarUser.objects.get(person=person).user_ptr
account.username = dct['username']
account.email = dct['email']
except ObjectDoesNotExist:
now = datetime.datetime.now()
- account = models.IshtarUser(
- person=person, username=dct['username'], email=dct['email'],
+ account = models.User.objects.create(
+ username=dct['username'], email=dct['email'],
first_name=person.surname or '***',
last_name=person.name or '***',
is_staff=False, is_active=True, is_superuser=False,
- last_login=now, date_joined=now)
+ last_login=now, date_joined=now
+ )
+ ishtaruser = account.ishtaruser
+ old_person_pk = ishtaruser.person.pk
+ ishtaruser.person = person
+ ishtaruser.save()
+ models.Person.objects.get(pk=old_person_pk).delete()
+
if dct['password']:
account.set_password(dct['password'])
account.save()