summaryrefslogtreecommitdiff
path: root/archaeological_files
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_files')
-rw-r--r--archaeological_files/__init__.py1
-rw-r--r--archaeological_files/admin.py33
-rw-r--r--archaeological_files/fixtures/initial_data-fr.json529
-rw-r--r--archaeological_files/lookups.py21
-rw-r--r--archaeological_files/migrations/0001_initial.py503
-rw-r--r--archaeological_files/migrations/0002_auto_20170414_2123.py188
-rw-r--r--archaeological_files/migrations/0003_views.py16
-rw-r--r--archaeological_files/migrations/0004_auto_20170802_1557.py18
-rw-r--r--archaeological_files/migrations/0005_auto_20170804_1741.py24
-rw-r--r--archaeological_files/migrations/0006_auto_20170804_2024.py31
-rw-r--r--archaeological_files/migrations/0007_auto_20170826_1152.py32
-rw-r--r--archaeological_files/models.py45
-rw-r--r--archaeological_files/old_migrations/0001_initial.py348
-rw-r--r--archaeological_files/old_migrations/0002_views.py (renamed from archaeological_files/migrations/0002_views.py)0
-rw-r--r--archaeological_files/old_migrations/0003_auto__add_field_file_name__add_field_historicalfile_name.py (renamed from archaeological_files/migrations/0003_auto__add_field_file_name__add_field_historicalfile_name.py)0
-rw-r--r--archaeological_files/old_migrations/0004_auto__chg_field_file_numeric_reference__chg_field_historicalfile_numer.py (renamed from archaeological_files/migrations/0004_auto__chg_field_file_numeric_reference__chg_field_historicalfile_numer.py)0
-rw-r--r--archaeological_files/old_migrations/0005_auto__chg_field_file_internal_reference__chg_field_historicalfile_inte.py (renamed from archaeological_files/migrations/0005_auto__chg_field_file_internal_reference__chg_field_historicalfile_inte.py)0
-rw-r--r--archaeological_files/old_migrations/0006_auto__chg_field_file_in_charge.py (renamed from archaeological_files/migrations/0006_auto__chg_field_file_in_charge.py)0
-rw-r--r--archaeological_files/old_migrations/0007_auto__add_field_file_cached_label__add_field_historicalfile_cached_lab.py (renamed from archaeological_files/migrations/0007_auto__add_field_file_cached_label__add_field_historicalfile_cached_lab.py)0
-rw-r--r--archaeological_files/old_migrations/0008_auto__chg_field_file_cached_label__chg_field_historicalfile_cached_lab.py (renamed from archaeological_files/migrations/0008_auto__chg_field_file_cached_label__chg_field_historicalfile_cached_lab.py)0
-rw-r--r--archaeological_files/old_migrations/0009_auto__add_field_file_responsible_town_planning_service__add_field_hist.py (renamed from archaeological_files/migrations/0009_auto__add_field_file_responsible_town_planning_service__add_field_hist.py)0
-rw-r--r--archaeological_files/old_migrations/0010_responsible_town_planning_service_transition.py (renamed from archaeological_files/migrations/0010_responsible_town_planning_service_transition.py)0
-rw-r--r--archaeological_files/old_migrations/0011_auto__del_field_file_town_planning_service__del_field_historicalfile_t.py (renamed from archaeological_files/migrations/0011_auto__del_field_file_town_planning_service__del_field_historicalfile_t.py)0
-rw-r--r--archaeological_files/old_migrations/0012_auto__del_unique_file_internal_reference__add_unique_file_year_interna.py (renamed from archaeological_files/migrations/0012_auto__del_unique_file_internal_reference__add_unique_file_year_interna.py)0
-rw-r--r--archaeological_files/old_migrations/0013_auto__del_unique_file_year_internal_reference.py (renamed from archaeological_files/migrations/0013_auto__del_unique_file_year_internal_reference.py)0
-rw-r--r--archaeological_files/old_migrations/0014_auto__add_field_file_requested_operation_type__add_field_file_organiza.py (renamed from archaeological_files/migrations/0014_auto__add_field_file_requested_operation_type__add_field_file_organiza.py)0
-rw-r--r--archaeological_files/old_migrations/0015_auto__add_field_file_history_creator__add_field_historicalfile_history.py (renamed from archaeological_files/migrations/0015_auto__add_field_file_history_creator__add_field_historicalfile_history.py)0
-rw-r--r--archaeological_files/old_migrations/0016_init_history_creator.py (renamed from archaeological_files/migrations/0016_init_history_creator.py)0
-rw-r--r--archaeological_files/old_migrations/0017_reinit_history_creator.py (renamed from archaeological_files/migrations/0017_reinit_history_creator.py)0
-rw-r--r--archaeological_files/old_migrations/0018_auto__add_field_file_imported_line__chg_field_file_responsible_town_pl.py (renamed from archaeological_files/migrations/0018_auto__add_field_file_imported_line__chg_field_file_responsible_town_pl.py)0
-rw-r--r--archaeological_files/old_migrations/0019_auto__chg_field_file_history_creator__chg_field_file_history_modifier.py (renamed from archaeological_files/migrations/0019_auto__chg_field_file_history_creator__chg_field_file_history_modifier.py)0
-rw-r--r--archaeological_files/old_migrations/0020_auto.py (renamed from archaeological_files/migrations/0020_auto.py)0
-rw-r--r--archaeological_files/old_migrations/0021_auto__chg_field_saisinetype_txt_idx__chg_field_filetype_txt_idx__del_f.py (renamed from archaeological_files/migrations/0021_auto__chg_field_saisinetype_txt_idx__chg_field_filetype_txt_idx__del_f.py)0
-rw-r--r--archaeological_files/old_migrations/0022_auto__add_field_file_corporation_general_contractor__add_field_file_co.py (renamed from archaeological_files/migrations/0022_auto__add_field_file_corporation_general_contractor__add_field_file_co.py)0
-rw-r--r--archaeological_files/old_migrations/0023_auto__del_field_file_corporation_responsible_town_planning_service__ad.py (renamed from archaeological_files/migrations/0023_auto__del_field_file_corporation_responsible_town_planning_service__ad.py)0
-rw-r--r--archaeological_files/old_migrations/0024_auto__chg_field_file_reference_number__chg_field_historicalfile_refere.py (renamed from archaeological_files/migrations/0024_auto__chg_field_file_reference_number__chg_field_historicalfile_refere.py)0
-rw-r--r--archaeological_files/old_migrations/0025_auto__add_field_file_external_id__chg_field_file_name__add_field_histo.py (renamed from archaeological_files/migrations/0025_auto__add_field_file_external_id__chg_field_file_name__add_field_histo.py)0
-rw-r--r--archaeological_files/old_migrations/0026_auto__chg_field_file_cached_label__chg_field_historicalfile_cached_lab.py (renamed from archaeological_files/migrations/0026_auto__chg_field_file_cached_label__chg_field_historicalfile_cached_lab.py)0
-rw-r--r--archaeological_files/old_migrations/0027_auto__chg_field_file_reference_number__chg_field_historicalfile_refere.py (renamed from archaeological_files/migrations/0027_auto__chg_field_file_reference_number__chg_field_historicalfile_refere.py)0
-rw-r--r--archaeological_files/old_migrations/0028_auto__chg_field_file_requested_operation_type.py (renamed from archaeological_files/migrations/0028_auto__chg_field_file_requested_operation_type.py)0
-rw-r--r--archaeological_files/old_migrations/0029_auto__chg_field_file_creation_date__chg_field_historicalfile_creation_.py (renamed from archaeological_files/migrations/0029_auto__chg_field_file_creation_date__chg_field_historicalfile_creation_.py)0
-rw-r--r--archaeological_files/old_migrations/0030_reference_number_to_permit_reference.py (renamed from archaeological_files/migrations/0030_reference_number_to_permit_reference.py)0
-rw-r--r--archaeological_files/old_migrations/0031_auto__del_field_file_reference_number__chg_field_file_permit_reference.py (renamed from archaeological_files/migrations/0031_auto__del_field_file_reference_number__chg_field_file_permit_reference.py)0
-rw-r--r--archaeological_files/old_migrations/0032_auto__add_field_file_auto_external_id__add_field_historicalfile_auto_e.py (renamed from archaeological_files/migrations/0032_auto__add_field_file_auto_external_id__add_field_historicalfile_auto_e.py)0
-rw-r--r--archaeological_files/old_migrations/0033_auto__chg_field_file_total_surface__chg_field_file_total_developed_sur.py (renamed from archaeological_files/migrations/0033_auto__chg_field_file_total_surface__chg_field_file_total_developed_sur.py)0
-rw-r--r--archaeological_files/old_migrations/__init__.py0
-rw-r--r--archaeological_files/templates/ishtar/blocks/window_file_nav.html1
-rw-r--r--archaeological_files/templates/ishtar/sheet_file.html5
-rw-r--r--archaeological_files/tests.py70
-rw-r--r--archaeological_files/urls.py38
-rw-r--r--archaeological_files/views.py11
-rw-r--r--archaeological_files/wizards.py7
52 files changed, 1199 insertions, 722 deletions
diff --git a/archaeological_files/__init__.py b/archaeological_files/__init__.py
index e69de29bb..c76037d94 100644
--- a/archaeological_files/__init__.py
+++ b/archaeological_files/__init__.py
@@ -0,0 +1 @@
+default_app_config = 'ishtar_common.apps.ArchaeologicalFilesConfig'
diff --git a/archaeological_files/admin.py b/archaeological_files/admin.py
index 9e1f56392..525f7e840 100644
--- a/archaeological_files/admin.py
+++ b/archaeological_files/admin.py
@@ -17,27 +17,46 @@
# See the file COPYING for details.
+from ajax_select import make_ajax_form
+
from django.conf import settings
-from django.contrib import admin
+from ishtar_common.apps import admin_site
from ishtar_common.admin import HistorizedObjectAdmin, GeneralTypeAdmin
import models
class FileAdmin(HistorizedObjectAdmin):
- list_display = ['year', 'numeric_reference', 'internal_reference',
- 'end_date', 'file_type', 'general_contractor']
+ list_display = ['year', 'numeric_reference', 'file_type', 'name']
if settings.COUNTRY == 'fr':
list_display += ['saisine_type', 'permit_reference']
- list_filter = ("file_type", "year",)
- search_fields = ('towns__name',)
+ list_filter = ["file_type", "year"]
+ if settings.COUNTRY == 'fr':
+ list_filter += ['saisine_type']
+ search_fields = ('name', 'towns__name', 'permit_reference')
+ form = make_ajax_form(
+ models.File, {'in_charge': 'person',
+ 'general_contractor': 'person',
+ 'corporation_general_contractor': 'organization',
+ 'responsible_town_planning_service': 'person',
+ 'planning_service': 'organization',
+ 'organization': 'organization',
+ 'scientist': 'person',
+ 'main_town': 'town',
+ 'towns': 'town',
+ 'related_file': 'file'
+ })
+ readonly_fields = HistorizedObjectAdmin.readonly_fields + [
+ 'raw_general_contractor', 'raw_town_planning_service', 'imports',
+ 'cached_label', 'imported_line'
+ ]
model = models.File
-admin.site.register(models.File, FileAdmin)
+admin_site.register(models.File, FileAdmin)
general_models = [models.FileType, models.PermitType]
if settings.COUNTRY == 'fr':
general_models.append(models.SaisineType)
for model in general_models:
- admin.site.register(model, GeneralTypeAdmin)
+ admin_site.register(model, GeneralTypeAdmin)
diff --git a/archaeological_files/fixtures/initial_data-fr.json b/archaeological_files/fixtures/initial_data-fr.json
index fff42cfb7..4941364ef 100644
--- a/archaeological_files/fixtures/initial_data-fr.json
+++ b/archaeological_files/fixtures/initial_data-fr.json
@@ -1,280 +1,253 @@
[
- {
- "pk": 5,
- "model": "archaeological_files.saisinetype",
- "fields": {
- "comment": "Article 6\r\n\r\n Lorsqu'il dispose d'informations lui indiquant qu'un projet qui ne lui est pas transmis en application de l'arr\u00eat\u00e9 mentionn\u00e9 \u00e0 l'article 5 est n\u00e9anmoins susceptible d'affecter des \u00e9l\u00e9ments du patrimoine arch\u00e9ologique, le pr\u00e9fet de r\u00e9gion peut demander au maire de lui communiquer au cours de l'instruction, selon le cas, le dossier de demande de permis de construire, de permis d'am\u00e9nager, de permis de d\u00e9molir ou le dossier de r\u00e9alisation de zone d'am\u00e9nagement concert\u00e9 qui correspond \u00e0 ce projet.\r\n\r\nIl peut, pour le m\u00eame motif, demander au maire de lui communiquer le dossier d'une d\u00e9claration pr\u00e9alable d\u00e9pos\u00e9e en application de l'article L. 421-4 du code de l'urbanisme.",
- "available": true,
- "txt_idx": "Article_6",
- "delay": 30,
- "label": "Auto-saisine (n'existe plus, pour archives donc)"
- }
- },
- {
- "pk": 3,
- "model": "archaeological_files.saisinetype",
- "fields": {
- "comment": "Les am\u00e9nageurs peuvent, avant de d\u00e9poser une demande pour obtenir les autorisations requises par les lois et r\u00e8glements ou avant d'engager toute autre proc\u00e9dure, saisir le pr\u00e9fet de r\u00e9gion afin qu'il examine si leur projet est susceptible de donner lieu \u00e0 des prescriptions arch\u00e9ologiques.\r\nA cette fin, ils produisent un dossier qui comporte un plan parcellaire et les r\u00e9f\u00e9rences cadastrales, le descriptif du projet et son emplacement sur le terrain d'assiette ainsi que, le cas \u00e9ch\u00e9ant, une notice pr\u00e9cisant les modalit\u00e9s techniques envisag\u00e9es pour l'ex\u00e9cution des travaux.\r\nSi le pr\u00e9fet de r\u00e9gion constate que le projet est susceptible d'affecter des \u00e9l\u00e9ments du patrimoine arch\u00e9ologique, il informe le demandeur, dans le d\u00e9lai de deux mois \u00e0 compter de la r\u00e9ception de la demande, que le projet qu'il lui a pr\u00e9sent\u00e9 donnera lieu \u00e0 des prescriptions arch\u00e9ologiques.",
- "available": true,
- "txt_idx": "Article_10",
- "delay": 60,
- "label": "Demande d'AVIS (Art. R. 523-12 du code du patrimoine)"
- }
- },
- {
- "pk": 6,
- "model": "archaeological_files.saisinetype",
- "fields": {
- "comment": "Lorsque des op\u00e9rations sont r\u00e9alis\u00e9es par tranches successives, le calendrier pr\u00e9visionnel de leur r\u00e9alisation est communiqu\u00e9 au pr\u00e9fet de r\u00e9gion qui peut d\u00e9cider de prescrire les mesures pr\u00e9vues \u00e0 l'article R. 523-15 soit pour la totalit\u00e9 du projet, soit lors de l'ex\u00e9cution de chaque tranche. Dans ce dernier cas, il d\u00e9finit par arr\u00eat\u00e9 les d\u00e9lais de sa saisine et la nature des documents \u00e0 fournir.\r\nLes op\u00e9rations de diagnostic sont toutefois conduites pour l'ensemble du projet si la personne qui r\u00e9alise ce projet en fait la demande.",
- "available": true,
- "txt_idx": "partial_demand",
- "delay": 30,
- "label": "Demande de r\u00e9alisation d'une TRANCHE (suite \u00e0 un arr\u00eat\u00e9 initial, Article R523-21)"
- }
- },
- {
- "pk": 7,
- "model": "archaeological_files.saisinetype",
- "fields": {
- "comment": "",
- "available": true,
- "txt_idx": "information_query",
- "delay": 30,
- "label": "Demande d'INFO (CU compris)"
- }
- },
- {
- "pk": 4,
- "model": "archaeological_files.saisinetype",
- "fields": {
- "comment": " Si le pr\u00e9fet de r\u00e9gion a fait conna\u00eetre, en application de l'article R. 523-12, la n\u00e9cessit\u00e9 d'une op\u00e9ration arch\u00e9ologique, l'am\u00e9nageur peut le saisir d'une demande anticip\u00e9e de prescription.\r\n\r\nLe pr\u00e9fet de r\u00e9gion prescrit alors, dans les conditions pr\u00e9vues par le pr\u00e9sent chapitre, la r\u00e9alisation d'un diagnostic arch\u00e9ologique et, si des \u00e9l\u00e9ments du patrimoine arch\u00e9ologique pr\u00e9sents sur le site sont d\u00e9j\u00e0 connus, prend les autres mesures pr\u00e9vues \u00e0 l'article R. 523-15.\r\n\r\nLa redevance d'arch\u00e9ologie pr\u00e9ventive correspondante est due par le demandeur, conform\u00e9ment au dernier alin\u00e9a de l'article L. 524-4.",
- "available": true,
- "txt_idx": "Article_12",
- "delay": 30,
- "label": "Demande VOLONTAIRE (Article R523-14)"
- }
- },
- {
- "pk": 9,
- "model": "archaeological_files.saisinetype",
- "fields": {
- "comment": "",
- "available": true,
- "txt_idx": "impact_study",
- "delay": 60,
- "label": "\u00c9tude d'impact (EI)"
- }
- },
- {
- "pk": 2,
- "model": "archaeological_files.saisinetype",
- "fields": {
- "comment": "Dans les cas mentionn\u00e9s aux 1\u00b0 \u00e0 5\u00b0 de l'article R. 523-4, le pr\u00e9fet de r\u00e9gion est saisi :\r\n\r\n1\u00b0 Pour les permis de construire, les permis d'am\u00e9nager et les permis de d\u00e9molir, par le pr\u00e9fet de d\u00e9partement ; celui-ci adresse au pr\u00e9fet de r\u00e9gion, d\u00e8s qu'il a re\u00e7u les \u00e9l\u00e9ments transmis par le maire en application des articles R. 423-7 \u00e0 R. 423-9 du code de l'urbanisme, les pi\u00e8ces compl\u00e9mentaires pr\u00e9vues par les arr\u00eat\u00e9s mentionn\u00e9s au dernier alin\u00e9a de l'article R. 423-2 du m\u00eame code faisant notamment appara\u00eetre l'emplacement pr\u00e9vu des travaux sur le terrain d'assiette, leur superficie, leur impact sur le sous-sol ;\r\n\r\n2\u00b0 Pour les zones d'am\u00e9nagement concert\u00e9, par la personne publique ayant pris l'initiative de la cr\u00e9ation de la zone ; celle-ci adresse au pr\u00e9fet de r\u00e9gion le dossier de r\u00e9alisation approuv\u00e9, pr\u00e9vu \u00e0 l'article R. 311-7 du code de l'urbanisme ;\r\n3\u00b0 Pour les travaux \u00e9num\u00e9r\u00e9s \u00e0 l'article R. 523-5, par le propri\u00e9taire du terrain et, s'il n'assure pas lui-m\u00eame la r\u00e9alisation des travaux, par la personne charg\u00e9e de celle-ci. Le dossier de d\u00e9claration adress\u00e9 au pr\u00e9fet de r\u00e9gion comporte un plan parcellaire, les r\u00e9f\u00e9rences cadastrales, la ou les surfaces int\u00e9ress\u00e9es, le descriptif des travaux, leur destination et leur emplacement sur le terrain d'assiette de l'op\u00e9ration ainsi qu'une notice pr\u00e9cisant les modalit\u00e9s techniques envisag\u00e9es pour leur ex\u00e9cution et leur impact sur le sous-sol ;\r\n\r\n4\u00b0 Pour les am\u00e9nagements et ouvrages mentionn\u00e9s au 5\u00b0 de l'article R. 523-4 qui sont soumis \u00e0 une autorisation administrative autre qu'une autorisation d'urbanisme, par le service charg\u00e9 de recevoir la demande d'autorisation ; celui-ci adresse au pr\u00e9fet de r\u00e9gion une copie du dossier de cette demande ;\r\n\r\n5\u00b0 Pour les am\u00e9nagements et ouvrages mentionn\u00e9s au 5\u00b0 de l'article R. 523-4 qui ne sont pas soumis \u00e0 une autorisation administrative, par l'am\u00e9nageur ; celui-ci adresse au pr\u00e9fet de r\u00e9gion un dossier d\u00e9crivant les travaux projet\u00e9s, notamment leur emplacement pr\u00e9vu sur le terrain d'assiette, leur superficie, leur impact sur le sous-sol et indiquant la date \u00e0 laquelle ils ont \u00e9t\u00e9 arr\u00eat\u00e9s.",
- "available": true,
- "txt_idx": "Article_8",
- "delay": 21,
- "label": "SAISINE simple (Article R523-9)"
- }
- },
- {
- "pk": 8,
- "model": "archaeological_files.saisinetype",
- "fields": {
- "comment": "",
- "available": true,
- "txt_idx": "HM_works",
- "delay": 21,
- "label": "Travaux sur monuments historiques class\u00e9s (R. 523-10)"
- }
- },
- {
- "pk": 1,
- "model": "archaeological_files.filetype",
- "fields": {
- "comment": "",
- "available": true,
- "txt_idx": "preventive",
- "label": "Arch\u00e9ologie pr\u00e9ventive"
- }
- },
- {
- "pk": 2,
- "model": "archaeological_files.filetype",
- "fields": {
- "comment": "",
- "available": true,
- "txt_idx": "prog",
- "label": "Arch\u00e9ologie programm\u00e9e"
- }
- },
- {
- "pk": 3,
- "model": "archaeological_files.filetype",
- "fields": {
- "comment": "",
- "available": true,
- "txt_idx": "undefined",
- "label": "Non pr\u00e9cis\u00e9"
- }
- },
- {
- "pk": 13,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": null,
- "available": true,
- "txt_idx": "AUT",
- "label": "Autorisation"
- }
- },
- {
- "pk": 18,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": null,
- "available": true,
- "txt_idx": "AL",
- "label": "Autorisation de lotir"
- }
- },
- {
- "pk": 15,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": null,
- "available": true,
- "txt_idx": "AT",
- "label": "Autorisation de travaux"
- }
- },
- {
- "pk": 11,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": null,
- "available": true,
- "txt_idx": "O",
- "label": "Autre"
- }
- },
- {
- "pk": 9,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": null,
- "available": true,
- "txt_idx": "CU",
- "label": "Certificat d'urbanisme"
- }
- },
- {
- "pk": 6,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": "",
- "available": true,
- "txt_idx": "DP",
- "label": "D\u00e9claration pr\u00e9alable"
- }
- },
- {
- "pk": 17,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": "",
- "available": true,
- "txt_idx": "DF",
- "label": "D\u00e9couverte fortuite"
- }
- },
- {
- "pk": 19,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": "Saisine suite \u00e0 une demande de travaux MH :\r\nArticle R523-10 \r\n\r\nPour les travaux sur les monuments historiques class\u00e9s mentionn\u00e9s au 6\u00b0 de l'article R. 523-4, la saisine du pr\u00e9fet de r\u00e9gion au titre de l'autorisation exig\u00e9e par l'article L. 621-9 vaut saisine au titre du pr\u00e9sent chapitre",
- "available": true,
- "txt_idx": "MH",
- "label": "Demande d'autorisation de travaux sur un immeuble class\u00e9 au titre des monuments historiques"
- }
- },
- {
- "pk": 3,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": "",
- "available": true,
- "txt_idx": "zac",
- "label": "Dossier de r\u00e9alisation de ZAC"
- }
- },
- {
- "pk": 10,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": null,
- "available": true,
- "txt_idx": "EI",
- "label": "\u00c9tude d'impact"
- }
- },
- {
- "pk": 16,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": null,
- "available": true,
- "txt_idx": "EMH",
- "label": "\u00c9tude pr\u00e9alable MH"
- }
- },
- {
- "pk": 12,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": null,
- "available": true,
- "txt_idx": "IC",
- "label": "Installation class\u00e9e"
- }
- },
- {
- "pk": 7,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": null,
- "available": true,
- "txt_idx": "NP",
- "label": "Non pr\u00e9cis\u00e9"
- }
- },
- {
- "pk": 2,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": "",
- "available": true,
- "txt_idx": "PA",
- "label": "Permis d'am\u00e9nager"
- }
- },
- {
- "pk": 14,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": "",
- "available": true,
- "txt_idx": "PC",
- "label": "Permis de construire"
- }
- },
- {
- "pk": 8,
- "model": "archaeological_files.permittype",
- "fields": {
- "comment": "",
- "available": true,
- "txt_idx": "PD",
- "label": "Permis de d\u00e9molir"
- }
+{
+ "model": "archaeological_files.saisinetype",
+ "fields": {
+ "label": "SAISINE simple (Article R523-9)",
+ "txt_idx": "Article_8",
+ "comment": "Dans les cas mentionn\u00e9s aux 1\u00b0 \u00e0 5\u00b0 de l'article R. 523-4, le pr\u00e9fet de r\u00e9gion est saisi :\r\n\r\n1\u00b0 Pour les permis de construire, les permis d'am\u00e9nager et les permis de d\u00e9molir, par le pr\u00e9fet de d\u00e9partement ; celui-ci adresse au pr\u00e9fet de r\u00e9gion, d\u00e8s qu'il a re\u00e7u les \u00e9l\u00e9ments transmis par le maire en application des articles R. 423-7 \u00e0 R. 423-9 du code de l'urbanisme, les pi\u00e8ces compl\u00e9mentaires pr\u00e9vues par les arr\u00eat\u00e9s mentionn\u00e9s au dernier alin\u00e9a de l'article R. 423-2 du m\u00eame code faisant notamment appara\u00eetre l'emplacement pr\u00e9vu des travaux sur le terrain d'assiette, leur superficie, leur impact sur le sous-sol ;\r\n\r\n2\u00b0 Pour les zones d'am\u00e9nagement concert\u00e9, par la personne publique ayant pris l'initiative de la cr\u00e9ation de la zone ; celle-ci adresse au pr\u00e9fet de r\u00e9gion le dossier de r\u00e9alisation approuv\u00e9, pr\u00e9vu \u00e0 l'article R. 311-7 du code de l'urbanisme ;\r\n3\u00b0 Pour les travaux \u00e9num\u00e9r\u00e9s \u00e0 l'article R. 523-5, par le propri\u00e9taire du terrain et, s'il n'assure pas lui-m\u00eame la r\u00e9alisation des travaux, par la personne charg\u00e9e de celle-ci. Le dossier de d\u00e9claration adress\u00e9 au pr\u00e9fet de r\u00e9gion comporte un plan parcellaire, les r\u00e9f\u00e9rences cadastrales, la ou les surfaces int\u00e9ress\u00e9es, le descriptif des travaux, leur destination et leur emplacement sur le terrain d'assiette de l'op\u00e9ration ainsi qu'une notice pr\u00e9cisant les modalit\u00e9s techniques envisag\u00e9es pour leur ex\u00e9cution et leur impact sur le sous-sol ;\r\n\r\n4\u00b0 Pour les am\u00e9nagements et ouvrages mentionn\u00e9s au 5\u00b0 de l'article R. 523-4 qui sont soumis \u00e0 une autorisation administrative autre qu'une autorisation d'urbanisme, par le service charg\u00e9 de recevoir la demande d'autorisation ; celui-ci adresse au pr\u00e9fet de r\u00e9gion une copie du dossier de cette demande ;\r\n\r\n5\u00b0 Pour les am\u00e9nagements et ouvrages mentionn\u00e9s au 5\u00b0 de l'article R. 523-4 qui ne sont pas soumis \u00e0 une autorisation administrative, par l'am\u00e9nageur ; celui-ci adresse au pr\u00e9fet de r\u00e9gion un dossier d\u00e9crivant les travaux projet\u00e9s, notamment leur emplacement pr\u00e9vu sur le terrain d'assiette, leur superficie, leur impact sur le sous-sol et indiquant la date \u00e0 laquelle ils ont \u00e9t\u00e9 arr\u00eat\u00e9s.",
+ "available": true,
+ "delay": 21
}
-] \ No newline at end of file
+},
+{
+ "model": "archaeological_files.saisinetype",
+ "fields": {
+ "label": "Demande d'AVIS (Art. R. 523-12 du code du patrimoine)",
+ "txt_idx": "Article_10",
+ "comment": "Les am\u00e9nageurs peuvent, avant de d\u00e9poser une demande pour obtenir les autorisations requises par les lois et r\u00e8glements ou avant d'engager toute autre proc\u00e9dure, saisir le pr\u00e9fet de r\u00e9gion afin qu'il examine si leur projet est susceptible de donner lieu \u00e0 des prescriptions arch\u00e9ologiques.\r\nA cette fin, ils produisent un dossier qui comporte un plan parcellaire et les r\u00e9f\u00e9rences cadastrales, le descriptif du projet et son emplacement sur le terrain d'assiette ainsi que, le cas \u00e9ch\u00e9ant, une notice pr\u00e9cisant les modalit\u00e9s techniques envisag\u00e9es pour l'ex\u00e9cution des travaux.\r\nSi le pr\u00e9fet de r\u00e9gion constate que le projet est susceptible d'affecter des \u00e9l\u00e9ments du patrimoine arch\u00e9ologique, il informe le demandeur, dans le d\u00e9lai de deux mois \u00e0 compter de la r\u00e9ception de la demande, que le projet qu'il lui a pr\u00e9sent\u00e9 donnera lieu \u00e0 des prescriptions arch\u00e9ologiques.",
+ "available": true,
+ "delay": 60
+ }
+},
+{
+ "model": "archaeological_files.saisinetype",
+ "fields": {
+ "label": "Demande VOLONTAIRE (Article R523-14)",
+ "txt_idx": "Article_12",
+ "comment": " Si le pr\u00e9fet de r\u00e9gion a fait conna\u00eetre, en application de l'article R. 523-12, la n\u00e9cessit\u00e9 d'une op\u00e9ration arch\u00e9ologique, l'am\u00e9nageur peut le saisir d'une demande anticip\u00e9e de prescription.\r\n\r\nLe pr\u00e9fet de r\u00e9gion prescrit alors, dans les conditions pr\u00e9vues par le pr\u00e9sent chapitre, la r\u00e9alisation d'un diagnostic arch\u00e9ologique et, si des \u00e9l\u00e9ments du patrimoine arch\u00e9ologique pr\u00e9sents sur le site sont d\u00e9j\u00e0 connus, prend les autres mesures pr\u00e9vues \u00e0 l'article R. 523-15.\r\n\r\nLa redevance d'arch\u00e9ologie pr\u00e9ventive correspondante est due par le demandeur, conform\u00e9ment au dernier alin\u00e9a de l'article L. 524-4.",
+ "available": true,
+ "delay": 30
+ }
+},
+{
+ "model": "archaeological_files.saisinetype",
+ "fields": {
+ "label": "Auto-saisine (n'existe plus, pour archives donc)",
+ "txt_idx": "Article_6",
+ "comment": "Article 6\r\n\r\n Lorsqu'il dispose d'informations lui indiquant qu'un projet qui ne lui est pas transmis en application de l'arr\u00eat\u00e9 mentionn\u00e9 \u00e0 l'article 5 est n\u00e9anmoins susceptible d'affecter des \u00e9l\u00e9ments du patrimoine arch\u00e9ologique, le pr\u00e9fet de r\u00e9gion peut demander au maire de lui communiquer au cours de l'instruction, selon le cas, le dossier de demande de permis de construire, de permis d'am\u00e9nager, de permis de d\u00e9molir ou le dossier de r\u00e9alisation de zone d'am\u00e9nagement concert\u00e9 qui correspond \u00e0 ce projet.\r\n\r\nIl peut, pour le m\u00eame motif, demander au maire de lui communiquer le dossier d'une d\u00e9claration pr\u00e9alable d\u00e9pos\u00e9e en application de l'article L. 421-4 du code de l'urbanisme.",
+ "available": true,
+ "delay": 30
+ }
+},
+{
+ "model": "archaeological_files.saisinetype",
+ "fields": {
+ "label": "Demande de r\u00e9alisation d'une TRANCHE (suite \u00e0 un arr\u00eat\u00e9 initial, Article R523-21)",
+ "txt_idx": "partial_demand",
+ "comment": "Lorsque des op\u00e9rations sont r\u00e9alis\u00e9es par tranches successives, le calendrier pr\u00e9visionnel de leur r\u00e9alisation est communiqu\u00e9 au pr\u00e9fet de r\u00e9gion qui peut d\u00e9cider de prescrire les mesures pr\u00e9vues \u00e0 l'article R. 523-15 soit pour la totalit\u00e9 du projet, soit lors de l'ex\u00e9cution de chaque tranche. Dans ce dernier cas, il d\u00e9finit par arr\u00eat\u00e9 les d\u00e9lais de sa saisine et la nature des documents \u00e0 fournir.\r\nLes op\u00e9rations de diagnostic sont toutefois conduites pour l'ensemble du projet si la personne qui r\u00e9alise ce projet en fait la demande.",
+ "available": true,
+ "delay": 30
+ }
+},
+{
+ "model": "archaeological_files.saisinetype",
+ "fields": {
+ "label": "Demande d'INFO (CU compris)",
+ "txt_idx": "information_query",
+ "comment": "",
+ "available": true,
+ "delay": 30
+ }
+},
+{
+ "model": "archaeological_files.saisinetype",
+ "fields": {
+ "label": "Travaux sur monuments historiques class\u00e9s (R. 523-10)",
+ "txt_idx": "HM_works",
+ "comment": "",
+ "available": true,
+ "delay": 21
+ }
+},
+{
+ "model": "archaeological_files.saisinetype",
+ "fields": {
+ "label": "\u00c9tude d'impact (EI)",
+ "txt_idx": "impact_study",
+ "comment": "",
+ "available": true,
+ "delay": 60
+ }
+},
+{
+ "model": "archaeological_files.filetype",
+ "fields": {
+ "label": "Arch\u00e9ologie pr\u00e9ventive",
+ "txt_idx": "preventive",
+ "comment": "",
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.filetype",
+ "fields": {
+ "label": "Arch\u00e9ologie programm\u00e9e",
+ "txt_idx": "prog",
+ "comment": "",
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.filetype",
+ "fields": {
+ "label": "Non pr\u00e9cis\u00e9",
+ "txt_idx": "undefined",
+ "comment": "",
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "Permis d'am\u00e9nager",
+ "txt_idx": "PA",
+ "comment": "",
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "Dossier de r\u00e9alisation de ZAC",
+ "txt_idx": "zac",
+ "comment": "",
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "D\u00e9claration pr\u00e9alable",
+ "txt_idx": "DP",
+ "comment": "",
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "Non pr\u00e9cis\u00e9",
+ "txt_idx": "NP",
+ "comment": null,
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "Permis de d\u00e9molir",
+ "txt_idx": "PD",
+ "comment": "",
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "Certificat d'urbanisme",
+ "txt_idx": "CU",
+ "comment": null,
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "\u00c9tude d'impact",
+ "txt_idx": "EI",
+ "comment": null,
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "Autre",
+ "txt_idx": "O",
+ "comment": null,
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "Installation class\u00e9e",
+ "txt_idx": "IC",
+ "comment": null,
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "Autorisation",
+ "txt_idx": "AUT",
+ "comment": null,
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "Permis de construire",
+ "txt_idx": "PC",
+ "comment": "",
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "Autorisation de travaux",
+ "txt_idx": "AT",
+ "comment": null,
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "\u00c9tude pr\u00e9alable MH",
+ "txt_idx": "EMH",
+ "comment": null,
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "D\u00e9couverte fortuite",
+ "txt_idx": "DF",
+ "comment": "",
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "Autorisation de lotir",
+ "txt_idx": "AL",
+ "comment": null,
+ "available": true
+ }
+},
+{
+ "model": "archaeological_files.permittype",
+ "fields": {
+ "label": "Demande d'autorisation de travaux sur un immeuble class\u00e9 au titre des monuments historiques",
+ "txt_idx": "MH",
+ "comment": "Saisine suite \u00e0 une demande de travaux MH :\r\nArticle R523-10 \r\n\r\nPour les travaux sur les monuments historiques class\u00e9s mentionn\u00e9s au 6\u00b0 de l'article R. 523-4, la saisine du pr\u00e9fet de r\u00e9gion au titre de l'autorisation exig\u00e9e par l'article L. 621-9 vaut saisine au titre du pr\u00e9sent chapitre",
+ "available": true
+ }
+}
+]
diff --git a/archaeological_files/lookups.py b/archaeological_files/lookups.py
new file mode 100644
index 000000000..90b904945
--- /dev/null
+++ b/archaeological_files/lookups.py
@@ -0,0 +1,21 @@
+from ajax_select import register, LookupChannel
+
+from django.db.models import Q
+from archaeological_files.models import File
+
+
+@register('file')
+class FileLookup(LookupChannel):
+ model = File
+
+ def get_query(self, q, request):
+ query = Q()
+ for term in q.strip().split(' '):
+ subquery = (
+ Q(cached_label__icontains=term)
+ )
+ query &= subquery
+ return self.model.objects.filter(query).order_by('cached_label')[:20]
+
+ def format_item_display(self, item):
+ return u"<span class='ajax-label'>%s</span>" % item.cached_label
diff --git a/archaeological_files/migrations/0001_initial.py b/archaeological_files/migrations/0001_initial.py
index b69998442..878be3902 100644
--- a/archaeological_files/migrations/0001_initial.py
+++ b/archaeological_files/migrations/0001_initial.py
@@ -1,348 +1,159 @@
# -*- 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 'FileType'
- db.create_table('archaeological_files_filetype', (
- ('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('archaeological_files', ['FileType'])
-
- # Adding model 'PermitType'
- db.create_table('archaeological_files_permittype', (
- ('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('archaeological_files', ['PermitType'])
-
- # Adding model 'SaisineType'
- db.create_table('archaeological_files_saisinetype', (
- ('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)),
- ('delay', self.gf('django.db.models.fields.IntegerField')()),
- ))
- db.send_create_signal('archaeological_files', ['SaisineType'])
-
- # Adding model 'HistoricalFile'
- db.create_table('archaeological_files_historicalfile', (
- ('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)),
- ('year', self.gf('django.db.models.fields.IntegerField')(default=2012)),
- ('numeric_reference', self.gf('django.db.models.fields.IntegerField')()),
- ('internal_reference', self.gf('django.db.models.fields.CharField')(max_length=60, db_index=True)),
- ('file_type_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
- ('in_charge_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
- ('general_contractor_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
- ('town_planning_service_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
- ('permit_type_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
- ('permit_reference', self.gf('django.db.models.fields.CharField')(max_length=60, null=True, blank=True)),
- ('end_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
- ('creation_date', self.gf('django.db.models.fields.DateField')(default=datetime.date.today)),
- ('reception_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
- ('related_file_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
- ('saisine_type_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
- ('reference_number', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
- ('total_surface', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
- ('total_developed_surface', self.gf('django.db.models.fields.IntegerField')(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)),
- ('comment', self.gf('django.db.models.fields.TextField')(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('archaeological_files', ['HistoricalFile'])
-
- # Adding model 'File'
- db.create_table('archaeological_files_file', (
- ('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'])),
- ('year', self.gf('django.db.models.fields.IntegerField')(default=2012)),
- ('numeric_reference', self.gf('django.db.models.fields.IntegerField')()),
- ('internal_reference', self.gf('django.db.models.fields.CharField')(unique=True, max_length=60)),
- ('file_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_files.FileType'])),
- ('in_charge', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['ishtar_common.Person'])),
- ('general_contractor', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['ishtar_common.Person'])),
- ('town_planning_service', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['ishtar_common.Organization'])),
- ('permit_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_files.PermitType'], null=True, blank=True)),
- ('permit_reference', self.gf('django.db.models.fields.CharField')(max_length=60, null=True, blank=True)),
- ('end_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
- ('creation_date', self.gf('django.db.models.fields.DateField')(default=datetime.date.today)),
- ('reception_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
- ('related_file', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_files.File'], null=True, blank=True)),
- ('saisine_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_files.SaisineType'], null=True, blank=True)),
- ('reference_number', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
- ('total_surface', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
- ('total_developed_surface', self.gf('django.db.models.fields.IntegerField')(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)),
- ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ))
- db.send_create_signal('archaeological_files', ['File'])
-
- # Adding M2M table for field towns on 'File'
- db.create_table('archaeological_files_file_towns', (
- ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
- ('file', models.ForeignKey(orm['archaeological_files.file'], null=False)),
- ('town', models.ForeignKey(orm['ishtar_common.town'], null=False))
- ))
- db.create_unique('archaeological_files_file_towns', ['file_id', 'town_id'])
-
+from __future__ import unicode_literals
- def backwards(self, orm):
- # Deleting model 'FileType'
- db.delete_table('archaeological_files_filetype')
-
- # Deleting model 'PermitType'
- db.delete_table('archaeological_files_permittype')
-
- # Deleting model 'SaisineType'
- db.delete_table('archaeological_files_saisinetype')
-
- # Deleting model 'HistoricalFile'
- db.delete_table('archaeological_files_historicalfile')
-
- # Deleting model 'File'
- db.delete_table('archaeological_files_file')
-
- # Removing M2M table for field towns on 'File'
- db.delete_table('archaeological_files_file_towns')
-
-
- models = {
- 'archaeological_files.file': {
- 'Meta': {'ordering': "['-year', '-numeric_reference']", 'object_name': 'File'},
- 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'creation_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today'}),
- 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
- 'file_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.FileType']"}),
- 'general_contractor': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}),
- 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['ishtar_common.Person']"}),
- 'internal_reference': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'}),
- 'numeric_reference': ('django.db.models.fields.IntegerField', [], {}),
- 'permit_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}),
- 'permit_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.PermitType']", 'null': 'True', 'blank': 'True'}),
- 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'reception_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
- 'reference_number': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
- 'related_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.File']", 'null': 'True', 'blank': 'True'}),
- 'saisine_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.SaisineType']", 'null': 'True', 'blank': 'True'}),
- 'total_developed_surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
- 'total_surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
- 'town_planning_service': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}),
- 'towns': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'file'", 'symmetrical': 'False', 'to': "orm['ishtar_common.Town']"}),
- 'year': ('django.db.models.fields.IntegerField', [], {'default': '2012'})
- },
- 'archaeological_files.filebydepartment': {
- 'Meta': {'object_name': 'FileByDepartment', 'db_table': "'file_department'", 'managed': 'False'},
- 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}),
- 'file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.File']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
- },
- 'archaeological_files.filetype': {
- 'Meta': {'object_name': 'FileType'},
- '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'})
- },
- 'archaeological_files.historicalfile': {
- 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalFile'},
- 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'creation_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today'}),
- 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
- 'file_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'general_contractor_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'}),
- 'in_charge_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'db_index': 'True'}),
- 'numeric_reference': ('django.db.models.fields.IntegerField', [], {}),
- 'permit_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}),
- 'permit_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
- 'reception_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
- 'reference_number': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
- 'related_file_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'saisine_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'total_developed_surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
- 'total_surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
- 'town_planning_service_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
- 'year': ('django.db.models.fields.IntegerField', [], {'default': '2012'})
- },
- 'archaeological_files.permittype': {
- 'Meta': {'object_name': 'PermitType'},
- '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'})
- },
- 'archaeological_files.saisinetype': {
- 'Meta': {'object_name': 'SaisineType'},
- 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'delay': ('django.db.models.fields.IntegerField', [], {}),
- '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'})
- },
- '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.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.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.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 = ['archaeological_files'] \ No newline at end of file
+from django.db import models, migrations
+import datetime
+import archaeological_operations.models
+import ishtar_common.utils
+import ishtar_common.models
+import re
+import django.core.validators
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='FileByDepartment',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ],
+ options={
+ 'db_table': 'file_department',
+ 'managed': False,
+ },
+ ),
+ migrations.CreateModel(
+ name='File',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('year', models.IntegerField(default=ishtar_common.utils.get_current_year, verbose_name='Year')),
+ ('numeric_reference', models.IntegerField(null=True, verbose_name='Numeric reference', blank=True)),
+ ('internal_reference', models.CharField(max_length=60, null=True, verbose_name='Internal reference', blank=True)),
+ ('external_id', models.CharField(max_length=120, null=True, verbose_name='External ID', blank=True)),
+ ('auto_external_id', models.BooleanField(default=False, verbose_name='External ID is set automatically')),
+ ('name', models.TextField(null=True, verbose_name='Name', blank=True)),
+ ('raw_general_contractor', models.CharField(max_length=200, null=True, verbose_name='General contractor (raw)', blank=True)),
+ ('raw_town_planning_service', models.CharField(max_length=200, null=True, verbose_name='Planning service (raw)', blank=True)),
+ ('permit_reference', models.TextField(null=True, verbose_name='Permit reference', blank=True)),
+ ('end_date', models.DateField(null=True, verbose_name='Closing date', blank=True)),
+ ('creation_date', models.DateField(default=datetime.date.today, null=True, verbose_name='Creation date', blank=True)),
+ ('reception_date', models.DateField(null=True, verbose_name='Reception date', blank=True)),
+ ('instruction_deadline', models.DateField(null=True, verbose_name='Instruction deadline', blank=True)),
+ ('total_surface', models.FloatField(null=True, verbose_name='Total surface (m2)', blank=True)),
+ ('total_developed_surface', models.FloatField(null=True, verbose_name='Total developed surface (m2)', blank=True)),
+ ('locality', models.CharField(max_length=100, null=True, verbose_name='Locality', blank=True)),
+ ('address', models.TextField(null=True, verbose_name='Main address', blank=True)),
+ ('postal_code', models.CharField(max_length=10, null=True, verbose_name='Main address - postal code', blank=True)),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('research_comment', models.TextField(null=True, verbose_name='Research archaeology comment', blank=True)),
+ ('classified_area', models.NullBooleanField(verbose_name='Classified area')),
+ ('protected_area', models.NullBooleanField(verbose_name='Protected area')),
+ ('cira_advised', models.NullBooleanField(verbose_name='Passage en CIRA')),
+ ('mh_register', models.NullBooleanField(verbose_name='Sur Monument Historique class\xe9')),
+ ('mh_listing', models.NullBooleanField(verbose_name='Sur Monument Historique inscrit')),
+ ('cached_label', models.TextField(null=True, verbose_name='Cached name', blank=True)),
+ ('imported_line', models.TextField(null=True, verbose_name='Imported line', blank=True)),
+ ],
+ options={
+ 'ordering': ('cached_label',),
+ 'verbose_name': 'Archaeological file',
+ 'verbose_name_plural': 'Archaeological files',
+ 'permissions': (('view_file', 'Peut voir tous les Dossiers'), ('view_own_file', 'Peut voir son propre Dossier'), ('add_own_file', 'Peut ajouter son propre Dossier'), ('change_own_file', 'Peut modifier son propre Dossier'), ('delete_own_file', 'Peut supprimer son propre Dossier'), ('close_file', 'Peut clore un Dossier')),
+ },
+ bases=(archaeological_operations.models.ClosedItem, models.Model, ishtar_common.models.OwnPerms, ishtar_common.models.ValueGetter, ishtar_common.models.ShortMenuItem, ishtar_common.models.DashboardFormItem),
+ ),
+ migrations.CreateModel(
+ name='FileType',
+ 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': 'Archaeological file type',
+ 'verbose_name_plural': 'Archaeological file types',
+ },
+ bases=(ishtar_common.models.Cached, models.Model),
+ ),
+ migrations.CreateModel(
+ name='HistoricalFile',
+ fields=[
+ ('id', models.IntegerField(verbose_name='ID', db_index=True, auto_created=True, blank=True)),
+ ('year', models.IntegerField(default=ishtar_common.utils.get_current_year, verbose_name='Year')),
+ ('numeric_reference', models.IntegerField(null=True, verbose_name='Numeric reference', blank=True)),
+ ('internal_reference', models.CharField(max_length=60, null=True, verbose_name='Internal reference', blank=True)),
+ ('external_id', models.CharField(max_length=120, null=True, verbose_name='External ID', blank=True)),
+ ('auto_external_id', models.BooleanField(default=False, verbose_name='External ID is set automatically')),
+ ('name', models.TextField(null=True, verbose_name='Name', blank=True)),
+ ('raw_general_contractor', models.CharField(max_length=200, null=True, verbose_name='General contractor (raw)', blank=True)),
+ ('raw_town_planning_service', models.CharField(max_length=200, null=True, verbose_name='Planning service (raw)', blank=True)),
+ ('permit_reference', models.TextField(null=True, verbose_name='Permit reference', blank=True)),
+ ('end_date', models.DateField(null=True, verbose_name='Closing date', blank=True)),
+ ('creation_date', models.DateField(default=datetime.date.today, null=True, verbose_name='Creation date', blank=True)),
+ ('reception_date', models.DateField(null=True, verbose_name='Reception date', blank=True)),
+ ('instruction_deadline', models.DateField(null=True, verbose_name='Instruction deadline', blank=True)),
+ ('total_surface', models.FloatField(null=True, verbose_name='Total surface (m2)', blank=True)),
+ ('total_developed_surface', models.FloatField(null=True, verbose_name='Total developed surface (m2)', blank=True)),
+ ('locality', models.CharField(max_length=100, null=True, verbose_name='Locality', blank=True)),
+ ('address', models.TextField(null=True, verbose_name='Main address', blank=True)),
+ ('postal_code', models.CharField(max_length=10, null=True, verbose_name='Main address - postal code', blank=True)),
+ ('comment', models.TextField(null=True, verbose_name='Comment', blank=True)),
+ ('research_comment', models.TextField(null=True, verbose_name='Research archaeology comment', blank=True)),
+ ('classified_area', models.NullBooleanField(verbose_name='Classified area')),
+ ('protected_area', models.NullBooleanField(verbose_name='Protected area')),
+ ('cira_advised', models.NullBooleanField(verbose_name='Passage en CIRA')),
+ ('mh_register', models.NullBooleanField(verbose_name='Sur Monument Historique class\xe9')),
+ ('mh_listing', models.NullBooleanField(verbose_name='Sur Monument Historique inscrit')),
+ ('cached_label', models.TextField(null=True, verbose_name='Cached name', blank=True)),
+ ('imported_line', models.TextField(null=True, verbose_name='Imported line', 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 Archaeological file',
+ },
+ ),
+ migrations.CreateModel(
+ name='PermitType',
+ 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': 'Permit type',
+ 'verbose_name_plural': 'Permit types',
+ },
+ bases=(ishtar_common.models.Cached, models.Model),
+ ),
+ migrations.CreateModel(
+ name='SaisineType',
+ 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')),
+ ('delay', models.IntegerField(default=30, verbose_name='Delay (in days)')),
+ ],
+ options={
+ 'ordering': ('label',),
+ 'verbose_name': 'Type de saisine',
+ 'verbose_name_plural': 'Types de saisine',
+ },
+ bases=(ishtar_common.models.Cached, models.Model, ishtar_common.models.ValueGetter),
+ ),
+ ]
diff --git a/archaeological_files/migrations/0002_auto_20170414_2123.py b/archaeological_files/migrations/0002_auto_20170414_2123.py
new file mode 100644
index 000000000..a8c8d7075
--- /dev/null
+++ b/archaeological_files/migrations/0002_auto_20170414_2123.py
@@ -0,0 +1,188 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import django.db.models.deletion
+from django.conf import settings
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_files', '0001_initial'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('ishtar_common', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='historicalfile',
+ name='corporation_general_contractor',
+ 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='historicalfile',
+ name='file_type',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='archaeological_files.FileType', null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalfile',
+ name='general_contractor',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='ishtar_common.Person', null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalfile',
+ 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='historicalfile',
+ 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='historicalfile',
+ 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='historicalfile',
+ name='in_charge',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='ishtar_common.Person', null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalfile',
+ name='main_town',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='ishtar_common.Town', null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalfile',
+ name='organization',
+ 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='historicalfile',
+ name='permit_type',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='archaeological_files.PermitType', null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalfile',
+ name='planning_service',
+ 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='historicalfile',
+ name='related_file',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='archaeological_files.File', null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalfile',
+ name='requested_operation_type',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='ishtar_common.OperationType', null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalfile',
+ name='responsible_town_planning_service',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='ishtar_common.Person', null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalfile',
+ name='saisine_type',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='archaeological_files.SaisineType', null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalfile',
+ name='scientist',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.DO_NOTHING, db_constraint=False, blank=True, to='ishtar_common.Person', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='corporation_general_contractor',
+ field=models.ForeignKey(related_name='general_contractor_files', on_delete=django.db.models.deletion.SET_NULL, verbose_name='General contractor organization', blank=True, to='ishtar_common.Organization', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='departments',
+ field=models.ManyToManyField(to='ishtar_common.Department', verbose_name='Departments', blank=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='file_type',
+ field=models.ForeignKey(verbose_name='File type', to='archaeological_files.FileType'),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='general_contractor',
+ field=models.ForeignKey(related_name='general_contractor_files', on_delete=django.db.models.deletion.SET_NULL, verbose_name='General contractor', blank=True, to='ishtar_common.Person', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='history_creator',
+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Creator', blank=True, to=settings.AUTH_USER_MODEL, null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='history_modifier',
+ field=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),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='imports',
+ field=models.ManyToManyField(related_name='imported_archaeological_files_file', to='ishtar_common.Import', blank=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='in_charge',
+ field=models.ForeignKey(related_name='file_responsability', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Person in charge', blank=True, to='ishtar_common.Person', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='main_town',
+ field=models.ForeignKey(related_name='file_main', verbose_name='Town', blank=True, to='ishtar_common.Town', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='organization',
+ field=models.ForeignKey(related_name='files', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Organization', blank=True, to='ishtar_common.Organization', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='permit_type',
+ field=models.ForeignKey(verbose_name='Permit type', blank=True, to='archaeological_files.PermitType', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='planning_service',
+ field=models.ForeignKey(related_name='planning_service_files', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Planning service organization', blank=True, to='ishtar_common.Organization', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='related_file',
+ field=models.ForeignKey(verbose_name='Related file', blank=True, to='archaeological_files.File', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='requested_operation_type',
+ field=models.ForeignKey(related_name='+', verbose_name='Requested operation type', blank=True, to='ishtar_common.OperationType', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='responsible_town_planning_service',
+ field=models.ForeignKey(related_name='responsible_town_planning_service_files', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Responsible for planning service', blank=True, to='ishtar_common.Person', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='saisine_type',
+ field=models.ForeignKey(verbose_name='Type de saisine', blank=True, to='archaeological_files.SaisineType', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='scientist',
+ field=models.ForeignKey(related_name='scientist', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Scientist in charge', blank=True, to='ishtar_common.Person', null=True),
+ ),
+ migrations.AddField(
+ model_name='file',
+ name='towns',
+ field=models.ManyToManyField(related_name='file', verbose_name='Towns', to='ishtar_common.Town'),
+ ),
+ ]
diff --git a/archaeological_files/migrations/0003_views.py b/archaeological_files/migrations/0003_views.py
new file mode 100644
index 000000000..5e3d891ad
--- /dev/null
+++ b/archaeological_files/migrations/0003_views.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+from archaeological_files.models import FileByDepartment
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_files', '0002_auto_20170414_2123'),
+ ]
+
+ operations = [
+ migrations.RunSQL(FileByDepartment.CREATE_SQL)
+ ]
diff --git a/archaeological_files/migrations/0004_auto_20170802_1557.py b/archaeological_files/migrations/0004_auto_20170802_1557.py
new file mode 100644
index 000000000..bffd44099
--- /dev/null
+++ b/archaeological_files/migrations/0004_auto_20170802_1557.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_files', '0003_views'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='file',
+ options={'ordering': ('cached_label',), 'verbose_name': 'Archaeological file', 'verbose_name_plural': 'Archaeological files', 'permissions': (('view_file', 'Can view all Archaeological files'), ('view_own_file', 'Can view own Archaeological file'), ('add_own_file', 'Can add own Archaeological file'), ('change_own_file', 'Can change own Archaeological file'), ('delete_own_file', 'Can delete own Archaeological file'), ('close_file', 'Can close File'))},
+ ),
+ ]
diff --git a/archaeological_files/migrations/0005_auto_20170804_1741.py b/archaeological_files/migrations/0005_auto_20170804_1741.py
new file mode 100644
index 000000000..223528cc1
--- /dev/null
+++ b/archaeological_files/migrations/0005_auto_20170804_1741.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_files', '0004_auto_20170802_1557'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='file',
+ name='main_town',
+ field=models.ForeignKey(related_name='file_main', verbose_name='Main town', blank=True, to='ishtar_common.Town', null=True),
+ ),
+ migrations.AlterField(
+ model_name='file',
+ name='towns',
+ field=models.ManyToManyField(related_name='file', verbose_name='Towns', to='ishtar_common.Town', blank=True),
+ ),
+ ]
diff --git a/archaeological_files/migrations/0006_auto_20170804_2024.py b/archaeological_files/migrations/0006_auto_20170804_2024.py
new file mode 100644
index 000000000..a74700d3c
--- /dev/null
+++ b/archaeological_files/migrations/0006_auto_20170804_2024.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import re
+import django.core.validators
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_files', '0005_auto_20170804_1741'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='filetype',
+ name='txt_idx',
+ field=models.CharField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', 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')]),
+ ),
+ migrations.AlterField(
+ model_name='permittype',
+ name='txt_idx',
+ field=models.CharField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', 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')]),
+ ),
+ migrations.AlterField(
+ model_name='saisinetype',
+ name='txt_idx',
+ field=models.CharField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', 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')]),
+ ),
+ ]
diff --git a/archaeological_files/migrations/0007_auto_20170826_1152.py b/archaeological_files/migrations/0007_auto_20170826_1152.py
new file mode 100644
index 000000000..be06c16e5
--- /dev/null
+++ b/archaeological_files/migrations/0007_auto_20170826_1152.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11 on 2017-08-26 11:52
+from __future__ import unicode_literals
+
+import django.core.validators
+from django.db import migrations, models
+import re
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_files', '0006_auto_20170804_2024'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='filetype',
+ name='txt_idx',
+ field=models.CharField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', max_length=100, unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID'),
+ ),
+ migrations.AlterField(
+ model_name='permittype',
+ name='txt_idx',
+ field=models.CharField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', max_length=100, unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID'),
+ ),
+ migrations.AlterField(
+ model_name='saisinetype',
+ name='txt_idx',
+ field=models.CharField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', max_length=100, unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID'),
+ ),
+ ]
diff --git a/archaeological_files/models.py b/archaeological_files/models.py
index 195418bc8..0d5b4b3e8 100644
--- a/archaeological_files/models.py
+++ b/archaeological_files/models.py
@@ -26,7 +26,8 @@ from django.db.models import Q, Count, Sum
from django.db.models.signals import post_save, m2m_changed, post_delete
from django.utils.translation import ugettext_lazy as _, ugettext
-from ishtar_common.utils import cached_label_changed, get_cache
+from ishtar_common.utils import cached_label_changed, get_cache, \
+ get_current_year
from ishtar_common.models import GeneralType, BaseHistorizedItem, \
HistoricalRecords, OwnPerms, Person, Organization, Department, Town, \
@@ -105,8 +106,7 @@ class File(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,
}
# fields
- year = models.IntegerField(_(u"Year"),
- default=lambda: datetime.datetime.now().year)
+ year = models.IntegerField(_(u"Year"), default=get_current_year)
numeric_reference = models.IntegerField(
_(u"Numeric reference"), blank=True, null=True)
internal_reference = models.CharField(_(u"Internal reference"), blank=True,
@@ -151,10 +151,10 @@ class File(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,
permit_reference = models.TextField(_(u"Permit reference"), blank=True,
null=True)
end_date = models.DateField(_(u"Closing date"), null=True, blank=True)
- main_town = models.ForeignKey(Town, verbose_name=_(u"Town"), null=True,
+ main_town = models.ForeignKey(Town, verbose_name=_(u"Main town"), null=True,
blank=True, related_name='file_main')
towns = models.ManyToManyField(Town, verbose_name=_(u"Towns"),
- related_name='file')
+ related_name='file', blank=True)
creation_date = models.DateField(
_(u"Creation date"), default=datetime.date.today, blank=True,
null=True)
@@ -180,7 +180,7 @@ class File(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,
comment = models.TextField(_(u"Comment"), null=True, blank=True)
# research archaeology -->
departments = models.ManyToManyField(
- Department, verbose_name=_(u"Departments"), null=True, blank=True)
+ Department, verbose_name=_(u"Departments"), blank=True)
requested_operation_type = models.ForeignKey(
OperationType, related_name='+', null=True,
blank=True, verbose_name=_(u"Requested operation type"))
@@ -220,14 +220,12 @@ class File(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,
verbose_name = _(u"Archaeological file")
verbose_name_plural = _(u"Archaeological files")
permissions = (
- ("view_file", ugettext(u"Can view all Archaeological files")),
- ("view_own_file", ugettext(u"Can view own Archaeological file")),
- ("add_own_file", ugettext(u"Can add own Archaeological file")),
- ("change_own_file",
- ugettext(u"Can change own Archaeological file")),
- ("delete_own_file",
- ugettext(u"Can delete own Archaeological file")),
- ("close_file", ugettext(u"Can close File")),
+ ("view_file", u"Can view all Archaeological files"),
+ ("view_own_file", u"Can view own Archaeological file"),
+ ("add_own_file", u"Can add own Archaeological file"),
+ ("change_own_file", u"Can change own Archaeological file"),
+ ("delete_own_file", u"Can delete own Archaeological file"),
+ ("close_file", u"Can close File"),
)
ordering = ('cached_label',)
@@ -430,9 +428,9 @@ class File(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,
return self.towns.all()[0].numero_insee[:2]
@classmethod
- def get_query_owns(cls, user):
- return (Q(history_creator=user) |
- Q(in_charge__ishtaruser=user.ishtaruser)) \
+ def get_query_owns(cls, ishtaruser):
+ return (Q(history_creator=ishtaruser.user_ptr) |
+ Q(in_charge__ishtaruser=ishtaruser)) \
& Q(end_date__isnull=True)
def is_active(self):
@@ -554,6 +552,19 @@ class FileByDepartment(models.Model):
"""
Database view for dashboard
"""
+ CREATE_SQL = """
+ CREATE VIEW file_department (id, department_id, file_id) as
+ select town."id", town."departement_id", file_towns."file_id"
+ from ishtar_common_town town
+ inner join archaeological_files_file_towns file_towns
+ on file_towns."town_id"=town."id"
+ order by town."departement_id";
+ CREATE RULE file_department_delete
+ AS ON DELETE TO file_department DO INSTEAD();
+ """
+ DELETE_SQL = """
+ DROP VIEW file_department;
+ """
file = models.ForeignKey(File, verbose_name=_(u"File"))
department = models.ForeignKey(Department, verbose_name=_(u"Department"),
blank=True, null=True)
diff --git a/archaeological_files/old_migrations/0001_initial.py b/archaeological_files/old_migrations/0001_initial.py
new file mode 100644
index 000000000..b69998442
--- /dev/null
+++ b/archaeological_files/old_migrations/0001_initial.py
@@ -0,0 +1,348 @@
+# -*- 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 'FileType'
+ db.create_table('archaeological_files_filetype', (
+ ('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('archaeological_files', ['FileType'])
+
+ # Adding model 'PermitType'
+ db.create_table('archaeological_files_permittype', (
+ ('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('archaeological_files', ['PermitType'])
+
+ # Adding model 'SaisineType'
+ db.create_table('archaeological_files_saisinetype', (
+ ('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)),
+ ('delay', self.gf('django.db.models.fields.IntegerField')()),
+ ))
+ db.send_create_signal('archaeological_files', ['SaisineType'])
+
+ # Adding model 'HistoricalFile'
+ db.create_table('archaeological_files_historicalfile', (
+ ('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)),
+ ('year', self.gf('django.db.models.fields.IntegerField')(default=2012)),
+ ('numeric_reference', self.gf('django.db.models.fields.IntegerField')()),
+ ('internal_reference', self.gf('django.db.models.fields.CharField')(max_length=60, db_index=True)),
+ ('file_type_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('in_charge_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('general_contractor_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('town_planning_service_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('permit_type_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('permit_reference', self.gf('django.db.models.fields.CharField')(max_length=60, null=True, blank=True)),
+ ('end_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
+ ('creation_date', self.gf('django.db.models.fields.DateField')(default=datetime.date.today)),
+ ('reception_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
+ ('related_file_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('saisine_type_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('reference_number', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('total_surface', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('total_developed_surface', self.gf('django.db.models.fields.IntegerField')(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)),
+ ('comment', self.gf('django.db.models.fields.TextField')(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('archaeological_files', ['HistoricalFile'])
+
+ # Adding model 'File'
+ db.create_table('archaeological_files_file', (
+ ('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'])),
+ ('year', self.gf('django.db.models.fields.IntegerField')(default=2012)),
+ ('numeric_reference', self.gf('django.db.models.fields.IntegerField')()),
+ ('internal_reference', self.gf('django.db.models.fields.CharField')(unique=True, max_length=60)),
+ ('file_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_files.FileType'])),
+ ('in_charge', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['ishtar_common.Person'])),
+ ('general_contractor', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['ishtar_common.Person'])),
+ ('town_planning_service', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['ishtar_common.Organization'])),
+ ('permit_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_files.PermitType'], null=True, blank=True)),
+ ('permit_reference', self.gf('django.db.models.fields.CharField')(max_length=60, null=True, blank=True)),
+ ('end_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
+ ('creation_date', self.gf('django.db.models.fields.DateField')(default=datetime.date.today)),
+ ('reception_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
+ ('related_file', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_files.File'], null=True, blank=True)),
+ ('saisine_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_files.SaisineType'], null=True, blank=True)),
+ ('reference_number', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('total_surface', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('total_developed_surface', self.gf('django.db.models.fields.IntegerField')(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)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ))
+ db.send_create_signal('archaeological_files', ['File'])
+
+ # Adding M2M table for field towns on 'File'
+ db.create_table('archaeological_files_file_towns', (
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+ ('file', models.ForeignKey(orm['archaeological_files.file'], null=False)),
+ ('town', models.ForeignKey(orm['ishtar_common.town'], null=False))
+ ))
+ db.create_unique('archaeological_files_file_towns', ['file_id', 'town_id'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'FileType'
+ db.delete_table('archaeological_files_filetype')
+
+ # Deleting model 'PermitType'
+ db.delete_table('archaeological_files_permittype')
+
+ # Deleting model 'SaisineType'
+ db.delete_table('archaeological_files_saisinetype')
+
+ # Deleting model 'HistoricalFile'
+ db.delete_table('archaeological_files_historicalfile')
+
+ # Deleting model 'File'
+ db.delete_table('archaeological_files_file')
+
+ # Removing M2M table for field towns on 'File'
+ db.delete_table('archaeological_files_file_towns')
+
+
+ models = {
+ 'archaeological_files.file': {
+ 'Meta': {'ordering': "['-year', '-numeric_reference']", 'object_name': 'File'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'creation_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today'}),
+ 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'file_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.FileType']"}),
+ 'general_contractor': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['ishtar_common.Person']"}),
+ 'internal_reference': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'}),
+ 'numeric_reference': ('django.db.models.fields.IntegerField', [], {}),
+ 'permit_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}),
+ 'permit_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.PermitType']", 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'reception_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'reference_number': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'related_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.File']", 'null': 'True', 'blank': 'True'}),
+ 'saisine_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.SaisineType']", 'null': 'True', 'blank': 'True'}),
+ 'total_developed_surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'total_surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'town_planning_service': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}),
+ 'towns': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'file'", 'symmetrical': 'False', 'to': "orm['ishtar_common.Town']"}),
+ 'year': ('django.db.models.fields.IntegerField', [], {'default': '2012'})
+ },
+ 'archaeological_files.filebydepartment': {
+ 'Meta': {'object_name': 'FileByDepartment', 'db_table': "'file_department'", 'managed': 'False'},
+ 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}),
+ 'file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.File']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
+ },
+ 'archaeological_files.filetype': {
+ 'Meta': {'object_name': 'FileType'},
+ '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'})
+ },
+ 'archaeological_files.historicalfile': {
+ 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalFile'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'creation_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today'}),
+ 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'file_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'general_contractor_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'}),
+ 'in_charge_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'db_index': 'True'}),
+ 'numeric_reference': ('django.db.models.fields.IntegerField', [], {}),
+ 'permit_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}),
+ 'permit_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'reception_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'reference_number': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'related_file_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'saisine_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'total_developed_surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'total_surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'town_planning_service_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'year': ('django.db.models.fields.IntegerField', [], {'default': '2012'})
+ },
+ 'archaeological_files.permittype': {
+ 'Meta': {'object_name': 'PermitType'},
+ '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'})
+ },
+ 'archaeological_files.saisinetype': {
+ 'Meta': {'object_name': 'SaisineType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'delay': ('django.db.models.fields.IntegerField', [], {}),
+ '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'})
+ },
+ '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.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.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.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 = ['archaeological_files'] \ No newline at end of file
diff --git a/archaeological_files/migrations/0002_views.py b/archaeological_files/old_migrations/0002_views.py
index dfbb466ec..dfbb466ec 100644
--- a/archaeological_files/migrations/0002_views.py
+++ b/archaeological_files/old_migrations/0002_views.py
diff --git a/archaeological_files/migrations/0003_auto__add_field_file_name__add_field_historicalfile_name.py b/archaeological_files/old_migrations/0003_auto__add_field_file_name__add_field_historicalfile_name.py
index 9dd744073..9dd744073 100644
--- a/archaeological_files/migrations/0003_auto__add_field_file_name__add_field_historicalfile_name.py
+++ b/archaeological_files/old_migrations/0003_auto__add_field_file_name__add_field_historicalfile_name.py
diff --git a/archaeological_files/migrations/0004_auto__chg_field_file_numeric_reference__chg_field_historicalfile_numer.py b/archaeological_files/old_migrations/0004_auto__chg_field_file_numeric_reference__chg_field_historicalfile_numer.py
index bcd4f7061..bcd4f7061 100644
--- a/archaeological_files/migrations/0004_auto__chg_field_file_numeric_reference__chg_field_historicalfile_numer.py
+++ b/archaeological_files/old_migrations/0004_auto__chg_field_file_numeric_reference__chg_field_historicalfile_numer.py
diff --git a/archaeological_files/migrations/0005_auto__chg_field_file_internal_reference__chg_field_historicalfile_inte.py b/archaeological_files/old_migrations/0005_auto__chg_field_file_internal_reference__chg_field_historicalfile_inte.py
index 2a26cdc3e..2a26cdc3e 100644
--- a/archaeological_files/migrations/0005_auto__chg_field_file_internal_reference__chg_field_historicalfile_inte.py
+++ b/archaeological_files/old_migrations/0005_auto__chg_field_file_internal_reference__chg_field_historicalfile_inte.py
diff --git a/archaeological_files/migrations/0006_auto__chg_field_file_in_charge.py b/archaeological_files/old_migrations/0006_auto__chg_field_file_in_charge.py
index 3c7ec0f50..3c7ec0f50 100644
--- a/archaeological_files/migrations/0006_auto__chg_field_file_in_charge.py
+++ b/archaeological_files/old_migrations/0006_auto__chg_field_file_in_charge.py
diff --git a/archaeological_files/migrations/0007_auto__add_field_file_cached_label__add_field_historicalfile_cached_lab.py b/archaeological_files/old_migrations/0007_auto__add_field_file_cached_label__add_field_historicalfile_cached_lab.py
index 92e979bd4..92e979bd4 100644
--- a/archaeological_files/migrations/0007_auto__add_field_file_cached_label__add_field_historicalfile_cached_lab.py
+++ b/archaeological_files/old_migrations/0007_auto__add_field_file_cached_label__add_field_historicalfile_cached_lab.py
diff --git a/archaeological_files/migrations/0008_auto__chg_field_file_cached_label__chg_field_historicalfile_cached_lab.py b/archaeological_files/old_migrations/0008_auto__chg_field_file_cached_label__chg_field_historicalfile_cached_lab.py
index 93fb7e01f..93fb7e01f 100644
--- a/archaeological_files/migrations/0008_auto__chg_field_file_cached_label__chg_field_historicalfile_cached_lab.py
+++ b/archaeological_files/old_migrations/0008_auto__chg_field_file_cached_label__chg_field_historicalfile_cached_lab.py
diff --git a/archaeological_files/migrations/0009_auto__add_field_file_responsible_town_planning_service__add_field_hist.py b/archaeological_files/old_migrations/0009_auto__add_field_file_responsible_town_planning_service__add_field_hist.py
index 39d2b9267..39d2b9267 100644
--- a/archaeological_files/migrations/0009_auto__add_field_file_responsible_town_planning_service__add_field_hist.py
+++ b/archaeological_files/old_migrations/0009_auto__add_field_file_responsible_town_planning_service__add_field_hist.py
diff --git a/archaeological_files/migrations/0010_responsible_town_planning_service_transition.py b/archaeological_files/old_migrations/0010_responsible_town_planning_service_transition.py
index 80771c562..80771c562 100644
--- a/archaeological_files/migrations/0010_responsible_town_planning_service_transition.py
+++ b/archaeological_files/old_migrations/0010_responsible_town_planning_service_transition.py
diff --git a/archaeological_files/migrations/0011_auto__del_field_file_town_planning_service__del_field_historicalfile_t.py b/archaeological_files/old_migrations/0011_auto__del_field_file_town_planning_service__del_field_historicalfile_t.py
index fb2af402a..fb2af402a 100644
--- a/archaeological_files/migrations/0011_auto__del_field_file_town_planning_service__del_field_historicalfile_t.py
+++ b/archaeological_files/old_migrations/0011_auto__del_field_file_town_planning_service__del_field_historicalfile_t.py
diff --git a/archaeological_files/migrations/0012_auto__del_unique_file_internal_reference__add_unique_file_year_interna.py b/archaeological_files/old_migrations/0012_auto__del_unique_file_internal_reference__add_unique_file_year_interna.py
index da1695457..da1695457 100644
--- a/archaeological_files/migrations/0012_auto__del_unique_file_internal_reference__add_unique_file_year_interna.py
+++ b/archaeological_files/old_migrations/0012_auto__del_unique_file_internal_reference__add_unique_file_year_interna.py
diff --git a/archaeological_files/migrations/0013_auto__del_unique_file_year_internal_reference.py b/archaeological_files/old_migrations/0013_auto__del_unique_file_year_internal_reference.py
index 24df2cb2c..24df2cb2c 100644
--- a/archaeological_files/migrations/0013_auto__del_unique_file_year_internal_reference.py
+++ b/archaeological_files/old_migrations/0013_auto__del_unique_file_year_internal_reference.py
diff --git a/archaeological_files/migrations/0014_auto__add_field_file_requested_operation_type__add_field_file_organiza.py b/archaeological_files/old_migrations/0014_auto__add_field_file_requested_operation_type__add_field_file_organiza.py
index aeb1faec1..aeb1faec1 100644
--- a/archaeological_files/migrations/0014_auto__add_field_file_requested_operation_type__add_field_file_organiza.py
+++ b/archaeological_files/old_migrations/0014_auto__add_field_file_requested_operation_type__add_field_file_organiza.py
diff --git a/archaeological_files/migrations/0015_auto__add_field_file_history_creator__add_field_historicalfile_history.py b/archaeological_files/old_migrations/0015_auto__add_field_file_history_creator__add_field_historicalfile_history.py
index 3be3e48ac..3be3e48ac 100644
--- a/archaeological_files/migrations/0015_auto__add_field_file_history_creator__add_field_historicalfile_history.py
+++ b/archaeological_files/old_migrations/0015_auto__add_field_file_history_creator__add_field_historicalfile_history.py
diff --git a/archaeological_files/migrations/0016_init_history_creator.py b/archaeological_files/old_migrations/0016_init_history_creator.py
index 32eef3c9c..32eef3c9c 100644
--- a/archaeological_files/migrations/0016_init_history_creator.py
+++ b/archaeological_files/old_migrations/0016_init_history_creator.py
diff --git a/archaeological_files/migrations/0017_reinit_history_creator.py b/archaeological_files/old_migrations/0017_reinit_history_creator.py
index 003c6f25d..003c6f25d 100644
--- a/archaeological_files/migrations/0017_reinit_history_creator.py
+++ b/archaeological_files/old_migrations/0017_reinit_history_creator.py
diff --git a/archaeological_files/migrations/0018_auto__add_field_file_imported_line__chg_field_file_responsible_town_pl.py b/archaeological_files/old_migrations/0018_auto__add_field_file_imported_line__chg_field_file_responsible_town_pl.py
index 4555145a3..4555145a3 100644
--- a/archaeological_files/migrations/0018_auto__add_field_file_imported_line__chg_field_file_responsible_town_pl.py
+++ b/archaeological_files/old_migrations/0018_auto__add_field_file_imported_line__chg_field_file_responsible_town_pl.py
diff --git a/archaeological_files/migrations/0019_auto__chg_field_file_history_creator__chg_field_file_history_modifier.py b/archaeological_files/old_migrations/0019_auto__chg_field_file_history_creator__chg_field_file_history_modifier.py
index 74794228a..74794228a 100644
--- a/archaeological_files/migrations/0019_auto__chg_field_file_history_creator__chg_field_file_history_modifier.py
+++ b/archaeological_files/old_migrations/0019_auto__chg_field_file_history_creator__chg_field_file_history_modifier.py
diff --git a/archaeological_files/migrations/0020_auto.py b/archaeological_files/old_migrations/0020_auto.py
index e6ecdfb3c..e6ecdfb3c 100644
--- a/archaeological_files/migrations/0020_auto.py
+++ b/archaeological_files/old_migrations/0020_auto.py
diff --git a/archaeological_files/migrations/0021_auto__chg_field_saisinetype_txt_idx__chg_field_filetype_txt_idx__del_f.py b/archaeological_files/old_migrations/0021_auto__chg_field_saisinetype_txt_idx__chg_field_filetype_txt_idx__del_f.py
index de4898d89..de4898d89 100644
--- a/archaeological_files/migrations/0021_auto__chg_field_saisinetype_txt_idx__chg_field_filetype_txt_idx__del_f.py
+++ b/archaeological_files/old_migrations/0021_auto__chg_field_saisinetype_txt_idx__chg_field_filetype_txt_idx__del_f.py
diff --git a/archaeological_files/migrations/0022_auto__add_field_file_corporation_general_contractor__add_field_file_co.py b/archaeological_files/old_migrations/0022_auto__add_field_file_corporation_general_contractor__add_field_file_co.py
index ddea52773..ddea52773 100644
--- a/archaeological_files/migrations/0022_auto__add_field_file_corporation_general_contractor__add_field_file_co.py
+++ b/archaeological_files/old_migrations/0022_auto__add_field_file_corporation_general_contractor__add_field_file_co.py
diff --git a/archaeological_files/migrations/0023_auto__del_field_file_corporation_responsible_town_planning_service__ad.py b/archaeological_files/old_migrations/0023_auto__del_field_file_corporation_responsible_town_planning_service__ad.py
index b58229e78..b58229e78 100644
--- a/archaeological_files/migrations/0023_auto__del_field_file_corporation_responsible_town_planning_service__ad.py
+++ b/archaeological_files/old_migrations/0023_auto__del_field_file_corporation_responsible_town_planning_service__ad.py
diff --git a/archaeological_files/migrations/0024_auto__chg_field_file_reference_number__chg_field_historicalfile_refere.py b/archaeological_files/old_migrations/0024_auto__chg_field_file_reference_number__chg_field_historicalfile_refere.py
index 7d297a328..7d297a328 100644
--- a/archaeological_files/migrations/0024_auto__chg_field_file_reference_number__chg_field_historicalfile_refere.py
+++ b/archaeological_files/old_migrations/0024_auto__chg_field_file_reference_number__chg_field_historicalfile_refere.py
diff --git a/archaeological_files/migrations/0025_auto__add_field_file_external_id__chg_field_file_name__add_field_histo.py b/archaeological_files/old_migrations/0025_auto__add_field_file_external_id__chg_field_file_name__add_field_histo.py
index 37ea1dd46..37ea1dd46 100644
--- a/archaeological_files/migrations/0025_auto__add_field_file_external_id__chg_field_file_name__add_field_histo.py
+++ b/archaeological_files/old_migrations/0025_auto__add_field_file_external_id__chg_field_file_name__add_field_histo.py
diff --git a/archaeological_files/migrations/0026_auto__chg_field_file_cached_label__chg_field_historicalfile_cached_lab.py b/archaeological_files/old_migrations/0026_auto__chg_field_file_cached_label__chg_field_historicalfile_cached_lab.py
index a90353c6c..a90353c6c 100644
--- a/archaeological_files/migrations/0026_auto__chg_field_file_cached_label__chg_field_historicalfile_cached_lab.py
+++ b/archaeological_files/old_migrations/0026_auto__chg_field_file_cached_label__chg_field_historicalfile_cached_lab.py
diff --git a/archaeological_files/migrations/0027_auto__chg_field_file_reference_number__chg_field_historicalfile_refere.py b/archaeological_files/old_migrations/0027_auto__chg_field_file_reference_number__chg_field_historicalfile_refere.py
index 345660bb4..345660bb4 100644
--- a/archaeological_files/migrations/0027_auto__chg_field_file_reference_number__chg_field_historicalfile_refere.py
+++ b/archaeological_files/old_migrations/0027_auto__chg_field_file_reference_number__chg_field_historicalfile_refere.py
diff --git a/archaeological_files/migrations/0028_auto__chg_field_file_requested_operation_type.py b/archaeological_files/old_migrations/0028_auto__chg_field_file_requested_operation_type.py
index 303e09b0f..303e09b0f 100644
--- a/archaeological_files/migrations/0028_auto__chg_field_file_requested_operation_type.py
+++ b/archaeological_files/old_migrations/0028_auto__chg_field_file_requested_operation_type.py
diff --git a/archaeological_files/migrations/0029_auto__chg_field_file_creation_date__chg_field_historicalfile_creation_.py b/archaeological_files/old_migrations/0029_auto__chg_field_file_creation_date__chg_field_historicalfile_creation_.py
index 52a9f70e4..52a9f70e4 100644
--- a/archaeological_files/migrations/0029_auto__chg_field_file_creation_date__chg_field_historicalfile_creation_.py
+++ b/archaeological_files/old_migrations/0029_auto__chg_field_file_creation_date__chg_field_historicalfile_creation_.py
diff --git a/archaeological_files/migrations/0030_reference_number_to_permit_reference.py b/archaeological_files/old_migrations/0030_reference_number_to_permit_reference.py
index 8a37b5085..8a37b5085 100644
--- a/archaeological_files/migrations/0030_reference_number_to_permit_reference.py
+++ b/archaeological_files/old_migrations/0030_reference_number_to_permit_reference.py
diff --git a/archaeological_files/migrations/0031_auto__del_field_file_reference_number__chg_field_file_permit_reference.py b/archaeological_files/old_migrations/0031_auto__del_field_file_reference_number__chg_field_file_permit_reference.py
index 7178855a8..7178855a8 100644
--- a/archaeological_files/migrations/0031_auto__del_field_file_reference_number__chg_field_file_permit_reference.py
+++ b/archaeological_files/old_migrations/0031_auto__del_field_file_reference_number__chg_field_file_permit_reference.py
diff --git a/archaeological_files/migrations/0032_auto__add_field_file_auto_external_id__add_field_historicalfile_auto_e.py b/archaeological_files/old_migrations/0032_auto__add_field_file_auto_external_id__add_field_historicalfile_auto_e.py
index 6dd172587..6dd172587 100644
--- a/archaeological_files/migrations/0032_auto__add_field_file_auto_external_id__add_field_historicalfile_auto_e.py
+++ b/archaeological_files/old_migrations/0032_auto__add_field_file_auto_external_id__add_field_historicalfile_auto_e.py
diff --git a/archaeological_files/migrations/0033_auto__chg_field_file_total_surface__chg_field_file_total_developed_sur.py b/archaeological_files/old_migrations/0033_auto__chg_field_file_total_surface__chg_field_file_total_developed_sur.py
index d9097bd6d..d9097bd6d 100644
--- a/archaeological_files/migrations/0033_auto__chg_field_file_total_surface__chg_field_file_total_developed_sur.py
+++ b/archaeological_files/old_migrations/0033_auto__chg_field_file_total_surface__chg_field_file_total_developed_sur.py
diff --git a/archaeological_files/old_migrations/__init__.py b/archaeological_files/old_migrations/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archaeological_files/old_migrations/__init__.py
diff --git a/archaeological_files/templates/ishtar/blocks/window_file_nav.html b/archaeological_files/templates/ishtar/blocks/window_file_nav.html
index 149603af8..f8b6ddb8a 100644
--- a/archaeological_files/templates/ishtar/blocks/window_file_nav.html
+++ b/archaeological_files/templates/ishtar/blocks/window_file_nav.html
@@ -1,6 +1,5 @@
{% extends "ishtar/blocks/window_nav.html" %}
{% load i18n %}
-{% load url from future %}
{% block extra_actions %}
<a class='history-nav' href='{% url "operation_add" item.pk %}'>
<span class="fa-stack fa-lg">
diff --git a/archaeological_files/templates/ishtar/sheet_file.html b/archaeological_files/templates/ishtar/sheet_file.html
index 9d0948660..6d64a975f 100644
--- a/archaeological_files/templates/ishtar/sheet_file.html
+++ b/archaeological_files/templates/ishtar/sheet_file.html
@@ -39,7 +39,7 @@
{% field_li "Type" item.file_type %}
-{% if item.related_file %}<li><label>{%trans "Related file"%}</label> <span class='value'><a href='#' onclick='load_window("{% url show-file item.related_file.pk "" %}")'>{{ item.related_file }}</a></span></li>{% endif %}
+{% if item.related_file %}<li><label>{%trans "Related file"%}</label> <span class='value'><a href='#' onclick='load_window("{% url "show-file" item.related_file.pk "" %}")'>{{ item.related_file }}</a></span></li>{% endif %}
</ul>
{% field "Comment" item.comment "<pre>" "</pre>" %}
@@ -127,7 +127,8 @@
<td class='string'>{{operation.in_charge|default:""}}</td>
<td>{{operation.start_date|default:""}}</td>
<td>{{operation.excavation_end_date|default:""}}</td>
- <td class='link'><a href="#" class='display_details' onclick='load_window("{%url show-operation operation.pk "" %}")'><i class="fa fa-info-circle" aria-hidden="true"></i></a></td>
+ <td class='link'><a href="#" class='display_details'
+ onclick='load_window("{% url "show-operation" operation.pk "" %}")'><i class="fa fa-info-circle" aria-hidden="true"></i></a></td>
</tr>
{% empty %}
<tr><td colspan="8" class='no_items'>{% trans "No operation associated to this archaeological file" %}</td></tr>
diff --git a/archaeological_files/tests.py b/archaeological_files/tests.py
index b23c91a95..8a1069d51 100644
--- a/archaeological_files/tests.py
+++ b/archaeological_files/tests.py
@@ -25,48 +25,26 @@ from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test.client import Client
-from ishtar_common.tests import TestCase, COMMON_FIXTURES
+from ishtar_common.tests import TestCase, COMMON_FIXTURES, create_superuser
-from ishtar_common.models import PersonType, Town, IshtarSiteProfile
+from ishtar_common.models import Town, IshtarSiteProfile
from archaeological_files import models
-from archaeological_operations.models import Parcel, ParcelOwner
-from archaeological_operations.tests import OperationInitTest, \
+from archaeological_operations.models import Parcel, ParcelOwner, ActType, \
+ AdministrativeAct
+from archaeological_operations.tests import OperationInitTest, FileInit, \
FILE_TOWNS_FIXTURES
-class FileInit(object):
- def login_as_superuser(self):
- self.client.login(username='username', password='tralala')
-
- def create_file(self):
- self.extra_models, self.model_list = {}, []
- self.user, created = User.objects.get_or_create(username='username',
- is_superuser=True)
- self.user.set_password('tralala')
- self.user.save()
- self.o_user, created = User.objects.get_or_create(username='ousername')
- person_type, created = PersonType.objects.get_or_create(
- label=u'Test ' u'person type', txt_idx='test_person',
- available=True)
- self.extra_models['person_type'] = person_type
- self.model_list.append(person_type)
-
- person = models.Person(surname='Surname', name='Name',
- history_modifier=self.o_user)
- person.save()
- self.extra_models['person'] = person
- self.model_list.append(person)
-
- file_type, created = models.FileType.objects.get_or_create(
- label=u'Test file type', txt_idx='test_file', available=True)
- self.extra_models['file_type'] = file_type
- self.model_list.append(file_type)
-
- dct = {'year': 2010, 'numeric_reference': 1000, 'file_type': file_type,
- 'internal_reference': u'UNIT_testÉ ?', 'in_charge': person,
- 'history_modifier': self.o_user, 'total_surface': 10000}
- self.item = self.model(**dct)
- self.item.save()
+def create_administrativact(user, fle):
+ act_type, created = ActType.objects.get_or_create(
+ txt_idx='act_type_F', intented_to='F')
+ dct = {'history_modifier': user,
+ 'act_type': act_type,
+ 'associated_file': fle,
+ 'signature_date': datetime.date(2017, 07, 10),
+ 'index': 22}
+ adminact, created = AdministrativeAct.objects.get_or_create(**dct)
+ return [act_type], [adminact]
class FileTest(TestCase, FileInit):
@@ -293,3 +271,21 @@ class FileOperationTest(TestCase, OperationInitTest, FileInit):
q = ParcelOwner.objects.filter(parcel__operation=self.operation,
parcel__parcel_number='42')
self.assertEqual(q.count(), 1)
+
+
+class DashboardTest(TestCase, FileInit):
+ fixtures = FILE_TOWNS_FIXTURES
+ model = models.File
+
+ def setUp(self):
+ self.username, self.password, self.user = create_superuser()
+ IshtarSiteProfile.objects.create()
+ self.create_file()
+
+ def test_dashboard(self):
+ url = 'dashboard-file'
+ c = Client()
+ c.login(username=self.username, password=self.password)
+
+ response = c.get(reverse(url))
+ self.assertEqual(response.status_code, 200)
diff --git a/archaeological_files/urls.py b/archaeological_files/urls.py
index 110851f80..f00d618d6 100644
--- a/archaeological_files/urls.py
+++ b/archaeological_files/urls.py
@@ -17,16 +17,16 @@
# See the file COPYING for details.
-from django.conf.urls.defaults import *
+from django.conf.urls import url
from ishtar_common.wizards import check_rights
-import views
+from archaeological_files import views
+from archaeological_operations.views import administrativeactfile_document
# be carreful: each check_rights must be relevant with ishtar_menu
# forms:
-urlpatterns = patterns(
- '',
+urlpatterns = [
url(r'file_administrativeactfil_search/(?P<step>.+)?$',
check_rights(['change_administrativeact'])(
views.file_administrativeactfile_search_wizard),
@@ -65,33 +65,25 @@ urlpatterns = patterns(
check_rights(['delete_file', 'delete_own_file'])(
views.file_deletion_wizard),
name='file_deletion'),
-)
-
-urlpatterns += patterns(
- 'archaeological_files.views',
- url(r'autocomplete-file/$', 'autocomplete_file',
+ url(r'autocomplete-file/$', views.autocomplete_file,
name='autocomplete-file'),
- url(r'get-file/(?P<type>.+)?$', 'get_file',
+ url(r'get-file/(?P<type>.+)?$', views.get_file,
name='get-file'),
- url(r'get-file-full/(?P<type>.+)?$', 'get_file',
+ url(r'get-file-full/(?P<type>.+)?$', views.get_file,
name='get-file-full', kwargs={'full': True}),
url(r'get-file-shortcut/(?P<type>.+)?$',
- 'get_file', name='get-file-shortcut',
+ views.get_file, name='get-file-shortcut',
kwargs={'full': 'shortcut'}),
url(r'get-administrativeactfile/(?P<type>.+)?$',
- 'get_administrativeactfile', name='get-administrativeactfile'),
- url(r'show-file(?:/(?P<pk>.+))?/(?P<type>.+)?$', 'show_file',
+ views.get_administrativeactfile, name='get-administrativeactfile'),
+ url(r'show-file(?:/(?P<pk>.+))?/(?P<type>.+)?$', views.show_file,
name='show-file'),
url(r'show-historized-file/(?P<pk>.+)?/(?P<date>.+)?$',
- 'show_file', name='show-historized-file'),
+ views.show_file, name='show-historized-file'),
url(r'revert-file/(?P<pk>.+)/(?P<date>.+)$',
- 'revert_file', name='revert-file'),
- url(r'dashboard_file/$', 'dashboard_file', name='dashboard-file'),
-)
-
-urlpatterns += patterns(
- 'archaeological_operations.views',
+ views.revert_file, name='revert-file'),
+ url(r'dashboard_file/$', views.dashboard_file, name='dashboard-file'),
url(r'file_administrativeact_document/$',
- 'administrativeactfile_document',
+ administrativeactfile_document,
name='file-administrativeact-document', kwargs={'file': True}),
-)
+]
diff --git a/archaeological_files/views.py b/archaeological_files/views.py
index 0b05ad37d..0c0dac3f3 100644
--- a/archaeological_files/views.py
+++ b/archaeological_files/views.py
@@ -23,7 +23,7 @@ import re
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.http import HttpResponse
-from django.shortcuts import render_to_response, redirect
+from django.shortcuts import redirect, render
from django.utils.translation import ugettext_lazy as _
from ishtar_common.views import get_item, show_item, revert_item
@@ -51,9 +51,9 @@ def autocomplete_file(request):
not request.user.has_perm('ishtar_common.view_own_file', models.File) \
and not request.user.ishtaruser.has_right('file_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(' '):
@@ -74,7 +74,7 @@ def autocomplete_file(request):
files = models.File.objects.filter(query)[:limit]
data = json.dumps([{'id': file.pk, 'value': unicode(file)}
for file in files])
- return HttpResponse(data, mimetype='text/plain')
+ return HttpResponse(data, content_type='text/plain')
get_file = get_item(models.File, 'get_file', 'file')
revert_file = revert_item(models.File)
@@ -99,8 +99,7 @@ def dashboard_file(request, *args, **kwargs):
Main dashboard
"""
dct = {'dashboard': models.FileDashboard()}
- return render_to_response('ishtar/dashboards/dashboard_file.html', dct,
- context_instance=RequestContext(request))
+ return render(request, 'ishtar/dashboards/dashboard_file.html', dct)
file_search_wizard = SearchWizard.as_view(
[('general-file_search', FileFormSelection)],
diff --git a/archaeological_files/wizards.py b/archaeological_files/wizards.py
index 1558cd46e..e8d6ca9ae 100644
--- a/archaeological_files/wizards.py
+++ b/archaeological_files/wizards.py
@@ -20,8 +20,7 @@
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Max
-from django.shortcuts import render_to_response
-from django.template import RequestContext
+from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _
from ishtar_common.forms import reverse_lazy
@@ -134,9 +133,7 @@ class FileDeletionWizard(FileClosingWizard):
for operation in Operation.objects.filter(associated_file=obj).all():
operation.delete()
obj.delete()
- return render_to_response(
- 'ishtar/wizard/wizard_delete_done.html', {},
- context_instance=RequestContext(self.request))
+ return render(self.request, 'ishtar/wizard/wizard_delete_done.html', {})
class FileAdministrativeActWizard(OperationAdministrativeActWizard):