From edc75df3f8cb64ebd36c377898700a70a9753239 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 29 Mar 2015 20:44:17 +0200 Subject: Update french translation --- chimere/locale/fr/LC_MESSAGES/django.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/locale/fr/LC_MESSAGES/django.po b/chimere/locale/fr/LC_MESSAGES/django.po index 4634b0a..aca5f0b 100644 --- a/chimere/locale/fr/LC_MESSAGES/django.po +++ b/chimere/locale/fr/LC_MESSAGES/django.po @@ -303,7 +303,7 @@ msgstr "Zones associées" #: models.py:115 models.py:116 templates/chimere/blocks/news.html:3 #: templates/chimere/blocks/news.html:5 msgid "News" -msgstr "Nouvelle" +msgstr "Actualités" #: models.py:125 msgid "Parameters" -- cgit v1.2.3 From 363432eaa8a95d98f715114600ab2ec2a86629e9 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 16 Apr 2015 18:47:57 +0200 Subject: Add search keywords to subcategories --- .../0010_auto__add_field_subcategory_keywords.py | 291 +++++++++++++++++++++ 1 file changed, 291 insertions(+) create mode 100644 chimere/migrations/0010_auto__add_field_subcategory_keywords.py diff --git a/chimere/migrations/0010_auto__add_field_subcategory_keywords.py b/chimere/migrations/0010_auto__add_field_subcategory_keywords.py new file mode 100644 index 0000000..3a05ac7 --- /dev/null +++ b/chimere/migrations/0010_auto__add_field_subcategory_keywords.py @@ -0,0 +1,291 @@ +# -*- 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 field 'SubCategory.keywords' + db.add_column('chimere_subcategory', 'keywords', + self.gf('django.db.models.fields.TextField')(max_length=200, null=True, blank=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'SubCategory.keywords' + db.delete_column('chimere_subcategory', 'keywords') + + + models = { + 'chimere.aggregatedroute': { + 'Meta': {'object_name': 'AggregatedRoute', 'db_table': "'chimere_aggregated_routes'", 'managed': 'False'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'route': ('django.contrib.gis.db.models.fields.MultiLineStringField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'subcategory': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.SubCategory']"}) + }, + 'chimere.area': { + 'Meta': {'ordering': "('order', 'name')", 'object_name': 'Area'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'default_subcategories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False', 'blank': 'True'}), + 'dynamic_categories': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'external_css': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layers': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'through': "orm['chimere.AreaLayers']", 'to': "orm['chimere.Layer']"}), + 'lower_right_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'unique': 'True'}), + 'restrict_to_extent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'db_table': "'chimere_subcategory_areas'", 'to': "orm['chimere.SubCategory']"}), + 'upper_left_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'urn': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'blank': 'True'}), + 'welcome_message': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.arealayers': { + 'Meta': {'ordering': "('order',)", 'object_name': 'AreaLayers'}, + 'area': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Area']"}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Layer']"}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.category': { + 'Meta': {'ordering': "['order']", 'object_name': 'Category'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.color': { + 'Meta': {'ordering': "['order']", 'object_name': 'Color'}, + 'code': ('django.db.models.fields.CharField', [], {'max_length': '6'}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.colortheme': { + 'Meta': {'object_name': 'ColorTheme'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.icon': { + 'Meta': {'object_name': 'Icon'}, + 'height': ('django.db.models.fields.IntegerField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'width': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.importer': { + 'Meta': {'object_name': 'Importer'}, + 'associate_marker_to_way': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'automatic_update': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.SubCategory']", 'null': 'True', 'blank': 'True'}), + 'default_description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'default_localisation': ('chimere.widgets.PointField', [], {'null': 'True', 'blank': 'True'}), + 'default_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'filtr': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'get_description': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'importer_type': ('django.db.models.fields.CharField', [], {'max_length': '4'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'overwrite': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'source_file_alt': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'srid': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'zipped': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'chimere.importerkeycategories': { + 'Meta': {'object_name': 'ImporterKeyCategories'}, + 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.SubCategory']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'importer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'key_categories'", 'to': "orm['chimere.Importer']"}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'chimere.layer': { + 'Meta': {'object_name': 'Layer'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer_code': ('django.db.models.fields.TextField', [], {'max_length': '300'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.marker': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Marker'}, + 'available_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'is_front_page': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'keywords': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'point': ('chimere.widgets.PointField', [], {}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_marker'", 'null': 'True', 'to': "orm['chimere.Marker']"}), + 'route': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'associated_marker'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.multimediaextension': { + 'Meta': {'object_name': 'MultimediaExtension'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'extensions'", 'to': "orm['chimere.MultimediaType']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '6'}) + }, + 'chimere.multimediafile': { + 'Meta': {'object_name': 'MultimediaFile'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'multimedia_files'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.MultimediaType']", 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}) + }, + 'chimere.multimediatype': { + 'Meta': {'object_name': 'MultimediaType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'iframe': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'media_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'mime_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.news': { + 'Meta': {'object_name': 'News'}, + 'areas': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.Area']", 'null': 'True', 'blank': 'True'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'date': ('django.db.models.fields.DateField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_front_page': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.page': { + 'Meta': {'object_name': 'Page'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'content': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mnemonic': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '10', 'null': 'True', 'blank': 'True'}), + 'template_path': ('django.db.models.fields.CharField', [], {'max_length': '150', 'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.picturefile': { + 'Meta': {'object_name': 'PictureFile'}, + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pictures'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'thumbnailfile': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'thumbnailfile_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'thumbnailfile_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.property': { + 'Meta': {'object_name': 'Property'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Marker']"}), + 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.PropertyModel']"}), + 'value': ('django.db.models.fields.TextField', [], {}) + }, + 'chimere.propertymodel': { + 'Meta': {'ordering': "('order',)", 'object_name': 'PropertyModel'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mandatory': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'properties'", 'blank': 'True', 'to': "orm['chimere.SubCategory']"}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '1'}) + }, + 'chimere.propertymodelchoice': { + 'Meta': {'object_name': 'PropertyModelChoice'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'choices'", 'to': "orm['chimere.PropertyModel']"}), + 'value': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.route': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Route'}, + 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.RouteFile']", 'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'has_associated_marker': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'keywords': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_route'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'route': ('chimere.widgets.RouteField', [], {}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.routefile': { + 'Meta': {'ordering': "('name',)", 'object_name': 'RouteFile'}, + 'file_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'raw_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'simplified_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.subcategory': { + 'Meta': {'ordering': "['category', 'order']", 'object_name': 'SubCategory'}, + 'as_layer': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subcategories'", 'to': "orm['chimere.Category']"}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']", 'null': 'True', 'blank': 'True'}), + 'dated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'hover_icon': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'subcat_hovered'", 'null': 'True', 'to': "orm['chimere.Icon']"}), + 'icon': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Icon']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'item_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'keywords': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1000'}), + 'routing_warn': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'submission': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + }, + 'chimere.tinyurl': { + 'Meta': {'object_name': 'TinyUrl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'parameters': ('django.db.models.fields.CharField', [], {'max_length': '500'}) + } + } + + complete_apps = ['chimere'] \ No newline at end of file -- cgit v1.2.3 From f4a3253ff50546dc210c67e0ecbb24e78cffb183 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 16 Apr 2015 18:49:52 +0200 Subject: Add search keywords to subcategories (missing files...) --- chimere/models.py | 2 ++ chimere/templates/search/indexes/chimere/marker_text.txt | 2 ++ chimere/templates/search/indexes/chimere/route_text.txt | 2 ++ 3 files changed, 6 insertions(+) diff --git a/chimere/models.py b/chimere/models.py index 77fdaf2..fcc01a1 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -229,6 +229,8 @@ class SubCategory(models.Model): default=False) routing_warn = models.BooleanField(_(u"Routing warn"), default=False) order = models.IntegerField(_(u"Order"), default=1000) + keywords = models.TextField(_(u"Keywords"), max_length=200, + blank=True, null=True) def __unicode__(self): return u"%s / %s" % (self.category.name, self.name) class Meta: diff --git a/chimere/templates/search/indexes/chimere/marker_text.txt b/chimere/templates/search/indexes/chimere/marker_text.txt index 7c7929d..d089654 100644 --- a/chimere/templates/search/indexes/chimere/marker_text.txt +++ b/chimere/templates/search/indexes/chimere/marker_text.txt @@ -2,3 +2,5 @@ {{object.name}} {{object.description|safe|striptags|unescape}} {{object.keywords}} +{% for category in object.categories.all %}{{category.keywords}} +{% endfor %} diff --git a/chimere/templates/search/indexes/chimere/route_text.txt b/chimere/templates/search/indexes/chimere/route_text.txt index 5e612cd..d67c88b 100644 --- a/chimere/templates/search/indexes/chimere/route_text.txt +++ b/chimere/templates/search/indexes/chimere/route_text.txt @@ -1,2 +1,4 @@ {{object.name}} {{object.keywords}} +{% for category in object.categories.all %}{{category.keywords}} +{% endfor %} -- cgit v1.2.3 From 8b9008a94a3b3b626bbe916d6f461189938dab3c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 16 Apr 2015 19:47:42 +0200 Subject: Allow disabling of autocomplete --- chimere/settings.sample.py | 2 ++ chimere/static/chimere/css/styles.css | 1 + chimere/templates/search/search.html | 3 ++- chimere/views.py | 8 ++++++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/chimere/settings.sample.py b/chimere/settings.sample.py index 1ddef5f..adb76fe 100644 --- a/chimere/settings.sample.py +++ b/chimere/settings.sample.py @@ -126,6 +126,8 @@ HAYSTACK_CONNECTIONS = { 'URL': 'http://127.0.0.1:8080/solr' }, } +HAYSTACK_SEARCH_RESULTS_PER_PAGE = 12 +HAYSTACK_AUTOCOMPLETE = False CHIMERE_CSV_ENCODING = 'ISO-8859-1' diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css index fd39b79..73b702f 100644 --- a/chimere/static/chimere/css/styles.css +++ b/chimere/static/chimere/css/styles.css @@ -803,6 +803,7 @@ table.inline-table td input[type=file]{ list-style-type:none; margin:0; padding:4px; + padding-bottom: 70px; } #search-listing ul li{ diff --git a/chimere/templates/search/search.html b/chimere/templates/search/search.html index 95d3937..b78cc1d 100644 --- a/chimere/templates/search/search.html +++ b/chimere/templates/search/search.html @@ -42,10 +42,11 @@ $(function(){ $("#main-map").chimere("razMap"); haystack_search(evt); }); + {% if autocomplete %} window.autocomplete = new Autocomplete({ form_selector: '.autocomplete-me' }); - window.autocomplete.setup(); + window.autocomplete.setup();{% endif %} }); {% endif %} diff --git a/chimere/views.py b/chimere/views.py index 8b5af5a..0dd5cd5 100644 --- a/chimere/views.py +++ b/chimere/views.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2008-2014 Étienne Loks +# Copyright (C) 2008-2015 Étienne Loks # # RSS : Copyright (C) 2010 Pierre Clarenc , # Samuel Renard , @@ -967,7 +967,11 @@ if hasattr(settings, 'CHIMERE_SEARCH_ENGINE') \ from haystack.views import SearchView as HaystackSearchView from haystack.query import SearchQuerySet class SearchView(HaystackSearchView): - pass + def extra_context(self, *args, **kwargs): + context = super(SearchView, self).extra_context(*args, **kwargs) + context["autocomplete"] = settings.HAYSTACK_AUTOCOMPLETE \ + if hasattr(settings, 'HAYSTACK_AUTOCOMPLETE') else False + return context def autocomplete(request): sqs = SearchQuerySet().autocomplete( content_auto=request.GET.get('q', ''))[:5] -- cgit v1.2.3 From 908744a6f3d5ac40a48f0a52c5167e131785b2cc Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 16 Apr 2015 20:33:02 +0200 Subject: Allow custom fx for "show_dialog" --- chimere/static/chimere/js/jquery.chimere.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index d85490f..4303e14 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -82,6 +82,7 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { // Provide this function for overriding the getSubcategories default get_subcategories_fx: null, hide_popup_fx: null, + open_dialog_fx: null, // if leave to false every click on the map hide the pop-up explicit_popup_hide: false, controls:null, @@ -1409,16 +1410,23 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { helpers.zoom_to_area(options["area"]); } }, + open_dialog: function(title, content){ + if(settings.open_dialog_fx){ + settings.open_dialog_fx(title, content); + } else { + $("#category_description").html(content).dialog(); + $("#category_description").dialog("option", "title", title); + $('#category_description').dialog('open'); + } + }, category_detail: function (category_id) { /* show the detail of a category */ var uri = extra_url + "getDescriptionDetail/" + category_id; $.ajax({url:uri, - success: function (data) { - $("#category_description").html(data).dialog(); - $("#category_description").dialog( "option", "title", - $("#category_title").html()); - } - }); + success: function (data) { + methods.open_dialog($("#category_title").html(), data); + } + }); }, /* * Load the subcategory description if available @@ -1430,10 +1438,7 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { dataType: "json", success: function (data) { if (!data.description){return} - $('#category_description').html(data.description); - $("#category_description").dialog("option", "title", - data.name); - $('#category_description').dialog('open'); + methods.open_dialog(data.name, data.description); }, error: function (data) { // fail silently -- cgit v1.2.3 From 5953bfdb54bd36f716d7b36681aae2648e3c1028 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 19 Apr 2015 22:52:43 +0200 Subject: Add a directory with all available markers --- chimere/actions.py | 13 +- chimere/models.py | 9 +- chimere/settings.sample.py | 2 + chimere/static/chimere/css/styles.css | 14 ++ chimere/templates/chimere/category_directory.html | 35 +++++ .../chimere/category_directory_detail.html | 25 ++++ .../templates/chimere/category_item_detail.html | 38 +++++ chimere/urls.py | 7 +- chimere/views.py | 154 +++++++++++++++++---- 9 files changed, 266 insertions(+), 31 deletions(-) create mode 100644 chimere/templates/chimere/category_directory.html create mode 100644 chimere/templates/chimere/category_directory_detail.html create mode 100644 chimere/templates/chimere/category_item_detail.html diff --git a/chimere/actions.py b/chimere/actions.py index 8ef5338..5ed3070 100644 --- a/chimere/actions.py +++ b/chimere/actions.py @@ -22,7 +22,7 @@ Actions available in the main interface """ from django.conf import settings from django.contrib.auth import models -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse, NoReverseMatch from django.utils.translation import ugettext_lazy as _ from models import Page @@ -33,7 +33,12 @@ class Action: self.extra_url_args, self.url = extra_url_args, None def update_url(self, area_name): - self.url = reverse(self.path, + try: + self.url = reverse(self.path, + args=[area_name if area_name else ''] + self.extra_url_args) + except NoReverseMatch: + # backward url management + self.url = reverse(self.path, args=[area_name + '/' if area_name else ''] + self.extra_url_args) default_actions = [(Action('view', 'chimere:index', _('View')), []), @@ -42,6 +47,10 @@ default_actions = [(Action('view', 'chimere:index', _('View')), []), Action('edit-route', 'chimere:editroute', _('Add a new route'))), ),] +if settings.CHIMERE_DIRECTORY: + default_actions.append((Action('categories', 'chimere:category-directory', + _('Directory')), [])) + if settings.CHIMERE_FEEDS: default_actions.append((Action('rss', 'chimere:feeds-form', _('RSS feeds')), [])) diff --git a/chimere/models.py b/chimere/models.py index fcc01a1..2469493 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -301,6 +301,14 @@ class SubCategory(models.Model): json_string = json.dumps(self.getJSONDict()) return json_string + @property + def slug(self): + return defaultfilters.slugify(self.name) + + @property + def item_nb(self): + return Marker.objects.filter(categories=self).count() + IMPORTERS = {'KML':KMLManager, 'OSM':OSMManager, 'SHP':ShapefileManager, @@ -702,7 +710,6 @@ class Marker(GeographicItem): url = reverse('chimere:tiny', args=[area_name, urn]) return url - PRE_ATTRS = { 'Marker':('name', 'geometry', 'import_version', 'modified_since_import'), 'Route':('name', 'geometry', 'import_version', 'modified_since_import'), diff --git a/chimere/settings.sample.py b/chimere/settings.sample.py index adb76fe..f6cc0b3 100644 --- a/chimere/settings.sample.py +++ b/chimere/settings.sample.py @@ -58,6 +58,8 @@ CHIMERE_DAYS_BEFORE_EVENT = 30 CHIMERE_ALL_DATED_ARE_FRONT = False # allow feeds CHIMERE_FEEDS = True +# display a directory of items +CHIMERE_DIRECTORY = False CHIMERE_ICON_WIDTH = 21 CHIMERE_ICON_HEIGHT = 25 diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css index 73b702f..9ae66ed 100644 --- a/chimere/static/chimere/css/styles.css +++ b/chimere/static/chimere/css/styles.css @@ -476,6 +476,11 @@ ul.share li{ margin:0; } +span.icon{ + display:inline-block; + width:70px; +} + #frm_categories{ padding:0; margin:0; @@ -1105,6 +1110,15 @@ div.pp_default .pp_expand{ padding:0 6px; } +#category-directory ul{ + padding:0; +} + +.category-directory-category{ + font-variant: small-caps; + font-weight: bold; +} + .olControlSimplePanZoom { top: 20px; right: 10px; diff --git a/chimere/templates/chimere/category_directory.html b/chimere/templates/chimere/category_directory.html new file mode 100644 index 0000000..916bd38 --- /dev/null +++ b/chimere/templates/chimere/category_directory.html @@ -0,0 +1,35 @@ +{% extends "chimere/base.html" %} +{% load i18n chimere_tags %} +{% load url from future %} +{% block extra_head %} + {{ block.super }} + {{ form.media }} + {% head_jquery %} +{% endblock %} +{% block message_map %}{% endblock %} +{% block message_edit%}{% endblock %} +{% block content %} + {{ block.super }} +
+ {% if not object_list.count %} +

{% trans "No category defined!" %}

+ {% else %} +
    {% for object in object_list %} + {% ifchanged object.category %} + {% if forloop.counter0 %} +
+ + {% endif %} +
  • {{object.category}}

    + +
  • + + {% endif %} +
    +{% endblock %} + + diff --git a/chimere/templates/chimere/category_directory_detail.html b/chimere/templates/chimere/category_directory_detail.html new file mode 100644 index 0000000..1b23b7e --- /dev/null +++ b/chimere/templates/chimere/category_directory_detail.html @@ -0,0 +1,25 @@ +{% extends "chimere/base.html" %} +{% load i18n chimere_tags %} +{% load url from future %} +{% block extra_head %} + {{ block.super }} + {{ form.media }} + {% head_jquery %} +{% endblock %} +{% block message_map %}{% endblock %} +{% block message_edit%}{% endblock %} +{% block content %} + {{ block.super }} + +
      {% for marker in items %} +
    • + {% include "chimere/category_item_detail.html" %} +
    • + {% endfor %} +
    +{% endblock %} + + diff --git a/chimere/templates/chimere/category_item_detail.html b/chimere/templates/chimere/category_item_detail.html new file mode 100644 index 0000000..3f90c6c --- /dev/null +++ b/chimere/templates/chimere/category_item_detail.html @@ -0,0 +1,38 @@ +{% load i18n sanitize chimere_tags %} + +

    {{ marker.name }}

    +
    + {% if marker.default_pictures or marker.default_pictures or marker.default_multimedia_items%} + + {%endif%} +
    + {% if dated %} +

    {{marker.start_date|date:"D d M Y"}} + {% if marker.end_date %} - {{marker.end_date|date:"D d M Y"}}

    {% endif %} + {% endif %} + {% if marker.description %} +

    {{ marker.description|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td tr th"|safe}}

    + {% endif %} + {% for property in marker.getProperties %} +

    {{ property.value|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td tr th"|safe}}

    + {% endfor %} + {% if marker.origin %}

    {% trans "Source:" %} {{marker.origin}}

    {% endif %} + {% if marker.license %}

    {% trans "License:" %} {{marker.license}}

    {% endif %} + {% share_bar marker.name %} + {% trans "See on the map" %} +

    + {% trans "Submit an amendment" %} + + {% if moderator_emails %} + + {% trans "Propose amendment" %} + {%endif%} +

    +
    diff --git a/chimere/urls.py b/chimere/urls.py index 28a7098..b9ec380 100644 --- a/chimere/urls.py +++ b/chimere/urls.py @@ -23,10 +23,11 @@ from django.contrib import admin from django.core.exceptions import ImproperlyConfigured admin.autodiscover() -from chimere.models import Area +from chimere.views import CategoryDirectoryView, CategoryView from chimere.feeds import LatestPOIsByCategory, LatestPOIsBySubCategory, \ LatestPOIs, LatestPOIsByZone, LatestPOIsByZoneID + def i18n_javascript(request): return admin.site.i18n_javascript(request) @@ -121,6 +122,10 @@ urlpatterns += patterns('chimere.views', 'processRouteFile', name='process_route_file'), url(r'^(?P[a-zA-Z0-9_-]+/)?dyn/(?P\w+)/$', 'extraPage', name='extra_page'), + url(r'^(?:(?P[a-zA-Z0-9_-]*)/)?categories/$', + CategoryDirectoryView.as_view(), name='category-directory'), + url(r'^(?:(?P[a-zA-Z0-9_-]*)/)?categories/(?P[a-zA-Z0-9_-]+)$', + CategoryView.as_view(), name='category-directory-detail'), # At the end, because it catches large url(r'^(?P[a-zA-Z0-9_-]+)?', 'index', name="index"), ) diff --git a/chimere/views.py b/chimere/views.py index 0dd5cd5..e6adb3e 100644 --- a/chimere/views.py +++ b/chimere/views.py @@ -38,12 +38,13 @@ from django.core import serializers from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from django.db.models import Q -from django.http import HttpResponseRedirect, HttpResponse -from django.shortcuts import redirect, render_to_response +from django.http import HttpResponseRedirect, HttpResponse, Http404 +from django.shortcuts import get_object_or_404, redirect, render_to_response from django.template import loader, RequestContext, defaultfilters from django.utils import simplejson as json from django.utils.http import urlquote from django.utils.translation import ugettext as _ +from django.views.generic import TemplateView, ListView from chimere.actions import actions from chimere.models import Category, SubCategory, PropertyModel, Page,\ @@ -599,6 +600,55 @@ def checkDate(q): ) return q +def _getGeoObjects(area_name, category_ids, status='A', getjson=True, + item_types=('Marker', 'Route')): + ''' + Get markers and routes + ''' + items = [] + current_cat, colors, idx = None, None, 0 + empty = [] if not getjson else {} + + # marker + if 'Marker' in item_types: + try: + q = checkDate(Q(status__in=status, categories__in=category_ids)) + query = Marker.objects.filter(q).distinct('pk').order_by('-pk') + except: + return empty + + category_ids = [int(cat_id) for cat_id in category_ids] + if getjson: + for geo_object in list(query): + items += json.loads(geo_object.getGeoJSON(category_ids)) + else: + items += list(query) + + # routes + if 'Route' in item_types: + query = AggregatedRoute.objects.filter(status__in=status, + subcategory__in=category_ids).order_by('subcategory', '-pk') + if getjson: + for route in query.all(): + c_cat = route.subcategory + if not current_cat or current_cat != c_cat: + idx = 0 + current_cat = c_cat + colors = list(Color.objects.filter( + color_theme=c_cat.color_theme)) + if colors: + items.append(json.loads( + route.getGeoJSON(color=colors[idx % len(colors)].code))) + else: + items.append(json.loads(route.getGeoJSON(color='000'))) + idx += 1 + else: + items += list(query) + + if not items: + return empty + return items + def getGeoObjects(request, area_name, category_ids, status): ''' Get the JSON for markers and routes @@ -606,31 +656,9 @@ def getGeoObjects(request, area_name, category_ids, status): if not status: status = 'A' status = status.split('_') - category_ids = category_ids.split('_') - query = AggregatedRoute.objects.filter(status__in=status, - subcategory__in=category_ids).order_by('subcategory') - jsons = [] - current_cat, colors, idx = None, None, 0 - for route in query.all(): - c_cat = route.subcategory - if not current_cat or current_cat != c_cat: - idx = 0 - current_cat = c_cat - colors = list(Color.objects.filter(color_theme = c_cat.color_theme)) - if colors: - jsons.append(json.loads( - route.getGeoJSON(color=colors[idx % len(colors)].code))) - else: - jsons.append(json.loads(route.getGeoJSON(color='000'))) - idx += 1 - try: - q = checkDate(Q(status__in=status, categories__in=category_ids)) - query = Marker.objects.filter(q).distinct('pk').order_by('pk') - except: - return HttpResponse('no results') - category_ids = [int(cat_id) for cat_id in category_ids] - for geo_object in list(query): - jsons += json.loads(geo_object.getGeoJSON(category_ids)) + category_ids = unicode(category_ids).split('_') + + jsons = _getGeoObjects(area_name, category_ids, status) if not jsons: return HttpResponse('no results') data = json.dumps({"type": "FeatureCollection", "features":jsons}) @@ -759,6 +787,78 @@ def redirectFromTinyURN(request, area_name='', tiny_urn=''): return redir return HttpResponseRedirect(response_dct['extra_url'] + parameters) +class CategoryDirectoryView(ListView): + template_name = "chimere/category_directory.html" + + def get_queryset(self): + self.area_name = self.kwargs.get('area_name', None) + if self.area_name: + self.area_name = self.area_name.split('/')[0] + area = get_object_or_404(Area, urn=self.area_name, available=True) + q = area.subcategories.filter(available=True, + category__available=True + ).order_by('category__order', 'category__id', 'order') + if q.count(): + return q + return SubCategory.objects.filter(available=True, + category__available=True + ).order_by('category__order', 'category__id', 'order') + + def get_context_data(self, *args, **kwargs): + context = super(CategoryDirectoryView, self).get_context_data( + *args, **kwargs) + new_context, redirect = get_base_response(self.request, self.area_name) + context.update(new_context) + context.update({ + 'actions':actions(self.area_name), + 'action_selected':('categories',), + }) + return context + +class CategoryView(TemplateView): + template_name = "chimere/category_directory_detail.html" + + def get_geo_items(self): + # TODO: simplify on v2.3 when slug are available + category_slug = self.kwargs.get('category_slug') + self.area_name = self.kwargs.get('area_name', None) + q = None + if self.area_name: + self.area_name = self.area_name.split('/')[0] + area = get_object_or_404(Area, urn=self.area_name, available=True) + q = area.subcategories.filter(available=True, + category__available=True) + if not q.count(): + q = None + if not q: + q = SubCategory.objects.filter(available=True, + category__available=True) + self.category = None + for subcat in q: + if defaultfilters.slugify(subcat.name) == category_slug: + self.category = subcat + break + if not self.category: + raise Http404(_("Category does not exist")) + + items = _getGeoObjects(self.area_name, [unicode(self.category.pk)], + getjson=False, item_types=('Marker',)) + return items + + def get_context_data(self, *args, **kwargs): + context = super(CategoryView, self).get_context_data( + *args, **kwargs) + self.items = self.get_geo_items() + new_context, redirect = get_base_response(self.request, self.area_name) + context.update(new_context) + context.update({ + 'actions':actions(self.area_name), + 'action_selected':('categories',), + 'category':self.category, + 'items':self.items + }) + return context + def route(request, area_name, lon1, lat1, lonlat_steps, lon2, lat2, transport='foot', speed=''): ''' -- cgit v1.2.3 From 9548c709b3e504ee91f161fa8ebfe4be66fe3f0d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 19 Apr 2015 23:12:36 +0200 Subject: Remove bad total number on directory --- chimere/templates/chimere/category_directory.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/templates/chimere/category_directory.html b/chimere/templates/chimere/category_directory.html index 916bd38..7031c83 100644 --- a/chimere/templates/chimere/category_directory.html +++ b/chimere/templates/chimere/category_directory.html @@ -23,7 +23,7 @@
  • {{object.category}}

  • -- cgit v1.2.3 From 0607368bae4b765807323a330a0ea5712f68fc2b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 19 Apr 2015 23:15:08 +0200 Subject: Update french translation --- chimere/locale/fr/LC_MESSAGES/django.po | 343 +++++++++++++++++--------------- 1 file changed, 183 insertions(+), 160 deletions(-) diff --git a/chimere/locale/fr/LC_MESSAGES/django.po b/chimere/locale/fr/LC_MESSAGES/django.po index aca5f0b..ba87f61 100644 --- a/chimere/locale/fr/LC_MESSAGES/django.po +++ b/chimere/locale/fr/LC_MESSAGES/django.po @@ -1,5 +1,5 @@ # Chimère -# Copyright (C) 2008-2013 +# Copyright (C) 2008-2015 # This file is distributed under the same license as the Chimère package. # Étienne Loks , 2008-2011. # @@ -7,34 +7,38 @@ msgid "" msgstr "" "Project-Id-Version: 0.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-26 01:30+0100\n" +"POT-Creation-Date: 2015-04-19 23:13+0200\n" "PO-Revision-Date: 2010-03-20 20:00+0100\n" "Last-Translator: Étienne Loks \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: actions.py:39 +#: actions.py:44 msgid "View" msgstr "Voir" -#: actions.py:40 +#: actions.py:45 msgid "Contribute" msgstr "Participer" -#: actions.py:41 +#: actions.py:46 msgid "Add a new point of interest" msgstr "Ajout d'un point remarquable" -#: actions.py:42 +#: actions.py:47 msgid "Add a new route" msgstr "Ajout d'un nouveau trajet" -#: actions.py:47 +#: actions.py:52 +msgid "Directory" +msgstr "Annuaire" + +#: actions.py:56 msgid "RSS feeds" msgstr "Flux RSS" -#: actions.py:51 +#: actions.py:60 msgid "Contact us" msgstr "Nous contacter" @@ -166,7 +170,7 @@ msgstr "Objet" msgid "OSM user" msgstr "Utilisateur OSM" -#: forms.py:122 models.py:1543 +#: forms.py:122 models.py:1552 msgid "Password" msgstr "Mot de passe" @@ -228,15 +232,15 @@ msgid "Bad file format: this must be a GPX or KML file" msgstr "Mauvais format de fichier : KML et GPX sont supportés" #: forms.py:518 models.py:54 models.py:102 models.py:164 models.py:185 -#: models.py:198 models.py:213 models.py:414 models.py:764 models.py:820 -#: models.py:879 models.py:997 models.py:1347 models.py:1359 models.py:1533 +#: models.py:198 models.py:213 models.py:424 models.py:773 models.py:829 +#: models.py:888 models.py:1006 models.py:1356 models.py:1368 models.py:1542 #: utils.py:490 templates/admin/chimere/managed_modified.html:23 #: templates/chimere/edit.html:40 templates/chimere/edit_route.html:37 #: templates/chimere/blocks/alternate_multimedia.html:39 msgid "Name" msgstr "Nom" -#: forms.py:527 models.py:1396 +#: forms.py:527 models.py:1405 msgid "Area" msgstr "Zone" @@ -266,13 +270,13 @@ msgstr "Vitesse" msgid "Mnemonic" msgstr "Mnémonique" -#: models.py:57 models.py:103 models.py:186 models.py:214 models.py:407 -#: models.py:768 models.py:1365 models.py:1535 models.py:1578 +#: models.py:57 models.py:103 models.py:186 models.py:214 models.py:417 +#: models.py:777 models.py:1374 models.py:1544 models.py:1587 msgid "Available" msgstr "Disponible" -#: models.py:58 models.py:174 models.py:187 models.py:231 models.py:822 -#: models.py:894 models.py:1364 models.py:1522 models.py:1534 +#: models.py:58 models.py:174 models.py:187 models.py:231 models.py:831 +#: models.py:903 models.py:1373 models.py:1531 models.py:1543 msgid "Order" msgstr "Ordre" @@ -284,15 +288,15 @@ msgstr "Chemin du patron" msgid "Page" msgstr "Page" -#: models.py:104 models.py:510 +#: models.py:104 models.py:520 msgid "Is front page" msgstr "Est en page principale" -#: models.py:106 models.py:1544 +#: models.py:106 models.py:1553 msgid "Date" msgstr "Date" -#: models.py:108 models.py:821 +#: models.py:108 models.py:830 msgid "Url" msgstr "Url" @@ -325,20 +329,20 @@ msgstr "Code" msgid "Color" msgstr "Couleur" -#: models.py:193 models.py:211 models.py:400 +#: models.py:193 models.py:211 models.py:410 msgid "Category" msgstr "Catégorie" -#: models.py:199 models.py:760 models.py:880 models.py:1063 +#: models.py:199 models.py:769 models.py:889 models.py:1072 #: templates/chimere/blocks/alternate_multimedia.html:43 msgid "Image" msgstr "Image" -#: models.py:201 models.py:882 models.py:1065 +#: models.py:201 models.py:891 models.py:1074 msgid "Height" msgstr "Hauteur" -#: models.py:202 models.py:883 models.py:1066 +#: models.py:202 models.py:892 models.py:1075 msgid "Width" msgstr "Largeur" @@ -354,7 +358,7 @@ msgstr "Disponible pour soumission" msgid "Marker" msgstr "Point d'intérêt" -#: models.py:218 models.py:1059 models.py:1076 +#: models.py:218 models.py:1068 models.py:1085 #: templates/chimere/edit_route.html:28 msgid "Route" msgstr "Trajet" @@ -383,363 +387,363 @@ msgstr "Apparaît dans le menu des couches ?" msgid "Routing warn" msgstr "Avertissement sur les itinéraires" -#: models.py:236 +#: models.py:232 models.py:435 templates/chimere/edit.html:56 +msgid "Keywords" +msgstr "Mots clés" + +#: models.py:238 msgid "Sub-category" msgstr "Sous-catégorie" -#: models.py:237 +#: models.py:239 msgid "Sub-categories" msgstr "Sous-catégories" -#: models.py:326 +#: models.py:336 msgid "Importer type" msgstr "Type d'import" -#: models.py:328 +#: models.py:338 msgid "Filter" msgstr "Filtre" -#: models.py:330 templates/chimere/blocks/alternate_multimedia.html:49 +#: models.py:340 templates/chimere/blocks/alternate_multimedia.html:49 msgid "Web address" msgstr "Adresse web" -#: models.py:332 +#: models.py:342 msgid "Don't forget the trailing slash" msgstr "N'oubliez pas la barre oblique (« / ») finale" -#: models.py:333 +#: models.py:343 msgid "Source file" msgstr "Fichier source" -#: models.py:335 +#: models.py:345 msgid "Alt source file" msgstr "Fichier source alternatif" -#: models.py:337 +#: models.py:347 msgid "Name by default" msgstr "Nom par défaut" -#: models.py:339 +#: models.py:349 msgid "SRID" msgstr "SRID" -#: models.py:340 +#: models.py:350 msgid "Zipped file" msgstr "Fichier zippé" -#: models.py:341 +#: models.py:351 msgid "Overwrite existing data" msgstr "Écraser les données existantes" -#: models.py:343 +#: models.py:353 msgid "Get description from source" msgstr "Obtenir une description depuis la source" -#: models.py:345 +#: models.py:355 msgid "Default description" msgstr "Description par défaut" -#: models.py:347 models.py:437 +#: models.py:357 models.py:447 msgid "Origin" msgstr "Origine" -#: models.py:349 models.py:439 +#: models.py:359 models.py:449 msgid "License" msgstr "Licence" -#: models.py:352 +#: models.py:362 msgid "Associated subcategories" msgstr "Sous-catégories associées" -#: models.py:353 utils.py:494 +#: models.py:363 utils.py:494 msgid "State" msgstr "État" -#: models.py:354 +#: models.py:364 msgid "Automatically associate a marker to a way" msgstr "Associer automatiquement un marqueur à une route" -#: models.py:356 +#: models.py:366 msgid "Automatically updated" msgstr "Mis à jour automatiquement" -#: models.py:358 +#: models.py:368 msgid "Default localisation" msgstr "Localisation par défaut" -#: models.py:364 models.py:398 +#: models.py:374 models.py:408 msgid "Importer" msgstr "Import" -#: models.py:401 models.py:427 +#: models.py:411 models.py:437 msgid "Import key" msgstr "Clé d'import" -#: models.py:404 +#: models.py:414 msgid "Importer - Key categories" msgstr "Importeur - clés / catégories" -#: models.py:406 +#: models.py:416 msgid "Submited" msgstr "Soumis" -#: models.py:408 +#: models.py:418 msgid "Modified" msgstr "Modifié" -#: models.py:409 +#: models.py:419 msgid "Disabled" msgstr "Désactivé" -#: models.py:410 +#: models.py:420 msgid "Imported" msgstr "Importé" -#: models.py:416 +#: models.py:426 msgid "Submitter session key" msgstr "Clé de session du demandeur" -#: models.py:418 +#: models.py:428 msgid "Submitter name or nickname" msgstr "Nom ou pseudo du demandeur" -#: models.py:420 +#: models.py:430 msgid "Submitter email" msgstr "Courriel du demandeur" -#: models.py:422 +#: models.py:432 msgid "Submitter comment" msgstr "Commentaire du demandeur" -#: models.py:424 models.py:1239 +#: models.py:434 models.py:1248 msgid "Status" msgstr "État" -#: models.py:425 templates/chimere/edit.html:56 -msgid "Keywords" -msgstr "Mots clés" - -#: models.py:429 +#: models.py:439 msgid "Import version" msgstr "Version de l'import" -#: models.py:431 +#: models.py:441 msgid "Source" msgstr "Source" -#: models.py:433 +#: models.py:443 msgid "Modified since last import" msgstr "Modifié depuis le dernier import" -#: models.py:435 +#: models.py:445 msgid "Not to be exported to OSM" msgstr "À ne pas exporter vers OSM" -#: models.py:441 templates/chimere/edit.html:63 +#: models.py:451 templates/chimere/edit.html:63 #: templates/chimere/edit_route.html:53 msgid "Start date" msgstr "Date de début" -#: models.py:442 +#: models.py:452 msgid "Not mandatory. Set it for dated item such as event. Format YYYY-MM-DD" msgstr "" "Optionnel. Précisez ce champ pour les éléments datés comme un événement. " "Format du champ : AAAA-MM-JJ" -#: models.py:444 templates/chimere/edit.html:69 +#: models.py:454 templates/chimere/edit.html:69 #: templates/chimere/edit_route.html:59 msgid "End date" msgstr "Date de fin" -#: models.py:445 +#: models.py:455 msgid "" "Not mandatory. Set it only if you have a multi-day event. Format YYYY-MM-DD" msgstr "" "Optionnel. Précisez ce champ seulement pour des événements durant plusieurs " "jours. Format du champ : AAAA-MM-JJ" -#: models.py:502 +#: models.py:512 msgid "Reference marker" msgstr "Point d'intérêt de référence" -#: models.py:503 utils.py:496 +#: models.py:513 utils.py:496 msgid "Localisation" msgstr "Localisation" -#: models.py:505 +#: models.py:515 msgid "Available Date" msgstr "Date de mise en disponibilité" -#: models.py:509 utils.py:495 templates/admin/chimere/managed_modified.html:31 +#: models.py:519 utils.py:495 templates/admin/chimere/managed_modified.html:31 #: templates/chimere/edit.html:50 templates/chimere/edit_route.html:47 msgid "Description" msgstr "Description" -#: models.py:580 models.py:1588 +#: models.py:590 models.py:1597 msgid "Point of interest" msgstr "Point d'intérêt" -#: models.py:758 +#: models.py:767 msgid "Audio" msgstr "Audio" -#: models.py:759 +#: models.py:768 msgid "Video" msgstr "Vidéo" -#: models.py:761 +#: models.py:770 msgid "Other" msgstr "Autre" -#: models.py:762 +#: models.py:771 msgid "Media type" msgstr "Type de media" -#: models.py:765 +#: models.py:774 msgid "Mime type" msgstr "Type mime" -#: models.py:767 +#: models.py:776 msgid "Inside an iframe" msgstr "À l'intérieur d'un iframe" -#: models.py:771 +#: models.py:780 msgid "Multimedia type" msgstr "Type de multimedia" -#: models.py:772 +#: models.py:781 msgid "Multimedia types" msgstr "Types de multimedia" -#: models.py:781 +#: models.py:790 msgid "Automatic recognition" msgstr "Reconnaissance automatique" -#: models.py:807 +#: models.py:816 msgid "Extension name" msgstr "Nom de l'extension" -#: models.py:809 +#: models.py:818 msgid "Associated multimedia type" msgstr "Type de multimedia associé" -#: models.py:813 +#: models.py:822 msgid "Multimedia extension" msgstr "Extension multimedia" -#: models.py:814 +#: models.py:823 msgid "Multimedia extensions" msgstr "Extensions multimedia" -#: models.py:824 models.py:884 +#: models.py:833 models.py:893 msgid "Display inside the description?" msgstr "Apparaît dans la description ?" -#: models.py:829 +#: models.py:838 msgid "Multimedia file" msgstr "Fichier multimedia" -#: models.py:830 +#: models.py:839 msgid "Multimedia files" msgstr "Fichiers multimedias" -#: models.py:886 +#: models.py:895 msgid "Thumbnail" msgstr "Miniature" -#: models.py:890 +#: models.py:899 msgid "Thumbnail height" msgstr "Hauteur de la miniature" -#: models.py:892 +#: models.py:901 msgid "Thumbnail width" msgstr "Largeur de la miniature" -#: models.py:901 +#: models.py:910 msgid "Picture file" msgstr "Fichier d'image" -#: models.py:902 +#: models.py:911 msgid "Picture files" msgstr "Fichiers d'image" -#: models.py:998 +#: models.py:1007 msgid "Raw file (gpx or kml)" msgstr "Fichier brut (gpx ou kml)" -#: models.py:1000 +#: models.py:1009 msgid "Simplified file" msgstr "Fichier simplifié" -#: models.py:1002 +#: models.py:1011 msgid "KML" msgstr "KML" -#: models.py:1002 +#: models.py:1011 msgid "GPX" msgstr "GPX" -#: models.py:1007 +#: models.py:1016 msgid "Route file" msgstr "Fichier de trajet" -#: models.py:1008 +#: models.py:1017 msgid "Route files" msgstr "Fichiers de trajet" -#: models.py:1058 +#: models.py:1067 msgid "Reference route" msgstr "Trajet de référence" -#: models.py:1062 +#: models.py:1071 msgid "Associated file" msgstr "Fichier associé" -#: models.py:1067 +#: models.py:1076 msgid "Has an associated marker" msgstr "Dispose d'un marqueur associé" -#: models.py:1348 +#: models.py:1357 msgid "Layer code" msgstr "Code pour la couche" -#: models.py:1354 +#: models.py:1363 msgid "Layer" msgstr "Couche" -#: models.py:1360 +#: models.py:1369 msgid "Area urn" msgstr "Urn de la zone" -#: models.py:1362 templates/chimere/blocks/welcome.html:3 +#: models.py:1371 templates/chimere/blocks/welcome.html:3 msgid "Welcome message" msgstr "Message d'accueil" -#: models.py:1366 +#: models.py:1375 msgid "Upper left corner" msgstr "Coin en haut à gauche" -#: models.py:1368 +#: models.py:1377 msgid "Lower right corner" msgstr "Coin en bas à droite" -#: models.py:1370 +#: models.py:1379 msgid "Default area" msgstr "Zone par défaut" -#: models.py:1371 +#: models.py:1380 msgid "Only one area is set by default" msgstr "Seule une zone est définie par défaut" -#: models.py:1375 +#: models.py:1384 msgid "Sub-categories checked by default" msgstr "Sous-catégories cochées par défaut" -#: models.py:1377 +#: models.py:1386 msgid "Sub-categories dynamicaly displayed" msgstr "Sous-categories affichées dynamiquement" -#: models.py:1378 +#: models.py:1387 msgid "" "If checked, categories are only displayed in the menu if they are available " "on the current extent." @@ -747,104 +751,104 @@ msgstr "" "Si coché, les catégories sont disponibles sur le menu seulement si elles " "apparaissent sur la zone affichée." -#: models.py:1382 models.py:1538 +#: models.py:1391 models.py:1547 msgid "Restricted to theses sub-categories" msgstr "Restreindre à ces sous-categories" -#: models.py:1383 +#: models.py:1392 msgid "If no sub-category is set all sub-categories are available" msgstr "" "Si aucune sous-catégorie n'est définie toutes les sous-catégories sont " "disponibles" -#: models.py:1385 +#: models.py:1394 msgid "Link to an external CSS" msgstr "Lien vers une feuille de style externe" -#: models.py:1387 +#: models.py:1396 msgid "Restrict to the area extent" msgstr "Restreindre à l'étendue de la zone" -#: models.py:1523 widgets.py:89 +#: models.py:1532 widgets.py:89 msgid "Default layer" msgstr "Couche par défaut" -#: models.py:1527 models.py:1528 +#: models.py:1536 models.py:1537 msgid "Layers" msgstr "Couches" -#: models.py:1536 +#: models.py:1545 msgid "Mandatory" msgstr "Obligatoire" -#: models.py:1539 +#: models.py:1548 msgid "" "If no sub-category is set all the property applies to all sub-categories" msgstr "" "Si aucune sous-catégorie n'est précisée, cette propriété est disponible pour " "toutes les sous-catégories" -#: models.py:1541 +#: models.py:1550 msgid "Text" msgstr "Texte" -#: models.py:1542 +#: models.py:1551 msgid "Long text" msgstr "Texte long" -#: models.py:1545 +#: models.py:1554 msgid "Choices" msgstr "Choix" -#: models.py:1546 +#: models.py:1555 msgid "Boolean" msgstr "Booléen" -#: models.py:1555 +#: models.py:1564 msgid "Type" msgstr "Type" -#: models.py:1560 models.py:1576 models.py:1590 +#: models.py:1569 models.py:1585 models.py:1599 msgid "Property model" msgstr "Modèle de propriété" -#: models.py:1577 models.py:1591 +#: models.py:1586 models.py:1600 msgid "Value" msgstr "Valeur" -#: models.py:1583 +#: models.py:1592 msgid "Model property choice" msgstr "Choix pour les modèles de propriété" -#: models.py:1602 +#: models.py:1611 msgid "Property" msgstr "Propriété" -#: settings.sample.py:92 +#: settings.sample.py:94 msgid "Foot" msgstr "À pieds" -#: settings.sample.py:93 +#: settings.sample.py:95 msgid "Bicycle" msgstr "À vélo" -#: settings.sample.py:94 +#: settings.sample.py:96 msgid "Motorcar" msgstr "En voiture" -#: settings.sample.py:97 +#: settings.sample.py:99 msgid "You are walking slowly" msgstr "Vous marchez lentement" -#: settings.sample.py:98 +#: settings.sample.py:100 msgid "You are walking pretty quickly" msgstr "Vous marchez plutôt rapidement" -#: settings.sample.py:99 +#: settings.sample.py:101 msgid "You are riding pretty slowly" msgstr "Vous conduisez plutôt lentement" -#: settings.sample.py:100 +#: settings.sample.py:102 msgid "You are riding pretty quickly" msgstr "Vous conduisez plutôt rapidement" @@ -1012,19 +1016,19 @@ msgstr "" "Les noms \"%s\" ne correspondent pas à des catégories existantes. Modifiez " "l'import pour faire correspondre ces noms avec des catégories." -#: views.py:301 +#: views.py:302 msgid "There are missing field(s) and/or errors in the submited form." msgstr "Il y a des champs manquants ou des erreurs dans ce formulaire." -#: views.py:386 +#: views.py:387 msgid "Bad file. Please check it with an external software." msgstr "Fichier incohérent. Merci de le vérifier avec un logiciel externe." -#: views.py:501 +#: views.py:502 msgid "Comments/request on the map" msgstr "Commentaires/requètes sur la carte" -#: views.py:504 +#: views.py:505 msgid "" "Thank you for your contribution. It will be taken into account. If you have " "left your email you may be contacted soon for more details." @@ -1033,19 +1037,23 @@ msgstr "" "laissé votre courriel vous serez peut-être contacté bientôt pour plus de " "détails." -#: views.py:508 +#: views.py:509 msgid "Temporary error. Renew your message later." msgstr "Erreur temporaire. Réenvoyez votre message plus tard." -#: views.py:687 +#: views.py:715 msgid "No category available in this area." msgstr "Pas de catégorie disponible sur cette zone." -#: views.py:800 +#: views.py:842 +msgid "Category does not exist" +msgstr "Cette catégorie n'existe pas" + +#: views.py:900 msgid "Bad geometry" msgstr "Géométrie incorrecte" -#: views.py:885 +#: views.py:985 msgid "Incorrect choice in the list" msgstr "Choix incorrect dans la liste" @@ -1311,45 +1319,60 @@ msgid "You must enable JavaScript in your browser to display Chimère." msgstr "" "Vous devez activer le JavaScript dans votre navigateur pour afficher Chimère." -#: templates/chimere/contactus.html:16 -msgid "" -"If you have some requests or remarks about this site you can leave them here." -msgstr "" -"Si vous avez des requètes, des remarques à propos de ce site vous pouvez " -"nous laisser un commentaire ici." - -#: templates/chimere/contactus.html:19 -msgid "Submit" -msgstr "Proposer" +#: templates/chimere/category_directory.html:15 +msgid "No category defined!" +msgstr "Pas de catégorie existante !" +#: templates/chimere/category_item_detail.html:17 #: templates/chimere/detail.html:17 msgid "Date:" msgstr "Date :" +#: templates/chimere/category_item_detail.html:26 #: templates/chimere/detail.html:26 msgid "Source:" msgstr "Source :" +#: templates/chimere/category_item_detail.html:27 #: templates/chimere/detail.html:27 msgid "License:" msgstr "Licence :" -#: templates/chimere/detail.html:29 -msgid "Show multimedia gallery" -msgstr "Montrer la galerie multimedia" +#: templates/chimere/category_item_detail.html:29 +msgid "See on the map" +msgstr "Voir sur la carte" +#: templates/chimere/category_item_detail.html:31 #: templates/chimere/detail.html:34 msgid "Submit an amendment" msgstr "Proposer une modification" +#: templates/chimere/category_item_detail.html:34 +#: templates/chimere/category_item_detail.html:35 #: templates/chimere/detail.html:37 templates/chimere/detail.html.py:38 msgid "Propose amendment" msgstr "Proposer une modification" +#: templates/chimere/category_item_detail.html:34 #: templates/chimere/detail.html:37 msgid "I would like to propose an amendment for this item:" msgstr "Je souhaiterais proposer une modification pour cet élément :" +#: templates/chimere/contactus.html:16 +msgid "" +"If you have some requests or remarks about this site you can leave them here." +msgstr "" +"Si vous avez des requètes, des remarques à propos de ce site vous pouvez " +"nous laisser un commentaire ici." + +#: templates/chimere/contactus.html:19 +msgid "Submit" +msgstr "Proposer" + +#: templates/chimere/detail.html:29 +msgid "Show multimedia gallery" +msgstr "Montrer la galerie multimedia" + #: templates/chimere/edit.html:20 msgid "Error" msgstr "Erreur" -- cgit v1.2.3 From 933c67e21f7ba3be26327fbdfb71191fd4fab89d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 20 Apr 2015 09:14:35 +0200 Subject: Admin: add an area list filter for markers and routes --- chimere/admin.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/chimere/admin.py b/chimere/admin.py index a93f96d..521c5a2 100644 --- a/chimere/admin.py +++ b/chimere/admin.py @@ -39,6 +39,7 @@ except ImportError: from chimere.forms import MarkerAdminForm, RouteAdminForm, AreaAdminForm,\ NewsAdminForm, CategoryAdminForm, ImporterAdminForm, OSMForm, \ PageAdminForm, PictureFileAdminForm, MultimediaFileAdminForm +from chimere import models from chimere.models import Category, Icon, SubCategory, Marker, \ PropertyModel, News, Route, Area, ColorTheme, Color, \ MultimediaFile, PictureFile, Importer, Layer, AreaLayers,\ @@ -176,13 +177,36 @@ class MultimediaInline(admin.TabularInline): ordering = ('order',) form = MultimediaFileAdminForm +class AreaMarkerListFilter(admin.SimpleListFilter): + title = _('area') + parameter_name = 'area' + + def lookups(self, request, model_admin): + return [(area.urn, area.name) for area in models.Area.objects.all()] + + def queryset(self, request, queryset): + try: + area = models.Area.objects.get(urn=self.value()) + except models.Area.DoesNotExist: + return queryset + return queryset.filter(area.getIncludeMarker()) + +class AreaRouteListFilter(AreaMarkerListFilter): + def queryset(self, request, queryset): + try: + area = models.Area.objects.get(urn=self.value()) + except models.Area.DoesNotExist: + return queryset + return queryset.filter(area.getIncludeRoute()) + class MarkerAdmin(admin.ModelAdmin): """ Specialized the Point field. """ search_fields = ("name",) list_display = ('name', 'status', 'start_date', 'end_date') - list_filter = ('status', 'categories', 'start_date', 'end_date') + list_filter = ('status', AreaMarkerListFilter, 'categories', 'start_date', + 'end_date') actions = [validate, disable, managed_modified, export_to_kml, export_to_shapefile, export_to_csv] exclude = ['submiter_session_key', 'import_key', 'import_version', @@ -255,14 +279,13 @@ class MarkerAdmin(admin.ModelAdmin): ) return my_urls + urls - class RouteAdmin(MarkerAdmin): """ Specialized the Route field. """ search_fields = ("name",) list_display = ('name', 'status') - list_filter = ('status', 'categories') + list_filter = ('status', AreaRouteListFilter, 'categories') exclude = ['height', 'width'] form = RouteAdminForm readonly_fields = ('associated_file', 'ref_item', 'has_associated_marker') -- cgit v1.2.3 From e0696c9b48bb44d095e37cd3ec2d47472cc2b568 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 20 Apr 2015 09:16:24 +0200 Subject: Update french translation --- chimere/locale/fr/LC_MESSAGES/django.po | 48 ++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/chimere/locale/fr/LC_MESSAGES/django.po b/chimere/locale/fr/LC_MESSAGES/django.po index ba87f61..0c5e884 100644 --- a/chimere/locale/fr/LC_MESSAGES/django.po +++ b/chimere/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-04-19 23:13+0200\n" +"POT-Creation-Date: 2015-04-20 09:15+0200\n" "PO-Revision-Date: 2010-03-20 20:00+0100\n" "Last-Translator: Étienne Loks \n" "MIME-Version: 1.0\n" @@ -42,94 +42,98 @@ msgstr "Flux RSS" msgid "Contact us" msgstr "Nous contacter" -#: admin.py:54 +#: admin.py:55 msgid "Disable" msgstr "Désactiver" -#: admin.py:60 templates/admin/chimere/managed_modified.html:44 +#: admin.py:61 templates/admin/chimere/managed_modified.html:44 #: templates/chimere/feeds/rss.html:70 msgid "Validate" msgstr "Valider" -#: admin.py:71 +#: admin.py:72 msgid "Export to KML" msgstr "Exporter en KML" -#: admin.py:85 +#: admin.py:86 msgid "Export to Shapefile" msgstr "Exporter en Shapefile" -#: admin.py:95 +#: admin.py:96 msgid "Export to CSV" msgstr "Exporter en CSV" -#: admin.py:102 +#: admin.py:103 msgid "Only one item can be managed at a time." msgstr "Seul un élément à la fois peut-être géré." -#: admin.py:112 +#: admin.py:113 msgid "No modified item associated to the selected item." msgstr "Pas d'élément modifié associé à l'élément sélectionné." -#: admin.py:158 +#: admin.py:159 msgid "Modified item traited." msgstr "Élément modifié traité." -#: admin.py:163 +#: admin.py:164 msgid "Managed modified items" msgstr "Gérer les éléments modifiés" -#: admin.py:197 admin.py:275 +#: admin.py:181 +msgid "area" +msgstr "zone" + +#: admin.py:221 admin.py:298 msgid "Submitter" msgstr "Demandeur" -#: admin.py:202 admin.py:280 admin.py:332 +#: admin.py:226 admin.py:303 admin.py:355 msgid "Import" msgstr "Import" -#: admin.py:207 admin.py:285 +#: admin.py:231 admin.py:308 msgid "Associated items" msgstr "Éléments associés" -#: admin.py:338 +#: admin.py:361 msgid "Cancel import" msgstr "Annuler l'import" -#: admin.py:344 +#: admin.py:367 msgid "Cancel export" msgstr "Annuler l'export" -#: admin.py:348 +#: admin.py:371 msgid "Can manage only one OSM export at a time." msgstr "Ne peux gérer qu'un seul export OSM à la fois." -#: admin.py:353 +#: admin.py:376 msgid "" "You must treat all item with the status \"imported\" before exporting to OSM." msgstr "" "Vous devez traiter tous les éléments avec le status « importé » avant " "d'exporter vers OSM." -#: admin.py:357 +#: admin.py:380 msgid "Only OSM importer are managed for export." msgstr "Seul les imports de type OSM peuvent être gérés pour les exports." -#: admin.py:364 +#: admin.py:387 msgid "No point of interest are concerned by this export." msgstr "Aucun point d'intérêt n'est concerné par cet export." -#: admin.py:376 +#: admin.py:399 msgid "Export launched." msgstr "Export lancé." -#: admin.py:380 +#: admin.py:403 #, python-format msgid "" "%s point(s) of interest concerned by this export before bounding box filter." msgstr "" "%s point(s) d'intérêt concerné par cet export (avant le filtre sur la zone)" -#: admin.py:385 +#: admin.py:408 msgid "Export to osm" msgstr "Exporter vers osm" -- cgit v1.2.3 From f09a00dddb0ae015f024f6b1a603b6d3969ab732 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 21 May 2015 14:34:03 +0200 Subject: OSM import: truncate cooordinate to conform to XAPI API --- chimere/static/chimere/js/importer_interface.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chimere/static/chimere/js/importer_interface.js b/chimere/static/chimere/js/importer_interface.js index 65bcf8c..4c6e29d 100644 --- a/chimere/static/chimere/js/importer_interface.js +++ b/chimere/static/chimere/js/importer_interface.js @@ -118,10 +118,10 @@ django.jQuery(function($) { value = $('input[name=id_filtr_type]:checked').val(); value += '[' + $("#id_filtr_tag").val() + ']'; value += '[bbox='; - value += $('#upper_left_lon').val() + ','; - value += $('#lower_right_lat').val() + ','; - value += $('#lower_right_lon').val() + ','; - value += $('#upper_left_lat').val(); + value += Number($('#upper_left_lon').val()).toFixed(6) + ','; + value += Number($('#lower_right_lat').val()).toFixed(6) + ','; + value += Number($('#lower_right_lon').val()).toFixed(6) + ','; + value += Number($('#upper_left_lat').val()).toFixed(6); value += ']'; $('#id_filtr').val(value); return false; -- cgit v1.2.3 From 126affc426744c2d6afdce06a1eb807343c1c65a Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 21 May 2015 17:36:17 +0200 Subject: Imports: "modified_since_import" now take description, start_date into account --- chimere/models.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/chimere/models.py b/chimere/models.py index 5727098..74555ae 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -697,7 +697,8 @@ class Marker(GeographicItem): PRE_ATTRS = { - 'Marker':('name', 'geometry', 'import_version', 'modified_since_import'), + 'Marker':('name', 'description', 'start_date', 'geometry', 'import_version', + 'modified_since_import'), 'Route':('name', 'geometry', 'import_version', 'modified_since_import'), 'Area':('urn', 'name'), } @@ -708,8 +709,9 @@ def geometry_pre_save(cls, pre_save_geom_values): instance = kwargs['instance'] try: instance = cls.objects.get(pk=instance.pk) - pre_save_geom_values[instance.pk] = [getattr(instance, attr) - for attr in PRE_ATTRS[cls.__name__]] + pre_save_geom_values[instance.pk] = dict( + [(attr, getattr(instance, attr)) + for attr in PRE_ATTRS[cls.__name__]]) except ObjectDoesNotExist: pass return geom_pre_save @@ -727,19 +729,20 @@ def geometry_post_save(pre_save_geom_values): or kwargs['instance'].pk not in pre_save_geom_values: return instance = kwargs['instance'] - name, geometry, import_version, modified_since_import = \ - pre_save_geom_values[instance.pk] + pre = pre_save_geom_values[instance.pk] # force the reinit of modified_since_import - if modified_since_import != instance.modified_since_import: + if pre['modified_since_import'] != instance.modified_since_import: return - if (instance.import_version != import_version + if (instance.import_version != pre['import_version'] and instance.modified_since_import): instance.modified_since_import = False instance.save() return if instance.modified_since_import: return - if instance.name != name or instance.geometry != geometry: + if [key for key in pre if pre not in ('import_version', + 'modified_since_import') and + getattr(instance, key) != pre[key]]: instance.modified_since_import = True instance.save() return geom_post_save -- cgit v1.2.3 From f8c2ecf2fe3aa78c64b2fa3b29979fe55e5636cf Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 21 May 2015 18:36:19 +0200 Subject: Fix modified_since_import in imports --- chimere/models.py | 7 ++++++- chimere/utils.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/chimere/models.py b/chimere/models.py index 74555ae..36a9e4b 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -466,7 +466,12 @@ class GeographicItem(models.Model): if not _set: new_keys += '%s:%s;' % (key, value) self.import_key = new_keys + modified_since_import = self.modified_since_import self.save() + # preserve modified_since_import + if modified_since_import != self.modified_since_import: + self.modified_since_import = modified_since_import + self.save() def has_modified(self): if (self.ref_item and self.ref_item != self) \ @@ -747,7 +752,7 @@ def geometry_post_save(pre_save_geom_values): instance.save() return geom_post_save def marker_post_save(sender, **kwargs): - if not kwargs['instance']: + if not kwargs['instance'] or kwargs['created']: return geometry_post_save(pre_save_marker_values)(sender, **kwargs) post_save.connect(marker_post_save, sender=Marker) diff --git a/chimere/utils.py b/chimere/utils.py index 55fc45c..5b34e9c 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -131,6 +131,8 @@ class ImportManager(object): values['has_associated_marker'] = False try: item = cls.objects.create(**values) + item.modified_since_import = False + item.save() except TypeError: # error on data source return None, False, False -- cgit v1.2.3 From 5fe6d580e85dc7208f48c89e417290cee7ec9d33 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 21 May 2015 18:41:20 +0200 Subject: Do not re-import modified since import --- chimere/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/utils.py b/chimere/utils.py index 5b34e9c..a765c32 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -100,7 +100,7 @@ class ImportManager(object): return ref_item, None, None if not self.importer_instance.overwrite \ and ref_item.modified_since_import: - dct_import['ref_item'] = ref_item + return ref_item, None, None else: item = ref_item for k in values: -- cgit v1.2.3 From 7f62e7d756265c88556d0afd8aa9ae6c941dfe5f Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 22 May 2015 20:39:37 +0200 Subject: HTML/XML imports: origin is a link with target blank --- chimere/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/utils.py b/chimere/utils.py index a765c32..2fe5fb4 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -1065,7 +1065,7 @@ class HtmlXsltManager(ImportManager): not "point" in item and not ("lat" in item and item['lat']): return cls = None - dct = {'origin':"%s" % (item['link'], + dct = {'origin':"%s" % (item['link'], self.importer_instance.origin), 'license':self.importer_instance.license, 'name':item['name']} -- cgit v1.2.3 From 7252ff1780351457fb785cdc78d89005b8c2cc12 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 30 May 2015 19:09:51 +0200 Subject: Remove routing for simple maps --- chimere/templates/chimere/blocks/map_menu.html | 2 +- chimere/templatetags/chimere_tags.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/chimere/templates/chimere/blocks/map_menu.html b/chimere/templates/chimere/blocks/map_menu.html index 38fb4a8..02f415a 100644 --- a/chimere/templates/chimere/blocks/map_menu.html +++ b/chimere/templates/chimere/blocks/map_menu.html @@ -1,7 +1,7 @@ {% load i18n %}
      - {% if routing %} + {% if routing and not simple %}
    • {% trans "From" context "routing" %}
    • {% trans "Add a step" context "routing" %}
    • {% trans "To" context "routing" %}
    • diff --git a/chimere/templatetags/chimere_tags.py b/chimere/templatetags/chimere_tags.py index 15b8afa..2b78839 100644 --- a/chimere/templatetags/chimere_tags.py +++ b/chimere/templatetags/chimere_tags.py @@ -171,7 +171,8 @@ def head_form(): @register.inclusion_tag('chimere/blocks/map_menu.html', takes_context=True) def map_menu(context): context_data = {'routing': settings.CHIMERE_ENABLE_ROUTING \ - if hasattr(settings, 'CHIMERE_ENABLE_ROUTING') else False} + if hasattr(settings, 'CHIMERE_ENABLE_ROUTING') else False, + 'simple':context.get('simple')} return context_data @register.inclusion_tag('chimere/blocks/routing.html', takes_context=True) -- cgit v1.2.3 From 893054de5c4c436af2b2c4b486366eecc923d198 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 31 May 2015 16:00:11 +0200 Subject: JS: fix reinitialization of clustering after dialog closing --- chimere/static/chimere/js/jquery.chimere.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index c9f02af..524767b 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -43,7 +43,6 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { else return v; }; })( jQuery ); - (function ($) { /* * Chimere jQuery plugin @@ -547,6 +546,7 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { content += "
    "; $('#cluster_list').html(content); $('#cluster_list').dialog('open'); + $("#cluster_list").on("dialogclose", methods.cleanCluster); settings.map.setCenter( feature.geometry.getBounds().getCenterLonLat()); // register after the display -- cgit v1.2.3 From 15218a371ecf74be64440bfa511be47325eb23bb Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 5 Jun 2015 19:10:55 +0200 Subject: News sorting: sooner first --- chimere/templatetags/chimere_tags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/templatetags/chimere_tags.py b/chimere/templatetags/chimere_tags.py index ff0a9c8..d7fa358 100644 --- a/chimere/templatetags/chimere_tags.py +++ b/chimere/templatetags/chimere_tags.py @@ -63,7 +63,7 @@ def get_news(area=None): if area: q = q.filter(area.getIncludeMarker()) news += list(q) - news.sort(key=lambda x:x.date, reverse=True) + news.sort(key=lambda x:x.date) return news @register.inclusion_tag('chimere/blocks/welcome.html', takes_context=True) -- cgit v1.2.3 From 9d4f1c0ea95393ebdfc11f3830720fb3f12eeb3a Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 5 Jun 2015 19:13:43 +0200 Subject: News template: don't display end date when equal to start date --- chimere/templates/chimere/blocks/news.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/templates/chimere/blocks/news.html b/chimere/templates/chimere/blocks/news.html index fa581f7..6b0b691 100644 --- a/chimere/templates/chimere/blocks/news.html +++ b/chimere/templates/chimere/blocks/news.html @@ -22,7 +22,7 @@ $(function(){

    {{news.title}} – {{ news.date }}

    {{news.content|safe}}

    {% else %} -

    {{news.name}} – {{ news.start_date }}{% if news.end_date %} - {{ news.end_date }}{% endif %}

    +

    {{news.name}} – {{ news.start_date }}{% if news.end_date and news.end_date != news.start_date %} – {{ news.end_date }}{% endif %}

    {% if news.default_pictures or news.default_pictures or news.default_multimedia_items%} "; $('#cluster_list').html(content); $('#cluster_list').dialog('open'); + $("#cluster_list").on("dialogclose", methods.cleanCluster); settings.map.setCenter( feature.geometry.getBounds().getCenterLonLat()); // register after the display @@ -777,8 +778,8 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { var id = this.id.substr(this.id.lastIndexOf("_")+1); helpers.zoom_to_subcategories([id]); }); - $(".toggle_category").bind("click", function (e) { - var item = $(this); + $(".toggle_category").parent().bind("click", function (e) { + var item = $(this).children('.toggle_category'); var id = item.attr('id').substr(item.attr('id').lastIndexOf("_")+1); methods.toggle_category(id); }); -- cgit v1.2.3 From 8fcff426dee860d0840061d9aa5204d53c70016f Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 16 Jun 2015 20:58:02 +0200 Subject: Search: enable by default search button --- chimere/templates/search/search.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/templates/search/search.html b/chimere/templates/search/search.html index b78cc1d..ab3e61e 100644 --- a/chimere/templates/search/search.html +++ b/chimere/templates/search/search.html @@ -30,7 +30,7 @@ var end_do_you_mean = "{% trans '?' %}"; {% else %}
    - +
    -- cgit v1.2.3 From 338dbb2f83e1549371c367102bbb156360bba221 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 13 Jul 2015 11:49:31 +0200 Subject: JS: fix catagory change when a popup is open --- chimere/static/chimere/js/jquery.chimere.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index 524767b..a4b1321 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -712,7 +712,6 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { } else { par.removeClass('selected'); } - methods.hidePopup(e); methods.loadGeoObjects(); _toggle_categories($(this)); settings.permalink.updateLink(); @@ -720,6 +719,7 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { $('#layer_cat_'+c_name).prop("checked", this.checked); } + methods.hidePopup(e); }); $('#display_submited_check').bind("click", function () { methods.loadGeoObjects(); -- cgit v1.2.3 From 34f46a933020740a63d2a80d025787aaa30c99e7 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 14 Jul 2015 10:49:12 +0200 Subject: Fix property representation when empty --- chimere/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chimere/models.py b/chimere/models.py index 36a9e4b..2f30892 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -1593,6 +1593,8 @@ class Property(models.Model): value = models.TextField(_(u"Value")) def __unicode__(self): if self.propertymodel.type == 'C': + if not self.value: + return '' try: return unicode(PropertyModelChoice.objects.get( pk=self.value).value) -- cgit v1.2.3 From cf03b1eea89f4a7a0c0b03629a81a0d8d588a35f Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 14 Jul 2015 15:56:37 +0200 Subject: Minor: format --- chimere/templatetags/chimere_tags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/templatetags/chimere_tags.py b/chimere/templatetags/chimere_tags.py index d7fa358..344febb 100644 --- a/chimere/templatetags/chimere_tags.py +++ b/chimere/templatetags/chimere_tags.py @@ -57,7 +57,7 @@ def get_news(area=None): Q(end_date__gte=today)| (Q(end_date__isnull=True) & Q(start_date__gte=today))) - if not'CHIMERE_ALL_DATED_ARE_FRONT' in dir(settings)\ + if not 'CHIMERE_ALL_DATED_ARE_FRONT' in dir(settings)\ or not settings.CHIMERE_ALL_DATED_ARE_FRONT: q = q.filter(is_front_page=True) if area: -- cgit v1.2.3 From 744633f3153ac5cf647e0d9691666a3e691cb426 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 6 Jun 2015 11:15:06 +0200 Subject: JS: add a method for new JSON items --- chimere/static/chimere/js/jquery.chimere.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index a4b1321..0af3f47 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -983,6 +983,20 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { cleanRoute: function(){ settings.layerVectors.removeAllFeatures(); }, + // add json layer + addJSON: function(json_url){ + settings.layerJson = new OpenLayers.Layer.Vector("GeoJSON", { + projection: EPSG_PROJECTION, + strategies: [new OpenLayers.Strategy.Fixed()], + protocol: new OpenLayers.Protocol.HTTP({ + url: json_url, + format: new OpenLayers.Format.GeoJSON() + }) + }); + settings.map.addLayer(settings.layerJson); + settings.map.zoomToExtent(settings.layerJson.getDataExtent()); + // settings.layerJson.setOpacity(0.5); + }, // Put a route on the map addRoute: function(route) { var polyline = route.geometry; -- cgit v1.2.3 From fd28c2563a802775fa8d45639a1a60c29d67e999 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 27 Jul 2015 16:56:40 +0200 Subject: JS: remove automatic zoom on JSON loading --- chimere/static/chimere/js/jquery.chimere.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index 0af3f47..16a7832 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -986,16 +986,15 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { // add json layer addJSON: function(json_url){ settings.layerJson = new OpenLayers.Layer.Vector("GeoJSON", { - projection: EPSG_PROJECTION, - strategies: [new OpenLayers.Strategy.Fixed()], + projection: EPSG_DISPLAY_PROJECTION, + strategies: [new OpenLayers.Strategy.BBOX()], protocol: new OpenLayers.Protocol.HTTP({ url: json_url, format: new OpenLayers.Format.GeoJSON() }) }); settings.map.addLayer(settings.layerJson); - settings.map.zoomToExtent(settings.layerJson.getDataExtent()); - // settings.layerJson.setOpacity(0.5); + settings.layerJson.setOpacity(0.8); }, // Put a route on the map addRoute: function(route) { -- cgit v1.2.3 From 8b2270ff8ebb5512d94c60604272d61ea8f8d549 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 28 Jul 2015 18:19:50 +0200 Subject: JS: put by default JSON layer to the bottom (without that the marker layer not working anymore) --- chimere/static/chimere/js/jquery.chimere.js | 1 + 1 file changed, 1 insertion(+) diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index 16a7832..3253c13 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -994,6 +994,7 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { }) }); settings.map.addLayer(settings.layerJson); + settings.map.setLayerIndex(settings.layerJson, 0); settings.layerJson.setOpacity(0.8); }, // Put a route on the map -- cgit v1.2.3 From bfeab1a4d50e6d8a941a9de7b034d86d7704926d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 28 Jul 2015 21:02:52 +0200 Subject: XSLT import : default link --- chimere/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chimere/utils.py b/chimere/utils.py index 2fe5fb4..d898759 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -1065,7 +1065,8 @@ class HtmlXsltManager(ImportManager): not "point" in item and not ("lat" in item and item['lat']): return cls = None - dct = {'origin':"%s" % (item['link'], + dct = {'origin':"%s" % ( + item.get('link') or '#', self.importer_instance.origin), 'license':self.importer_instance.license, 'name':item['name']} -- cgit v1.2.3 From 33a658752352be3b95d31bba87a1c9f00d565edd Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 30 Jul 2015 13:26:04 +0200 Subject: JS: adapt JSON layer --- chimere/static/chimere/js/jquery.chimere.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index 3253c13..728bc00 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -985,17 +985,25 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { }, // add json layer addJSON: function(json_url){ + var jsonStyle = new OpenLayers.Style({ + 'strokeWidth':1, + 'fillColor':'#BBBBBB', + 'strokeColor':'#AAAAAA' + }); + + var jsonStyleMap = new OpenLayers.StyleMap({'default': jsonStyle}); settings.layerJson = new OpenLayers.Layer.Vector("GeoJSON", { projection: EPSG_DISPLAY_PROJECTION, - strategies: [new OpenLayers.Strategy.BBOX()], + strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: json_url, format: new OpenLayers.Format.GeoJSON() - }) + }), + styleMap: jsonStyleMap }); settings.map.addLayer(settings.layerJson); settings.map.setLayerIndex(settings.layerJson, 0); - settings.layerJson.setOpacity(0.8); + settings.layerJson.setOpacity(0.6); }, // Put a route on the map addRoute: function(route) { -- cgit v1.2.3 From a1e080dc1e0de5e7673fe19a471cd3e8116e3889 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 11 Aug 2015 11:32:03 +0200 Subject: JS: change JSON layer transparency --- chimere/static/chimere/js/jquery.chimere.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index 728bc00..41fe484 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -1003,7 +1003,7 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { }); settings.map.addLayer(settings.layerJson); settings.map.setLayerIndex(settings.layerJson, 0); - settings.layerJson.setOpacity(0.6); + settings.layerJson.setOpacity(0.4); }, // Put a route on the map addRoute: function(route) { -- cgit v1.2.3 From 4dc29d3286a34b8dc428d69a138b6eb6ac97461e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 13 Aug 2015 10:48:09 +0200 Subject: Admin: add a filter when no category is available --- chimere/admin.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/chimere/admin.py b/chimere/admin.py index b8414dc..47e7e25 100644 --- a/chimere/admin.py +++ b/chimere/admin.py @@ -25,6 +25,7 @@ import datetime from django import forms from django.conf import settings from django.contrib import admin, messages +from django.contrib.admin import SimpleListFilter from django.core.exceptions import ObjectDoesNotExist from django.db.models import Q from django.http import HttpResponse, HttpResponseRedirect @@ -176,13 +177,30 @@ class MultimediaInline(admin.TabularInline): ordering = ('order',) form = MultimediaFileAdminForm +class HasCategoriesListFilter(SimpleListFilter): + title = _('Has categories') + parameter_name = 'has_category' + + def lookups(self, request, model_admin): + return ( + ('true', _('Yes')), + ('false', _('No')), + ) + + def queryset(self, request, queryset): + if self.value() == 'false': + return queryset.filter(categories__isnull=True) + else: + return queryset.exclude(categories__isnull=True) + class MarkerAdmin(admin.ModelAdmin): """ Specialized the Point field. """ search_fields = ("name",) list_display = ('name', 'status', 'start_date', 'end_date') - list_filter = ('status', 'categories', 'start_date', 'end_date') + list_filter = ('status', 'categories', HasCategoriesListFilter, + 'start_date', 'end_date') actions = [validate, disable, managed_modified, export_to_kml, export_to_shapefile, export_to_csv] exclude = ['submiter_session_key', 'import_key', 'import_version', -- cgit v1.2.3 From 9d0ff9f26f5b71c2e3d02451e8240472b29a2134 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 13 Aug 2015 11:48:05 +0200 Subject: Admin: fix has_category doesn't have to filter by true by default --- chimere/admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chimere/admin.py b/chimere/admin.py index 47e7e25..e94f22f 100644 --- a/chimere/admin.py +++ b/chimere/admin.py @@ -190,8 +190,9 @@ class HasCategoriesListFilter(SimpleListFilter): def queryset(self, request, queryset): if self.value() == 'false': return queryset.filter(categories__isnull=True) - else: + elif self.value() == 'true': return queryset.exclude(categories__isnull=True) + return queryset class MarkerAdmin(admin.ModelAdmin): """ -- cgit v1.2.3 From 5d2cac2cb5a03c8f55a2396e4c4ce13911a9149c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 23 Sep 2015 23:33:10 +0200 Subject: Imports: specify the status used by default during imports --- ...0009_auto__add_field_importer_default_status.py | 289 +++++++++++++++++++++ chimere/models.py | 16 +- chimere/static/chimere/js/importer_interface.js | 16 +- chimere/utils.py | 3 +- 4 files changed, 308 insertions(+), 16 deletions(-) create mode 100644 chimere/migrations/0009_auto__add_field_importer_default_status.py diff --git a/chimere/migrations/0009_auto__add_field_importer_default_status.py b/chimere/migrations/0009_auto__add_field_importer_default_status.py new file mode 100644 index 0000000..e29c599 --- /dev/null +++ b/chimere/migrations/0009_auto__add_field_importer_default_status.py @@ -0,0 +1,289 @@ +# -*- 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 field 'Importer.default_status' + db.add_column('chimere_importer', 'default_status', + self.gf('django.db.models.fields.CharField')(default='I', max_length=1), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'Importer.default_status' + db.delete_column('chimere_importer', 'default_status') + + + models = { + 'chimere.aggregatedroute': { + 'Meta': {'object_name': 'AggregatedRoute', 'db_table': "'chimere_aggregated_routes'", 'managed': 'False'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'route': ('django.contrib.gis.db.models.fields.MultiLineStringField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'subcategory': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.SubCategory']"}) + }, + 'chimere.area': { + 'Meta': {'ordering': "('order', 'name')", 'object_name': 'Area'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'default_subcategories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False', 'blank': 'True'}), + 'dynamic_categories': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'external_css': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layers': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'through': "orm['chimere.AreaLayers']", 'to': "orm['chimere.Layer']"}), + 'lower_right_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'unique': 'True'}), + 'restrict_to_extent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'db_table': "'chimere_subcategory_areas'", 'to': "orm['chimere.SubCategory']"}), + 'upper_left_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'urn': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'blank': 'True'}), + 'welcome_message': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.arealayers': { + 'Meta': {'ordering': "('order',)", 'object_name': 'AreaLayers'}, + 'area': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Area']"}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Layer']"}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.category': { + 'Meta': {'ordering': "['order']", 'object_name': 'Category'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.color': { + 'Meta': {'ordering': "['order']", 'object_name': 'Color'}, + 'code': ('django.db.models.fields.CharField', [], {'max_length': '6'}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.colortheme': { + 'Meta': {'object_name': 'ColorTheme'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.icon': { + 'Meta': {'object_name': 'Icon'}, + 'height': ('django.db.models.fields.IntegerField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'width': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.importer': { + 'Meta': {'object_name': 'Importer'}, + 'associate_marker_to_way': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'automatic_update': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.SubCategory']", 'null': 'True', 'blank': 'True'}), + 'default_description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'default_localisation': ('chimere.widgets.PointField', [], {'null': 'True', 'blank': 'True'}), + 'default_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'default_status': ('django.db.models.fields.CharField', [], {'default': "'I'", 'max_length': '1'}), + 'filtr': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'get_description': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'importer_type': ('django.db.models.fields.CharField', [], {'max_length': '4'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'overwrite': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'source_file_alt': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'srid': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'zipped': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'chimere.importerkeycategories': { + 'Meta': {'object_name': 'ImporterKeyCategories'}, + 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.SubCategory']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'importer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'key_categories'", 'to': "orm['chimere.Importer']"}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'chimere.layer': { + 'Meta': {'object_name': 'Layer'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer_code': ('django.db.models.fields.TextField', [], {'max_length': '300'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.marker': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Marker'}, + 'available_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'is_front_page': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'point': ('chimere.widgets.PointField', [], {}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_marker'", 'null': 'True', 'to': "orm['chimere.Marker']"}), + 'route': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'associated_marker'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.multimediaextension': { + 'Meta': {'object_name': 'MultimediaExtension'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'extensions'", 'to': "orm['chimere.MultimediaType']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '6'}) + }, + 'chimere.multimediafile': { + 'Meta': {'object_name': 'MultimediaFile'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'multimedia_files'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.MultimediaType']", 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}) + }, + 'chimere.multimediatype': { + 'Meta': {'object_name': 'MultimediaType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'iframe': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'media_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'mime_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.news': { + 'Meta': {'object_name': 'News'}, + 'areas': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.Area']", 'null': 'True', 'blank': 'True'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'date': ('django.db.models.fields.DateField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_front_page': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.page': { + 'Meta': {'object_name': 'Page'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'content': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mnemonic': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '10', 'null': 'True', 'blank': 'True'}), + 'template_path': ('django.db.models.fields.CharField', [], {'max_length': '150', 'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.picturefile': { + 'Meta': {'object_name': 'PictureFile'}, + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pictures'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'thumbnailfile': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'thumbnailfile_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'thumbnailfile_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.property': { + 'Meta': {'object_name': 'Property'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Marker']"}), + 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.PropertyModel']"}), + 'value': ('django.db.models.fields.TextField', [], {}) + }, + 'chimere.propertymodel': { + 'Meta': {'ordering': "('order',)", 'object_name': 'PropertyModel'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mandatory': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'properties'", 'blank': 'True', 'to': "orm['chimere.SubCategory']"}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '1'}) + }, + 'chimere.propertymodelchoice': { + 'Meta': {'object_name': 'PropertyModelChoice'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'choices'", 'to': "orm['chimere.PropertyModel']"}), + 'value': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.route': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Route'}, + 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.RouteFile']", 'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'has_associated_marker': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_route'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'route': ('chimere.widgets.RouteField', [], {}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.routefile': { + 'Meta': {'ordering': "('name',)", 'object_name': 'RouteFile'}, + 'file_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'raw_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'simplified_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.subcategory': { + 'Meta': {'ordering': "['category', 'order']", 'object_name': 'SubCategory'}, + 'as_layer': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subcategories'", 'to': "orm['chimere.Category']"}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']", 'null': 'True', 'blank': 'True'}), + 'dated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'hover_icon': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'subcat_hovered'", 'null': 'True', 'to': "orm['chimere.Icon']"}), + 'icon': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Icon']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'item_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1000'}), + 'routing_warn': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'submission': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + }, + 'chimere.tinyurl': { + 'Meta': {'object_name': 'TinyUrl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'parameters': ('django.db.models.fields.CharField', [], {'max_length': '500'}) + } + } + + complete_apps = ['chimere'] \ No newline at end of file diff --git a/chimere/models.py b/chimere/models.py index 2f30892..757e464 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -299,6 +299,13 @@ class SubCategory(models.Model): json_string = json.dumps(self.getJSONDict()) return json_string +STATUS = (('S', _(u'Submited')), + ('A', _(u'Available')), + ('M', _(u'Modified')), + ('D', _(u'Disabled')), + ('I', _(u'Imported'))) +STATUS_DCT = dict(STATUS) + IMPORTERS = {'KML':KMLManager, 'OSM':OSMManager, 'SHP':ShapefileManager, @@ -355,6 +362,8 @@ class Importer(models.Model): u"a marker to a way"), default=False) automatic_update = models.BooleanField(_(u"Automatically updated"), default=False) + default_status = models.CharField(_(u"Default status"), max_length=1, + choices=STATUS, default='I') default_localisation = PointField(_(u"Default localisation"), srid=settings.CHIMERE_EPSG_DISPLAY_PROJECTION, blank=True, null=True, @@ -403,13 +412,6 @@ class ImporterKeyCategories(models.Model): class Meta: verbose_name = _(u"Importer - Key categories") -STATUS = (('S', _(u'Submited')), - ('A', _(u'Available')), - ('M', _(u'Modified')), - ('D', _(u'Disabled')), - ('I', _(u'Imported'))) -STATUS_DCT = dict(STATUS) - class GeographicItem(models.Model): name = models.CharField(_(u"Name"), max_length=150) categories = SelectMultipleField(SubCategory) diff --git a/chimere/static/chimere/js/importer_interface.js b/chimere/static/chimere/js/importer_interface.js index 4c6e29d..5c77a8d 100644 --- a/chimere/static/chimere/js/importer_interface.js +++ b/chimere/static/chimere/js/importer_interface.js @@ -2,35 +2,37 @@ django.jQuery(function($) { var importer_form_filter = { OSM:new Array('field-filtr', 'field-default_name', 'field-categories', 'field-source', 'field-overwrite', - 'field-automatic_update'), + 'field-automatic_update', 'field-default_status'), KML:new Array('field-source', 'field-source_file', 'field-default_name', 'field-filtr', 'field-zipped', 'field-origin', 'field-license', 'field-categories', 'field-overwrite', - 'field-get_description', 'field-automatic_update'), + 'field-get_description', 'field-automatic_update', + 'field-default_status'), SHP:new Array('field-source', 'field-source_file', 'field-default_name', 'field-zipped', 'field-origin', 'field-srid', 'field-license', 'field-categories', 'field-overwrite', - 'field-automatic_update'), + 'field-automatic_update', 'field-default_status'), RSS:new Array('field-source', 'field-default_name', 'field-origin', 'field-srid', 'field-license', 'field-categories', 'field-overwrite', 'field-get_description', - 'field-automatic_update'), + 'field-automatic_update', 'field-default_status'), CSV:new Array('field-source', 'field-source_file', 'field-default_name', 'field-origin', 'field-srid', 'field-license', 'field-categories', 'field-overwrite', - 'field-get_description', 'field-automatic_update'), + 'field-get_description', 'field-automatic_update', + 'field-default_status'), XSLT:new Array('field-source', 'field-source_file', 'field-source_file_alt', 'field-default_name', 'field-origin', 'field-srid', 'field-license', 'field-categories', 'field-overwrite', 'field-get_description', 'field-default_localisation', - 'field-automatic_update'), + 'field-automatic_update', 'field-default_status'), XXLT:new Array('field-source', 'field-source_file', 'field-source_file_alt', 'field-default_name', 'field-origin', 'field-srid', 'field-license', 'field-categories', 'field-overwrite', 'field-get_description', 'field-default_localisation', - 'field-automatic_update') + 'field-automatic_update', 'field-default_status') } var osm_map_initialized; var edit_map_initialized; diff --git a/chimere/utils.py b/chimere/utils.py index d898759..c5c59e9 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -124,8 +124,7 @@ class ImportManager(object): self.importer_instance.default_description values.update({ 'import_source':self.importer_instance.source}) - values['status'] = 'I' \ - if not self.importer_instance.automatic_update else 'A' + values['status'] = self.importer_instance.default_status if not self.importer_instance.associate_marker_to_way\ and cls.__name__ == 'Route': values['has_associated_marker'] = False -- cgit v1.2.3 From ea4e8f2fcf280068a6581569cf51ff576bcd7f35 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 23 Sep 2015 23:39:23 +0200 Subject: Fix migration after merge --- ...0009_auto__add_field_importer_default_status.py | 289 -------------------- ...0011_auto__add_field_importer_default_status.py | 292 +++++++++++++++++++++ 2 files changed, 292 insertions(+), 289 deletions(-) delete mode 100644 chimere/migrations/0009_auto__add_field_importer_default_status.py create mode 100644 chimere/migrations/0011_auto__add_field_importer_default_status.py diff --git a/chimere/migrations/0009_auto__add_field_importer_default_status.py b/chimere/migrations/0009_auto__add_field_importer_default_status.py deleted file mode 100644 index e29c599..0000000 --- a/chimere/migrations/0009_auto__add_field_importer_default_status.py +++ /dev/null @@ -1,289 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Importer.default_status' - db.add_column('chimere_importer', 'default_status', - self.gf('django.db.models.fields.CharField')(default='I', max_length=1), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Importer.default_status' - db.delete_column('chimere_importer', 'default_status') - - - models = { - 'chimere.aggregatedroute': { - 'Meta': {'object_name': 'AggregatedRoute', 'db_table': "'chimere_aggregated_routes'", 'managed': 'False'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'route': ('django.contrib.gis.db.models.fields.MultiLineStringField', [], {}), - 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), - 'subcategory': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.SubCategory']"}) - }, - 'chimere.area': { - 'Meta': {'ordering': "('order', 'name')", 'object_name': 'Area'}, - 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - 'default_subcategories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False', 'blank': 'True'}), - 'dynamic_categories': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - 'external_css': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'layers': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'through': "orm['chimere.AreaLayers']", 'to': "orm['chimere.Layer']"}), - 'lower_right_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), - 'order': ('django.db.models.fields.IntegerField', [], {'unique': 'True'}), - 'restrict_to_extent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'db_table': "'chimere_subcategory_areas'", 'to': "orm['chimere.SubCategory']"}), - 'upper_left_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), - 'urn': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'blank': 'True'}), - 'welcome_message': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) - }, - 'chimere.arealayers': { - 'Meta': {'ordering': "('order',)", 'object_name': 'AreaLayers'}, - 'area': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Area']"}), - 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'layer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Layer']"}), - 'order': ('django.db.models.fields.IntegerField', [], {}) - }, - 'chimere.category': { - 'Meta': {'ordering': "['order']", 'object_name': 'Category'}, - 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), - 'order': ('django.db.models.fields.IntegerField', [], {}) - }, - 'chimere.color': { - 'Meta': {'ordering': "['order']", 'object_name': 'Color'}, - 'code': ('django.db.models.fields.CharField', [], {'max_length': '6'}), - 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'order': ('django.db.models.fields.IntegerField', [], {}) - }, - 'chimere.colortheme': { - 'Meta': {'object_name': 'ColorTheme'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) - }, - 'chimere.icon': { - 'Meta': {'object_name': 'Icon'}, - 'height': ('django.db.models.fields.IntegerField', [], {}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), - 'width': ('django.db.models.fields.IntegerField', [], {}) - }, - 'chimere.importer': { - 'Meta': {'object_name': 'Importer'}, - 'associate_marker_to_way': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'automatic_update': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'categories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.SubCategory']", 'null': 'True', 'blank': 'True'}), - 'default_description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'default_localisation': ('chimere.widgets.PointField', [], {'null': 'True', 'blank': 'True'}), - 'default_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'default_status': ('django.db.models.fields.CharField', [], {'default': "'I'", 'max_length': '1'}), - 'filtr': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'get_description': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'importer_type': ('django.db.models.fields.CharField', [], {'max_length': '4'}), - 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'overwrite': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'source_file_alt': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'srid': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'state': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'zipped': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) - }, - 'chimere.importerkeycategories': { - 'Meta': {'object_name': 'ImporterKeyCategories'}, - 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.SubCategory']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'importer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'key_categories'", 'to': "orm['chimere.Importer']"}), - 'key': ('django.db.models.fields.CharField', [], {'max_length': '200'}) - }, - 'chimere.layer': { - 'Meta': {'object_name': 'Layer'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'layer_code': ('django.db.models.fields.TextField', [], {'max_length': '300'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) - }, - 'chimere.marker': { - 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Marker'}, - 'available_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), - 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'is_front_page': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), - 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'point': ('chimere.widgets.PointField', [], {}), - 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_marker'", 'null': 'True', 'to': "orm['chimere.Marker']"}), - 'route': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'associated_marker'", 'null': 'True', 'to': "orm['chimere.Route']"}), - 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), - 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), - 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), - 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}) - }, - 'chimere.multimediaextension': { - 'Meta': {'object_name': 'MultimediaExtension'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'extensions'", 'to': "orm['chimere.MultimediaType']"}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '6'}) - }, - 'chimere.multimediafile': { - 'Meta': {'object_name': 'MultimediaFile'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'multimedia_files'", 'to': "orm['chimere.Marker']"}), - 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.MultimediaType']", 'null': 'True', 'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), - 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), - 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}) - }, - 'chimere.multimediatype': { - 'Meta': {'object_name': 'MultimediaType'}, - 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'iframe': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'media_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), - 'mime_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) - }, - 'chimere.news': { - 'Meta': {'object_name': 'News'}, - 'areas': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.Area']", 'null': 'True', 'blank': 'True'}), - 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'content': ('django.db.models.fields.TextField', [], {}), - 'date': ('django.db.models.fields.DateField', [], {}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_front_page': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}), - 'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}) - }, - 'chimere.page': { - 'Meta': {'object_name': 'Page'}, - 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'content': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mnemonic': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), - 'order': ('django.db.models.fields.IntegerField', [], {'default': '10', 'null': 'True', 'blank': 'True'}), - 'template_path': ('django.db.models.fields.CharField', [], {'max_length': '150', 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}) - }, - 'chimere.picturefile': { - 'Meta': {'object_name': 'PictureFile'}, - 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pictures'", 'to': "orm['chimere.Marker']"}), - 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), - 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), - 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), - 'thumbnailfile': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'thumbnailfile_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'thumbnailfile_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) - }, - 'chimere.property': { - 'Meta': {'object_name': 'Property'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'marker': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Marker']"}), - 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.PropertyModel']"}), - 'value': ('django.db.models.fields.TextField', [], {}) - }, - 'chimere.propertymodel': { - 'Meta': {'ordering': "('order',)", 'object_name': 'PropertyModel'}, - 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mandatory': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), - 'order': ('django.db.models.fields.IntegerField', [], {}), - 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'properties'", 'blank': 'True', 'to': "orm['chimere.SubCategory']"}), - 'type': ('django.db.models.fields.CharField', [], {'max_length': '1'}) - }, - 'chimere.propertymodelchoice': { - 'Meta': {'object_name': 'PropertyModelChoice'}, - 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'choices'", 'to': "orm['chimere.PropertyModel']"}), - 'value': ('django.db.models.fields.CharField', [], {'max_length': '150'}) - }, - 'chimere.route': { - 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Route'}, - 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.RouteFile']", 'null': 'True', 'blank': 'True'}), - 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), - 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), - 'has_associated_marker': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), - 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_route'", 'null': 'True', 'to': "orm['chimere.Route']"}), - 'route': ('chimere.widgets.RouteField', [], {}), - 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), - 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), - 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), - 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), - 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) - }, - 'chimere.routefile': { - 'Meta': {'ordering': "('name',)", 'object_name': 'RouteFile'}, - 'file_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), - 'raw_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'simplified_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}) - }, - 'chimere.subcategory': { - 'Meta': {'ordering': "['category', 'order']", 'object_name': 'SubCategory'}, - 'as_layer': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subcategories'", 'to': "orm['chimere.Category']"}), - 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']", 'null': 'True', 'blank': 'True'}), - 'dated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'hover_icon': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'subcat_hovered'", 'null': 'True', 'to': "orm['chimere.Icon']"}), - 'icon': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Icon']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'item_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), - 'order': ('django.db.models.fields.IntegerField', [], {'default': '1000'}), - 'routing_warn': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'submission': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) - }, - 'chimere.tinyurl': { - 'Meta': {'object_name': 'TinyUrl'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parameters': ('django.db.models.fields.CharField', [], {'max_length': '500'}) - } - } - - complete_apps = ['chimere'] \ No newline at end of file diff --git a/chimere/migrations/0011_auto__add_field_importer_default_status.py b/chimere/migrations/0011_auto__add_field_importer_default_status.py new file mode 100644 index 0000000..bb36e42 --- /dev/null +++ b/chimere/migrations/0011_auto__add_field_importer_default_status.py @@ -0,0 +1,292 @@ +# -*- 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 field 'Importer.default_status' + db.add_column('chimere_importer', 'default_status', + self.gf('django.db.models.fields.CharField')(default='I', max_length=1), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'Importer.default_status' + db.delete_column('chimere_importer', 'default_status') + + + models = { + 'chimere.aggregatedroute': { + 'Meta': {'object_name': 'AggregatedRoute', 'db_table': "'chimere_aggregated_routes'", 'managed': 'False'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'route': ('django.contrib.gis.db.models.fields.MultiLineStringField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'subcategory': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.SubCategory']"}) + }, + 'chimere.area': { + 'Meta': {'ordering': "('order', 'name')", 'object_name': 'Area'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'default_subcategories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False', 'blank': 'True'}), + 'dynamic_categories': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'external_css': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layers': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'through': "orm['chimere.AreaLayers']", 'to': "orm['chimere.Layer']"}), + 'lower_right_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'unique': 'True'}), + 'restrict_to_extent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'db_table': "'chimere_subcategory_areas'", 'to': "orm['chimere.SubCategory']"}), + 'upper_left_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'urn': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'blank': 'True'}), + 'welcome_message': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.arealayers': { + 'Meta': {'ordering': "('order',)", 'object_name': 'AreaLayers'}, + 'area': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Area']"}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Layer']"}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.category': { + 'Meta': {'ordering': "['order']", 'object_name': 'Category'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.color': { + 'Meta': {'ordering': "['order']", 'object_name': 'Color'}, + 'code': ('django.db.models.fields.CharField', [], {'max_length': '6'}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.colortheme': { + 'Meta': {'object_name': 'ColorTheme'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.icon': { + 'Meta': {'object_name': 'Icon'}, + 'height': ('django.db.models.fields.IntegerField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'width': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.importer': { + 'Meta': {'object_name': 'Importer'}, + 'associate_marker_to_way': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'automatic_update': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.SubCategory']", 'null': 'True', 'blank': 'True'}), + 'default_description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'default_localisation': ('chimere.widgets.PointField', [], {'null': 'True', 'blank': 'True'}), + 'default_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'default_status': ('django.db.models.fields.CharField', [], {'default': "'I'", 'max_length': '1'}), + 'filtr': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'get_description': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'importer_type': ('django.db.models.fields.CharField', [], {'max_length': '4'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'overwrite': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'source_file_alt': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'srid': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'zipped': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'chimere.importerkeycategories': { + 'Meta': {'object_name': 'ImporterKeyCategories'}, + 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.SubCategory']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'importer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'key_categories'", 'to': "orm['chimere.Importer']"}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'chimere.layer': { + 'Meta': {'object_name': 'Layer'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer_code': ('django.db.models.fields.TextField', [], {'max_length': '300'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.marker': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Marker'}, + 'available_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'is_front_page': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'keywords': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'point': ('chimere.widgets.PointField', [], {}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_marker'", 'null': 'True', 'to': "orm['chimere.Marker']"}), + 'route': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'associated_marker'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.multimediaextension': { + 'Meta': {'object_name': 'MultimediaExtension'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'extensions'", 'to': "orm['chimere.MultimediaType']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '6'}) + }, + 'chimere.multimediafile': { + 'Meta': {'object_name': 'MultimediaFile'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'multimedia_files'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.MultimediaType']", 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}) + }, + 'chimere.multimediatype': { + 'Meta': {'object_name': 'MultimediaType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'iframe': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'media_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'mime_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.news': { + 'Meta': {'object_name': 'News'}, + 'areas': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.Area']", 'null': 'True', 'blank': 'True'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'date': ('django.db.models.fields.DateField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_front_page': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.page': { + 'Meta': {'object_name': 'Page'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'content': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mnemonic': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '10', 'null': 'True', 'blank': 'True'}), + 'template_path': ('django.db.models.fields.CharField', [], {'max_length': '150', 'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.picturefile': { + 'Meta': {'object_name': 'PictureFile'}, + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pictures'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'thumbnailfile': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'thumbnailfile_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'thumbnailfile_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.property': { + 'Meta': {'object_name': 'Property'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Marker']"}), + 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.PropertyModel']"}), + 'value': ('django.db.models.fields.TextField', [], {}) + }, + 'chimere.propertymodel': { + 'Meta': {'ordering': "('order',)", 'object_name': 'PropertyModel'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mandatory': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'properties'", 'blank': 'True', 'to': "orm['chimere.SubCategory']"}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '1'}) + }, + 'chimere.propertymodelchoice': { + 'Meta': {'object_name': 'PropertyModelChoice'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'choices'", 'to': "orm['chimere.PropertyModel']"}), + 'value': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.route': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Route'}, + 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.RouteFile']", 'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'has_associated_marker': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'keywords': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_route'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'route': ('chimere.widgets.RouteField', [], {}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.routefile': { + 'Meta': {'ordering': "('name',)", 'object_name': 'RouteFile'}, + 'file_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'raw_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'simplified_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.subcategory': { + 'Meta': {'ordering': "['category', 'order']", 'object_name': 'SubCategory'}, + 'as_layer': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subcategories'", 'to': "orm['chimere.Category']"}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']", 'null': 'True', 'blank': 'True'}), + 'dated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'hover_icon': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'subcat_hovered'", 'null': 'True', 'to': "orm['chimere.Icon']"}), + 'icon': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Icon']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'item_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'keywords': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1000'}), + 'routing_warn': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'submission': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + }, + 'chimere.tinyurl': { + 'Meta': {'object_name': 'TinyUrl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'parameters': ('django.db.models.fields.CharField', [], {'max_length': '500'}) + } + } + + complete_apps = ['chimere'] \ No newline at end of file -- cgit v1.2.3 From 99f5c4e65b884dbf8674d6dfb346efe43b23f1d6 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 25 Sep 2015 16:35:58 +0200 Subject: JS: hide popup on new search --- chimere/static/chimere/js/jquery.chimere.js | 1 + 1 file changed, 1 insertion(+) diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index f7e0785..0d164d0 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -668,6 +668,7 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { }); }, razMap: function() { + methods.hidePopup(); settings.layerMarkers.clearMarkers(); settings.layerVectors.removeAllFeatures(); }, -- cgit v1.2.3 From f13cc64d7fc133055d9c77e728de1f3df9d7ba07 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 25 Sep 2015 17:44:36 +0200 Subject: JS: fix unselection of categories / clean when dealing with clusters. --- chimere/static/chimere/js/jquery.chimere.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index 0d164d0..07cf160 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -669,8 +669,15 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { }, razMap: function() { methods.hidePopup(); + methods.uncheckCategories(); settings.layerMarkers.clearMarkers(); settings.layerVectors.removeAllFeatures(); + if (settings.enable_clustering){ + settings.layerCluster.removeAllFeatures(); + settings.cluster_array = []; + settings.layerCluster.addFeatures(settings.cluster_array); + methods.cleanCluster(); + } }, /* * Update the categories div in ajax @@ -696,7 +703,7 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { _init_categories(); _reCheckCategories(); if (settings.current_category) { - // TODO : add a force mode + // TODO : add a force mode // (in case the category is yet visible in HTML...) methods.toggle_category(); } @@ -804,6 +811,18 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { } } }, + /* + * + */ + uncheckCategories: function (){ + $('#frm_categories .subcategories input:checkbox').each(function(index){ + $(this).attr("checked", false); + $(this).removeAttr("checked", false); + }); + $('#frm_categories .selected').each(function(index){ + $(this).removeClass("selected"); + }); + }, /* * Hide clusterized markers */ -- cgit v1.2.3 From e6800dee22a9ebfe426662746d239a0c484ac520 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 28 Sep 2015 23:43:59 +0200 Subject: Add RSS option for share bar --- chimere/templatetags/chimere_tags.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chimere/templatetags/chimere_tags.py b/chimere/templatetags/chimere_tags.py index a89b721..61a1ab9 100644 --- a/chimere/templatetags/chimere_tags.py +++ b/chimere/templatetags/chimere_tags.py @@ -318,9 +318,10 @@ def get_tinyfied_url(marker, area_name=''): @register.inclusion_tag('chimere/blocks/share_bar.html', takes_context=True) -def share_bar(context, name='', email_only=False): +def share_bar(context, name='', email_only=False, rss=True): context['STATIC_URL'] = settings.STATIC_URL context['name'] = name + context['rss'] = rss context['email_only'] = email_only context['share_networks'] = [(defaultfilters.slugify(name), url, icon) for name, url, icon in settings.CHIMERE_SHARE_NETWORKS] -- cgit v1.2.3 From 29ac339c908a590af01e38daf3b072dc476fa2a0 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 14 Oct 2015 16:59:09 +0200 Subject: Disable zoombar (too problematic) --- chimere/static/chimere/css/styles.css | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css index 9ae66ed..c23e843 100644 --- a/chimere/static/chimere/css/styles.css +++ b/chimere/static/chimere/css/styles.css @@ -1124,6 +1124,11 @@ div.pp_default .pp_expand{ right: 10px; } +.olControlSimplePanZoom #zoombar, +.olControlSimplePanZoom #slider{ + display: none; +} + .olControlSimplePanZoom .button { background-image: url('../img/map_sprite.png'); position:absolute; @@ -1170,11 +1175,12 @@ div.pp_default .pp_expand{ } .olControlSimplePanZoom #zoomout { - top:210px; + top:70px; width:25px; height:20px; left:10px; background-position: -15px -220px; + border-top:1px solid #ccc; } .olControlSimplePanZoom #slider { -- cgit v1.2.3 From d2ca6b5ea37832ba7477b3d02425b83ca0938f49 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 19 Nov 2015 16:39:40 +0100 Subject: Flake8 --- chimere/tasks.py | 37 +++--- chimere/utils.py | 370 +++++++++++++++++++++++++++++-------------------------- 2 files changed, 216 insertions(+), 191 deletions(-) diff --git a/chimere/tasks.py b/chimere/tasks.py index 9c94f43..9eff7f5 100644 --- a/chimere/tasks.py +++ b/chimere/tasks.py @@ -60,19 +60,20 @@ else: return task_exc IMPORT_MESSAGES = { - 'import_pending':[_(u"Import pending")], - 'import_process':[_(u"Import processing")], - 'import_done':[_(u"Import successfuly done"), + 'import_pending': [_(u"Import pending")], + 'import_process': [_(u"Import processing")], + 'import_done': [_(u"Import successfuly done"), _(u" %(new)d new item(s), %(updated)d updated item(s)")], - 'import_failed':[_(u"Import failed"), "%s"], - 'import_cancel':[_(u"Import canceled")], - 'export_pending':[_(u"Export pending")], - 'export_process':[_(u"Export processing")], - 'export_done':[_(u"Export successfuly done"), + 'import_failed': [_(u"Import failed"), "%s"], + 'import_cancel': [_(u"Import canceled")], + 'export_pending': [_(u"Export pending")], + 'export_process': [_(u"Export processing")], + 'export_done': [_(u"Export successfuly done"), _(u" %(updated)d updated item(s)")], - 'export_failed':[_(u"Export failed"), "%s"], - 'export_cancel':[_(u"Export canceled")] - } + 'export_failed': [_(u"Export failed"), "%s"], + 'export_cancel': [_(u"Export canceled")] +} + @task() def importing(importer_pk): @@ -89,15 +90,16 @@ def importing(importer_pk): new_item, updated_item, error = importer.manager.get() importer.state = error + '\n' if error else '' importer.state += unicode(IMPORT_MESSAGES['import_done'][0]) - importer.state += u" - " \ - + unicode(IMPORT_MESSAGES['import_done'][1]) % {'new':new_item, - 'updated':updated_item} + importer.state += \ + u" - " + unicode(IMPORT_MESSAGES['import_done'][1]) % { + 'new': new_item, 'updated': updated_item} importer.state = importer.state importer.save() return True + @task() -@single_instance_task(60*10) +@single_instance_task(60 * 10) def exporting(importer_pk, extra_args=[]): try: importer = Importer.objects.get(pk=importer_pk) @@ -116,10 +118,11 @@ def exporting(importer_pk, extra_args=[]): pass if error: importer.state = unicode(IMPORT_MESSAGES['export_failed'][0]) \ - + u" - " + unicode(IMPORT_MESSAGES['export_failed'][1]) % error + + u" - " + unicode(IMPORT_MESSAGES['export_failed'][1]) % error importer.save() return importer.state = unicode(IMPORT_MESSAGES['export_done'][0]) + u" - " \ - + unicode(IMPORT_MESSAGES['export_done'][1]) % {'updated':updated_item} + + unicode(IMPORT_MESSAGES['export_done'][1]) % { + 'updated': updated_item} importer.save() return True diff --git a/chimere/utils.py b/chimere/utils.py index c5c59e9..e017762 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -45,26 +45,30 @@ from django.utils.translation import ugettext_lazy as _ from chimere import get_version from external_utils import OsmApi + def unicode_normalize(string): if type(string) == str: string = unicode(string.decode('utf-8')) return ''.join( (c for c in unicodedata.normalize('NFD', string) - if unicodedata.category(c) != 'Mn')) + if unicodedata.category(c) != 'Mn')) + class ImportManager(object): u""" Generic class for specific importers """ default_source = None + def __init__(self, importer_instance): self.importer_instance = importer_instance if self.importer_instance.default_name: self.default_name = self.importer_instance.default_name else: - self.default_name = " - ".join([cat.name + self.default_name = " - ".join([ + cat.name for cat in self.importer_instance.categories.order_by( - 'name').all()]) + 'name').all()]) def get(self): raise NotImplementedError @@ -83,8 +87,8 @@ class ImportManager(object): item = None if import_key or pk: dct_import = { - 'import_key__icontains':'%s:%s;' % (key, import_key), - 'import_source':self.importer_instance.source} + 'import_key__icontains': '%s:%s;' % (key, import_key), + 'import_source': self.importer_instance.source} ref_item = cls.objects.filter(**dct_import) try: item = None @@ -121,12 +125,12 @@ class ImportManager(object): if not self.importer_instance.get_description and \ self.importer_instance.default_description: values['description'] = \ - self.importer_instance.default_description + self.importer_instance.default_description values.update({ - 'import_source':self.importer_instance.source}) + 'import_source': self.importer_instance.source}) values['status'] = self.importer_instance.default_status if not self.importer_instance.associate_marker_to_way\ - and cls.__name__ == 'Route': + and cls.__name__ == 'Route': values['has_associated_marker'] = False try: item = cls.objects.create(**values) @@ -158,8 +162,8 @@ class ImportManager(object): current_file_name = None for name in namelist: if name.endswith(suffix) \ - or name.endswith(suffix.lower()) \ - or name.endswith(suffix.upper()): + or name.endswith(suffix.lower()) \ + or name.endswith(suffix.upper()): current_file_name = name filenames.append(current_file_name) files = [] @@ -180,7 +184,7 @@ class ImportManager(object): if not hasattr(source, 'read'): if not source: source = self.importer_instance.source \ - if self.importer_instance.source else self.default_source + if self.importer_instance.source else self.default_source try: url = source if extra_url: @@ -207,6 +211,7 @@ class ImportManager(object): source = files[0] if len(suffixes) == 1 else files return (source, None) + class KMLManager(ImportManager): u""" KML importer @@ -215,6 +220,7 @@ class KMLManager(ImportManager): """ XPATH = '//kml:Folder/kml:name[text()="%s"]/../kml:Placemark' DEFAULT_XPATH = '//kml:Placemark' + def __init__(self, importer_instance, ns=''): super(KMLManager, self).__init__(importer_instance) self.ns = ns @@ -249,9 +255,9 @@ class KMLManager(ImportManager): if not self.ns: self.ns = tree.getroot().nsmap[None] xpath = self.XPATH % self.importer_instance.filtr \ - if self.importer_instance.filtr else self.DEFAULT_XPATH + if self.importer_instance.filtr else self.DEFAULT_XPATH for placemark in tree.xpath(xpath, - namespaces={'kml':self.ns}): + namespaces={'kml': self.ns}): name, point, line = None, None, None pl_id = placemark.attrib.get('id') pl_key = 'kml-%d' % self.importer_instance.pk @@ -279,10 +285,10 @@ class KMLManager(ImportManager): for p in points if p]) line = 'SRID=4326;LINESTRING(%s)' % points cls = None - dct = {'description':description, - 'name':name, - 'origin':self.importer_instance.origin, - 'license':self.importer_instance.license} + dct = {'description': description, + 'name': name, + 'origin': self.importer_instance.origin, + 'license': self.importer_instance.license} if point: dct['point'] = point cls = Marker @@ -292,7 +298,7 @@ class KMLManager(ImportManager): cls = Route if cls: item, updated, created = self.create_or_update_item( - cls, dct, pl_id, key=pl_key) + cls, dct, pl_id, key=pl_key) if updated: updated_item += 1 if created: @@ -301,15 +307,17 @@ class KMLManager(ImportManager): @classmethod def export(cls, queryset): - dct = {'name':settings.PROJECT_NAME, - 'description':unicode(datetime.date.today()), - 'locations':queryset.all() + dct = { + 'name': settings.PROJECT_NAME, + 'description': unicode(datetime.date.today()), + 'locations': queryset.all() } - filename = unicode_normalize(settings.PROJECT_NAME + dct['description']\ + filename = unicode_normalize(settings.PROJECT_NAME + dct['description'] + '.kml') result = render_to_response('chimere/export.kml', dct) return filename, result + class ShapefileManager(ImportManager): u""" Shapefile importer @@ -351,7 +359,7 @@ class ShapefileManager(ImportManager): srid = settings.CHIMERE_EPSG_DISPLAY_PROJECTION msg = _(u"SRID cannot be guessed. The default SRID (%s) has " u"been used.") % srid - #If imported items are not well located " + # If imported items are not well located " # u"ask your data provider for the SRID to use.") % srid shapefilename = tmpdir + os.sep + sources[0] ds = DataSource(shapefilename) @@ -374,7 +382,7 @@ class ShapefileManager(ImportManager): u"is not managed by Chimère.") % lyr.geom_type) geom_key = 'point' if lyr.geom_type == 'Point' else 'route' geom_cls = Marker if lyr.geom_type == 'Point' else Route - indexes = [] + # indexes = [] for idx, feat in enumerate(lyr): name = unicode(idx) if lbl_name: @@ -384,7 +392,7 @@ class ShapefileManager(ImportManager): except UnicodeDecodeError: try: name = unicode( - name.decode(settings.CHIMERE_SHAPEFILE_ENCODING)) + name.decode(settings.CHIMERE_SHAPEFILE_ENCODING)) except: continue try: @@ -393,15 +401,17 @@ class ShapefileManager(ImportManager): return (0, 0, _(u"Bad Shapefile")) if feat.geom.geom_type == 'MultiLineString': geoms = [geom.wkt for geom in feat.geom] - import_key = feat.get(id_name) if id_name and len(geoms) == 1 else '' + import_key = feat.get(id_name) if id_name and len(geoms) == 1 \ + else '' for geom in geoms: - dct = {geom_key:'SRID=%s;%s' % (srid, geom), - 'name':name, - 'origin':self.importer_instance.origin, - 'license':self.importer_instance.license - } + dct = { + geom_key: 'SRID=%s;%s' % (srid, geom), + 'name': name, + 'origin': self.importer_instance.origin, + 'license': self.importer_instance.license + } item, updated, created = self.create_or_update_item( - geom_cls, dct, import_key) + geom_cls, dct, import_key) if updated: updated_item += 1 if created: @@ -426,8 +436,9 @@ class ShapefileManager(ImportManager): tmp_name = tmp.name field_names = [field.name for field in queryset.model._meta.fields] - geo_field = getattr(queryset.model, - 'point' if 'point' in field_names else 'route')._field + geo_field = getattr( + queryset.model, + 'point' if 'point' in field_names else 'route')._field dr = ogr.GetDriverByName('ESRI Shapefile') ds = dr.CreateDataSource(tmp_name) @@ -453,7 +464,7 @@ class ShapefileManager(ImportManager): feat = ogr.Feature(feature_def) feat.SetField('name', str(unicode_normalize(item.name)[:80])) feat.SetField('category', - str(unicode_normalize(category.name)[:80])) + str(unicode_normalize(category.name)[:80])) geom = getattr(item, geo_field.name) if not geom: @@ -479,6 +490,7 @@ class ShapefileManager(ImportManager): buff.close() return filename, zip_stream + class CSVManager(ImportManager): u""" CSV importer @@ -489,9 +501,8 @@ class CSVManager(ImportManager): # (label, getter, setter) COLS = [("Id", 'pk', 'pk'), (_(u"Name"), 'name', 'name'), - (_(u"Categories"), lambda obj:", ".join( - [c.name for c in obj.categories.all()]), - set_categories), + (_(u"Categories"), lambda obj: ", ".join( + [c.name for c in obj.categories.all()]), set_categories), (_(u"State"), 'status', lambda x: x), (_(u"Description"), 'description', 'description'), (_(u"Localisation"), 'geometry', 'geometry')] @@ -514,11 +525,11 @@ class CSVManager(ImportManager): prop_cols = [] for pm in Marker.all_properties(): prop_cols.append((pm.name, pm.getAttrName(), - pm.getAttrName()+'_set')) + pm.getAttrName() + '_set')) cols = list(self.COLS) + prop_cols - datas = [] + # datas = [] for idx, row in enumerate(reader): - if not idx: # first row + if not idx: # first row try: assert(len(row) >= len(cols)) except AssertionError: @@ -526,16 +537,17 @@ class CSVManager(ImportManager): continue if len(row) < len(cols): continue - pk, name, cats, state = row[0], row[1], row[2], row[3] + # pk, name, cats, state = row[0], row[1], row[2], row[3] + pk, name = row[0], row[1] geom = row[5] description = '' if self.importer_instance.get_description: description = row[4] COL_INDEX = 6 - dct = {'description':description, - 'name':name, - 'origin':self.importer_instance.origin, - 'license':self.importer_instance.license} + dct = {'description': description, + 'name': name, + 'origin': self.importer_instance.origin, + 'license': self.importer_instance.license} cls = None if 'POINT' in geom: cls = Marker @@ -546,8 +558,8 @@ class CSVManager(ImportManager): else: continue import_key = pk if pk else name.decode('utf-8') - item, updated, created = self.create_or_update_item(cls, dct, - import_key, pk=pk) + item, updated, created = self.create_or_update_item( + cls, dct, import_key, pk=pk) if updated: updated_item += 1 if created: @@ -555,17 +567,17 @@ class CSVManager(ImportManager): for idx, col in enumerate(cols[COL_INDEX:]): name, getter, setter_val = col setter = getattr(item, setter_val) - val = row[idx+COL_INDEX] + val = row[idx + COL_INDEX] setter(item, val) return (new_item, updated_item, msg) @classmethod def export(cls, queryset): - dct = {'description':unicode(datetime.date.today()), 'data':[]} - cls_name = queryset.model.__name__.lower() + dct = {'description': unicode(datetime.date.today()), 'data': []} + # cls_name = queryset.model.__name__.lower() cols = list(cls.COLS) for pm in queryset.model.all_properties(): - cols.append((pm.name, pm.getAttrName(), pm.getAttrName()+'_set')) + cols.append((pm.name, pm.getAttrName(), pm.getAttrName() + '_set')) header = [col[0] for col in cols] dct['data'].append(header) for item in queryset.all(): @@ -576,11 +588,12 @@ class CSVManager(ImportManager): else: data.append(getattr(item, attr)) dct['data'].append(data) - filename = unicode_normalize(settings.PROJECT_NAME + dct['description']\ + filename = unicode_normalize(settings.PROJECT_NAME + dct['description'] + '.csv') result = render_to_response('chimere/export.csv', dct) return filename, result + class GeoRSSManager(ImportManager): u""" RSS importer. @@ -596,19 +609,19 @@ class GeoRSSManager(ImportManager): - number of item updated ; - error detail on error """ - from models import Marker + from models import Marker, Route new_item, updated_item, msg = 0, 0, '' feed = feedparser.parse(self.importer_instance.source) - if feed['bozo'] and not isinstance(feed['bozo_exception'], - feedparser.CharacterEncodingOverride): + if feed['bozo'] and not isinstance( + feed['bozo_exception'], feedparser.CharacterEncodingOverride): return (0, 0, _(u"RSS feed is not well formed")) for item in feed['items']: if "georss_point" not in item and 'georss_line' not in item \ and not ("geo_lat" in item and "geo_long" in item): continue cls = None - dct = {'origin':self.importer_instance.origin, - 'license':self.importer_instance.license} + dct = {'origin': self.importer_instance.origin, + 'license': self.importer_instance.license} if 'georss_point' in item or "geo_lat" in item: cls = Marker if 'georss_point' in item: @@ -630,11 +643,11 @@ class GeoRSSManager(ImportManager): points = item['georss_line'].split(' ') reordered_points = [] # lat, lon -> x, y - for idx in xrange(len(points)/2): - reordered_points.append("%s %s" % (points[idx*2+1], - points[idx*2])) + for idx in xrange(len(points) / 2): + reordered_points.append("%s %s" % (points[idx * 2 + 1], + points[idx * 2])) dct['route'] = 'SRID=4326;LINESTRING(%s)' % \ - ",".join(reordered_points) + ",".join(reordered_points) dct['name'] = item['title'] pl_id = item['id'] if 'id' in item else item['title'] @@ -649,6 +662,7 @@ RE_HOOK = re.compile('\[([^\]]*)\]') # TODO: manage deleted item from OSM + class OSMManager(ImportManager): u""" OSM importer/exporter @@ -666,8 +680,8 @@ class OSMManager(ImportManager): - updated items; - error detail on error. """ - source, msg = self.get_source_file(['.osm'], - extra_url=self.importer_instance.filtr) + source, msg = self.get_source_file( + ['.osm'], extra_url=self.importer_instance.filtr) if not source: return (0, 0, msg) @@ -680,8 +694,8 @@ class OSMManager(ImportManager): return 0, 0, _(u"Nothing to import") def import_ways(self, tree): - from chimere.models import Marker, Route - msg, items, new_item, updated_item = "", [], 0 , 0 + from chimere.models import Route + msg, items, new_item, updated_item = "", [], 0, 0 nodes = {} for node in tree.xpath('//node'): node_id = node.attrib.get('id') @@ -703,17 +717,17 @@ class OSMManager(ImportManager): points.append(item.get('ref')) if not points: continue - wkt = 'SRID=4326;LINESTRING(%s)' % ",".join([nodes[point_id] - for point_id in points if point_id in nodes]) - dct = {'route':wkt, - 'name':name, - 'origin':self.importer_instance.origin \ - or u'OpenStreetMap.org', - 'license':self.importer_instance.license \ - or u'ODbL', - 'import_version':version} + wkt = 'SRID=4326;LINESTRING(%s)' % ",".join( + [nodes[point_id] for point_id in points if point_id in nodes]) + dct = {'route': wkt, + 'name': name, + 'origin': self.importer_instance.origin + or u'OpenStreetMap.org', + 'license': self.importer_instance.license + or u'ODbL', + 'import_version': version} item, updated, created = self.create_or_update_item( - Route, dct, node_id, version) + Route, dct, node_id, version) if updated: updated_item += 1 if created: @@ -723,7 +737,7 @@ class OSMManager(ImportManager): def import_nodes(self, tree): from chimere.models import Marker - msg, items, new_item, updated_item = "", [], 0 , 0 + msg, items, new_item, updated_item = "", [], 0, 0 for node in tree.xpath('//node'): name = None node_id = node.attrib.get('id') @@ -736,15 +750,15 @@ class OSMManager(ImportManager): name = item.attrib.get('v') point = 'SRID=4326;POINT(%s %s)' % (node.get('lon'), node.get('lat')) - dct = {'point':point, - 'name':name, - 'origin':self.importer_instance.origin \ - or u'OpenStreetMap.org', - 'license':self.importer_instance.license \ - or u'ODbL', - 'import_version':version} + dct = {'point': point, + 'name': name, + 'origin': self.importer_instance.origin + or u'OpenStreetMap.org', + 'license': self.importer_instance.license + or u'ODbL', + 'import_version': version} item, updated, created = self.create_or_update_item( - Marker, dct, node_id, version) + Marker, dct, node_id, version) if updated: updated_item += 1 if created: @@ -779,8 +793,8 @@ class OSMManager(ImportManager): username = username.encode('latin1') password = password.encode('latin1') api = OsmApi.OsmApi(api=api, username=username, password=password) - api.ChangesetCreate({u"comment": u"Import from Chimère %s" % \ - get_version()}) + api.ChangesetCreate({u"comment": u"Import from Chimère %s" % + get_version()}) hooks = RE_HOOK.findall(self.importer_instance.filtr) if not hooks: hooks = RE_HOOK.findall(self.importer_instance.source) @@ -794,28 +808,31 @@ class OSMManager(ImportManager): continue if key == 'bbox': x1, y1, x2, y2 = [float(val) for val in value.split(',')] - bbox = GEOSGeometry( + bbox = GEOSGeometry( 'POLYGON((%f %f,%f %f,%f %f,%f %f,%f %f))' % ( - x1, y1, x2, y1, x2, y2, x1, y2, x1, y1), srid=4326) + x1, y1, x2, y1, x2, y2, x1, y2, x1, y1), srid=4326) continue tags[key] = value if not tags: return 0, _(u"No non ambigious tag is defined in the XAPI request") if not bbox: - return 0, _(u"No bounding box is defined in the XAPI request."\ - u"If you are sure to manage the entire planet set the bounding box"\ - u" to -180,-90,180,90") - default_dct = {'tag':tags, - 'import_source':self.importer_instance.source} + return 0, _( + u"No bounding box is defined in the XAPI request." + u"If you are sure to manage the entire planet set the " + u"bounding box to -180,-90,180,90") + default_dct = {'tag': tags, + 'import_source': self.importer_instance.source} idx = -1 - for idx, item in enumerate(Marker.objects.filter(status='A', - point__contained=bbox, - categories=self.importer_instance.categories.all(), - not_for_osm=False, modified_since_import=True, - route=None).all()): + for idx, item in enumerate( + Marker.objects.filter( + status='A', + point__contained=bbox, + categories=self.importer_instance.categories.all(), + not_for_osm=False, modified_since_import=True, + route=None).all()): dct = default_dct.copy() - dct.update({'lon':item.point.x, - 'lat':item.point.y}) + dct.update({'lon': item.point.x, + 'lat': item.point.y}) dct['tag']['name'] = item.name node = None import_key = item.get_key('OSM') @@ -830,7 +847,7 @@ class OSMManager(ImportManager): if error.status == 404: dct.pop('id') dct.pop('version') - pass # if the node doesn't exist it is created + pass # if the node doesn't exist it is created else: raise if not updated: @@ -839,20 +856,23 @@ class OSMManager(ImportManager): item.import_version = node['version'] item.save() api.ChangesetClose() - return idx+1, None + return idx + 1, None + -import urllib2, chardet, HTMLParser +import chardet +import HTMLParser from BeautifulSoup import BeautifulSoup -from lxml import etree + RE_CLEANS = ((re.compile('(\n)*|^( )*(\n)*( )*|( )*(\n)*( )*$'), ''), (re.compile(' ( )*'), ' '), (re.compile(r"""\d{1,2}) '\ - r'(?P'+ '|'.join(UNI_MONTH_NAMES['fr_FR']) +') '\ - r'(?P\d{4})?[^\d]*'\ - r'(?P\d{1,2}) '\ - r'(?P'+ '|'.join(UNI_MONTH_NAMES['fr_FR']) +') *'\ - r'(?P\d{4})?.*'), - re.compile(r'(?P\d{1,2}) '\ - r'(?P'+ '|'.join(UNI_MONTH_NAMES['fr_FR']) +') *'\ - r'(?P\d{4})?') - ], - 'en':[ - re.compile(r'(?P\d{4})-'\ - r'(?P\d{2})-'\ - r'(?P\d{2})'\ - r'(?:T'\ - r'(?P\d{2})?:'\ - r'(?P\d{2})?:'\ - r'(?P\d{2})'\ - r')?.*'\ - r'(?P\d{4})-'\ - r'(?P\d{2})-'\ - r'(?P\d{2})'\ - r'(?:T'\ - r'(?P\d{2})?:'\ - r'(?P\d{2})?:'\ - r'(?P\d{2})'\ - r')?.*' - ), - re.compile(r'(?P\d{4})-'\ - r'(?P\d{2})-'\ - r'(?P\d{2})'\ - r'(?:T'\ - r'(?P\d{2})?:'\ - r'(?P\d{2})?:'\ - r'(?P\d{2})'\ - r')?' - ) - ], - } + UNI_MONTH_NAMES = {locale: [m for m in MONTH_NAMES[locale]] + for locale in MONTH_NAMES} + +DATE_PARSINGS = { + 'fr_FR': [ + re.compile(r'(?P\d{1,2}) ' + r'(?P' + '|'.join(UNI_MONTH_NAMES['fr_FR']) + ') ' + r'(?P\d{4})?[^\d]*' + r'(?P\d{1,2}) ' + r'(?P' + '|'.join(UNI_MONTH_NAMES['fr_FR']) + ') *' + r'(?P\d{4})?.*'), + re.compile(r'(?P\d{1,2}) ' + r'(?P' + '|'.join(UNI_MONTH_NAMES['fr_FR']) + ') * ' + r'(?P\d{4})?')], + 'en': [ + re.compile(r'(?P\d{4})-' + r'(?P\d{2})-' + r'(?P\d{2})' + r'(?:T' + r'(?P\d{2})?:' + r'(?P\d{2})?:' + r'(?P\d{2})' + r')?.*' + r'(?P\d{4})-' + r'(?P\d{2})-' + r'(?P\d{2})' + r'(?:T' + r'(?P\d{2})?:' + r'(?P\d{2})?:' + r'(?P\d{2})' + r')?.*'), + re.compile(r'(?P\d{4})-' + r'(?P\d{2})-' + r'(?P\d{2})' + r'(?:T' + r'(?P\d{2})?:' + r'(?P\d{2})?:' + r'(?P\d{2})' + r')?')], +} + def clean_field(value): return value.strip() + class HtmlXsltManager(ImportManager): PARSER = 'HTMLParser' + def get(self): u""" Get data from the source @@ -939,7 +959,7 @@ class HtmlXsltManager(ImportManager): soup = BeautifulSoup(data) main_page = soup.prettify() # convert it to valid XHTML - #doc, errors = tidy_document(main_page) + # doc, errors = tidy_document(main_page) doc = main_page dom = etree.HTML(doc, getattr(etree, self.PARSER)()) try: @@ -963,8 +983,8 @@ class HtmlXsltManager(ImportManager): base_url = u"/".join(self.importer_instance.source.split(u'/')[:-1]) base_url += u"/" for item in newdom.getroot(): - c_item = {child.tag:clean_field(child.text) - for child in item.getchildren() if child.text} + c_item = {child.tag: clean_field(child.text) + for child in item.getchildren() if child.text} # try to have more information on the linked page if transform_child and 'link' in c_item: # not an absolute address @@ -985,8 +1005,8 @@ class HtmlXsltManager(ImportManager): child_dom = etree.HTML(child_page, etree.HTMLParser()) extra_keys = transform_child(child_dom).getroot() if len(extra_keys): - c_item.update({extra.tag:etree.tostring(extra) - for extra in extra_keys[0].getchildren()}) + c_item.update({extra.tag: etree.tostring(extra) + for extra in extra_keys[0].getchildren()}) items.append(c_item) # change relative link to full link, simplify, unescape HTML entities html_unescape = HTMLParser.HTMLParser().unescape @@ -994,7 +1014,7 @@ class HtmlXsltManager(ImportManager): for k in item: val = item[k] for r, replaced in RE_CLEANS: - val = re.sub(r, replaced % {'base_url':base_url}, val) + val = re.sub(r, replaced % {'base_url': base_url}, val) item[k] = html_unescape(val) self.key_categories = self.importer_instance.get_key_category_dict() self.missing_cats = set() @@ -1003,9 +1023,10 @@ class HtmlXsltManager(ImportManager): self.add_dct_item(item) msg = '' if self.missing_cats: - msg = _(u"Names \"%s\" doesn't match existing categories. " - u"Modify the import to match theses names with categories.") % ( - u'", "'.join(self.missing_cats)) + msg = _( + u"Names \"%s\" doesn't match existing categories. " + u"Modify the import to match theses names with categories.") %\ + (u'", "'.join(self.missing_cats)) return (self.new_item, self.updated_item, msg) @classmethod @@ -1042,18 +1063,18 @@ class HtmlXsltManager(ImportManager): if not m: continue values = m.groupdict() - date = self._internal_parse_date(locale, - 'year1' in values and values['year1'], - values['month1'], values['day1']) + date = self._internal_parse_date( + locale, 'year1' in values and values['year1'], + values['month1'], values['day1']) if not date: continue dct['start_date'] = date has_dates = True if 'day2' not in values: break - date = self._internal_parse_date(locale, - 'year2' in values and values['year2'], - values['month2'], values['day2']) + date = self._internal_parse_date( + locale, 'year2' in values and values['year2'], + values['month2'], values['day2']) if date: dct['end_date'] = date break @@ -1061,14 +1082,14 @@ class HtmlXsltManager(ImportManager): def add_dct_item(self, item): if not self.importer_instance.default_localisation and \ - not "point" in item and not ("lat" in item and item['lat']): + "point" not in item and not ("lat" in item and item['lat']): return cls = None - dct = {'origin':"%s" % ( - item.get('link') or '#', - self.importer_instance.origin), - 'license':self.importer_instance.license, - 'name':item['name']} + dct = { + 'origin': "%s" % ( + item.get('link') or '#', self.importer_instance.origin), + 'license': self.importer_instance.license, + 'name': item['name']} category = None if 'category' in item and item['category']: if item['category'] in self.key_categories: @@ -1095,5 +1116,6 @@ class HtmlXsltManager(ImportManager): if created: self.new_item += 1 + class XMLXsltManager(HtmlXsltManager): PARSER = 'XMLParser' -- cgit v1.2.3 From ea17ebad02a419da21c4512954c32dfb5ca7b650 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 22 Nov 2015 13:16:54 +0100 Subject: Manage JSON imports --- .../0012_auto__chg_field_importer_filtr.py | 290 +++++++++++++++++++++ chimere/models.py | 24 +- chimere/static/chimere/js/importer_interface.js | 7 +- chimere/tests.py | 16 ++ chimere/tests/test.json | 57 ++++ chimere/utils.py | 72 +++++ 6 files changed, 455 insertions(+), 11 deletions(-) create mode 100644 chimere/migrations/0012_auto__chg_field_importer_filtr.py create mode 100644 chimere/tests/test.json diff --git a/chimere/migrations/0012_auto__chg_field_importer_filtr.py b/chimere/migrations/0012_auto__chg_field_importer_filtr.py new file mode 100644 index 0000000..84e4c72 --- /dev/null +++ b/chimere/migrations/0012_auto__chg_field_importer_filtr.py @@ -0,0 +1,290 @@ +# -*- 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 'Importer.filtr' + db.alter_column('chimere_importer', 'filtr', self.gf('django.db.models.fields.TextField')(null=True)) + + def backwards(self, orm): + + # Changing field 'Importer.filtr' + db.alter_column('chimere_importer', 'filtr', self.gf('django.db.models.fields.CharField')(max_length=200, null=True)) + + models = { + 'chimere.aggregatedroute': { + 'Meta': {'object_name': 'AggregatedRoute', 'db_table': "'chimere_aggregated_routes'", 'managed': 'False'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'route': ('django.contrib.gis.db.models.fields.MultiLineStringField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'subcategory': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.SubCategory']"}) + }, + 'chimere.area': { + 'Meta': {'ordering': "('order', 'name')", 'object_name': 'Area'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'default_subcategories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False', 'blank': 'True'}), + 'dynamic_categories': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'external_css': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layers': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'through': "orm['chimere.AreaLayers']", 'to': "orm['chimere.Layer']"}), + 'lower_right_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'unique': 'True'}), + 'restrict_to_extent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'db_table': "'chimere_subcategory_areas'", 'to': "orm['chimere.SubCategory']"}), + 'upper_left_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'urn': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'blank': 'True'}), + 'welcome_message': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.arealayers': { + 'Meta': {'ordering': "('order',)", 'object_name': 'AreaLayers'}, + 'area': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Area']"}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Layer']"}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.category': { + 'Meta': {'ordering': "['order']", 'object_name': 'Category'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.color': { + 'Meta': {'ordering': "['order']", 'object_name': 'Color'}, + 'code': ('django.db.models.fields.CharField', [], {'max_length': '6'}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.colortheme': { + 'Meta': {'object_name': 'ColorTheme'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.icon': { + 'Meta': {'object_name': 'Icon'}, + 'height': ('django.db.models.fields.IntegerField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'width': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.importer': { + 'Meta': {'object_name': 'Importer'}, + 'associate_marker_to_way': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'automatic_update': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.SubCategory']", 'null': 'True', 'blank': 'True'}), + 'default_description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'default_localisation': ('chimere.widgets.PointField', [], {'null': 'True', 'blank': 'True'}), + 'default_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'default_status': ('django.db.models.fields.CharField', [], {'default': "'I'", 'max_length': '1'}), + 'filtr': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'get_description': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'importer_type': ('django.db.models.fields.CharField', [], {'max_length': '4'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'overwrite': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'source_file_alt': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'srid': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'zipped': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'chimere.importerkeycategories': { + 'Meta': {'object_name': 'ImporterKeyCategories'}, + 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.SubCategory']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'importer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'key_categories'", 'to': "orm['chimere.Importer']"}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'chimere.layer': { + 'Meta': {'object_name': 'Layer'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer_code': ('django.db.models.fields.TextField', [], {'max_length': '300'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.marker': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Marker'}, + 'available_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'is_front_page': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'keywords': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'point': ('chimere.widgets.PointField', [], {}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_marker'", 'null': 'True', 'to': "orm['chimere.Marker']"}), + 'route': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'associated_marker'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.multimediaextension': { + 'Meta': {'object_name': 'MultimediaExtension'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'extensions'", 'to': "orm['chimere.MultimediaType']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '6'}) + }, + 'chimere.multimediafile': { + 'Meta': {'object_name': 'MultimediaFile'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'multimedia_files'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.MultimediaType']", 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}) + }, + 'chimere.multimediatype': { + 'Meta': {'object_name': 'MultimediaType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'iframe': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'media_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'mime_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.news': { + 'Meta': {'object_name': 'News'}, + 'areas': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.Area']", 'null': 'True', 'blank': 'True'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'date': ('django.db.models.fields.DateField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_front_page': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.page': { + 'Meta': {'object_name': 'Page'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'content': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mnemonic': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '10', 'null': 'True', 'blank': 'True'}), + 'template_path': ('django.db.models.fields.CharField', [], {'max_length': '150', 'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.picturefile': { + 'Meta': {'object_name': 'PictureFile'}, + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pictures'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'thumbnailfile': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'thumbnailfile_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'thumbnailfile_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.property': { + 'Meta': {'object_name': 'Property'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Marker']"}), + 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.PropertyModel']"}), + 'value': ('django.db.models.fields.TextField', [], {}) + }, + 'chimere.propertymodel': { + 'Meta': {'ordering': "('order',)", 'object_name': 'PropertyModel'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mandatory': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'properties'", 'blank': 'True', 'to': "orm['chimere.SubCategory']"}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '1'}) + }, + 'chimere.propertymodelchoice': { + 'Meta': {'object_name': 'PropertyModelChoice'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'choices'", 'to': "orm['chimere.PropertyModel']"}), + 'value': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.route': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Route'}, + 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.RouteFile']", 'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'has_associated_marker': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'keywords': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_route'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'route': ('chimere.widgets.RouteField', [], {}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.routefile': { + 'Meta': {'ordering': "('name',)", 'object_name': 'RouteFile'}, + 'file_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'raw_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'simplified_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.subcategory': { + 'Meta': {'ordering': "['category', 'order']", 'object_name': 'SubCategory'}, + 'as_layer': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subcategories'", 'to': "orm['chimere.Category']"}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']", 'null': 'True', 'blank': 'True'}), + 'dated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'hover_icon': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'subcat_hovered'", 'null': 'True', 'to': "orm['chimere.Icon']"}), + 'icon': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Icon']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'item_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'keywords': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1000'}), + 'routing_warn': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'submission': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + }, + 'chimere.tinyurl': { + 'Meta': {'object_name': 'TinyUrl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'parameters': ('django.db.models.fields.CharField', [], {'max_length': '500'}) + } + } + + complete_apps = ['chimere'] \ No newline at end of file diff --git a/chimere/models.py b/chimere/models.py index be84036..e7a0f8f 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -46,7 +46,8 @@ from chimere.widgets import HiddenPointChooserWidget, PointField, RouteField, \ DatePickerWidget from chimere.managers import BaseGeoManager from chimere.utils import KMLManager, OSMManager, ShapefileManager, \ - GeoRSSManager, CSVManager, HtmlXsltManager, XMLXsltManager + GeoRSSManager, CSVManager, HtmlXsltManager, XMLXsltManager, JsonManager + class Page(models.Model): """Simple extra pages @@ -316,13 +317,14 @@ STATUS = (('S', _(u'Submited')), ('I', _(u'Imported'))) STATUS_DCT = dict(STATUS) -IMPORTERS = {'KML':KMLManager, - 'OSM':OSMManager, - 'SHP':ShapefileManager, - 'RSS':GeoRSSManager, - 'CSV':CSVManager, - 'XSLT':HtmlXsltManager, - 'XXLT':XMLXsltManager +IMPORTERS = {'KML': KMLManager, + 'OSM': OSMManager, + 'SHP': ShapefileManager, + 'RSS': GeoRSSManager, + 'CSV': CSVManager, + 'JSON': JsonManager, + 'XSLT': HtmlXsltManager, + 'XXLT': XMLXsltManager } IMPORTER_CHOICES = (('KML', 'KML'), @@ -330,20 +332,21 @@ IMPORTER_CHOICES = (('KML', 'KML'), ('SHP', 'Shapefile'), ('RSS', 'GeoRSS'), ('CSV', 'CSV'), + ('JSON', 'JSON'), ('XSLT', 'HTML-XSLT'), ('XXLT', 'XML-XSLT'), ) IMPORTER_CHOICES_DICT = dict(IMPORTER_CHOICES) + class Importer(models.Model): ''' Data importer for a specific subcategory ''' importer_type = models.CharField(_(u"Importer type"), max_length=4, choices=IMPORTER_CHOICES) - filtr = models.CharField(_(u"Filter"), max_length=200, - blank=True, null=True) + filtr = models.TextField(_(u"Filter"), blank=True, null=True) source = models.CharField(_(u"Web address"), max_length=200, blank=True, null=True, help_text=_(u"Don't forget the trailing slash")) @@ -410,6 +413,7 @@ class Importer(models.Model): dct[key_cat.key] = key_cat.category return dct + class ImporterKeyCategories(models.Model): """ Association between key and categories diff --git a/chimere/static/chimere/js/importer_interface.js b/chimere/static/chimere/js/importer_interface.js index 5c77a8d..c2a3a07 100644 --- a/chimere/static/chimere/js/importer_interface.js +++ b/chimere/static/chimere/js/importer_interface.js @@ -32,7 +32,12 @@ django.jQuery(function($) { 'field-origin', 'field-srid', 'field-license', 'field-categories', 'field-overwrite', 'field-get_description', 'field-default_localisation', - 'field-automatic_update', 'field-default_status') + 'field-automatic_update', 'field-default_status'), + JSON:new Array('field-source', 'field-source_file', 'field-default_name', + 'field-filtr', 'field-zipped', 'field-origin', + 'field-license', 'field-categories', 'field-overwrite', + 'field-get_description', 'field-automatic_update', + 'field-default_status', 'field-default_localisation') } var osm_map_initialized; var edit_map_initialized; diff --git a/chimere/tests.py b/chimere/tests.py index 3a3144e..6c39cba 100644 --- a/chimere/tests.py +++ b/chimere/tests.py @@ -323,6 +323,22 @@ class XmlXsltImporterTest(TestCase, ImporterTest): importer1.categories.add(subcategories[0]) self.marker_importers = [(importer1, 10),] + +class JsonImporterTest(TestCase, ImporterTest): + def setUp(self): + subcategories = subcategory_setup() + jsonfile = File(open(test_dir_path + 'tests/test.json')) + importer1 = Importer.objects.create( + importer_type='JSON', + source_file=jsonfile, + filtr='{"title":"name", "id_agenda":"id", ' + '"content":"description", "date_start_evt":"start_date", ' + '"date_end_evt":"end_date"}', + default_localisation='SRID=4326;POINT(-4.5 48.4)',) + importer1.categories.add(subcategories[0]) + self.marker_importers = [(importer1, 5), ] + + class FeedsTest(TestCase): def setUp(self): self.areas = areas_setup() diff --git a/chimere/tests/test.json b/chimere/tests/test.json new file mode 100644 index 0000000..6c9fa0c --- /dev/null +++ b/chimere/tests/test.json @@ -0,0 +1,57 @@ + +[ +{"id_agenda":"1759", +"title":"Exposition municipale d'Orsay : inscription en ligne", +"content":"TEST +TESTST", +"date_start_evt":"2015-08-20", +"date_end_evt":"2015-12-14", +"date_start_display":"2015-10-20", +"date_end_display":"2015-12-14", +"date_add":"2015-10-20 10:37:52", +"date_update":"2015-10-27 14:56:18" +}, +{"id_agenda":"179", +"title":"Exposition municipale d'Orsay : inscription en ligne", +"content":"TEST +TESTST", +"date_start_evt":"2015-08-20", +"date_end_evt":"2015-12-14", +"date_start_display":"2015-10-20", +"date_end_display":"2015-12-14", +"date_add":"2015-10-20 10:37:52", +"date_update":"2015-10-27 14:56:18" +}, +{"id_agenda":"19", +"title":"Exposition municipale d'Orsay : inscription en ligne", +"content":"TEST +TESTST", +"date_start_evt":"2015-08-20", +"date_end_evt":"2015-12-14", +"date_start_display":"2015-10-20", +"date_end_display":"2015-12-14", +"date_add":"2015-10-20 10:37:52", +"date_update":"2015-10-27 14:56:18" +}, +{"id_agenda":"17", +"title":"Exposition municipale d'Orsay : inscription en ligne", +"content":"TEST +TESTST", +"date_start_evt":"2015-08-20", +"date_end_evt":"2015-12-14", +"date_start_display":"2015-10-20", +"date_end_display":"2015-12-14", +"date_add":"2015-10-20 10:37:52", +"date_update":"2015-10-27 14:56:18" +}, +{"id_agenda":"59", +"title":"Exposition municipale d'Orsay : inscription en ligne", +"content":"TEST +TESTST", +"date_start_evt":"2015-08-20", +"date_end_evt":"2015-12-14", +"date_start_display":"2015-10-20", +"date_end_display":"2015-12-14", +"date_add":"2015-10-20 10:37:52", +"date_update":"2015-10-27 14:56:18" +}] diff --git a/chimere/utils.py b/chimere/utils.py index e017762..5289600 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -27,6 +27,7 @@ import feedparser import os import re import StringIO +import json import tempfile import urllib2 import unicodedata @@ -658,6 +659,77 @@ class GeoRSSManager(ImportManager): new_item += 1 return (new_item, updated_item, msg) + +class JsonManager(ImportManager): + u""" + Json importer. + This manager only gets and do not produce Json feed + """ + + def get(self): + u""" + Get data from a json simple source + + Return a tuple with: + - number of new item ; + - number of item updated ; + - error detail on error + """ + from models import Marker + new_item, updated_item, msg = 0, 0, '' + source, msg = self.get_source_file(['.json']) + if msg: + return (0, 0, msg) + + vals = source.read().replace('\n', ' ') + try: + values = json.JSONDecoder().decode(vals) + except ValueError as e: + return (new_item, updated_item, + _(u"JSON file is not well formed: " + e.message)) + # configuration in filtr + try: + filtr = json.JSONDecoder().decode(self.importer_instance.filtr) + except ValueError: + return ( + new_item, updated_item, + _(u"Bad configuration: filter field must be a valid " + u"JSON string")) + + vls = filtr.values() + for k in ('name', 'id', 'description'): + if k not in vls: + return ( + new_item, updated_item, + _(u"A key must be associated to \"%s\" in the " + u"filter.") % k) + + for item in values: + dct = {'origin': self.importer_instance.origin, + 'license': self.importer_instance.license} + for k in filtr: + if k in item and item[k]: + dct[filtr[k]] = item[k] + if 'point' in item: + x, y = item['point'].split(",") + dct['point'] = 'SRID=4326;POINT(%s %s)' % (x, y) + elif 'lat' in item and item['lat']: + dct['point'] = 'SRID=4326;POINT(%s %s)' % (item['lon'], + item['lat']) + else: + dct['point'] = self.importer_instance.default_localisation + if not dct['point']: + continue + cls = Marker + pl_id = (dct.pop('id') if 'id' in dct else dct['name']) \ + + "-" + unicode(self.importer_instance.pk) + it, updated, created = self.create_or_update_item(cls, dct, pl_id) + if updated: + updated_item += 1 + if created: + new_item += 1 + return (new_item, updated_item, msg) + RE_HOOK = re.compile('\[([^\]]*)\]') # TODO: manage deleted item from OSM -- cgit v1.2.3 From 6194bba5c5810ff45be8652140096404e629f9c4 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 22 Nov 2015 13:41:24 +0100 Subject: JSON importer: fix default location UI --- chimere/static/chimere/js/importer_interface.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chimere/static/chimere/js/importer_interface.js b/chimere/static/chimere/js/importer_interface.js index c2a3a07..1b95fb0 100644 --- a/chimere/static/chimere/js/importer_interface.js +++ b/chimere/static/chimere/js/importer_interface.js @@ -70,13 +70,17 @@ django.jQuery(function($) { osm_map_initialized = true; } } - else if (importer_val == 'XSLT' || importer_val == 'XXLT'){ + else if (importer_val == 'XSLT' || importer_val == 'XXLT' + || importer_val == 'JSON'){ $('#importerkeycategories_set-group').show(); $('#key_categories-group').show(); $('#importerkeycategories_set-group .form-row').show(); $('#key_categories-group .form-row').show(); $('.form-row.field-filtr').addClass('field-map'); $('#map_edit').show(); + $('#map_edit_area').hide(); + $('.help-osm').hide(); + $('.input-osm').hide(); if (!edit_map_initialized){ init_map_edit(); edit_map_initialized = true; -- cgit v1.2.3 From 36dc7bd5f7874871ec0603a50c6329d0f04d8a3b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 24 Nov 2015 13:42:36 +0100 Subject: Prevent crash when inconsistant data is put on choice property model --- chimere/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chimere/models.py b/chimere/models.py index e7a0f8f..9a91a74 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -1619,7 +1619,7 @@ class Property(models.Model): try: return unicode(PropertyModelChoice.objects.get( pk=self.value).value) - except self.DoesNotExist: + except (self.DoesNotExist, ValueError): return "" return unicode(self.value) @@ -1636,7 +1636,7 @@ class Property(models.Model): if self.propertymodel.type == 'C' and self.value: try: return PropertyModelChoice.objects.get(pk=self.value) - except self.DoesNotExist: + except (self.DoesNotExist, ValueError): return None else: return self.value -- cgit v1.2.3 From a6be0e9966c51aef1ef1b154d28627924902e179 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 28 Dec 2015 09:30:16 +0100 Subject: Better management of JSON imports --- chimere/utils.py | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/chimere/utils.py b/chimere/utils.py index 5289600..0dfe588 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -22,12 +22,13 @@ Utilitaries """ import csv +import collections import datetime import feedparser +import json import os import re import StringIO -import json import tempfile import urllib2 import unicodedata @@ -683,7 +684,8 @@ class JsonManager(ImportManager): vals = source.read().replace('\n', ' ') try: - values = json.JSONDecoder().decode(vals) + values = json.JSONDecoder( + object_pairs_hook=collections.OrderedDict).decode(vals) except ValueError as e: return (new_item, updated_item, _(u"JSON file is not well formed: " + e.message)) @@ -704,20 +706,38 @@ class JsonManager(ImportManager): _(u"A key must be associated to \"%s\" in the " u"filter.") % k) + default_dct = {'origin': self.importer_instance.origin, + 'license': self.importer_instance.license} + if 'prefix_title' in filtr: + default_dct['title'] = filtr.pop('prefix_title') + if 'prefix_description' in filtr: + default_dct['description'] = filtr.pop('prefix_description') + if self.importer_instance.default_localisation: + default_dct['point'] = self.importer_instance.default_localisation + for item in values: - dct = {'origin': self.importer_instance.origin, - 'license': self.importer_instance.license} + dct = default_dct.copy() for k in filtr: if k in item and item[k]: - dct[filtr[k]] = item[k] + if filtr[k] not in dct: + dct[filtr[k]] = "" + else: + if filtr[k] == 'description': + dct[filtr[k]] += "
    " + else: + dct[filtr[k]] += " " + dct[filtr[k]] += item[k] if 'point' in item: x, y = item['point'].split(",") dct['point'] = 'SRID=4326;POINT(%s %s)' % (x, y) - elif 'lat' in item and item['lat']: + elif 'lat' in item and item['lat'] \ + and 'lon' in item and item['lon']: dct['point'] = 'SRID=4326;POINT(%s %s)' % (item['lon'], item['lat']) - else: - dct['point'] = self.importer_instance.default_localisation + elif 'x' in item and item['x'] \ + and 'y' in item and item['y']: + dct['point'] = 'SRID=4326;POINT(%s %s)' % (item['x'], + item['y']) if not dct['point']: continue cls = Marker -- cgit v1.2.3 From 8acc204d20d97b6cf909d51afd0d4089bb86e132 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 28 Dec 2015 09:39:20 +0100 Subject: Import JSON: prefix_title -> prefix_name --- chimere/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chimere/utils.py b/chimere/utils.py index 0dfe588..4944d73 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -708,8 +708,8 @@ class JsonManager(ImportManager): default_dct = {'origin': self.importer_instance.origin, 'license': self.importer_instance.license} - if 'prefix_title' in filtr: - default_dct['title'] = filtr.pop('prefix_title') + if 'prefix_name' in filtr: + default_dct['name'] = filtr.pop('prefix_name') if 'prefix_description' in filtr: default_dct['description'] = filtr.pop('prefix_description') if self.importer_instance.default_localisation: -- cgit v1.2.3 From 89c4baf537a590dbe80c5f6a4c20f202c63ebb15 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 4 Jan 2016 02:07:07 +0100 Subject: Fix XHTML importer when no description is provided --- chimere/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/utils.py b/chimere/utils.py index 4944d73..8066255 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -1197,7 +1197,7 @@ class HtmlXsltManager(ImportManager): item['lat']) else: dct['point'] = self.importer_instance.default_localisation - dct['description'] = item['description'] + dct['description'] = item.get('description', '') if 'date' in item: dct.update(self.parse_date(item['date'])) key = item['key'] -- cgit v1.2.3