[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH] Remove dependance with GIS extension on website
From: |
Étienne Loks |
Subject: |
[Maposmatic-dev] [PATCH] Remove dependance with GIS extension on website database |
Date: |
Wed, 9 Sep 2009 11:33:02 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
---
www/maposmatic/views.py | 8 +++++---
www/maposmatic/widgets.py | 10 ----------
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/www/maposmatic/views.py b/www/maposmatic/views.py
index 9666a13..0af721f 100644
--- a/www/maposmatic/views.py
+++ b/www/maposmatic/views.py
@@ -25,7 +25,8 @@
from django.core.paginator import Paginator
from django.forms.util import ErrorList
-from django.forms import CharField, ChoiceField, RadioSelect, ModelForm,
ValidationError
+from django.forms import CharField, ChoiceField, FloatField, RadioSelect, \
+ ModelForm, ValidationError
from django.shortcuts import get_object_or_404, render_to_response
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
@@ -35,7 +36,7 @@ from www.maposmatic.models import MapRenderingJob
import datetime
import psycopg2
import www.settings
-from www.maposmatic.widgets import AreaField, PointField
+from www.maposmatic.widgets import AreaField
# Test if a given city has its administrative boundaries inside the
# OpenStreetMap database. We don't go through the Django ORM but
@@ -69,7 +70,8 @@ class MapRenderingJobForm(ModelForm):
('bbox', _('Bounding box')))
mode = ChoiceField(choices=modes, initial='admin', widget=RadioSelect)
maptitle = CharField(max_length=256, required=False)
- bbox = AreaField(label=_("Area"), fields=(PointField(), PointField()))
+ bbox = AreaField(label=_("Area"), fields=(FloatField(), FloatField(),
+ FloatField(), FloatField()))
def clean(self):
cleaned_data = self.cleaned_data
diff --git a/www/maposmatic/widgets.py b/www/maposmatic/widgets.py
index 522f934..c7007ff 100644
--- a/www/maposmatic/widgets.py
+++ b/www/maposmatic/widgets.py
@@ -23,7 +23,6 @@ Extra widgets and fields
from django import forms
from django.utils.safestring import mark_safe
-from django.contrib.gis.db import models
from www import settings
@@ -31,15 +30,6 @@ URL_OSM_CSS =
["http://www.openlayers.org/api/theme/default/style.css"]
URL_OSM_JS = ["http://www.openlayers.org/api/OpenLayers.js",
"http://www.openstreetmap.org/openlayers/OpenStreetMap.js"]
-class PointField(models.PointField):
- '''
- Set the widget for the form field
- '''
- def clean(self, value):
- if len(value) != 2 and self.required:
- raise ValidationError(_("Invalid point"))
- return value
-
class AreaWidget(forms.TextInput):
"""
Manage the edition of an area on the map
--
1.6.0.4
- [Maposmatic-dev] [PATCH] Remove dependance with GIS extension on website database,
Étienne Loks <=