summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archaeological_context_records/__init__.py0
-rw-r--r--archaeological_context_records/migrations/0001_initial.py629
-rw-r--r--archaeological_context_records/migrations/__init__.py0
-rw-r--r--archaeological_context_records/models.py243
-rw-r--r--archaeological_files/__init__.py0
-rw-r--r--archaeological_files/ishtar_menu.py65
-rw-r--r--archaeological_files/migrations/0001_initial.py348
-rw-r--r--archaeological_files/migrations/__init__.py0
-rw-r--r--archaeological_files/models.py185
-rw-r--r--archaeological_finds/__init__.py0
-rw-r--r--archaeological_finds/migrations/0001_initial.py808
-rw-r--r--archaeological_finds/migrations/__init__.py0
-rw-r--r--archaeological_finds/models.py281
-rw-r--r--archaeological_operations/__init__.py0
-rw-r--r--archaeological_operations/ishtar_menu.py72
-rw-r--r--archaeological_operations/migrations/0001_initial.py600
-rw-r--r--archaeological_operations/migrations/__init__.py0
-rw-r--r--archaeological_operations/models.py300
-rw-r--r--archaeological_warehouse/__init__.py0
-rw-r--r--archaeological_warehouse/migrations/0001_initial.py229
-rw-r--r--archaeological_warehouse/migrations/__init__.py0
-rw-r--r--archaeological_warehouse/models.py82
-rw-r--r--ishtar_common/admin.py6
-rw-r--r--ishtar_common/fixtures/initial_data_bak.json (renamed from ishtar_common/fixtures/initial_data.json)0
-rw-r--r--ishtar_common/menus.py76
-rw-r--r--ishtar_common/migrations/0001_initial.py408
-rw-r--r--ishtar_common/migrations/__init__.py0
-rw-r--r--ishtar_common/models.py952
28 files changed, 4260 insertions, 1024 deletions
diff --git a/archaeological_context_records/__init__.py b/archaeological_context_records/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archaeological_context_records/__init__.py
diff --git a/archaeological_context_records/migrations/0001_initial.py b/archaeological_context_records/migrations/0001_initial.py
new file mode 100644
index 000000000..09ee30efe
--- /dev/null
+++ b/archaeological_context_records/migrations/0001_initial.py
@@ -0,0 +1,629 @@
+# -*- 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 'Parcel'
+ db.create_table('archaeological_context_records_parcel', (
+ ('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'])),
+ ('history_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+ ('associated_file', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='parcels', null=True, to=orm['archaeological_files.File'])),
+ ('operation', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='parcels', null=True, to=orm['archaeological_operations.Operation'])),
+ ('year', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('town', self.gf('django.db.models.fields.related.ForeignKey')(related_name='parcels', to=orm['ishtar_common.Town'])),
+ ('section', self.gf('django.db.models.fields.CharField')(max_length=4)),
+ ('parcel_number', self.gf('django.db.models.fields.CharField')(max_length=6)),
+ ))
+ db.send_create_signal('archaeological_context_records', ['Parcel'])
+
+ # Adding model 'ParcelOwner'
+ db.create_table('archaeological_context_records_parcelowner', (
+ ('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'])),
+ ('history_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+ ('owner', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Person'])),
+ ('parcel', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_context_records.Parcel'])),
+ ('start_date', self.gf('django.db.models.fields.DateField')()),
+ ('end_date', self.gf('django.db.models.fields.DateField')()),
+ ))
+ db.send_create_signal('archaeological_context_records', ['ParcelOwner'])
+
+ # Adding model 'DatingType'
+ db.create_table('archaeological_context_records_datingtype', (
+ ('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_context_records', ['DatingType'])
+
+ # Adding model 'DatingQuality'
+ db.create_table('archaeological_context_records_datingquality', (
+ ('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_context_records', ['DatingQuality'])
+
+ # Adding model 'Dating'
+ db.create_table('archaeological_context_records_dating', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('period', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_operations.Period'])),
+ ('start_date', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('end_date', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('dating_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_context_records.DatingType'], null=True, blank=True)),
+ ('quality', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_context_records.DatingQuality'], null=True, blank=True)),
+ ))
+ db.send_create_signal('archaeological_context_records', ['Dating'])
+
+ # Adding model 'Unit'
+ db.create_table('archaeological_context_records_unit', (
+ ('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')()),
+ ('parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_context_records.Unit'], null=True, blank=True)),
+ ))
+ db.send_create_signal('archaeological_context_records', ['Unit'])
+
+ # Adding model 'ActivityType'
+ db.create_table('archaeological_context_records_activitytype', (
+ ('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')()),
+ ))
+ db.send_create_signal('archaeological_context_records', ['ActivityType'])
+
+ # Adding model 'IdentificationType'
+ db.create_table('archaeological_context_records_identificationtype', (
+ ('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')()),
+ ))
+ db.send_create_signal('archaeological_context_records', ['IdentificationType'])
+
+ # Adding model 'HistoricalContextRecord'
+ db.create_table('archaeological_context_records_historicalcontextrecord', (
+ ('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)),
+ ('parcel_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)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=200)),
+ ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('length', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('width', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('thickness', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('depth', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('location', self.gf('django.db.models.fields.CharField')(max_length=200, null=True, blank=True)),
+ ('unit_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('has_furniture', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
+ ('filling', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('interpretation', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('taq', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('taq_estimated', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('tpq', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('tpq_estimated', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('identification_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('activity_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('history_id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('history_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
+ ('history_user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True)),
+ ('history_type', self.gf('django.db.models.fields.CharField')(max_length=1)),
+ ))
+ db.send_create_signal('archaeological_context_records', ['HistoricalContextRecord'])
+
+ # Adding model 'ContextRecord'
+ db.create_table('archaeological_context_records_contextrecord', (
+ ('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'])),
+ ('parcel', self.gf('django.db.models.fields.related.ForeignKey')(related_name='context_record', to=orm['archaeological_context_records.Parcel'])),
+ ('operation', self.gf('django.db.models.fields.related.ForeignKey')(related_name='context_record', to=orm['archaeological_operations.Operation'])),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=200)),
+ ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('length', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('width', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('thickness', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('depth', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('location', self.gf('django.db.models.fields.CharField')(max_length=200, null=True, blank=True)),
+ ('unit', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['archaeological_context_records.Unit'])),
+ ('has_furniture', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
+ ('filling', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('interpretation', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('taq', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('taq_estimated', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('tpq', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('tpq_estimated', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('identification', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_context_records.IdentificationType'], null=True, blank=True)),
+ ('activity', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_context_records.ActivityType'], null=True, blank=True)),
+ ))
+ db.send_create_signal('archaeological_context_records', ['ContextRecord'])
+
+ # Adding M2M table for field datings on 'ContextRecord'
+ db.create_table('archaeological_context_records_contextrecord_datings', (
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+ ('contextrecord', models.ForeignKey(orm['archaeological_context_records.contextrecord'], null=False)),
+ ('dating', models.ForeignKey(orm['archaeological_context_records.dating'], null=False))
+ ))
+ db.create_unique('archaeological_context_records_contextrecord_datings', ['contextrecord_id', 'dating_id'])
+
+ # Adding model 'ContextRecordSource'
+ db.create_table('archaeological_context_records_contextrecordsource', (
+ ('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)),
+ ('context_record', self.gf('django.db.models.fields.related.ForeignKey')(related_name='source', to=orm['archaeological_context_records.ContextRecord'])),
+ ))
+ db.send_create_signal('archaeological_context_records', ['ContextRecordSource'])
+
+ # Adding M2M table for field authors on 'ContextRecordSource'
+ db.create_table('archaeological_context_records_contextrecordsource_authors', (
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+ ('contextrecordsource', models.ForeignKey(orm['archaeological_context_records.contextrecordsource'], null=False)),
+ ('author', models.ForeignKey(orm['ishtar_common.author'], null=False))
+ ))
+ db.create_unique('archaeological_context_records_contextrecordsource_authors', ['contextrecordsource_id', 'author_id'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'Parcel'
+ db.delete_table('archaeological_context_records_parcel')
+
+ # Deleting model 'ParcelOwner'
+ db.delete_table('archaeological_context_records_parcelowner')
+
+ # Deleting model 'DatingType'
+ db.delete_table('archaeological_context_records_datingtype')
+
+ # Deleting model 'DatingQuality'
+ db.delete_table('archaeological_context_records_datingquality')
+
+ # Deleting model 'Dating'
+ db.delete_table('archaeological_context_records_dating')
+
+ # Deleting model 'Unit'
+ db.delete_table('archaeological_context_records_unit')
+
+ # Deleting model 'ActivityType'
+ db.delete_table('archaeological_context_records_activitytype')
+
+ # Deleting model 'IdentificationType'
+ db.delete_table('archaeological_context_records_identificationtype')
+
+ # Deleting model 'HistoricalContextRecord'
+ db.delete_table('archaeological_context_records_historicalcontextrecord')
+
+ # Deleting model 'ContextRecord'
+ db.delete_table('archaeological_context_records_contextrecord')
+
+ # Removing M2M table for field datings on 'ContextRecord'
+ db.delete_table('archaeological_context_records_contextrecord_datings')
+
+ # Deleting model 'ContextRecordSource'
+ db.delete_table('archaeological_context_records_contextrecordsource')
+
+ # Removing M2M table for field authors on 'ContextRecordSource'
+ db.delete_table('archaeological_context_records_contextrecordsource_authors')
+
+
+ models = {
+ 'archaeological_context_records.activitytype': {
+ 'Meta': {'object_name': 'ActivityType'},
+ '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'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'archaeological_context_records.contextrecord': {
+ 'Meta': {'object_name': 'ContextRecord'},
+ 'activity': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_context_records.ActivityType']", 'null': 'True', 'blank': 'True'}),
+ 'datings': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['archaeological_context_records.Dating']", 'symmetrical': 'False'}),
+ 'depth': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'filling': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'has_furniture': ('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'}),
+ 'identification': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_context_records.IdentificationType']", 'null': 'True', 'blank': 'True'}),
+ 'interpretation': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'location': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'operation': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'context_record'", 'to': "orm['archaeological_operations.Operation']"}),
+ 'parcel': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'context_record'", 'to': "orm['archaeological_context_records.Parcel']"}),
+ 'taq': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'taq_estimated': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'thickness': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'tpq': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'tpq_estimated': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'unit': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['archaeological_context_records.Unit']"}),
+ 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_context_records.contextrecordsource': {
+ 'Meta': {'object_name': 'ContextRecordSource'},
+ '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'}),
+ 'context_record': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'source'", 'to': "orm['archaeological_context_records.ContextRecord']"}),
+ 'creation_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ '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_context_records.dating': {
+ 'Meta': {'object_name': 'Dating'},
+ 'dating_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_context_records.DatingType']", 'null': 'True', 'blank': 'True'}),
+ 'end_date': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'period': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.Period']"}),
+ 'quality': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_context_records.DatingQuality']", 'null': 'True', 'blank': 'True'}),
+ 'start_date': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_context_records.datingquality': {
+ 'Meta': {'object_name': 'DatingQuality'},
+ '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_context_records.datingtype': {
+ 'Meta': {'object_name': 'DatingType'},
+ '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_context_records.historicalcontextrecord': {
+ 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalContextRecord'},
+ 'activity_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'depth': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'filling': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'has_furniture': ('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'}),
+ 'identification_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'interpretation': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'location': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'operation_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'parcel_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'taq': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'taq_estimated': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'thickness': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'tpq': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'tpq_estimated': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'unit_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_context_records.identificationtype': {
+ 'Meta': {'object_name': 'IdentificationType'},
+ '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'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'archaeological_context_records.parcel': {
+ 'Meta': {'object_name': 'Parcel'},
+ 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parcels'", 'null': 'True', 'to': "orm['archaeological_files.File']"}),
+ 'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'operation': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parcels'", 'null': 'True', 'to': "orm['archaeological_operations.Operation']"}),
+ 'parcel_number': ('django.db.models.fields.CharField', [], {'max_length': '6'}),
+ 'section': ('django.db.models.fields.CharField', [], {'max_length': '4'}),
+ 'town': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'parcels'", 'to': "orm['ishtar_common.Town']"}),
+ 'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_context_records.parcelowner': {
+ 'Meta': {'object_name': 'ParcelOwner'},
+ 'end_date': ('django.db.models.fields.DateField', [], {}),
+ 'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']"}),
+ 'parcel': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_context_records.Parcel']"}),
+ 'start_date': ('django.db.models.fields.DateField', [], {})
+ },
+ 'archaeological_context_records.unit': {
+ 'Meta': {'object_name': 'Unit'},
+ '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'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_context_records.Unit']", 'null': 'True', 'blank': 'True'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ '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.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.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_context_records'] \ No newline at end of file
diff --git a/archaeological_context_records/migrations/__init__.py b/archaeological_context_records/migrations/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archaeological_context_records/migrations/__init__.py
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
new file mode 100644
index 000000000..c47fd3354
--- /dev/null
+++ b/archaeological_context_records/models.py
@@ -0,0 +1,243 @@
+#!/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.utils.translation import ugettext_lazy as _, ugettext
+
+from ishtar_common.models import GeneralType, BaseHistorizedItem, \
+ LightHistorizedItem, HistoricalRecords, OwnPerms, Town, Person, Source
+FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS
+if FILES_AVAILABLE:
+ from archaeological_files.models import File
+from archaeological_operations.models import Operation, Period
+
+class Parcel(LightHistorizedItem):
+ if FILES_AVAILABLE:
+ associated_file = models.ForeignKey(File, related_name='parcels',
+ blank=True, null=True, verbose_name=_(u"File"))
+ operation = models.ForeignKey(Operation, related_name='parcels', blank=True,
+ null=True, verbose_name=_(u"Operation"))
+ year = models.IntegerField(_(u"Year"), blank=True, null=True)
+ town = models.ForeignKey(Town, related_name='parcels',
+ verbose_name=_(u"Town"))
+ section = models.CharField(_(u"Section"), max_length=4)
+ parcel_number = models.CharField(_(u"Parcel number"), max_length=6)
+
+ class Meta:
+ verbose_name = _(u"Parcel")
+ verbose_name_plural = _(u"Parcels")
+
+ def short_label(self):
+ return JOINT.join([unicode(item) for item in [self.section,
+ self.parcel_number] if item])
+
+ def __unicode__(self):
+ return self.short_label()
+
+ def long_label(self):
+ items = [unicode(self.operation or self.associated_file)]
+ items += [unicode(item) for item in [self.section, self.parcel_number]
+ if item]
+ return JOINT.join(items)
+
+class ParcelOwner(LightHistorizedItem):
+ owner = models.ForeignKey(Person, verbose_name=_(u"Owner"))
+ parcel = models.ForeignKey(Parcel, verbose_name=_(u"Parcel"))
+ start_date = models.DateField(_(u"Start date"))
+ end_date = models.DateField(_(u"End date"))
+
+ class Meta:
+ verbose_name = _(u"Parcel owner")
+ verbose_name_plural = _(u"Parcel owners")
+
+ def __unicode__(self):
+ return self.owner + JOINT + self.parcel
+
+class DatingType(GeneralType):
+ class Meta:
+ verbose_name = _(u"Dating type")
+ verbose_name_plural = _(u"Dating types")
+
+class DatingQuality(GeneralType):
+ class Meta:
+ verbose_name = _(u"Dating quality")
+ verbose_name_plural = _(u"Dating qualities")
+
+class Dating(models.Model):
+ period = models.ForeignKey(Period, verbose_name=_(u"Period"))
+ start_date = models.IntegerField(_(u"Start date"), blank=True, null=True)
+ end_date = models.IntegerField(_(u"End date"), blank=True, null=True)
+ dating_type = models.ForeignKey(DatingType, verbose_name=_(u"Dating type"),
+ blank=True, null=True)
+ quality = models.ForeignKey(DatingQuality, verbose_name=_(u"Quality"),
+ blank=True, null=True)
+
+ class Meta:
+ verbose_name = _(u"Dating")
+ verbose_name_plural = _(u"Datings")
+
+ def __unicode__(self):
+ start_date = self.start_date and unicode(self.start_date) or u""
+ end_date = self.end_date and unicode(self.end_date) or u""
+ if not start_date and not end_date:
+ return unicode(self.period)
+ return u"%s (%s-%s)" % (self.period, start_date, end_date)
+
+class Unit(GeneralType):
+ order = models.IntegerField(_(u"Order"))
+ parent = models.ForeignKey("Unit", verbose_name=_(u"Parent unit"),
+ blank=True, null=True)
+
+ class Meta:
+ verbose_name = _(u"Type Unit")
+ verbose_name_plural = _(u"Types Unit")
+
+ def __unicode__(self):
+ return self.label
+
+class ActivityType(GeneralType):
+ order = models.IntegerField(_(u"Order"))
+
+ class Meta:
+ verbose_name = _(u"Type Activity")
+ verbose_name_plural = _(u"Types Activity")
+
+ def __unicode__(self):
+ return self.label
+
+class IdentificationType(GeneralType):
+ order = models.IntegerField(_(u"Order"))
+ class Meta:
+ verbose_name = _(u"Type Identification")
+ verbose_name_plural = _(u"Types Identification")
+
+ def __unicode__(self):
+ return self.label
+
+class ContextRecord(BaseHistorizedItem, OwnPerms):
+ TABLE_COLS = ['parcel.town', 'operation.year',
+ 'operation.operation_code',
+ 'label', 'unit']
+ if settings.COUNTRY == 'fr':
+ TABLE_COLS.insert(1, 'parcel.operation.code_patriarche')
+ parcel = models.ForeignKey(Parcel, verbose_name=_(u"Parcel"),
+ related_name='context_record')
+ operation = models.ForeignKey(Operation, verbose_name=_(u"Operation"),
+ related_name='context_record')
+ label = models.CharField(_(u"ID"), max_length=200)
+ description = models.TextField(_(u"Description"), blank=True, null=True)
+ length = models.IntegerField(_(u"Length (cm)"), blank=True, null=True)
+ width = models.IntegerField(_(u"Width (cm)"), blank=True, null=True)
+ thickness = models.IntegerField(_(u"Thickness (cm)"), blank=True, null=True)
+ depth = models.IntegerField(_(u"Depth (cm)"), blank=True, null=True)
+ location = models.CharField(_(u"Location"), blank=True, null=True,
+ max_length=200,
+ help_text=_(u"A short description of the location of the context record"))
+ datings = models.ManyToManyField(Dating)
+ unit = models.ForeignKey(Unit, verbose_name=_(u"Unit"), related_name='+',
+ blank=True, null=True)
+ has_furniture = models.NullBooleanField(u"Has furniture?", blank=True,
+ null=True)
+ filling = models.TextField(_(u"Filling"), blank=True, null=True)
+ interpretation = models.TextField(_(u"Interpretation"), blank=True,
+ null=True)
+ taq = models.IntegerField(_(u"TAQ"), blank=True, null=True,
+ help_text=_(u"\"Terminus Ante Quem\" the context record can't have been "
+ "created after this date"))
+ taq_estimated = models.IntegerField(_(u"Estimated TAQ"), blank=True,
+ null=True, help_text=_(u"Estimation of a \"Terminus Ante Quem\""))
+ tpq = models.IntegerField(_(u"TPQ"), blank=True, null=True,
+ help_text=_(u"\"Terminus Post Quem\" the context record can't have been "
+ " created before this date"))
+ tpq_estimated = models.IntegerField(_(u"Estimated TPQ"), blank=True,
+ null=True, help_text=_(u"Estimation of a \"Terminus Post Quem\""))
+ identification = models.ForeignKey(IdentificationType, blank=True,
+ null=True, verbose_name=_(u"Identification"),)
+ activity = models.ForeignKey(ActivityType,blank=True, null=True,
+ verbose_name=_(u"Activity"),)
+ history = HistoricalRecords()
+
+ class Meta:
+ verbose_name = _(u"Context Record")
+ verbose_name_plural = _(u"Context Record")
+ permissions = (
+ ("view_own_contextrecord", ugettext(u"Can view own Context Record")),
+ ("add_own_contextrecord", ugettext(u"Can add own Context Record")),
+ ("change_own_contextrecord", ugettext(u"Can change own Context Record")),
+ ("delete_own_contextrecord", ugettext(u"Can delete own Context Record")),
+ )
+
+ def __unicode__(self):
+ return self.short_label()
+
+ def short_label(self):
+ return JOINT.join([unicode(item) for item in [self.parcel,
+ self.label] if item])
+
+ def full_label(self):
+ if not self.parcel.operation:
+ return unicode(self)
+ return self._real_label() or self._temp_label()
+
+ def _real_label(self):
+ if not self.parcel.operation.code_patriarche:
+ return
+ return JOINT.join((self.parcel.operation.code_patriarche,
+ self.label))
+
+ def _temp_label(self):
+ if self.parcel.operation.code_patriarche:
+ return
+ return JOINT.join([unicode(lbl) for lbl in [self.parcel.operation.year,
+ self.parcel.operation.operation_code,
+ self.label] if lbl])
+
+ @classmethod
+ def get_years(cls):
+ years = set()
+ for res in list(cls.objects.values('operation__start_date')):
+ yr = res['operation__start_date'].year
+ years.add(yr)
+ return list(years)
+
+ @classmethod
+ def get_by_year(cls, year):
+ return cls.objects.filter(operation__start_date__year=year)
+
+ @classmethod
+ def get_operations(cls):
+ return [dct['operation__pk']
+ for dct in cls.objects.values('operation__pk').distinct()]
+
+ @classmethod
+ def get_by_operation(cls, operation_id):
+ return cls.objects.filter(operation__pk=operation_id)
+
+ @classmethod
+ def get_total_number(cls):
+ return cls.objects.filter(operation__start_date__isnull=False).count()
+
+class ContextRecordSource(Source):
+ class Meta:
+ verbose_name = _(u"Context record documentation")
+ verbose_name_plural = _(u"Context record documentations")
+ context_record = models.ForeignKey(ContextRecord,
+ verbose_name=_(u"Context record"), related_name="source")
+
diff --git a/archaeological_files/__init__.py b/archaeological_files/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archaeological_files/__init__.py
diff --git a/archaeological_files/ishtar_menu.py b/archaeological_files/ishtar_menu.py
new file mode 100644
index 000000000..370320f69
--- /dev/null
+++ b/archaeological_files/ishtar_menu.py
@@ -0,0 +1,65 @@
+#!/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 archaeological_operations.models import Operation
+from ishtar_common.menu_base import SectionItem, MenuItem
+from ishtar_common.models import AdministrativeAct
+
+import models
+
+ORDER = 20
+
+MENU_SECTIONS = [
+ SectionItem('file_management', _(u"Archaeological file"),
+ childs=[
+ MenuItem('file_search', _(u"Search"),
+ model=models.File,
+ access_controls=['view_file', 'view_own_file']),
+ MenuItem('file_creation', _(u"Creation"),
+ model=models.File,
+ access_controls=['add_file', 'add_own_file']),
+ MenuItem('file_modification', _(u"Modification"),
+ model=models.File,
+ access_controls=['change_file', 'change_own_file']),
+ MenuItem('file_closing', _(u"Closing"),
+ model=models.File,
+ access_controls=['change_file',
+ 'change_own_file']),
+ MenuItem('file_deletion', _(u"Deletion"),
+ model=models.File,
+ access_controls=['delete_file', 'delete_own_file']),
+ SectionItem('admin_act_files', _(u"Administrative act"),
+ childs=[
+ MenuItem('file_administrativeactfile',
+ _(u"Add"),
+ model=Operation,
+ access_controls=['change_file', 'change_own_file']),
+ MenuItem('file_administrativeactfile_modification',
+ _(u"Modification"),
+ model=AdministrativeAct,
+ access_controls=['change_file', 'change_own_file']),
+ MenuItem('file_administrativeactfile_deletion',
+ _(u"Deletion"),
+ model=AdministrativeAct,
+ access_controls=['delete_file', 'delete_own_file']),
+ ],),
+ ]),
+]
diff --git a/archaeological_files/migrations/0001_initial.py b/archaeological_files/migrations/0001_initial.py
new file mode 100644
index 000000000..b69998442
--- /dev/null
+++ b/archaeological_files/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/__init__.py b/archaeological_files/migrations/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archaeological_files/migrations/__init__.py
diff --git a/archaeological_files/models.py b/archaeological_files/models.py
new file mode 100644
index 000000000..68a65f6de
--- /dev/null
+++ b/archaeological_files/models.py
@@ -0,0 +1,185 @@
+#!/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.
+
+import datetime
+
+from django.conf import settings
+from django.contrib.gis.db import models
+from django.utils.translation import ugettext_lazy as _, ugettext
+
+from ishtar_common.models import GeneralType, BaseHistorizedItem, \
+ HistoricalRecords, OwnPerms, Person, Organization, Department, Town
+
+class FileType(GeneralType):
+ class Meta:
+ verbose_name = _(u"Archaeological file type")
+ verbose_name_plural = _(u"Archaeological file types")
+
+ @classmethod
+ def is_preventive(cls, file_type_id, key=''):
+ key = key or 'preventive'
+ try:
+ preventive = FileType.objects.get(txt_idx=key).pk
+ return file_type_id == preventive
+ except ObjectDoesNotExist:
+ return False
+
+class PermitType(GeneralType):
+ class Meta:
+ verbose_name = _(u"Permit type")
+ verbose_name_plural = _(u"Permit types")
+
+if settings.COUNTRY == 'fr':
+ class SaisineType(GeneralType):
+ delay = models.IntegerField(_(u"Delay (in days)"))
+ class Meta:
+ verbose_name = u"Type Saisine"
+ verbose_name_plural = u"Types Saisine"
+
+class File(BaseHistorizedItem, OwnPerms):
+ TABLE_COLS = ['numeric_reference', 'year', 'internal_reference',
+ 'file_type', 'saisine_type', 'towns', ]
+ year = models.IntegerField(_(u"Year"),
+ default=lambda:datetime.datetime.now().year)
+ numeric_reference = models.IntegerField(_(u"Numeric reference"))
+ internal_reference = models.CharField(_(u"Internal reference"),
+ max_length=60, unique=True)
+ file_type = models.ForeignKey(FileType, verbose_name=_(u"File type"))
+ in_charge = models.ForeignKey(Person, related_name='+',
+ verbose_name=_(u"Person in charge"))
+ general_contractor = models.ForeignKey(Person, related_name='+',
+ verbose_name=_(u"General contractor"), blank=True, null=True)
+ town_planning_service = models.ForeignKey(Organization, related_name='+',
+ verbose_name=_(u"Town planning service"), blank=True, null=True)
+ permit_type = models.ForeignKey(PermitType, verbose_name=_(u"Permit type"),
+ blank=True, null=True)
+ permit_reference = models.CharField(_(u"Permit reference"),
+ max_length=60, blank=True, null=True)
+ end_date = models.DateField(_(u"Closing date"), null=True, blank=True)
+ towns = models.ManyToManyField(Town, verbose_name=_(u"Towns"),
+ related_name='file')
+ creation_date = models.DateField(_(u"Creation date"),
+ default=datetime.date.today)
+ reception_date = models.DateField(_(u'Reception date'), blank=True,
+ null=True)
+ related_file = models.ForeignKey("File", verbose_name=_(u"Related file"),
+ blank=True, null=True)
+ if settings.COUNTRY == 'fr':
+ saisine_type = models.ForeignKey(SaisineType, blank=True, null=True,
+ verbose_name= u"Type de saisine")
+ reference_number = models.IntegerField(_(u"Reference number"),
+ blank=True, null=True)
+ total_surface = models.IntegerField(_(u"Total surface (m²)"),
+ blank=True, null=True)
+ total_developed_surface = models.IntegerField(
+ _(u"Total developed surface (m²)"), blank=True, null=True)
+ address = models.TextField(_(u"Main address"), null=True, blank=True)
+ address_complement = models.TextField(_(u"Main address - complement"),
+ null=True, blank=True)
+ postal_code = models.CharField(_(u"Main address - postal code"),
+ max_length=10, null=True, blank=True)
+ comment = models.TextField(_(u"Comment"), null=True, blank=True)
+ history = HistoricalRecords()
+
+ class Meta:
+ verbose_name = _(u"Archaeological file")
+ verbose_name_plural = _(u"Archaeological files")
+ permissions = (
+ ("view_own_file", ugettext(u"Can view own Archaelogical file")),
+ ("add_own_file", ugettext(u"Can add own Archaelogical file")),
+ ("change_own_file", ugettext(u"Can change own Archaelogical file")),
+ ("delete_own_file", ugettext(u"Can delete own Archaelogical file")),
+ )
+ ordering = ['-year', '-numeric_reference']
+
+ @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()
+
+ 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.numeric_reference))))
+ items += [unicode(getattr(self, k))[:36]
+ for k in ['internal_reference',] if getattr(self, k)]
+ return JOINT.join(items)
+
+ @classmethod
+ def get_query_owns(cls, user):
+ return 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 total_surface_ha(self):
+ if self.total_surface:
+ return self.total_surface/10000.0
+
+ def total_developed_surface_ha(self):
+ if self.total_developed_surface:
+ return self.total_developed_surface/10000.0
+
+ def operation_acts(self):
+ acts = []
+ for ope in self.operations.all():
+ for act in ope.administrative_act.all():
+ acts.append(act)
+ return acts
+
+ def is_preventive(self):
+ return FileType.is_preventive(self.file_type.pk)
+
+class FileByDepartment(models.Model):
+ '''
+ Database view: don't forget to create it
+
+ create view file_department (id, department_id, file_id) as
+ select town."id", town."departement_id", file_towns."file_id"
+ from ishtar_base_town town
+ inner join ishtar_base_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();
+ '''
+ file = models.ForeignKey(File, verbose_name=_(u"File"))
+ department = models.ForeignKey(Department, verbose_name=_(u"Department"),
+ blank=True, null=True)
+ class Meta:
+ managed = False
+ db_table = 'file_department'
diff --git a/archaeological_finds/__init__.py b/archaeological_finds/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archaeological_finds/__init__.py
diff --git a/archaeological_finds/migrations/0001_initial.py b/archaeological_finds/migrations/0001_initial.py
new file mode 100644
index 000000000..03a45ed8d
--- /dev/null
+++ b/archaeological_finds/migrations/0001_initial.py
@@ -0,0 +1,808 @@
+# -*- 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 'MaterialType'
+ db.create_table('archaeological_finds_materialtype', (
+ ('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)),
+ ('recommendation', self.gf('django.db.models.fields.TextField')()),
+ ('parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_finds.MaterialType'], null=True, blank=True)),
+ ))
+ db.send_create_signal('archaeological_finds', ['MaterialType'])
+
+ # Adding model 'HistoricalBaseItem'
+ db.create_table('archaeological_finds_historicalbaseitem', (
+ ('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)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=60)),
+ ('description', self.gf('django.db.models.fields.TextField')()),
+ ('context_record_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('is_isolated', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
+ ('index', self.gf('django.db.models.fields.IntegerField')(default=0)),
+ ('material_index', self.gf('django.db.models.fields.IntegerField')(default=0)),
+ ('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_finds', ['HistoricalBaseItem'])
+
+ # Adding model 'BaseItem'
+ db.create_table('archaeological_finds_baseitem', (
+ ('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'])),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=60)),
+ ('description', self.gf('django.db.models.fields.TextField')()),
+ ('context_record', self.gf('django.db.models.fields.related.ForeignKey')(related_name='base_items', to=orm['archaeological_context_records.ContextRecord'])),
+ ('is_isolated', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
+ ('index', self.gf('django.db.models.fields.IntegerField')(default=0)),
+ ('material_index', self.gf('django.db.models.fields.IntegerField')(default=0)),
+ ))
+ db.send_create_signal('archaeological_finds', ['BaseItem'])
+
+ # Adding model 'HistoricalItem'
+ db.create_table('archaeological_finds_historicalitem', (
+ ('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)),
+ ('order', self.gf('django.db.models.fields.IntegerField')()),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=60)),
+ ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('material_type_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('volume', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
+ ('weight', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
+ ('item_number', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('upstream_treatment_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('downstream_treatment_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('dating_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('container_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('history_id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('history_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
+ ('history_user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True)),
+ ('history_type', self.gf('django.db.models.fields.CharField')(max_length=1)),
+ ))
+ db.send_create_signal('archaeological_finds', ['HistoricalItem'])
+
+ # Adding model 'Item'
+ db.create_table('archaeological_finds_item', (
+ ('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'])),
+ ('order', self.gf('django.db.models.fields.IntegerField')()),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=60)),
+ ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('material_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_finds.MaterialType'])),
+ ('volume', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
+ ('weight', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
+ ('item_number', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('upstream_treatment', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='downstream_treatment', null=True, to=orm['archaeological_finds.Treatment'])),
+ ('downstream_treatment', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='upstream_treatment', null=True, to=orm['archaeological_finds.Treatment'])),
+ ('dating', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_context_records.Dating'])),
+ ('container', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='items', null=True, to=orm['archaeological_warehouse.Container'])),
+ ))
+ db.send_create_signal('archaeological_finds', ['Item'])
+
+ # Adding M2M table for field base_items on 'Item'
+ db.create_table('archaeological_finds_item_base_items', (
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+ ('item', models.ForeignKey(orm['archaeological_finds.item'], null=False)),
+ ('baseitem', models.ForeignKey(orm['archaeological_finds.baseitem'], null=False))
+ ))
+ db.create_unique('archaeological_finds_item_base_items', ['item_id', 'baseitem_id'])
+
+ # Adding model 'ItemSource'
+ db.create_table('archaeological_finds_itemsource', (
+ ('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)),
+ ('item', self.gf('django.db.models.fields.related.ForeignKey')(related_name='source', to=orm['archaeological_finds.Item'])),
+ ))
+ db.send_create_signal('archaeological_finds', ['ItemSource'])
+
+ # Adding M2M table for field authors on 'ItemSource'
+ db.create_table('archaeological_finds_itemsource_authors', (
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+ ('itemsource', models.ForeignKey(orm['archaeological_finds.itemsource'], null=False)),
+ ('author', models.ForeignKey(orm['ishtar_common.author'], null=False))
+ ))
+ db.create_unique('archaeological_finds_itemsource_authors', ['itemsource_id', 'author_id'])
+
+ # Adding model 'TreatmentType'
+ db.create_table('archaeological_finds_treatmenttype', (
+ ('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)),
+ ('virtual', self.gf('django.db.models.fields.BooleanField')(default=False)),
+ ))
+ db.send_create_signal('archaeological_finds', ['TreatmentType'])
+
+ # Adding model 'HistoricalTreatment'
+ db.create_table('archaeological_finds_historicaltreatment', (
+ ('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)),
+ ('container_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('treatment_type_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('location_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('person_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)),
+ ('end_date', self.gf('django.db.models.fields.DateField')(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_finds', ['HistoricalTreatment'])
+
+ # Adding model 'Treatment'
+ db.create_table('archaeological_finds_treatment', (
+ ('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'])),
+ ('container', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_warehouse.Container'], null=True, blank=True)),
+ ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('treatment_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_finds.TreatmentType'])),
+ ('location', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_warehouse.Warehouse'], null=True, blank=True)),
+ ('person', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Person'], null=True, blank=True)),
+ ('start_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)),
+ ))
+ db.send_create_signal('archaeological_finds', ['Treatment'])
+
+ # Adding model 'TreatmentSource'
+ db.create_table('archaeological_finds_treatmentsource', (
+ ('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)),
+ ('treatment', self.gf('django.db.models.fields.related.ForeignKey')(related_name='source', to=orm['archaeological_finds.Treatment'])),
+ ))
+ db.send_create_signal('archaeological_finds', ['TreatmentSource'])
+
+ # Adding M2M table for field authors on 'TreatmentSource'
+ db.create_table('archaeological_finds_treatmentsource_authors', (
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+ ('treatmentsource', models.ForeignKey(orm['archaeological_finds.treatmentsource'], null=False)),
+ ('author', models.ForeignKey(orm['ishtar_common.author'], null=False))
+ ))
+ db.create_unique('archaeological_finds_treatmentsource_authors', ['treatmentsource_id', 'author_id'])
+
+ # Adding model 'Property'
+ db.create_table('archaeological_finds_property', (
+ ('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'])),
+ ('history_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+ ('item', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_finds.Item'])),
+ ('administrative_act', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_operations.AdministrativeAct'])),
+ ('person', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Person'])),
+ ('start_date', self.gf('django.db.models.fields.DateField')()),
+ ('end_date', self.gf('django.db.models.fields.DateField')()),
+ ))
+ db.send_create_signal('archaeological_finds', ['Property'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'MaterialType'
+ db.delete_table('archaeological_finds_materialtype')
+
+ # Deleting model 'HistoricalBaseItem'
+ db.delete_table('archaeological_finds_historicalbaseitem')
+
+ # Deleting model 'BaseItem'
+ db.delete_table('archaeological_finds_baseitem')
+
+ # Deleting model 'HistoricalItem'
+ db.delete_table('archaeological_finds_historicalitem')
+
+ # Deleting model 'Item'
+ db.delete_table('archaeological_finds_item')
+
+ # Removing M2M table for field base_items on 'Item'
+ db.delete_table('archaeological_finds_item_base_items')
+
+ # Deleting model 'ItemSource'
+ db.delete_table('archaeological_finds_itemsource')
+
+ # Removing M2M table for field authors on 'ItemSource'
+ db.delete_table('archaeological_finds_itemsource_authors')
+
+ # Deleting model 'TreatmentType'
+ db.delete_table('archaeological_finds_treatmenttype')
+
+ # Deleting model 'HistoricalTreatment'
+ db.delete_table('archaeological_finds_historicaltreatment')
+
+ # Deleting model 'Treatment'
+ db.delete_table('archaeological_finds_treatment')
+
+ # Deleting model 'TreatmentSource'
+ db.delete_table('archaeological_finds_treatmentsource')
+
+ # Removing M2M table for field authors on 'TreatmentSource'
+ db.delete_table('archaeological_finds_treatmentsource_authors')
+
+ # Deleting model 'Property'
+ db.delete_table('archaeological_finds_property')
+
+
+ models = {
+ 'archaeological_context_records.activitytype': {
+ 'Meta': {'object_name': 'ActivityType'},
+ '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'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'archaeological_context_records.contextrecord': {
+ 'Meta': {'object_name': 'ContextRecord'},
+ 'activity': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_context_records.ActivityType']", 'null': 'True', 'blank': 'True'}),
+ 'datings': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['archaeological_context_records.Dating']", 'symmetrical': 'False'}),
+ 'depth': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'filling': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'has_furniture': ('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'}),
+ 'identification': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_context_records.IdentificationType']", 'null': 'True', 'blank': 'True'}),
+ 'interpretation': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'location': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'operation': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'context_record'", 'to': "orm['archaeological_operations.Operation']"}),
+ 'parcel': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'context_record'", 'to': "orm['archaeological_context_records.Parcel']"}),
+ 'taq': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'taq_estimated': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'thickness': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'tpq': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'tpq_estimated': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'unit': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['archaeological_context_records.Unit']"}),
+ 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_context_records.dating': {
+ 'Meta': {'object_name': 'Dating'},
+ 'dating_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_context_records.DatingType']", 'null': 'True', 'blank': 'True'}),
+ 'end_date': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'period': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.Period']"}),
+ 'quality': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_context_records.DatingQuality']", 'null': 'True', 'blank': 'True'}),
+ 'start_date': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_context_records.datingquality': {
+ 'Meta': {'object_name': 'DatingQuality'},
+ '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_context_records.datingtype': {
+ 'Meta': {'object_name': 'DatingType'},
+ '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_context_records.identificationtype': {
+ 'Meta': {'object_name': 'IdentificationType'},
+ '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'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'archaeological_context_records.parcel': {
+ 'Meta': {'object_name': 'Parcel'},
+ 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parcels'", 'null': 'True', 'to': "orm['archaeological_files.File']"}),
+ 'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'operation': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parcels'", 'null': 'True', 'to': "orm['archaeological_operations.Operation']"}),
+ 'parcel_number': ('django.db.models.fields.CharField', [], {'max_length': '6'}),
+ 'section': ('django.db.models.fields.CharField', [], {'max_length': '4'}),
+ 'town': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'parcels'", 'to': "orm['ishtar_common.Town']"}),
+ 'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_context_records.unit': {
+ 'Meta': {'object_name': 'Unit'},
+ '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'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_context_records.Unit']", 'null': 'True', 'blank': 'True'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ '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_finds.baseitem': {
+ 'Meta': {'object_name': 'BaseItem'},
+ 'context_record': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'base_items'", 'to': "orm['archaeological_context_records.ContextRecord']"}),
+ 'description': ('django.db.models.fields.TextField', [], {}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'index': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'is_isolated': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
+ 'material_index': ('django.db.models.fields.IntegerField', [], {'default': '0'})
+ },
+ 'archaeological_finds.historicalbaseitem': {
+ 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalBaseItem'},
+ 'context_record_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {}),
+ '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'}),
+ 'index': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'is_isolated': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
+ 'material_index': ('django.db.models.fields.IntegerField', [], {'default': '0'})
+ },
+ 'archaeological_finds.historicalitem': {
+ 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalItem'},
+ 'container_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'dating_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'downstream_treatment_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'}),
+ 'item_number': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
+ 'material_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {}),
+ 'upstream_treatment_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'volume': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ 'weight': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_finds.historicaltreatment': {
+ 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalTreatment'},
+ 'container_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'end_date': ('django.db.models.fields.DateField', [], {'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'}),
+ 'location_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'person_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'treatment_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_finds.item': {
+ 'Meta': {'object_name': 'Item'},
+ 'base_items': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'item'", 'symmetrical': 'False', 'to': "orm['archaeological_finds.BaseItem']"}),
+ 'container': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'items'", 'null': 'True', 'to': "orm['archaeological_warehouse.Container']"}),
+ 'dating': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_context_records.Dating']"}),
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'downstream_treatment': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'upstream_treatment'", 'null': 'True', 'to': "orm['archaeological_finds.Treatment']"}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'item_number': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
+ 'material_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_finds.MaterialType']"}),
+ 'order': ('django.db.models.fields.IntegerField', [], {}),
+ 'upstream_treatment': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'downstream_treatment'", 'null': 'True', 'to': "orm['archaeological_finds.Treatment']"}),
+ 'volume': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ 'weight': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_finds.itemsource': {
+ 'Meta': {'object_name': 'ItemSource'},
+ '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'}),
+ 'item': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'source'", 'to': "orm['archaeological_finds.Item']"}),
+ '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_finds.materialtype': {
+ 'Meta': {'object_name': 'MaterialType'},
+ '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'}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_finds.MaterialType']", 'null': 'True', 'blank': 'True'}),
+ 'recommendation': ('django.db.models.fields.TextField', [], {}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'archaeological_finds.property': {
+ 'Meta': {'object_name': 'Property'},
+ 'administrative_act': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.AdministrativeAct']"}),
+ 'end_date': ('django.db.models.fields.DateField', [], {}),
+ 'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'item': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_finds.Item']"}),
+ 'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']"}),
+ 'start_date': ('django.db.models.fields.DateField', [], {})
+ },
+ 'archaeological_finds.treatment': {
+ 'Meta': {'object_name': 'Treatment'},
+ 'container': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.Container']", 'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'end_date': ('django.db.models.fields.DateField', [], {'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'}),
+ 'location': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.Warehouse']", 'null': 'True', 'blank': 'True'}),
+ 'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']", 'null': 'True', 'blank': 'True'}),
+ 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+ 'treatment_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_finds.TreatmentType']"})
+ },
+ 'archaeological_finds.treatmentsource': {
+ 'Meta': {'object_name': 'TreatmentSource'},
+ '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'}),
+ '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'}),
+ 'treatment': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'source'", 'to': "orm['archaeological_finds.Treatment']"})
+ },
+ 'archaeological_finds.treatmenttype': {
+ 'Meta': {'object_name': 'TreatmentType'},
+ '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'}),
+ 'virtual': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
+ },
+ '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.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.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'})
+ },
+ 'archaeological_warehouse.container': {
+ 'Meta': {'object_name': 'Container'},
+ 'comment': ('django.db.models.fields.TextField', [], {}),
+ 'container_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.ContainerType']"}),
+ 'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'location': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.Warehouse']"}),
+ 'reference': ('django.db.models.fields.CharField', [], {'max_length': '40'})
+ },
+ 'archaeological_warehouse.containertype': {
+ 'Meta': {'object_name': 'ContainerType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'reference': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),
+ 'volume': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_warehouse.warehouse': {
+ 'Meta': {'object_name': 'Warehouse'},
+ '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'}),
+ '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': '40'}),
+ 'person_in_charge': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']", 'null': 'True', 'blank': 'True'}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'warehouse_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.WarehouseType']"})
+ },
+ 'archaeological_warehouse.warehousetype': {
+ 'Meta': {'object_name': 'WarehouseType'},
+ '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_finds'] \ No newline at end of file
diff --git a/archaeological_finds/migrations/__init__.py b/archaeological_finds/migrations/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archaeological_finds/migrations/__init__.py
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py
new file mode 100644
index 000000000..cea9a35f1
--- /dev/null
+++ b/archaeological_finds/models.py
@@ -0,0 +1,281 @@
+#!/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.utils.translation import ugettext_lazy as _, ugettext
+
+from ishtar_common.models import GeneralType, BaseHistorizedItem, \
+ LightHistorizedItem, HistoricalRecords, OwnPerms, Source, Person
+
+from archaeological_operations.models import AdministrativeAct
+from archaeological_context_records.models import ContextRecord, Dating
+WAREHOUSE_AVAILABLE = 'archaeological_warehouse' in settings.INSTALLED_APPS
+if WAREHOUSE_AVAILABLE:
+ from archaeological_warehouse.models import Warehouse, Container
+
+class MaterialType(GeneralType):
+ recommendation = models.TextField(_(u"Recommendation"))
+ parent = models.ForeignKey("MaterialType", blank=True, null=True,
+ verbose_name=_(u"Parent material"))
+
+ class Meta:
+ verbose_name = _(u"Material type")
+ verbose_name_plural = _(u"Material types")
+
+class BaseItem(BaseHistorizedItem, OwnPerms):
+ label = models.CharField(_(u"ID"), max_length=60)
+ description = models.TextField(_(u"Description"))
+ context_record = models.ForeignKey(ContextRecord,
+ related_name='base_items', verbose_name=_(u"Context Record"))
+ is_isolated = models.NullBooleanField(_(u"Is isolated?"), blank=True,
+ null=True)
+ index = models.IntegerField(u"Index", default=0)
+ material_index = models.IntegerField(u"Material index", default=0)
+ history = HistoricalRecords()
+
+ class Meta:
+ verbose_name = _(u"Base item")
+ verbose_name_plural = _(u"Base items")
+ permissions = (
+ ("view_own_baseitem", ugettext(u"Can view own Base item")),
+ ("add_own_baseitem", ugettext(u"Can add own Base item")),
+ ("change_own_baseitem", ugettext(u"Can change own Base item")),
+ ("delete_own_baseitem", ugettext(u"Can delete own Base item")),
+ )
+
+ def __unicode__(self):
+ return self.label
+
+ def get_last_item(self):
+ #TODO: manage virtuals - property(last_item) ?
+ items = self.item.filter().order_by("-order").all()
+ return items and items[0]
+
+ def full_label(self):
+ return self._real_label() or self._temp_label()
+
+ def material_type_label(self):
+ item = self.get_last_item()
+ items = [item and unicode(item.material_type) or '']
+ ope = self.context_record.operation
+ items += [ope.code_patriarche or \
+ (unicode(ope.year) + "-" + unicode(ope.operation_code))]
+ items += [self.context_record.label, unicode(self.material_index)]
+ return JOINT.join(items)
+
+ def _real_label(self):
+ if not self.context_record.parcel.operation.code_patriarche:
+ return
+ item = self.get_last_item()
+ lbl = item.label or self.label
+ return JOINT.join([unicode(it) for it in (
+ self.context_record.parcel.operation.code_patriarche,
+ self.context_record.label,
+ lbl) if it])
+
+ def _temp_label(self):
+ if self.context_record.parcel.operation.code_patriarche:
+ return
+ item = self.get_last_item()
+ lbl = item.label or self.label
+ return JOINT.join([unicode(it) for it in (
+ self.context_record.parcel.year,
+ self.index,
+ self.context_record.label,
+ lbl) if it])
+
+class Item(BaseHistorizedItem, OwnPerms):
+ TABLE_COLS = ['label', 'material_type', 'dating.period',
+ 'base_items.context_record.parcel.town',
+ 'base_items.context_record.parcel.operation.year',
+ 'base_items.context_record.parcel.operation.operation_code',
+ 'base_items.is_isolated']
+ if settings.COUNTRY == 'fr':
+ TABLE_COLS.insert(6,
+ 'base_items.context_record.parcel.operation.code_patriarche')
+ base_items = models.ManyToManyField(BaseItem, verbose_name=_(u"Base item"),
+ related_name='item')
+ order = models.IntegerField(_(u"Order"))
+ label = models.CharField(_(u"ID"), max_length=60)
+ description = models.TextField(_(u"Description"), blank=True, null=True)
+ material_type = models.ForeignKey(MaterialType,
+ verbose_name = _(u"Material type"))
+ volume = models.FloatField(_(u"Volume (l)"), blank=True, null=True)
+ weight = models.FloatField(_(u"Weight (g)"), blank=True, null=True)
+ item_number = models.IntegerField(_("Item number"), blank=True, null=True)
+ upstream_treatment = models.ForeignKey("Treatment", blank=True, null=True,
+ related_name='downstream_treatment', verbose_name=_("Upstream treatment"))
+ downstream_treatment = models.ForeignKey("Treatment", blank=True, null=True,
+ related_name='upstream_treatment', verbose_name=_("Downstream treatment"))
+ dating = models.ForeignKey(Dating, verbose_name=_(u"Dating"))
+ if WAREHOUSE_AVAILABLE:
+ container = models.ForeignKey(Container, verbose_name=_(u"Container"),
+ blank=True, null=True, related_name='items')
+ history = HistoricalRecords()
+
+ @classmethod
+ def get_years(cls):
+ years = set()
+ items = cls.objects.filter(downstream_treatment__isnull=True)
+ for item in items:
+ bi = item.base_items.all()
+ if not bi:
+ continue
+ bi = bi[0]
+ yr = bi.context_record.operation.start_date.year
+ years.add(yr)
+ return list(years)
+
+ @classmethod
+ def get_by_year(cls, year):
+ return cls.objects.filter(downstream_treatment__isnull=True,
+ base_items__context_record__operation__start_date__year=year)
+
+ @classmethod
+ def get_operations(cls):
+ operations = set()
+ items = cls.objects.filter(downstream_treatment__isnull=True)
+ for item in items:
+ bi = item.base_items.all()
+ if not bi:
+ continue
+ bi = bi[0]
+ pk = bi.context_record.operation.pk
+ operations.add(pk)
+ return list(operations)
+
+ @classmethod
+ def get_by_operation(cls, operation_id):
+ return cls.objects.filter(downstream_treatment__isnull=True,
+ base_items__context_record__operation__pk=operation_id)
+
+ @classmethod
+ def get_total_number(cls):
+ return cls.objects.filter(downstream_treatment__isnull=True).count()
+
+ def duplicate(self, user):
+ dct = dict([(attr, getattr(self, attr)) for attr in ('order', 'label',
+ 'description', 'material_type', 'volume', 'weight',
+ 'item_number', 'dating')])
+ dct['order'] += 1
+ dct['history_modifier'] = user
+ new = self.__class__(**dct)
+ new.save()
+ for base_item in self.base_items.all():
+ new.base_items.add(base_item)
+ return new
+
+ class Meta:
+ verbose_name = _(u"Item")
+ verbose_name_plural = _(u"Items")
+ permissions = (
+ ("view_own_item", ugettext(u"Can view own Item")),
+ ("add_own_item", ugettext(u"Can add own Item")),
+ ("change_own_item", ugettext(u"Can change own Item")),
+ ("delete_own_item", ugettext(u"Can delete own Item")),
+ )
+
+ def __unicode__(self):
+ return self.label
+
+ def save(self, *args, **kwargs):
+ if not self.pk:
+ super(Item, self).save(*args, **kwargs)
+ for base_item in self.base_items.all():
+ if not base_item.index:
+ idx = BaseItem.objects.filter(context_record=\
+ base_item.context_record).aggregate(Max('index'))
+ base_item.index = idx and idx['index__max'] + 1 or 1
+ if not base_item.material_index:
+ idx = BaseItem.objects.filter(context_record=\
+ base_item.context_record,
+ item__material_type=self.material_type).aggregate(
+ Max('material_index'))
+ base_item.material_index = idx and \
+ idx['material_index__max'] + 1 or 1
+ base_item.save()
+ super(Item, self).save(*args, **kwargs)
+
+class ItemSource(Source):
+ class Meta:
+ verbose_name = _(u"Item documentation")
+ verbose_name_plural = _(u"Item documentations")
+ item = models.ForeignKey(Item, verbose_name=_(u"Item"),
+ related_name="source")
+
+class TreatmentType(GeneralType):
+ virtual = models.BooleanField(_(u"Virtual"))
+ class Meta:
+ verbose_name = _(u"Treatment type")
+ verbose_name_plural = _(u"Treatment types")
+
+class Treatment(BaseHistorizedItem, OwnPerms):
+ container = models.ForeignKey(Container, verbose_name=_(u"Container"),
+ blank=True, null=True)
+ description = models.TextField(_(u"Description"), blank=True, null=True)
+ treatment_type = models.ForeignKey(TreatmentType,
+ verbose_name=_(u"Treatment type"))
+ if WAREHOUSE_AVAILABLE:
+ location = models.ForeignKey(Warehouse, verbose_name=_(u"Location"),
+ blank=True, null=True)
+ person = models.ForeignKey(Person, verbose_name=_(u"Person"),
+ blank=True, null=True)
+ start_date = models.DateField(_(u"Start date"), blank=True, null=True)
+ end_date = models.DateField(_(u"End date"), blank=True, null=True)
+ history = HistoricalRecords()
+
+ class Meta:
+ verbose_name = _(u"Treatment")
+ verbose_name_plural = _(u"Treatments")
+ permissions = (
+ ("view_own_treatment", ugettext(u"Can view own Treatment")),
+ ("add_own_treatment", ugettext(u"Can add own Treatment")),
+ ("change_own_treatment", ugettext(u"Can change own Treatment")),
+ ("delete_own_treatment", ugettext(u"Can delete own Treatment")),
+ )
+
+ def __unicode__(self):
+ lbl = unicode(self.treatment_type)
+ if self.person:
+ lbl += u" %s %s" % (_(u"by"), unicode(self.person))
+ return lbl
+
+class TreatmentSource(Source):
+ class Meta:
+ verbose_name = _(u"Treatment documentation")
+ verbose_name_plural = _(u"Treament documentations")
+ treatment = models.ForeignKey(Treatment, verbose_name=_(u"Treatment"),
+ related_name="source")
+
+class Property(LightHistorizedItem):
+ item = models.ForeignKey(Item, verbose_name=_(u"Item"))
+ administrative_act = models.ForeignKey(AdministrativeAct,
+ verbose_name=_(u"Administrative act"))
+ person = models.ForeignKey(Person, verbose_name=_(u"Person"))
+ start_date = models.DateField(_(u"Start date"))
+ end_date = models.DateField(_(u"End date"))
+
+ class Meta:
+ verbose_name = _(u"Property")
+ verbose_name_plural = _(u"Properties")
+
+ def __unicode__(self):
+ return self.person + JOINT + self.item
+
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])
diff --git a/archaeological_warehouse/__init__.py b/archaeological_warehouse/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archaeological_warehouse/__init__.py
diff --git a/archaeological_warehouse/migrations/0001_initial.py b/archaeological_warehouse/migrations/0001_initial.py
new file mode 100644
index 000000000..6c3b14e75
--- /dev/null
+++ b/archaeological_warehouse/migrations/0001_initial.py
@@ -0,0 +1,229 @@
+# -*- 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 'WarehouseType'
+ db.create_table('archaeological_warehouse_warehousetype', (
+ ('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_warehouse', ['WarehouseType'])
+
+ # Adding model 'Warehouse'
+ db.create_table('archaeological_warehouse_warehouse', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('history_modifier', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['auth.User'])),
+ ('address', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('address_complement', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('postal_code', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)),
+ ('town', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('country', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('mobile_phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=40)),
+ ('warehouse_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_warehouse.WarehouseType'])),
+ ('person_in_charge', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Person'], null=True, blank=True)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ))
+ db.send_create_signal('archaeological_warehouse', ['Warehouse'])
+
+ # Adding model 'ContainerType'
+ db.create_table('archaeological_warehouse_containertype', (
+ ('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)),
+ ('length', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('width', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('height', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('volume', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('reference', self.gf('django.db.models.fields.CharField')(max_length=30)),
+ ))
+ db.send_create_signal('archaeological_warehouse', ['ContainerType'])
+
+ # Adding model 'Container'
+ db.create_table('archaeological_warehouse_container', (
+ ('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'])),
+ ('history_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+ ('location', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_warehouse.Warehouse'])),
+ ('container_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archaeological_warehouse.ContainerType'])),
+ ('reference', self.gf('django.db.models.fields.CharField')(max_length=40)),
+ ('comment', self.gf('django.db.models.fields.TextField')()),
+ ))
+ db.send_create_signal('archaeological_warehouse', ['Container'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'WarehouseType'
+ db.delete_table('archaeological_warehouse_warehousetype')
+
+ # Deleting model 'Warehouse'
+ db.delete_table('archaeological_warehouse_warehouse')
+
+ # Deleting model 'ContainerType'
+ db.delete_table('archaeological_warehouse_containertype')
+
+ # Deleting model 'Container'
+ db.delete_table('archaeological_warehouse_container')
+
+
+ models = {
+ 'archaeological_warehouse.container': {
+ 'Meta': {'object_name': 'Container'},
+ 'comment': ('django.db.models.fields.TextField', [], {}),
+ 'container_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.ContainerType']"}),
+ 'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'location': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.Warehouse']"}),
+ 'reference': ('django.db.models.fields.CharField', [], {'max_length': '40'})
+ },
+ 'archaeological_warehouse.containertype': {
+ 'Meta': {'object_name': 'ContainerType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'reference': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),
+ 'volume': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'archaeological_warehouse.warehouse': {
+ 'Meta': {'object_name': 'Warehouse'},
+ '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'}),
+ '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': '40'}),
+ 'person_in_charge': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']", 'null': 'True', 'blank': 'True'}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'warehouse_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_warehouse.WarehouseType']"})
+ },
+ 'archaeological_warehouse.warehousetype': {
+ 'Meta': {'object_name': 'WarehouseType'},
+ '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.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.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_warehouse'] \ No newline at end of file
diff --git a/archaeological_warehouse/migrations/__init__.py b/archaeological_warehouse/migrations/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archaeological_warehouse/migrations/__init__.py
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
new file mode 100644
index 000000000..fe381e521
--- /dev/null
+++ b/archaeological_warehouse/models.py
@@ -0,0 +1,82 @@
+#!/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.utils.translation import ugettext_lazy as _, ugettext
+
+from ishtar_common.models import GeneralType, BaseHistorizedItem, \
+ LightHistorizedItem, OwnPerms, Address, Person
+
+
+class WarehouseType(GeneralType):
+ class Meta:
+ verbose_name = _(u"Warehouse type")
+ verbose_name_plural = _(u"Warehouse types")
+
+class Warehouse(Address, OwnPerms):
+ name = models.CharField(_(u"Name"), max_length=40)
+ warehouse_type = models.ForeignKey(WarehouseType,
+ verbose_name=_(u"Warehouse type"))
+ person_in_charge = models.ForeignKey(Person,
+ verbose_name=_(u"Person in charge"), null=True, blank=True)
+ comment = models.TextField(_(u"Comment"), null=True, blank=True)
+
+ class Meta:
+ verbose_name = _(u"Warehouse")
+ verbose_name_plural = _(u"Warehouses")
+ permissions = (
+ ("view_own_warehouse", ugettext(u"Can view own Warehouse")),
+ ("add_own_warehouse", ugettext(u"Can add own Warehouse")),
+ ("change_own_warehouse", ugettext(u"Can change own Warehouse")),
+ ("delete_own_warehouse", ugettext(u"Can delete own Warehouse")),
+ )
+
+ def __unicode__(self):
+ return u"%s (%s)" % (self.name, unicode(self.warehouse_type))
+
+
+class ContainerType(GeneralType):
+ length = models.IntegerField(_(u"Length (mm)"), blank=True, null=True)
+ width = models.IntegerField(_(u"Width (mm)"), blank=True, null=True)
+ height = models.IntegerField(_(u"Height (mm)"), blank=True, null=True)
+ volume = models.IntegerField(_(u"Volume (l)"), blank=True, null=True)
+ reference = models.CharField(_(u"Reference"), max_length=30)
+
+ class Meta:
+ verbose_name = _(u"Container type")
+ verbose_name_plural = _(u"Container types")
+
+class Container(LightHistorizedItem):
+ TABLE_COLS = ['reference', 'container_type', 'location',]
+ location = models.ForeignKey(Warehouse, verbose_name=_(u"Warehouse"))
+ container_type = models.ForeignKey(ContainerType,
+ verbose_name=_("Container type"))
+ reference = models.CharField(_(u"Reference"), max_length=40)
+ comment = models.TextField(_(u"Comment"))
+
+ class Meta:
+ verbose_name = _(u"Container")
+ verbose_name_plural = _(u"Containers")
+
+ def __unicode__(self):
+ lbl = u" - ".join((self.reference, unicode(self.container_type),
+ unicode(self.location)))
+ return lbl
+
diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py
index 6d22fbcfa..c4e5fa7f2 100644
--- a/ishtar_common/admin.py
+++ b/ishtar_common/admin.py
@@ -35,11 +35,11 @@ class HistorizedObjectAdmin(admin.ModelAdmin):
obj.history_modifier = request.user
obj.save()
-class DepartementAdmin(admin.ModelAdmin):
+class DepartmentAdmin(admin.ModelAdmin):
list_display = ('number', 'label',)
- model = models.Departement
+ model = models.Department
-admin.site.register(models.Departement, DepartementAdmin)
+admin.site.register(models.Department, DepartmentAdmin)
class OrganizationAdmin(HistorizedObjectAdmin):
list_display = ('name', 'organization_type')
diff --git a/ishtar_common/fixtures/initial_data.json b/ishtar_common/fixtures/initial_data_bak.json
index dbed23faa..dbed23faa 100644
--- a/ishtar_common/fixtures/initial_data.json
+++ b/ishtar_common/fixtures/initial_data_bak.json
diff --git a/ishtar_common/menus.py b/ishtar_common/menus.py
index 8bc2087c1..c55e2a328 100644
--- a/ishtar_common/menus.py
+++ b/ishtar_common/menus.py
@@ -58,82 +58,6 @@ for order, menu in sorted(_extra_menus, key=lambda x:x[0]):
_section_items += menu
"""
- SectionItem('file_management', _(u"Archaeological file"),
- childs=[
- MenuItem('file_search', _(u"Search"),
- model=models.File,
- access_controls=['view_file', 'view_own_file']),
- MenuItem('file_creation', _(u"Creation"),
- model=models.File,
- access_controls=['add_file', 'add_own_file']),
- MenuItem('file_modification', _(u"Modification"),
- model=models.File,
- access_controls=['change_file', 'change_own_file']),
- MenuItem('file_closing', _(u"Closing"),
- model=models.File,
- access_controls=['change_file',
- 'change_own_file']),
- MenuItem('file_deletion', _(u"Deletion"),
- model=models.File,
- access_controls=['delete_file', 'delete_own_file']),
- SectionItem('admin_act_files', _(u"Administrative act"),
- childs=[
- MenuItem('file_administrativeactfile',
- _(u"Add"),
- model=models.Operation,
- access_controls=['change_file', 'change_own_file']),
- MenuItem('file_administrativeactfile_modification',
- _(u"Modification"),
- model=models.AdministrativeAct,
- access_controls=['change_file', 'change_own_file']),
- MenuItem('file_administrativeactfile_deletion',
- _(u"Deletion"),
- model=models.AdministrativeAct,
- access_controls=['delete_file', 'delete_own_file']),
- ],),
- ]),
- 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=models.AdministrativeAct,
- access_controls=['change_operation',
- 'change_own_operation']),
- MenuItem('operation_administrativeactop_deletion',
- _(u"Deletion"),
- model=models.AdministrativeAct,
- access_controls=['operation_deletion',
- 'delete_own_operation']),
- ],),
- ]),
SectionItem('record_management', _(u"Context record"),
childs=[
MenuItem('record_search', _(u"Search"),
diff --git a/ishtar_common/migrations/0001_initial.py b/ishtar_common/migrations/0001_initial.py
new file mode 100644
index 000000000..fc22881bc
--- /dev/null
+++ b/ishtar_common/migrations/0001_initial.py
@@ -0,0 +1,408 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding model 'Wizard'
+ db.create_table('ishtar_common_wizard', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('url_name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
+ ))
+ db.send_create_signal('ishtar_common', ['Wizard'])
+
+ # Adding model 'WizardStep'
+ db.create_table('ishtar_common_wizardstep', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('order', self.gf('django.db.models.fields.IntegerField')()),
+ ('wizard', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Wizard'])),
+ ('url_name', self.gf('django.db.models.fields.CharField')(max_length=128)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
+ ))
+ db.send_create_signal('ishtar_common', ['WizardStep'])
+
+ # Adding model 'Department'
+ db.create_table('ishtar_common_department', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=30)),
+ ('number', self.gf('django.db.models.fields.CharField')(unique=True, max_length=3)),
+ ))
+ db.send_create_signal('ishtar_common', ['Department'])
+
+ # Adding model 'OrganizationType'
+ db.create_table('ishtar_common_organizationtype', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
+ ))
+ db.send_create_signal('ishtar_common', ['OrganizationType'])
+
+ # Adding model 'HistoricalOrganization'
+ db.create_table('ishtar_common_historicalorganization', (
+ ('id', self.gf('django.db.models.fields.IntegerField')(db_index=True, blank=True)),
+ ('history_modifier_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('address', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('address_complement', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('postal_code', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)),
+ ('town', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('country', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('mobile_phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('organization_type_id', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
+ ('history_id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('history_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
+ ('history_user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True)),
+ ('history_type', self.gf('django.db.models.fields.CharField')(max_length=1)),
+ ))
+ db.send_create_signal('ishtar_common', ['HistoricalOrganization'])
+
+ # Adding model 'Organization'
+ db.create_table('ishtar_common_organization', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('history_modifier', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['auth.User'])),
+ ('address', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('address_complement', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('postal_code', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)),
+ ('town', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('country', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('mobile_phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('organization_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.OrganizationType'])),
+ ))
+ db.send_create_signal('ishtar_common', ['Organization'])
+
+ # Adding model 'PersonType'
+ db.create_table('ishtar_common_persontype', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
+ ))
+ db.send_create_signal('ishtar_common', ['PersonType'])
+
+ # Adding M2M table for field rights on 'PersonType'
+ db.create_table('ishtar_common_persontype_rights', (
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+ ('persontype', models.ForeignKey(orm['ishtar_common.persontype'], null=False)),
+ ('wizardstep', models.ForeignKey(orm['ishtar_common.wizardstep'], null=False))
+ ))
+ db.create_unique('ishtar_common_persontype_rights', ['persontype_id', 'wizardstep_id'])
+
+ # Adding model 'Person'
+ db.create_table('ishtar_common_person', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('history_modifier', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['auth.User'])),
+ ('address', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('address_complement', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('postal_code', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True)),
+ ('town', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('country', self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True)),
+ ('phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('mobile_phone', self.gf('django.db.models.fields.CharField')(max_length=18, null=True, blank=True)),
+ ('title', self.gf('django.db.models.fields.CharField')(max_length=2)),
+ ('surname', self.gf('django.db.models.fields.CharField')(max_length=20)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=30)),
+ ('email', self.gf('django.db.models.fields.CharField')(max_length=40, null=True, blank=True)),
+ ('person_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.PersonType'])),
+ ('attached_to', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Organization'], null=True, blank=True)),
+ ))
+ db.send_create_signal('ishtar_common', ['Person'])
+
+ # Adding model 'IshtarUser'
+ db.create_table('ishtar_common_ishtaruser', (
+ ('user_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['auth.User'], unique=True, primary_key=True)),
+ ('person', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Person'], unique=True)),
+ ))
+ db.send_create_signal('ishtar_common', ['IshtarUser'])
+
+ # Adding model 'AuthorType'
+ db.create_table('ishtar_common_authortype', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
+ ))
+ db.send_create_signal('ishtar_common', ['AuthorType'])
+
+ # Adding model 'Author'
+ db.create_table('ishtar_common_author', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('person', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Person'])),
+ ('author_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.AuthorType'])),
+ ))
+ db.send_create_signal('ishtar_common', ['Author'])
+
+ # Adding model 'SourceType'
+ db.create_table('ishtar_common_sourcetype', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
+ ('comment', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
+ ('available', self.gf('django.db.models.fields.BooleanField')(default=False)),
+ ))
+ db.send_create_signal('ishtar_common', ['SourceType'])
+
+ # Adding model 'Arrondissement'
+ db.create_table('ishtar_common_arrondissement', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=30)),
+ ('department', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Department'])),
+ ))
+ db.send_create_signal('ishtar_common', ['Arrondissement'])
+
+ # Adding model 'Canton'
+ db.create_table('ishtar_common_canton', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=30)),
+ ('arrondissement', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Arrondissement'])),
+ ))
+ db.send_create_signal('ishtar_common', ['Canton'])
+
+ # Adding model 'Town'
+ db.create_table('ishtar_common_town', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('surface', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
+ ('center', self.gf('django.contrib.gis.db.models.fields.PointField')(srid=27572, null=True, blank=True)),
+ ('numero_insee', self.gf('django.db.models.fields.CharField')(unique=True, max_length=6)),
+ ('departement', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Department'], null=True, blank=True)),
+ ('canton', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.Canton'], null=True, blank=True)),
+ ))
+ db.send_create_signal('ishtar_common', ['Town'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'Wizard'
+ db.delete_table('ishtar_common_wizard')
+
+ # Deleting model 'WizardStep'
+ db.delete_table('ishtar_common_wizardstep')
+
+ # Deleting model 'Department'
+ db.delete_table('ishtar_common_department')
+
+ # Deleting model 'OrganizationType'
+ db.delete_table('ishtar_common_organizationtype')
+
+ # Deleting model 'HistoricalOrganization'
+ db.delete_table('ishtar_common_historicalorganization')
+
+ # Deleting model 'Organization'
+ db.delete_table('ishtar_common_organization')
+
+ # Deleting model 'PersonType'
+ db.delete_table('ishtar_common_persontype')
+
+ # Removing M2M table for field rights on 'PersonType'
+ db.delete_table('ishtar_common_persontype_rights')
+
+ # Deleting model 'Person'
+ db.delete_table('ishtar_common_person')
+
+ # Deleting model 'IshtarUser'
+ db.delete_table('ishtar_common_ishtaruser')
+
+ # Deleting model 'AuthorType'
+ db.delete_table('ishtar_common_authortype')
+
+ # Deleting model 'Author'
+ db.delete_table('ishtar_common_author')
+
+ # Deleting model 'SourceType'
+ db.delete_table('ishtar_common_sourcetype')
+
+ # Deleting model 'Arrondissement'
+ db.delete_table('ishtar_common_arrondissement')
+
+ # Deleting model 'Canton'
+ db.delete_table('ishtar_common_canton')
+
+ # Deleting model 'Town'
+ db.delete_table('ishtar_common_town')
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'ishtar_common.arrondissement': {
+ 'Meta': {'object_name': 'Arrondissement'},
+ 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
+ },
+ 'ishtar_common.author': {
+ 'Meta': {'object_name': 'Author'},
+ 'author_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.AuthorType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']"})
+ },
+ 'ishtar_common.authortype': {
+ 'Meta': {'object_name': 'AuthorType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.canton': {
+ 'Meta': {'object_name': 'Canton'},
+ 'arrondissement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Arrondissement']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
+ },
+ 'ishtar_common.department': {
+ 'Meta': {'ordering': "['number']", 'object_name': 'Department'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
+ 'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'})
+ },
+ 'ishtar_common.historicalorganization': {
+ 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalOrganization'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'history_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'history_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'history_modifier_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'history_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
+ 'history_user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}),
+ 'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'organization_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.ishtaruser': {
+ 'Meta': {'object_name': 'IshtarUser', '_ormbases': ['auth.User']},
+ 'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']", 'unique': 'True'}),
+ 'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
+ },
+ 'ishtar_common.organization': {
+ 'Meta': {'object_name': 'Organization'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'organization_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.OrganizationType']"}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.organizationtype': {
+ 'Meta': {'object_name': 'OrganizationType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.person': {
+ 'Meta': {'object_name': 'Person'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'attached_to': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Organization']", 'null': 'True', 'blank': 'True'}),
+ 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'email': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
+ 'person_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.PersonType']"}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.persontype': {
+ 'Meta': {'object_name': 'PersonType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'rights': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.WizardStep']", 'symmetrical': 'False'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.sourcetype': {
+ 'Meta': {'object_name': 'SourceType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.town': {
+ 'Meta': {'ordering': "['numero_insee']", 'object_name': 'Town'},
+ 'canton': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Canton']", 'null': 'True', 'blank': 'True'}),
+ 'center': ('django.contrib.gis.db.models.fields.PointField', [], {'srid': '27572', 'null': 'True', 'blank': 'True'}),
+ 'departement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'numero_insee': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '6'}),
+ 'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.wizard': {
+ 'Meta': {'ordering': "['url_name']", 'object_name': 'Wizard'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'url_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
+ },
+ 'ishtar_common.wizardstep': {
+ 'Meta': {'ordering': "['wizard', 'order']", 'object_name': 'WizardStep'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {}),
+ 'url_name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'wizard': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Wizard']"})
+ }
+ }
+
+ complete_apps = ['ishtar_common'] \ No newline at end of file
diff --git a/ishtar_common/migrations/__init__.py b/ishtar_common/migrations/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ishtar_common/migrations/__init__.py
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 56c381e94..4406a2b86 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2010-2011 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# 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
@@ -30,7 +30,7 @@ from django.utils.safestring import SafeUnicode, mark_safe
from django.core.urlresolvers import reverse, NoReverseMatch
from django.db.utils import DatabaseError
from django.db.models import Q, Max, Count, Sum, Avg
-from django.db.models.signals import m2m_changed, post_save
+from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.contrib.gis.db import models
@@ -1053,13 +1053,13 @@ class Dashboard:
if vals[v] == mx:
return v
-class Departement(models.Model):
+class Department(models.Model):
label = models.CharField(_(u"Label"), max_length=30)
number = models.CharField(_(u"Number"), unique=True, max_length=3)
class Meta:
- verbose_name = _(u"Departement")
- verbose_name_plural = _(u"Departements")
+ verbose_name = _(u"Department")
+ verbose_name_plural = _(u"Departments")
ordering = ['number']
def __unicode__(self):
@@ -1213,891 +1213,10 @@ class Source(models.Model):
def __unicode__(self):
return self.title
-class FileType(GeneralType):
- class Meta:
- verbose_name = _(u"Archaeological file type")
- verbose_name_plural = _(u"Archaeological file types")
-
- @classmethod
- def is_preventive(cls, file_type_id, key=''):
- key = key or 'preventive'
- try:
- preventive = FileType.objects.get(txt_idx=key).pk
- return file_type_id == preventive
- except ObjectDoesNotExist:
- return False
-
-class PermitType(GeneralType):
- class Meta:
- verbose_name = _(u"Permit type")
- verbose_name_plural = _(u"Permit types")
-
-if settings.COUNTRY == 'fr':
- class SaisineType(GeneralType):
- delay = models.IntegerField(_(u"Delay (in days)"))
- class Meta:
- verbose_name = u"Type Saisine"
- verbose_name_plural = u"Types Saisine"
-
-class File(BaseHistorizedItem, OwnPerms):
- TABLE_COLS = ['numeric_reference', 'year', 'internal_reference',
- 'file_type', 'saisine_type', 'towns', ]
- year = models.IntegerField(_(u"Year"),
- default=lambda:datetime.datetime.now().year)
- numeric_reference = models.IntegerField(_(u"Numeric reference"))
- internal_reference = models.CharField(_(u"Internal reference"),
- max_length=60, unique=True)
- file_type = models.ForeignKey(FileType, verbose_name=_(u"File type"))
- in_charge = models.ForeignKey(Person, related_name='+',
- verbose_name=_(u"Person in charge"))
- general_contractor = models.ForeignKey(Person, related_name='+',
- verbose_name=_(u"General contractor"), blank=True, null=True)
- town_planning_service = models.ForeignKey(Organization, related_name='+',
- verbose_name=_(u"Town planning service"), blank=True, null=True)
- permit_type = models.ForeignKey(PermitType, verbose_name=_(u"Permit type"),
- blank=True, null=True)
- permit_reference = models.CharField(_(u"Permit reference"),
- max_length=60, blank=True, null=True)
- end_date = models.DateField(_(u"Closing date"), null=True, blank=True)
- towns = models.ManyToManyField("Town", verbose_name=_(u"Towns"),
- related_name='file')
- creation_date = models.DateField(_(u"Creation date"),
- default=datetime.date.today)
- reception_date = models.DateField(_(u'Reception date'), blank=True,
- null=True)
- related_file = models.ForeignKey("File", verbose_name=_(u"Related file"),
- blank=True, null=True)
- if settings.COUNTRY == 'fr':
- saisine_type = models.ForeignKey(SaisineType, blank=True, null=True,
- verbose_name= u"Type de saisine")
- reference_number = models.IntegerField(_(u"Reference number"),
- blank=True, null=True)
- total_surface = models.IntegerField(_(u"Total surface (m²)"),
- blank=True, null=True)
- total_developed_surface = models.IntegerField(
- _(u"Total developed surface (m²)"), blank=True, null=True)
- address = models.TextField(_(u"Main address"), null=True, blank=True)
- address_complement = models.TextField(_(u"Main address - complement"),
- null=True, blank=True)
- postal_code = models.CharField(_(u"Main address - postal code"),
- max_length=10, null=True, blank=True)
- comment = models.TextField(_(u"Comment"), null=True, blank=True)
- history = HistoricalRecords()
-
- class Meta:
- verbose_name = _(u"Archaeological file")
- verbose_name_plural = _(u"Archaeological files")
- permissions = (
- ("view_own_file", ugettext(u"Can view own Archaelogical file")),
- ("add_own_file", ugettext(u"Can add own Archaelogical file")),
- ("change_own_file", ugettext(u"Can change own Archaelogical file")),
- ("delete_own_file", ugettext(u"Can delete own Archaelogical file")),
- )
- ordering = ['-year', '-numeric_reference']
-
- @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()
-
- 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.numeric_reference))))
- items += [unicode(getattr(self, k))[:36]
- for k in ['internal_reference',] if getattr(self, k)]
- return JOINT.join(items)
-
- @classmethod
- def get_query_owns(cls, user):
- return 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 total_surface_ha(self):
- if self.total_surface:
- return self.total_surface/10000.0
-
- def total_developed_surface_ha(self):
- if self.total_developed_surface:
- return self.total_developed_surface/10000.0
-
- def operation_acts(self):
- acts = []
- for ope in self.operations.all():
- for act in ope.administrative_act.all():
- acts.append(act)
- return acts
-
- def is_preventive(self):
- return FileType.is_preventive(self.file_type.pk)
-
-class FileByDepartment(models.Model):
- '''
- Database view: don't forget to create it
-
- create view file_department (id, department_id, file_id) as
- select town."id", town."departement_id", file_towns."file_id"
- from ishtar_base_town town
- inner join ishtar_base_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();
- '''
- file = models.ForeignKey(File, verbose_name=_(u"File"))
- department = models.ForeignKey(Departement, verbose_name=_(u"Department"),
- blank=True, null=True)
- class Meta:
- managed = False
- db_table = 'file_department'
-
-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 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"))
- 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(Departement, 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 Parcel(LightHistorizedItem):
- associated_file = models.ForeignKey(File, related_name='parcels',
- blank=True, null=True, verbose_name=_(u"File"))
- operation = models.ForeignKey(Operation, related_name='parcels', blank=True,
- null=True, verbose_name=_(u"Operation"))
- year = models.IntegerField(_(u"Year"), blank=True, null=True)
- town = models.ForeignKey("Town", related_name='parcels',
- verbose_name=_(u"Town"))
- section = models.CharField(_(u"Section"), max_length=4)
- parcel_number = models.CharField(_(u"Parcel number"), max_length=6)
-
- class Meta:
- verbose_name = _(u"Parcel")
- verbose_name_plural = _(u"Parcels")
-
- def short_label(self):
- return JOINT.join([unicode(item) for item in [self.section,
- self.parcel_number] if item])
-
- def __unicode__(self):
- return self.short_label()
-
- def long_label(self):
- items = [unicode(self.operation or self.associated_file)]
- items += [unicode(item) for item in [self.section, self.parcel_number]
- if item]
- return JOINT.join(items)
-
-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 DatingType(GeneralType):
- class Meta:
- verbose_name = _(u"Dating type")
- verbose_name_plural = _(u"Dating types")
-
-class DatingQuality(GeneralType):
- class Meta:
- verbose_name = _(u"Dating quality")
- verbose_name_plural = _(u"Dating qualities")
-
-class Dating(models.Model):
- period = models.ForeignKey(Period, verbose_name=_(u"Period"))
- start_date = models.IntegerField(_(u"Start date"), blank=True, null=True)
- end_date = models.IntegerField(_(u"End date"), blank=True, null=True)
- dating_type = models.ForeignKey(DatingType, verbose_name=_(u"Dating type"),
- blank=True, null=True)
- quality = models.ForeignKey(DatingQuality, verbose_name=_(u"Quality"),
- blank=True, null=True)
-
- class Meta:
- verbose_name = _(u"Dating")
- verbose_name_plural = _(u"Datings")
-
- def __unicode__(self):
- start_date = self.start_date and unicode(self.start_date) or u""
- end_date = self.end_date and unicode(self.end_date) or u""
- if not start_date and not end_date:
- return unicode(self.period)
- return u"%s (%s-%s)" % (self.period, start_date, end_date)
-
-class Unit(GeneralType):
- order = models.IntegerField(_(u"Order"))
- parent = models.ForeignKey("Unit", verbose_name=_(u"Parent unit"),
- blank=True, null=True)
-
- class Meta:
- verbose_name = _(u"Type Unit")
- verbose_name_plural = _(u"Types Unit")
-
- def __unicode__(self):
- return self.label
-
-class ActivityType(GeneralType):
- order = models.IntegerField(_(u"Order"))
-
- class Meta:
- verbose_name = _(u"Type Activity")
- verbose_name_plural = _(u"Types Activity")
-
- def __unicode__(self):
- return self.label
-
-class IdentificationType(GeneralType):
- order = models.IntegerField(_(u"Order"))
- class Meta:
- verbose_name = _(u"Type Identification")
- verbose_name_plural = _(u"Types Identification")
-
- def __unicode__(self):
- return self.label
-
-class ContextRecord(BaseHistorizedItem, OwnPerms):
- TABLE_COLS = ['parcel.town', 'operation.year',
- 'operation.operation_code',
- 'label', 'unit']
- if settings.COUNTRY == 'fr':
- TABLE_COLS.insert(1, 'parcel.operation.code_patriarche')
- parcel = models.ForeignKey(Parcel, verbose_name=_(u"Parcel"),
- related_name='context_record')
- operation = models.ForeignKey(Operation, verbose_name=_(u"Operation"),
- related_name='context_record')
- label = models.CharField(_(u"ID"), max_length=200)
- description = models.TextField(_(u"Description"), blank=True, null=True)
- length = models.IntegerField(_(u"Length (cm)"), blank=True, null=True)
- width = models.IntegerField(_(u"Width (cm)"), blank=True, null=True)
- thickness = models.IntegerField(_(u"Thickness (cm)"), blank=True, null=True)
- depth = models.IntegerField(_(u"Depth (cm)"), blank=True, null=True)
- location = models.CharField(_(u"Location"), blank=True, null=True,
- max_length=200,
- help_text=_(u"A short description of the location of the context record"))
- datings = models.ManyToManyField(Dating)
- unit = models.ForeignKey(Unit, verbose_name=_(u"Unit"), related_name='+',
- blank=True, null=True)
- has_furniture = models.NullBooleanField(u"Has furniture?", blank=True,
- null=True)
- filling = models.TextField(_(u"Filling"), blank=True, null=True)
- interpretation = models.TextField(_(u"Interpretation"), blank=True,
- null=True)
- taq = models.IntegerField(_(u"TAQ"), blank=True, null=True,
- help_text=_(u"\"Terminus Ante Quem\" the context record can't have been "
- "created after this date"))
- taq_estimated = models.IntegerField(_(u"Estimated TAQ"), blank=True,
- null=True, help_text=_(u"Estimation of a \"Terminus Ante Quem\""))
- tpq = models.IntegerField(_(u"TPQ"), blank=True, null=True,
- help_text=_(u"\"Terminus Post Quem\" the context record can't have been "
- " created before this date"))
- tpq_estimated = models.IntegerField(_(u"Estimated TPQ"), blank=True,
- null=True, help_text=_(u"Estimation of a \"Terminus Post Quem\""))
- identification = models.ForeignKey(IdentificationType, blank=True,
- null=True, verbose_name=_(u"Identification"),)
- activity = models.ForeignKey(ActivityType,blank=True, null=True,
- verbose_name=_(u"Activity"),)
- history = HistoricalRecords()
-
- class Meta:
- verbose_name = _(u"Context Record")
- verbose_name_plural = _(u"Context Record")
- permissions = (
- ("view_own_contextrecord", ugettext(u"Can view own Context Record")),
- ("add_own_contextrecord", ugettext(u"Can add own Context Record")),
- ("change_own_contextrecord", ugettext(u"Can change own Context Record")),
- ("delete_own_contextrecord", ugettext(u"Can delete own Context Record")),
- )
-
- def __unicode__(self):
- return self.short_label()
-
- def short_label(self):
- return JOINT.join([unicode(item) for item in [self.parcel,
- self.label] if item])
-
- def full_label(self):
- if not self.parcel.operation:
- return unicode(self)
- return self._real_label() or self._temp_label()
-
- def _real_label(self):
- if not self.parcel.operation.code_patriarche:
- return
- return JOINT.join((self.parcel.operation.code_patriarche,
- self.label))
-
- def _temp_label(self):
- if self.parcel.operation.code_patriarche:
- return
- return JOINT.join([unicode(lbl) for lbl in [self.parcel.operation.year,
- self.parcel.operation.operation_code,
- self.label] if lbl])
-
- @classmethod
- def get_years(cls):
- years = set()
- for res in list(cls.objects.values('operation__start_date')):
- yr = res['operation__start_date'].year
- years.add(yr)
- return list(years)
-
- @classmethod
- def get_by_year(cls, year):
- return cls.objects.filter(operation__start_date__year=year)
-
- @classmethod
- def get_operations(cls):
- return [dct['operation__pk']
- for dct in cls.objects.values('operation__pk').distinct()]
-
- @classmethod
- def get_by_operation(cls, operation_id):
- return cls.objects.filter(operation__pk=operation_id)
-
- @classmethod
- def get_total_number(cls):
- return cls.objects.filter(operation__start_date__isnull=False).count()
-
-class ContextRecordSource(Source):
- class Meta:
- verbose_name = _(u"Context record documentation")
- verbose_name_plural = _(u"Context record documentations")
- context_record = models.ForeignKey(ContextRecord,
- verbose_name=_(u"Context record"), related_name="source")
-
-class MaterialType(GeneralType):
- recommendation = models.TextField(_(u"Recommendation"))
- parent = models.ForeignKey("MaterialType", blank=True, null=True,
- verbose_name=_(u"Parent material"))
-
- class Meta:
- verbose_name = _(u"Material type")
- verbose_name_plural = _(u"Material types")
-
-class BaseItem(BaseHistorizedItem, OwnPerms):
- label = models.CharField(_(u"ID"), max_length=60)
- description = models.TextField(_(u"Description"))
- context_record = models.ForeignKey(ContextRecord,
- related_name='base_items', verbose_name=_(u"Context Record"))
- is_isolated = models.NullBooleanField(_(u"Is isolated?"), blank=True,
- null=True)
- index = models.IntegerField(u"Index", default=0)
- material_index = models.IntegerField(u"Material index", default=0)
- history = HistoricalRecords()
-
- class Meta:
- verbose_name = _(u"Base item")
- verbose_name_plural = _(u"Base items")
- permissions = (
- ("view_own_baseitem", ugettext(u"Can view own Base item")),
- ("add_own_baseitem", ugettext(u"Can add own Base item")),
- ("change_own_baseitem", ugettext(u"Can change own Base item")),
- ("delete_own_baseitem", ugettext(u"Can delete own Base item")),
- )
-
- def __unicode__(self):
- return self.label
-
- def get_last_item(self):
- #TODO: manage virtuals - property(last_item) ?
- items = self.item.filter().order_by("-order").all()
- return items and items[0]
-
- def full_label(self):
- return self._real_label() or self._temp_label()
-
- def material_type_label(self):
- item = self.get_last_item()
- items = [item and unicode(item.material_type) or '']
- ope = self.context_record.operation
- items += [ope.code_patriarche or \
- (unicode(ope.year) + "-" + unicode(ope.operation_code))]
- items += [self.context_record.label, unicode(self.material_index)]
- return JOINT.join(items)
-
- def _real_label(self):
- if not self.context_record.parcel.operation.code_patriarche:
- return
- item = self.get_last_item()
- lbl = item.label or self.label
- return JOINT.join([unicode(it) for it in (
- self.context_record.parcel.operation.code_patriarche,
- self.context_record.label,
- lbl) if it])
-
- def _temp_label(self):
- if self.context_record.parcel.operation.code_patriarche:
- return
- item = self.get_last_item()
- lbl = item.label or self.label
- return JOINT.join([unicode(it) for it in (
- self.context_record.parcel.year,
- self.index,
- self.context_record.label,
- lbl) if it])
-
-class Item(BaseHistorizedItem, OwnPerms):
- TABLE_COLS = ['label', 'material_type', 'dating.period',
- 'base_items.context_record.parcel.town',
- 'base_items.context_record.parcel.operation.year',
- 'base_items.context_record.parcel.operation.operation_code',
- 'base_items.is_isolated']
- if settings.COUNTRY == 'fr':
- TABLE_COLS.insert(6,
- 'base_items.context_record.parcel.operation.code_patriarche')
- base_items = models.ManyToManyField(BaseItem, verbose_name=_(u"Base item"),
- related_name='item')
- order = models.IntegerField(_(u"Order"))
- label = models.CharField(_(u"ID"), max_length=60)
- description = models.TextField(_(u"Description"), blank=True, null=True)
- material_type = models.ForeignKey(MaterialType,
- verbose_name = _(u"Material type"))
- volume = models.FloatField(_(u"Volume (l)"), blank=True, null=True)
- weight = models.FloatField(_(u"Weight (g)"), blank=True, null=True)
- item_number = models.IntegerField(_("Item number"), blank=True, null=True)
- upstream_treatment = models.ForeignKey("Treatment", blank=True, null=True,
- related_name='downstream_treatment', verbose_name=_("Upstream treatment"))
- downstream_treatment = models.ForeignKey("Treatment", blank=True, null=True,
- related_name='upstream_treatment', verbose_name=_("Downstream treatment"))
- dating = models.ForeignKey(Dating, verbose_name=_(u"Dating"))
- container = models.ForeignKey('Container', verbose_name=_(u"Container"),
- blank=True, null=True, related_name='items')
- history = HistoricalRecords()
-
- @classmethod
- def get_years(cls):
- years = set()
- items = cls.objects.filter(downstream_treatment__isnull=True)
- for item in items:
- bi = item.base_items.all()
- if not bi:
- continue
- bi = bi[0]
- yr = bi.context_record.operation.start_date.year
- years.add(yr)
- return list(years)
-
- @classmethod
- def get_by_year(cls, year):
- return cls.objects.filter(downstream_treatment__isnull=True,
- base_items__context_record__operation__start_date__year=year)
-
- @classmethod
- def get_operations(cls):
- operations = set()
- items = cls.objects.filter(downstream_treatment__isnull=True)
- for item in items:
- bi = item.base_items.all()
- if not bi:
- continue
- bi = bi[0]
- pk = bi.context_record.operation.pk
- operations.add(pk)
- return list(operations)
-
- @classmethod
- def get_by_operation(cls, operation_id):
- return cls.objects.filter(downstream_treatment__isnull=True,
- base_items__context_record__operation__pk=operation_id)
-
- @classmethod
- def get_total_number(cls):
- return cls.objects.filter(downstream_treatment__isnull=True).count()
-
- def duplicate(self, user):
- dct = dict([(attr, getattr(self, attr)) for attr in ('order', 'label',
- 'description', 'material_type', 'volume', 'weight',
- 'item_number', 'dating')])
- dct['order'] += 1
- dct['history_modifier'] = user
- new = self.__class__(**dct)
- new.save()
- for base_item in self.base_items.all():
- new.base_items.add(base_item)
- return new
-
- class Meta:
- verbose_name = _(u"Item")
- verbose_name_plural = _(u"Items")
- permissions = (
- ("view_own_item", ugettext(u"Can view own Item")),
- ("add_own_item", ugettext(u"Can add own Item")),
- ("change_own_item", ugettext(u"Can change own Item")),
- ("delete_own_item", ugettext(u"Can delete own Item")),
- )
-
- def __unicode__(self):
- return self.label
-
- def save(self, *args, **kwargs):
- if not self.pk:
- super(Item, self).save(*args, **kwargs)
- for base_item in self.base_items.all():
- if not base_item.index:
- idx = BaseItem.objects.filter(context_record=\
- base_item.context_record).aggregate(Max('index'))
- base_item.index = idx and idx['index__max'] + 1 or 1
- if not base_item.material_index:
- idx = BaseItem.objects.filter(context_record=\
- base_item.context_record,
- item__material_type=self.material_type).aggregate(
- Max('material_index'))
- base_item.material_index = idx and \
- idx['material_index__max'] + 1 or 1
- base_item.save()
- super(Item, self).save(*args, **kwargs)
-
-class ItemSource(Source):
- class Meta:
- verbose_name = _(u"Item documentation")
- verbose_name_plural = _(u"Item documentations")
- item = models.ForeignKey(Item, verbose_name=_(u"Item"),
- related_name="source")
-
-class ParcelOwner(LightHistorizedItem):
- owner = models.ForeignKey(Person, verbose_name=_(u"Owner"))
- parcel = models.ForeignKey(Parcel, verbose_name=_(u"Parcel"))
- start_date = models.DateField(_(u"Start date"))
- end_date = models.DateField(_(u"End date"))
-
- class Meta:
- verbose_name = _(u"Parcel owner")
- verbose_name_plural = _(u"Parcel owners")
-
- def __unicode__(self):
- return self.owner + JOINT + self.parcel
-
-class WarehouseType(GeneralType):
- class Meta:
- verbose_name = _(u"Warehouse type")
- verbose_name_plural = _(u"Warehouse types")
-
-class Warehouse(Address, OwnPerms):
- name = models.CharField(_(u"Name"), max_length=40)
- warehouse_type = models.ForeignKey(WarehouseType,
- verbose_name=_(u"Warehouse type"))
- person_in_charge = models.ForeignKey(Person,
- verbose_name=_(u"Person in charge"), null=True, blank=True)
- comment = models.TextField(_(u"Comment"), null=True, blank=True)
-
- class Meta:
- verbose_name = _(u"Warehouse")
- verbose_name_plural = _(u"Warehouses")
- permissions = (
- ("view_own_warehouse", ugettext(u"Can view own Warehouse")),
- ("add_own_warehouse", ugettext(u"Can add own Warehouse")),
- ("change_own_warehouse", ugettext(u"Can change own Warehouse")),
- ("delete_own_warehouse", ugettext(u"Can delete own Warehouse")),
- )
-
- def __unicode__(self):
- return u"%s (%s)" % (self.name, unicode(self.warehouse_type))
-
-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"))
- 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])
-
-class ContainerType(GeneralType):
- length = models.IntegerField(_(u"Length (mm)"), blank=True, null=True)
- width = models.IntegerField(_(u"Width (mm)"), blank=True, null=True)
- height = models.IntegerField(_(u"Height (mm)"), blank=True, null=True)
- volume = models.IntegerField(_(u"Volume (l)"), blank=True, null=True)
- reference = models.CharField(_(u"Reference"), max_length=30)
-
- class Meta:
- verbose_name = _(u"Container type")
- verbose_name_plural = _(u"Container types")
-
-class Container(LightHistorizedItem):
- TABLE_COLS = ['reference', 'container_type', 'location',]
- location = models.ForeignKey(Warehouse, verbose_name=_(u"Warehouse"))
- container_type = models.ForeignKey(ContainerType,
- verbose_name=_("Container type"))
- reference = models.CharField(_(u"Reference"), max_length=40)
- comment = models.TextField(_(u"Comment"))
-
- class Meta:
- verbose_name = _(u"Container")
- verbose_name_plural = _(u"Containers")
-
- def __unicode__(self):
- lbl = u" - ".join((self.reference, unicode(self.container_type),
- unicode(self.location)))
- return lbl
-
if settings.COUNTRY == 'fr':
class Arrondissement(models.Model):
name = models.CharField(u"Nom", max_length=30)
- department = models.ForeignKey(Departement, verbose_name=u"Département")
+ department = models.ForeignKey(Department, verbose_name=u"Département")
def __unicode__(self):
return JOINT.join((self.name, unicode(self.department)))
@@ -2117,7 +1236,7 @@ class Town(models.Model):
if settings.COUNTRY == 'fr':
numero_insee = models.CharField(u"Numéro INSEE", max_length=6,
unique=True)
- departement = models.ForeignKey(Departement, verbose_name=u"Département",
+ departement = models.ForeignKey(Department, verbose_name=u"Département",
null=True, blank=True)
canton = models.ForeignKey(Canton, verbose_name=u"Canton", null=True,
blank=True)
@@ -2134,61 +1253,4 @@ class Town(models.Model):
return u"%s (%s)" % (self.name, self.numero_insee)
return self.name
-class TreatmentType(GeneralType):
- virtual = models.BooleanField(_(u"Virtual"))
- class Meta:
- verbose_name = _(u"Treatment type")
- verbose_name_plural = _(u"Treatment types")
-
-class Treatment(BaseHistorizedItem, OwnPerms):
- container = models.ForeignKey(Container, verbose_name=_(u"Container"),
- blank=True, null=True)
- description = models.TextField(_(u"Description"), blank=True, null=True)
- treatment_type = models.ForeignKey(TreatmentType,
- verbose_name=_(u"Treatment type"))
- location = models.ForeignKey(Warehouse, verbose_name=_(u"Location"),
- blank=True, null=True)
- person = models.ForeignKey(Person, verbose_name=_(u"Person"),
- blank=True, null=True)
- start_date = models.DateField(_(u"Start date"), blank=True, null=True)
- end_date = models.DateField(_(u"End date"), blank=True, null=True)
- history = HistoricalRecords()
-
- class Meta:
- verbose_name = _(u"Treatment")
- verbose_name_plural = _(u"Treatments")
- permissions = (
- ("view_own_treatment", ugettext(u"Can view own Treatment")),
- ("add_own_treatment", ugettext(u"Can add own Treatment")),
- ("change_own_treatment", ugettext(u"Can change own Treatment")),
- ("delete_own_treatment", ugettext(u"Can delete own Treatment")),
- )
-
- def __unicode__(self):
- lbl = unicode(self.treatment_type)
- if self.person:
- lbl += u" %s %s" % (_(u"by"), unicode(self.person))
- return lbl
-
-class TreatmentSource(Source):
- class Meta:
- verbose_name = _(u"Treatment documentation")
- verbose_name_plural = _(u"Treament documentations")
- treatment = models.ForeignKey(Treatment, verbose_name=_(u"Treatment"),
- related_name="source")
-
-class Property(LightHistorizedItem):
- item = models.ForeignKey(Item, verbose_name=_(u"Item"))
- administrative_act = models.ForeignKey(AdministrativeAct,
- verbose_name=_(u"Administrative act"))
- person = models.ForeignKey(Person, verbose_name=_(u"Person"))
- start_date = models.DateField(_(u"Start date"))
- end_date = models.DateField(_(u"End date"))
-
- class Meta:
- verbose_name = _(u"Property")
- verbose_name_plural = _(u"Properties")
-
- def __unicode__(self):
- return self.person + JOINT + self.item