diff options
Diffstat (limited to 'archaeological_operations')
-rw-r--r-- | archaeological_operations/__init__.py | 0 | ||||
-rw-r--r-- | archaeological_operations/ishtar_menu.py | 72 | ||||
-rw-r--r-- | archaeological_operations/migrations/0001_initial.py | 600 | ||||
-rw-r--r-- | archaeological_operations/migrations/__init__.py | 0 | ||||
-rw-r--r-- | archaeological_operations/models.py | 300 |
5 files changed, 972 insertions, 0 deletions
diff --git a/archaeological_operations/__init__.py b/archaeological_operations/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/archaeological_operations/__init__.py diff --git a/archaeological_operations/ishtar_menu.py b/archaeological_operations/ishtar_menu.py new file mode 100644 index 000000000..dfd45a167 --- /dev/null +++ b/archaeological_operations/ishtar_menu.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2010-2012 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# See the file COPYING for details. + +from django.utils.translation import ugettext_lazy as _ + +from ishtar_common.menu_base import SectionItem, MenuItem +from ishtar_common.models import AdministrativeAct + +import models + +ORDER = 30 + +MENU_SECTIONS = [ + SectionItem('operation_management', _(u"Operation"), + childs=[ + MenuItem('operation_search', _(u"Search"), + model=models.Operation, + access_controls=['view_operation', + 'view_own_operation']), + MenuItem('operation_creation', _(u"Creation"), + model=models.Operation, + access_controls=['add_operation', + 'add_own_operation']), + MenuItem('operation_modification', _(u"Modification"), + model=models.Operation, + access_controls=['change_operation', + 'change_own_operation']), + MenuItem('operation_closing', _(u"Closing"), + model=models.Operation, + access_controls=['change_operation', + 'change_own_operation']), + MenuItem('operation_deletion', _(u"Deletion"), + model=models.Operation, + access_controls=['change_operation', + 'change_own_operation']), + SectionItem('admin_act_operations', + _(u"Administrative act"), + childs=[ + MenuItem('operation_administrativeactop', + _(u"Add"), + model=models.Operation, + access_controls=['change_operation', + 'change_own_operation']), + MenuItem('operation_administrativeactop_modification', + _(u"Modification"), + model=AdministrativeAct, + access_controls=['change_operation', + 'change_own_operation']), + MenuItem('operation_administrativeactop_deletion', + _(u"Deletion"), + model=AdministrativeAct, + access_controls=['operation_deletion', + 'delete_own_operation']), + ],), + ]), +] diff --git a/archaeological_operations/migrations/0001_initial.py b/archaeological_operations/migrations/0001_initial.py new file mode 100644 index 000000000..e472e5e4d --- /dev/null +++ b/archaeological_operations/migrations/0001_initial.py @@ -0,0 +1,600 @@ +# -*- 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 'OperationType' + db.create_table('archaeological_operations_operationtype', ( + ('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_operations', ['OperationType']) + + # Adding model 'RemainType' + db.create_table('archaeological_operations_remaintype', ( + ('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_operations', ['RemainType']) + + # Adding model 'Period' + db.create_table('archaeological_operations_period', ( + ('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)), + ('order', self.gf('django.db.models.fields.IntegerField')()), + ('start_date', self.gf('django.db.models.fields.IntegerField')()), + ('end_date', self.gf('django.db.models.fields.IntegerField')()), + ('parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_operations.Period'], null=True, blank=True)), + )) + db.send_create_signal('archaeological_operations', ['Period']) + + # Adding model 'HistoricalOperation' + db.create_table('archaeological_operations_historicaloperation', ( + ('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)), + ('start_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)), + ('excavation_end_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)), + ('end_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)), + ('in_charge_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)), + ('year', self.gf('django.db.models.fields.IntegerField')()), + ('operation_code', self.gf('django.db.models.fields.IntegerField')()), + ('associated_file_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)), + ('operation_type_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)), + ('surface', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('cost', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('scheduled_man_days', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('optional_man_days', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('effective_man_days', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('code_patriarche', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('code_dracar', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)), + ('fnap_financing', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)), + ('fnap_cost', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('zoning_prescription', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), + ('large_area_prescription', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), + ('geoarchaeological_context_prescription', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), + ('operator_reference', self.gf('django.db.models.fields.CharField')(max_length=20, null=True, blank=True)), + ('common_name', self.gf('django.db.models.fields.CharField')(max_length=120, 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_operations', ['HistoricalOperation']) + + # Adding model 'Operation' + db.create_table('archaeological_operations_operation', ( + ('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'])), + ('start_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)), + ('excavation_end_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)), + ('end_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)), + ('in_charge', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['ishtar_common.Person'])), + ('year', self.gf('django.db.models.fields.IntegerField')()), + ('operation_code', self.gf('django.db.models.fields.IntegerField')()), + ('associated_file', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='operations', null=True, to=orm['archaeological_files.File'])), + ('operation_type', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['archaeological_operations.OperationType'])), + ('surface', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('cost', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('scheduled_man_days', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('optional_man_days', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('effective_man_days', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('code_patriarche', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('code_dracar', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)), + ('fnap_financing', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)), + ('fnap_cost', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('zoning_prescription', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), + ('large_area_prescription', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), + ('geoarchaeological_context_prescription', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), + ('operator_reference', self.gf('django.db.models.fields.CharField')(max_length=20, null=True, blank=True)), + ('common_name', self.gf('django.db.models.fields.CharField')(max_length=120, null=True, blank=True)), + ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + )) + db.send_create_signal('archaeological_operations', ['Operation']) + + # Adding M2M table for field remains on 'Operation' + db.create_table('archaeological_operations_operation_remains', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('operation', models.ForeignKey(orm['archaeological_operations.operation'], null=False)), + ('remaintype', models.ForeignKey(orm['archaeological_operations.remaintype'], null=False)) + )) + db.create_unique('archaeological_operations_operation_remains', ['operation_id', 'remaintype_id']) + + # Adding M2M table for field towns on 'Operation' + db.create_table('archaeological_operations_operation_towns', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('operation', models.ForeignKey(orm['archaeological_operations.operation'], null=False)), + ('town', models.ForeignKey(orm['ishtar_common.town'], null=False)) + )) + db.create_unique('archaeological_operations_operation_towns', ['operation_id', 'town_id']) + + # Adding M2M table for field periods on 'Operation' + db.create_table('archaeological_operations_operation_periods', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('operation', models.ForeignKey(orm['archaeological_operations.operation'], null=False)), + ('period', models.ForeignKey(orm['archaeological_operations.period'], null=False)) + )) + db.create_unique('archaeological_operations_operation_periods', ['operation_id', 'period_id']) + + # Adding model 'OperationSource' + db.create_table('archaeological_operations_operationsource', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('title', self.gf('django.db.models.fields.CharField')(max_length=200)), + ('source_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.SourceType'])), + ('associated_url', self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True)), + ('receipt_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)), + ('creation_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)), + ('operation', self.gf('django.db.models.fields.related.ForeignKey')(related_name='source', to=orm['archaeological_operations.Operation'])), + ('index', self.gf('django.db.models.fields.IntegerField')()), + )) + db.send_create_signal('archaeological_operations', ['OperationSource']) + + # Adding M2M table for field authors on 'OperationSource' + db.create_table('archaeological_operations_operationsource_authors', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('operationsource', models.ForeignKey(orm['archaeological_operations.operationsource'], null=False)), + ('author', models.ForeignKey(orm['ishtar_common.author'], null=False)) + )) + db.create_unique('archaeological_operations_operationsource_authors', ['operationsource_id', 'author_id']) + + # Adding model 'ActType' + db.create_table('archaeological_operations_acttype', ( + ('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)), + ('intented_to', self.gf('django.db.models.fields.CharField')(max_length=1)), + )) + db.send_create_signal('archaeological_operations', ['ActType']) + + # Adding model 'HistoricalAdministrativeAct' + db.create_table('archaeological_operations_historicaladministrativeact', ( + ('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)), + ('act_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)), + ('operator_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)), + ('scientific_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)), + ('signatory_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)), + ('operation_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)), + ('associated_file_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)), + ('signature_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)), + ('act_object', self.gf('django.db.models.fields.CharField')(max_length=200)), + ('ref_sra', self.gf('django.db.models.fields.CharField')(max_length=15)), + ('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_operations', ['HistoricalAdministrativeAct']) + + # Adding model 'AdministrativeAct' + db.create_table('archaeological_operations_administrativeact', ( + ('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'])), + ('act_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_operations.ActType'])), + ('in_charge', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['ishtar_common.Person'])), + ('operator', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Organization'], null=True, blank=True)), + ('scientific', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['ishtar_common.Person'])), + ('signatory', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['ishtar_common.Person'])), + ('operation', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='administrative_act', null=True, to=orm['archaeological_operations.Operation'])), + ('associated_file', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='administrative_act', null=True, to=orm['archaeological_files.File'])), + ('signature_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)), + ('act_object', self.gf('django.db.models.fields.CharField')(max_length=200)), + ('ref_sra', self.gf('django.db.models.fields.CharField')(max_length=15)), + )) + db.send_create_signal('archaeological_operations', ['AdministrativeAct']) + + + def backwards(self, orm): + # Deleting model 'OperationType' + db.delete_table('archaeological_operations_operationtype') + + # Deleting model 'RemainType' + db.delete_table('archaeological_operations_remaintype') + + # Deleting model 'Period' + db.delete_table('archaeological_operations_period') + + # Deleting model 'HistoricalOperation' + db.delete_table('archaeological_operations_historicaloperation') + + # Deleting model 'Operation' + db.delete_table('archaeological_operations_operation') + + # Removing M2M table for field remains on 'Operation' + db.delete_table('archaeological_operations_operation_remains') + + # Removing M2M table for field towns on 'Operation' + db.delete_table('archaeological_operations_operation_towns') + + # Removing M2M table for field periods on 'Operation' + db.delete_table('archaeological_operations_operation_periods') + + # Deleting model 'OperationSource' + db.delete_table('archaeological_operations_operationsource') + + # Removing M2M table for field authors on 'OperationSource' + db.delete_table('archaeological_operations_operationsource_authors') + + # Deleting model 'ActType' + db.delete_table('archaeological_operations_acttype') + + # Deleting model 'HistoricalAdministrativeAct' + db.delete_table('archaeological_operations_historicaladministrativeact') + + # Deleting model 'AdministrativeAct' + db.delete_table('archaeological_operations_administrativeact') + + + 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.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.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'}) + }, + 'archaeological_operations.acttype': { + 'Meta': {'object_name': 'ActType'}, + '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'}), + 'intented_to': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'archaeological_operations.administrativeact': { + 'Meta': {'object_name': 'AdministrativeAct'}, + 'act_object': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'act_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.ActType']"}), + 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'administrative_act'", 'null': 'True', 'to': "orm['archaeological_files.File']"}), + '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', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), + 'operation': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'administrative_act'", 'null': 'True', 'to': "orm['archaeological_operations.Operation']"}), + 'operator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Organization']", 'null': 'True', 'blank': 'True'}), + 'ref_sra': ('django.db.models.fields.CharField', [], {'max_length': '15'}), + 'scientific': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), + 'signatory': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), + 'signature_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}) + }, + 'archaeological_operations.historicaladministrativeact': { + 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalAdministrativeAct'}, + 'act_object': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'act_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'associated_file_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'}), + 'operation_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'operator_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'ref_sra': ('django.db.models.fields.CharField', [], {'max_length': '15'}), + 'scientific_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'signatory_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'signature_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}) + }, + 'archaeological_operations.historicaloperation': { + 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalOperation'}, + 'associated_file_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'code_dracar': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'code_patriarche': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'common_name': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'effective_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'excavation_end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'fnap_cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'fnap_financing': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), + 'geoarchaeological_context_prescription': ('django.db.models.fields.NullBooleanField', [], {'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'}), + 'large_area_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'operation_code': ('django.db.models.fields.IntegerField', [], {}), + 'operation_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'operator_reference': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), + 'optional_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'scheduled_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'year': ('django.db.models.fields.IntegerField', [], {}), + 'zoning_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}) + }, + 'archaeological_operations.operation': { + 'Meta': {'object_name': 'Operation'}, + 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'operations'", 'null': 'True', 'to': "orm['archaeological_files.File']"}), + 'code_dracar': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'code_patriarche': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'common_name': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'effective_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'excavation_end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'fnap_cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'fnap_financing': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), + 'geoarchaeological_context_prescription': ('django.db.models.fields.NullBooleanField', [], {'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'}), + 'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), + 'large_area_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'operation_code': ('django.db.models.fields.IntegerField', [], {}), + 'operation_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['archaeological_operations.OperationType']"}), + 'operator_reference': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), + 'optional_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'periods': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['archaeological_operations.Period']", 'symmetrical': 'False'}), + 'remains': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['archaeological_operations.RemainType']", 'symmetrical': 'False'}), + 'scheduled_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'towns': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.Town']", 'symmetrical': 'False'}), + 'year': ('django.db.models.fields.IntegerField', [], {}), + 'zoning_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}) + }, + 'archaeological_operations.operationbydepartment': { + 'Meta': {'object_name': 'OperationByDepartment', 'db_table': "'operation_department'", 'managed': 'False'}, + 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'operation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.Operation']"}) + }, + 'archaeological_operations.operationsource': { + 'Meta': {'object_name': 'OperationSource'}, + 'associated_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.Author']", 'symmetrical': 'False'}), + 'creation_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'index': ('django.db.models.fields.IntegerField', [], {}), + 'operation': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'source'", 'to': "orm['archaeological_operations.Operation']"}), + 'receipt_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'source_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.SourceType']"}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'archaeological_operations.operationtype': { + 'Meta': {'object_name': 'OperationType'}, + '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_operations.period': { + 'Meta': {'object_name': 'Period'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.IntegerField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.Period']", 'null': 'True', 'blank': 'True'}), + 'start_date': ('django.db.models.fields.IntegerField', [], {}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'archaeological_operations.remaintype': { + 'Meta': {'object_name': 'RemainType'}, + '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'}) + }, + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'ishtar_common.arrondissement': { + 'Meta': {'object_name': 'Arrondissement'}, + 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'ishtar_common.author': { + 'Meta': {'object_name': 'Author'}, + 'author_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.AuthorType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']"}) + }, + 'ishtar_common.authortype': { + 'Meta': {'object_name': 'AuthorType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'ishtar_common.canton': { + 'Meta': {'object_name': 'Canton'}, + 'arrondissement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Arrondissement']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'ishtar_common.department': { + 'Meta': {'ordering': "['number']", 'object_name': 'Department'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'}) + }, + 'ishtar_common.organization': { + 'Meta': {'object_name': 'Organization'}, + 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'organization_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.OrganizationType']"}), + 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}) + }, + 'ishtar_common.organizationtype': { + 'Meta': {'object_name': 'OrganizationType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'ishtar_common.person': { + 'Meta': {'object_name': 'Person'}, + 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'attached_to': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Organization']", 'null': 'True', 'blank': 'True'}), + 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'person_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.PersonType']"}), + 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '2'}), + 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}) + }, + 'ishtar_common.persontype': { + 'Meta': {'object_name': 'PersonType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'rights': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.WizardStep']", 'symmetrical': 'False'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'ishtar_common.sourcetype': { + 'Meta': {'object_name': 'SourceType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'ishtar_common.town': { + 'Meta': {'ordering': "['numero_insee']", 'object_name': 'Town'}, + 'canton': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Canton']", 'null': 'True', 'blank': 'True'}), + 'center': ('django.contrib.gis.db.models.fields.PointField', [], {'srid': '27572', 'null': 'True', 'blank': 'True'}), + 'departement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'numero_insee': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '6'}), + 'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'ishtar_common.wizard': { + 'Meta': {'ordering': "['url_name']", 'object_name': 'Wizard'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'url_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}) + }, + 'ishtar_common.wizardstep': { + 'Meta': {'ordering': "['wizard', 'order']", 'object_name': 'WizardStep'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'url_name': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'wizard': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Wizard']"}) + } + } + + complete_apps = ['archaeological_operations']
\ No newline at end of file diff --git a/archaeological_operations/migrations/__init__.py b/archaeological_operations/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/archaeological_operations/migrations/__init__.py diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py new file mode 100644 index 000000000..48baa57ba --- /dev/null +++ b/archaeological_operations/models.py @@ -0,0 +1,300 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2012 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# See the file COPYING for details. + +from django.conf import settings +from django.contrib.gis.db import models +from django.db.models.signals import post_save +from django.utils.translation import ugettext_lazy as _, ugettext + +from ishtar_common.models import GeneralType, BaseHistorizedItem, \ + HistoricalRecords, OwnPerms, Department, Source, Person, Organization, Town +FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS +if FILES_AVAILABLE: + from archaeological_files.models import File + +class OperationType(GeneralType): + class Meta: + verbose_name = _(u"Operation type") + verbose_name_plural = _(u"Operation types") + + @classmethod + def is_preventive(cls, ope_type_id, key=''): + key = key or 'prev_excavation' + try: + preventive = OperationType.objects.get(txt_idx=key).pk + return ope_type_id == preventive + except ObjectDoesNotExist: + return False + +class RemainType(GeneralType): + class Meta: + verbose_name = _(u"Remain type") + verbose_name_plural = _(u"Remain types") + +class Period(GeneralType) : + order = models.IntegerField(_(u"Order")) + start_date = models.IntegerField(_(u"Start date")) + end_date = models.IntegerField(_(u"End date")) + parent = models.ForeignKey("Period", verbose_name=_(u"Parent period"), + blank=True, null=True) + + class Meta: + verbose_name = _(u"Type Period") + verbose_name_plural = _(u"Types Period") + + def __unicode__(self): + return self.label + +class Operation(BaseHistorizedItem, OwnPerms): + TABLE_COLS = ['year_index', 'operation_type', 'remains', 'towns', + 'associated_file', 'start_date', 'excavation_end_date'] + start_date = models.DateField(_(u"Start date"), null=True, blank=True) + excavation_end_date = models.DateField(_(u"Excavation end date"), null=True, + blank=True) + end_date = models.DateField(_(u"Closing date"), null=True, blank=True) + in_charge = models.ForeignKey(Person, related_name='+', null=True, + blank=True, verbose_name=_(u"In charge")) + year = models.IntegerField(_(u"Year")) + operation_code = models.IntegerField(_(u"Operation code")) + if FILES_AVAILABLE: + associated_file = models.ForeignKey(File, related_name='operations', + verbose_name=_(u"File"), blank=True, null=True) + operation_type = models.ForeignKey(OperationType, related_name='+', + verbose_name=_(u"Operation type")) + surface = models.IntegerField(_(u"Surface (m²)"), blank=True, null=True) + remains = models.ManyToManyField("RemainType", verbose_name=_(u'Remains')) + towns = models.ManyToManyField(Town, verbose_name=_(u"Towns")) + cost = models.IntegerField(_(u"Cost (€)"), blank=True, null=True) + periods = models.ManyToManyField(Period, verbose_name=_(u"Periods")) + scheduled_man_days = models.IntegerField(_(u"Scheduled man-days"), + blank=True, null=True) + optional_man_days = models.IntegerField(_(u"Optional man-days"), + blank=True, null=True) + effective_man_days = models.IntegerField(_(u"Effective man-days"), + blank=True, null=True) + if settings.COUNTRY == 'fr': + code_patriarche = models.IntegerField(u"Code PATRIARCHE", null=True, + blank=True) + TABLE_COLS = ['code_patriarche'] + TABLE_COLS + code_dracar = models.CharField(u"Code DRACAR", max_length=10, null=True, + blank=True) + fnap_financing = models.FloatField(u"Financement FNAP (%)", + blank=True, null=True) + fnap_cost = models.IntegerField(u"Financement FNAP (€)", + blank=True, null=True) + zoning_prescription = models.NullBooleanField( + _(u"Prescription on zoning"), blank=True, null=True) + large_area_prescription = models.NullBooleanField( + _(u"Prescription on large area"), blank=True, null=True) + geoarchaeological_context_prescription = models.NullBooleanField( + _(u"Prescription on geoarchaeological context"), blank=True, null=True) + operator_reference = models.CharField(_(u"Operator reference"), + max_length=20, null=True, blank=True) + common_name = models.CharField(_(u"Generic name"), max_length=120, null=True, + blank=True) + comment = models.TextField(_(u"Comment"), null=True, blank=True) + history = HistoricalRecords() + + class Meta: + verbose_name = _(u"Operation") + verbose_name_plural = _(u"Operations") + permissions = ( + ("view_own_operation", ugettext(u"Can view own Operation")), + ("add_own_operation", ugettext(u"Can add own Operation")), + ("change_own_operation", ugettext(u"Can change own Operation")), + ("delete_own_operation", ugettext(u"Can delete own Operation")), + ) + + def __unicode__(self): + items = [unicode(_('Intercommunal'))] + if self.towns.count() == 1: + items[0] = unicode(self.towns.all()[0]) + items.append("-".join((unicode(self.year), + unicode(self.operation_code)))) + return JOINT.join(items) + + @classmethod + def get_available_operation_code(cls, year=None): + if not year: + year = datetime.date.today().year + max_val = cls.objects.filter(year=year).aggregate( + Max('operation_code'))["operation_code__max"] + return (max_val + 1) if max_val else 1 + + @classmethod + def get_years(cls): + return [res['year'] for res in list(cls.objects.values('year').annotate( + Count("id")).order_by())] + + @classmethod + def get_by_year(cls, year): + return cls.objects.filter(year=year) + + @classmethod + def get_total_number(cls): + return cls.objects.count() + + year_index_lbl = _(u"Operation code") + @property + def year_index(self): + lbl = unicode(self.operation_code) + lbl = u"%d-%s%s" % (self.year, (3-len(lbl))*"0", lbl) + return lbl + + def clean(self): + objs = self.__class__.objects.filter(year=self.year, + operation_code=self.operation_code) + if self.pk: + objs = objs.exclude(pk=self.pk) + if objs.count(): + raise ValidationError(_(u"This operation code already exists for " + u"this year")) + + def is_own(self, person): + return False + + @property + def surface_ha(self): + if self.surface: + return self.surface/10000.0 + + @property + def cost_by_m2(self): + if not self.surface or not self.cost: + return + return round(float(self.cost)/self.surface, 2) + + @property + def cost_by_m2(self): + if not self.surface or not self.cost: + return + return round(float(self.cost)/self.surface, 2) + + @classmethod + def get_query_owns(cls, user): + return Q(in_charge=user.person)|Q(history_modifier=user)\ + & Q(end_date__isnull=True) + + def is_active(self): + return not bool(self.end_date) + + def closing(self): + if self.is_active(): + return + for item in self.history.all(): + if not item.end_date: + break + return {'date':item.history_date, + 'user':IshtarUser.objects.get(pk=item.history_modifier_id)} + +def operation_post_save(sender, **kwargs): + if not kwargs['instance']: + return + operation = kwargs['instance'] + if operation.fnap_financing and operation.cost: + fnap_cost = int(float(operation.cost)/100*operation.fnap_financing) + if not operation.fnap_cost or operation.fnap_cost != fnap_cost: + operation.fnap_cost = fnap_cost + operation.save() + elif operation.fnap_cost and operation.cost: + fnap_percent = float(operation.fnap_cost)*100/operation.cost + operation.fnap_financing = fnap_percent + operation.save() +post_save.connect(operation_post_save, sender=Operation) + +class OperationByDepartment(models.Model): + ''' + Database view: don't forget to create it + + create view operation_department (id, department_id, operation_id) as + select town."id", town."departement_id", operation_towns."operation_id" + from ishtar_base_town town + inner join ishtar_base_operation_towns operation_towns on + operation_towns."town_id"=town."id" order by town."departement_id"; + CREATE RULE operation_department_delete + AS ON DELETE TO operation_department DO INSTEAD(); + ''' + operation = models.ForeignKey(Operation, verbose_name=_(u"Operation")) + department = models.ForeignKey(Department, verbose_name=_(u"Department"), + blank=True, null=True) + class Meta: + managed = False + db_table = 'operation_department' + +class OperationSource(Source): + class Meta: + verbose_name = _(u"Operation documentation") + verbose_name_plural = _(u"Operation documentations") + operation = models.ForeignKey(Operation, verbose_name=_(u"Operation"), + related_name="source") + index = models.IntegerField(verbose_name=_(u"Index")) + TABLE_COLS = ['operation.year', 'operation.operation_code'] + \ + Source.TABLE_COLS + +class ActType(GeneralType): + TYPE = (('F', _(u'Archaelogical file')), + ('O', _(u'Operation')), + ) + intented_to = models.CharField(_(u"Intended to"), max_length=1, + choices=TYPE) + class Meta: + verbose_name = _(u"Act type") + verbose_name_plural = _(u"Act types") + +class AdministrativeAct(BaseHistorizedItem, OwnPerms): + TABLE_COLS = ['act_type', 'associated_file', 'operation', + 'associated_file.towns', 'operation.towns'] + TABLE_COLS_FILE = ['act_type', 'associated_file', 'associated_file.towns',] + TABLE_COLS_OPE = ['act_type', 'operation', 'operation.towns'] + act_type = models.ForeignKey(ActType, verbose_name=_(u"Act type")) + in_charge = models.ForeignKey(Person, blank=True, null=True, + related_name='+', verbose_name=_(u"Person in charge of the operation")) + operator = models.ForeignKey(Organization, blank=True, null=True, + verbose_name=_(u"Archaeological preventive operator")) + scientific = models.ForeignKey(Person, blank=True, null=True, +related_name='+', verbose_name=_(u"Person in charge of the scientific part")) + signatory = models.ForeignKey(Person, blank=True, null=True, + related_name='+', verbose_name=_(u"Signatory")) + operation = models.ForeignKey(Operation, blank=True, null=True, + related_name='administrative_act', verbose_name=_(u"Operation")) + if FILES_AVAILABLE: + associated_file = models.ForeignKey(File, blank=True, null=True, + related_name='administrative_act', + verbose_name=_(u"Archaelogical file")) + signature_date = models.DateField(_(u"Signature date"), blank=True, + null=True) + act_object = models.CharField(_(u"Object"), max_length=200) + if settings.COUNTRY == 'fr': + ref_sra = models.CharField(u"Référence SRA", max_length=15) + history = HistoricalRecords() + + class Meta: + verbose_name = _(u"Administrative act") + verbose_name_plural = _(u"Administrative acts") + permissions = ( +("view_own_administrativeact", ugettext(u"Can view own Administrative act")), +("add_own_administrativeact", ugettext(u"Can add own Administrative act")), +("change_own_administrativeact", ugettext(u"Can change own Administrative act")), +("delete_own_administrativeact", ugettext(u"Can delete own Administrative act")), + ) + + def __unicode__(self): + return JOINT.join([unicode(item) + for item in [self.operation, self.associated_file, self.act_object] + if item]) |