diff options
6 files changed, 423 insertions, 29 deletions
| diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py index 128fd2ebc..86f21f263 100644 --- a/archaeological_files/forms.py +++ b/archaeological_files/forms.py @@ -225,7 +225,7 @@ class FileFormGeneral(forms.Form):          validators=[valid_id(models.File)])      comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea,                                required=False) -    total_surface = forms.IntegerField( +    total_surface = forms.FloatField(          required=False, widget=widgets.AreaWidget,          label=_(u"Total surface (m2)"),          validators=[validators.MinValueValidator(0), @@ -309,7 +309,7 @@ class FileFormPreventive(forms.Form):      permit_reference = forms.CharField(          label=_(u"Permit reference"), required=False,          validators=[validators.MaxLengthValidator(60)]) -    total_developed_surface = forms.IntegerField( +    total_developed_surface = forms.FloatField(          widget=widgets.AreaWidget, label=_(u"Total developed surface (m2)"),          required=False, validators=[validators.MinValueValidator(0),                                      validators.MaxValueValidator(999999999)]) diff --git a/archaeological_files/migrations/0032_auto__chg_field_file_total_surface__chg_field_file_total_developed_sur.py b/archaeological_files/migrations/0032_auto__chg_field_file_total_surface__chg_field_file_total_developed_sur.py new file mode 100644 index 000000000..b2f841b09 --- /dev/null +++ b/archaeological_files/migrations/0032_auto__chg_field_file_total_surface__chg_field_file_total_developed_sur.py @@ -0,0 +1,373 @@ +# -*- 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): + +        # Changing field 'File.total_surface' +        db.alter_column('archaeological_files_file', 'total_surface', self.gf('django.db.models.fields.FloatField')(null=True)) + +        # Changing field 'File.total_developed_surface' +        db.alter_column('archaeological_files_file', 'total_developed_surface', self.gf('django.db.models.fields.FloatField')(null=True)) + +        # Changing field 'HistoricalFile.total_surface' +        db.alter_column('archaeological_files_historicalfile', 'total_surface', self.gf('django.db.models.fields.FloatField')(null=True)) + +        # Changing field 'HistoricalFile.total_developed_surface' +        db.alter_column('archaeological_files_historicalfile', 'total_developed_surface', self.gf('django.db.models.fields.FloatField')(null=True)) + +    def backwards(self, orm): + +        # Changing field 'File.total_surface' +        db.alter_column('archaeological_files_file', 'total_surface', self.gf('django.db.models.fields.IntegerField')(null=True)) + +        # Changing field 'File.total_developed_surface' +        db.alter_column('archaeological_files_file', 'total_developed_surface', self.gf('django.db.models.fields.IntegerField')(null=True)) + +        # Changing field 'HistoricalFile.total_surface' +        db.alter_column('archaeological_files_historicalfile', 'total_surface', self.gf('django.db.models.fields.IntegerField')(null=True)) + +        # Changing field 'HistoricalFile.total_developed_surface' +        db.alter_column('archaeological_files_historicalfile', 'total_developed_surface', self.gf('django.db.models.fields.IntegerField')(null=True)) + +    models = { +        'archaeological_files.file': { +            'Meta': {'ordering': "('cached_label',)", 'object_name': 'File'}, +            'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'cached_label': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'cira_advised': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'classified_area': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'corporation_general_contractor': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'general_contractor_files'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), +            'creation_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today', 'null': 'True', 'blank': 'True'}), +            'departments': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}), +            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'external_id': ('django.db.models.fields.CharField', [], {'max_length': '120', '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': "'general_contractor_files'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), +            'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'imported_line': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_archaeological_files_file'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), +            'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'file_responsability'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), +            'instruction_deadline': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}), +            'locality': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), +            'main_town': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'file_main'", 'null': 'True', 'to': "orm['ishtar_common.Town']"}), +            'mh_listing': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'mh_register': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'name': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'numeric_reference': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'organization': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'files'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), +            'permit_reference': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'permit_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.PermitType']", 'null': 'True', 'blank': 'True'}), +            'planning_service': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'planning_service_files'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), +            'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), +            'protected_area': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'raw_general_contractor': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), +            'raw_town_planning_service': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), +            'reception_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'related_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.File']", 'null': 'True', 'blank': 'True'}), +            'requested_operation_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.OperationType']"}), +            'research_comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'responsible_town_planning_service': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'responsible_town_planning_service_files'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), +            'saisine_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.SaisineType']", 'null': 'True', 'blank': 'True'}), +            'scientist': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'scientist'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), +            'total_developed_surface': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), +            'total_surface': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), +            'towns': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'file'", 'symmetrical': 'False', 'to': "orm['ishtar_common.Town']"}), +            'year': ('django.db.models.fields.IntegerField', [], {'default': '2016'}) +        }, +        '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': {'ordering': "('label',)", 'object_name': 'FileType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) +        }, +        'archaeological_files.historicalfile': { +            'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalFile'}, +            'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'cached_label': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'cira_advised': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'classified_area': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'corporation_general_contractor_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'creation_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today', 'null': 'True', 'blank': 'True'}), +            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'external_id': ('django.db.models.fields.CharField', [], {'max_length': '120', '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_creator_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'history_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), +            'history_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'history_modifier_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'history_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), +            'history_user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), +            'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}), +            'imported_line': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'in_charge_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'instruction_deadline': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}), +            'locality': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), +            'main_town_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'mh_listing': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'mh_register': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'name': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'numeric_reference': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'organization_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'permit_reference': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'permit_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'planning_service_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'}), +            'protected_area': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'raw_general_contractor': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), +            'raw_town_planning_service': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), +            'reception_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'related_file_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'requested_operation_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'research_comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'responsible_town_planning_service_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'}), +            'scientist_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'total_developed_surface': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), +            'total_surface': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), +            'year': ('django.db.models.fields.IntegerField', [], {'default': '2016'}) +        }, +        'archaeological_files.permittype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'PermitType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) +        }, +        'archaeological_files.saisinetype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'SaisineType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'delay': ('django.db.models.fields.IntegerField', [], {'default': '30'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) +        }, +        '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'}), +            'state': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.State']", 'null': 'True', 'blank': 'True'}) +        }, +        'ishtar_common.import': { +            'Meta': {'object_name': 'Import'}, +            'conservative_import': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), +            'encoding': ('django.db.models.fields.CharField', [], {'default': "'utf-8'", 'max_length': '15'}), +            'end_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), +            'error_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'imported_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), +            'imported_images': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), +            'importer_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.ImporterType']"}), +            'match_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), +            'result_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), +            'seconds_remaining': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'skip_lines': ('django.db.models.fields.IntegerField', [], {'default': '1'}), +            'state': ('django.db.models.fields.CharField', [], {'default': "'C'", 'max_length': '2'}), +            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.IshtarUser']"}) +        }, +        'ishtar_common.importertype': { +            'Meta': {'object_name': 'ImporterType'}, +            'associated_models': ('django.db.models.fields.CharField', [], {'max_length': '200'}), +            'description': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'is_template': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), +            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '100', 'unique': 'True', 'null': 'True', 'blank': 'True'}), +            'unicity_keys': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), +            'users': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['ishtar_common.IshtarUser']", 'null': 'True', 'blank': 'True'}) +        }, +        'ishtar_common.ishtaruser': { +            'Meta': {'object_name': 'IshtarUser', '_ormbases': ['auth.User']}, +            'person': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ishtaruser'", 'unique': 'True', 'to': "orm['ishtar_common.Person']"}), +            'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}) +        }, +        'ishtar_common.operationtype': { +            'Meta': {'ordering': "['-preventive', 'order', 'label']", 'object_name': 'OperationType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), +            'preventive': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), +            'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) +        }, +        'ishtar_common.organization': { +            'Meta': {'object_name': 'Organization'}, +            'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'alt_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'alt_address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'alt_address_is_prefered': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            'alt_country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), +            'alt_postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), +            'alt_town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}), +            'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), +            'email': ('django.db.models.fields.EmailField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), +            'exclude_from_merge': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}), +            'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_ishtar_common_organization'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), +            'merge_candidate': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_candidate_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}), +            'merge_exclusion': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_exclusion_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}), +            'merge_key': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), +            'name': ('django.db.models.fields.CharField', [], {'max_length': '500'}), +            'organization_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.OrganizationType']"}), +            'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), +            'phone2': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), +            'phone3': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), +            'phone_desc': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), +            'phone_desc2': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), +            'phone_desc3': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), +            'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), +            'raw_phone': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}) +        }, +        'ishtar_common.organizationtype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'OrganizationType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) +        }, +        'ishtar_common.person': { +            'Meta': {'object_name': 'Person'}, +            'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'alt_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'alt_address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'alt_address_is_prefered': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            'alt_country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), +            'alt_postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), +            'alt_town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}), +            'attached_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'members'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'contact_type': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), +            'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), +            'email': ('django.db.models.fields.EmailField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), +            'exclude_from_merge': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}), +            'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_ishtar_common_person'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), +            'merge_candidate': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_candidate_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'merge_exclusion': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_exclusion_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'merge_key': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), +            'name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), +            'person_types': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.PersonType']", 'symmetrical': 'False'}), +            'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), +            'phone2': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), +            'phone3': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), +            'phone_desc': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), +            'phone_desc2': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), +            'phone_desc3': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), +            'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), +            'raw_name': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), +            'raw_phone': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'surname': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), +            'title': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), +            'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}) +        }, +        'ishtar_common.persontype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'PersonType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.Group']", 'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) +        }, +        'ishtar_common.state': { +            'Meta': {'ordering': "['number']", 'object_name': 'State'}, +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}), +            'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'}) +        }, +        'ishtar_common.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'}) +        } +    } + +    complete_apps = ['archaeological_files']
\ No newline at end of file diff --git a/archaeological_files/models.py b/archaeological_files/models.py index aafa7d986..9709824df 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -135,9 +135,9 @@ class File(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,              verbose_name=u"Type de saisine")          instruction_deadline = models.DateField(_(u'Instruction deadline'),                                                  blank=True, null=True) -    total_surface = models.IntegerField(_(u"Total surface (m2)"), -                                        blank=True, null=True) -    total_developed_surface = models.IntegerField( +    total_surface = models.FloatField(_(u"Total surface (m2)"), +                                      blank=True, null=True) +    total_developed_surface = models.FloatField(          _(u"Total developed surface (m2)"), blank=True, null=True)      locality = models.CharField(_(u"Locality"),                                  max_length=100, null=True, blank=True) diff --git a/archaeological_files_pdl/forms.py b/archaeological_files_pdl/forms.py index 928fc1e70..a182d0f0e 100644 --- a/archaeological_files_pdl/forms.py +++ b/archaeological_files_pdl/forms.py @@ -99,13 +99,13 @@ class FileFormPlanning(forms.Form):          required=False)      postal_code = forms.CharField(label=_(u"Postal code"), max_length=10,                                    required=False) -    total_surface = forms.IntegerField( +    total_surface = forms.FloatField(          required=False,          widget=widgets.AreaWidget,          label=_(u"Total surface (m2)"),          validators=[validators.MinValueValidator(0),                      validators.MaxValueValidator(999999999)]) -    total_developed_surface = forms.IntegerField( +    total_developed_surface = forms.FloatField(          widget=widgets.AreaWidget,          label=_(u"Total developed surface (m2)"),          required=False, diff --git a/archaeological_files_pdl/templates/ishtar/wizard/wizard_preventiveplanning.html b/archaeological_files_pdl/templates/ishtar/wizard/wizard_preventiveplanning.html index 1be5b1b36..304b58b76 100644 --- a/archaeological_files_pdl/templates/ishtar/wizard/wizard_preventiveplanning.html +++ b/archaeological_files_pdl/templates/ishtar/wizard/wizard_preventiveplanning.html @@ -8,6 +8,10 @@  <table> +{% if wizard.form.name.errors %}<tr> +  <td colspan="2">{{wizard.form.name.errors}}</td> +</tr>{% endif %} +  <tr class='required'>    <th><label for="id_preventiveplanning-{{CURRENT_ACTION}}-name">Nom de l'aménagement</label></th>  </tr> @@ -23,7 +27,6 @@  {% if wizard.form.main_town.errors %}<tr>    <td colspan="2">{{wizard.form.main_town.errors}}</td>  </tr>{% endif %} -  <tr>    <th colspan='2'><label for="id_preventiveplanning-{{CURRENT_ACTION}}-towns">{% trans "Towns" %}</label></th>  </tr> @@ -31,6 +34,9 @@    <td>{{wizard.form.town|safe}}</td>  </tr> +{% if wizard.form.department.errors %}<tr> +  <td colspan="2">{{wizard.form.department.errors}}</td> +</tr>{% endif %}  <tr>    <th colspan='2'><label for="id_preventiveplanning-{{CURRENT_ACTION}}-department">{% trans "Departments" %}</label></th>  </tr> @@ -38,6 +44,9 @@    <td>{{wizard.form.department|safe}}</td>  </tr> +{% if wizard.form.locality.errors %}<tr> +  <td colspan="2">{{wizard.form.locality.errors}}</td> +</tr>{% endif %}  <tr>    <th colspan='2'><label for="id_preventiveplanning-{{CURRENT_ACTION}}-locality">Lieu-dit</label></th>  </tr> @@ -45,6 +54,9 @@    <td colspan='2'>{{wizard.form.locality|safe}}</td>  </tr> +{% if wizard.form.address.errors %}<tr> +  <td colspan="2">{{wizard.form.address.errors}}</td> +</tr>{% endif %}  <tr>    <th colspan='2'><label for="id_preventiveplanning-{{CURRENT_ACTION}}-address">Adresse</label></th>  </tr> @@ -52,6 +64,9 @@    <td colspan='2'>{{wizard.form.address|safe}}</td>  </tr> +{% if wizard.form.postal_code.errors %}<tr> +  <td colspan="2">{{wizard.form.postal_code.errors}}</td> +</tr>{% endif %}  <tr>    <th colspan='2'><label for="id_preventiveplanning-{{CURRENT_ACTION}}-postal_code">Code postal</label></th>  </tr> @@ -64,6 +79,9 @@  <h4>Surfaces</h4>  <table> +{% if wizard.form.total_surface.errors %}<tr> +  <td colspan="2">{{wizard.form.total_surface.errors}}</td> +</tr>{% endif %}  <tr>    <th><label for="id_preventiveplanning-{{CURRENT_ACTION}}-total_surface">Surface totale des terrains</label></th>  </tr> @@ -71,6 +89,9 @@    <td>{{wizard.form.total_surface|safe}}</td>  </tr> +{% if wizard.form.total_developed_surface.errors %}<tr> +  <td colspan="2">{{wizard.form.total_developed_surface.errors}}</td> +</tr>{% endif %}  <tr>    <th><label for="id_preventiveplanning-{{CURRENT_ACTION}}-total_developed_surface">Surface totale aménagée</label></th>  </tr> diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 49abe606f..8bb0dc00b 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -91,6 +91,25 @@ def check_rights_condition(rights):      return func +def _check_right(step, condition=True): +    '''Return a method to check the right for a specific step''' +    def check_right(self): +        cond = condition +        # TODO: cond.__name__ != 'check_right' prevent unexplicated +        # infinite loop... to be fixed +        if callable(cond) and cond.__name__ != 'check_right': +            cond = cond(self) +        if not cond: +            return False +        return True +        # TODO: to be check +        if not hasattr(self.request.user, 'ishtaruser'): +            return False +        return self.request.user.ishtaruser.has_right( +            ('administrator', step), session=self.request.session) +    return check_right + +  class Wizard(NamedUrlWizardView):      model = None      label = '' @@ -105,31 +124,12 @@ class Wizard(NamedUrlWizardView):      filter_owns = {}      current_obj_slug = '' -    @staticmethod -    def _check_right(step, condition=True): -        '''Return a method to check the right for a specific step''' -        def check_right(self): -            cond = condition -            if callable(condition): -                cond = condition(self) -            if not cond: -                return False -            return True -            # TODO: to be check -            if not hasattr(self.request.user, 'ishtaruser'): -                return False -            return self.request.user.ishtaruser.has_right( -                ('administrator', step), session=self.request.session) -        return check_right -      def __init__(self, *args, **kwargs):          """Check right for each step of the wizard"""          super(Wizard, self).__init__(*args, **kwargs)          for form_key in self.form_list.keys()[:-1]: -            condition = True -            if form_key in self.condition_dict: -                condition = self.condition_dict.get(form_key, True) -            cond = self._check_right(form_key, condition) +            condition = self.condition_dict.get(form_key, True) +            cond = _check_right(form_key, condition)              self.condition_dict[form_key] = cond      def dispatch(self, request, *args, **kwargs): | 
