summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chimere/main/admin.py7
-rw-r--r--chimere/main/forms.py2
-rw-r--r--chimere/main/models.py29
-rw-r--r--chimere/main/widgets.py7
-rw-r--r--docs/en/INSTALL.t2t4
5 files changed, 28 insertions, 21 deletions
diff --git a/chimere/main/admin.py b/chimere/main/admin.py
index 31c9d5c..0f8231f 100644
--- a/chimere/main/admin.py
+++ b/chimere/main/admin.py
@@ -49,6 +49,7 @@ class MarkerAdmin(admin.ModelAdmin):
search_fields = ("name",)
list_display = ('name', 'subcategory', 'status')
list_filter = ('status', 'subcategory')
+ exclude = ['height', 'width']
form = MarkerAdminForm
def queryset(self, request):
@@ -71,6 +72,7 @@ class RouteAdmin(admin.ModelAdmin):
search_fields = ("name",)
list_display = ('name', 'subcategory', 'status')
list_filter = ('status', 'subcategory')
+ exclude = ['height', 'width']
form = RouteAdminForm
def queryset(self, request):
@@ -119,10 +121,13 @@ class ColorInline(admin.TabularInline):
class ColorThemeAdmin(admin.ModelAdmin):
inlines = [ColorInline,]
+class IconAdmin(admin.ModelAdmin):
+ exclude = ['height', 'width']
+
# register of differents database fields
admin.site.register(News, NewsAdmin)
admin.site.register(Category, CategoryAdmin)
-admin.site.register(Icon)
+admin.site.register(Icon, IconAdmin)
admin.site.register(SubCategory, SubCategoryAdmin)
admin.site.register(Marker, MarkerAdmin)
admin.site.register(Route, RouteAdmin)
diff --git a/chimere/main/forms.py b/chimere/main/forms.py
index f2490da..2eff8b1 100644
--- a/chimere/main/forms.py
+++ b/chimere/main/forms.py
@@ -247,8 +247,10 @@ class AreaAdminForm(forms.ModelForm):
"""
Custom save method in order to manage area
"""
+ print 1
new_area = super(AreaAdminForm, self).save(*args, **keys)
area = self.cleaned_data['area']
+ print 2
new_area.upper_left_corner = 'POINT(%s %s)' % (area[0][0], area[0][1])
new_area.lower_right_corner = 'POINT(%s %s)' % (area[1][0],
area[1][1])
diff --git a/chimere/main/models.py b/chimere/main/models.py
index 3efc1bc..5744529 100644
--- a/chimere/main/models.py
+++ b/chimere/main/models.py
@@ -27,8 +27,7 @@ from django.contrib.gis.gdal import SpatialReference
from django.contrib import admin
from chimere import settings
-from chimere.main.widgets import PointField, RouteField, \
- ManyToManyField_NoSyncdb
+from chimere.main.widgets import PointField, RouteField
class News(models.Model):
"""News of the site
@@ -42,6 +41,7 @@ class News(models.Model):
return self.title
class Meta:
verbose_name = _("News")
+ verbose_name_plural = _("News")
class TinyUrl(models.Model):
"""Tinyfied version of permalink parameters
@@ -122,6 +122,8 @@ class Icon(models.Model):
name = models.CharField(_("Name"), max_length=150)
image = models.ImageField(_("Image"), upload_to='icons',
height_field='height', width_field='width')
+ height = models.IntegerField(_("Height"))
+ width = models.IntegerField(_("Width"))
def __unicode__(self):
return self.name
class Meta:
@@ -163,8 +165,8 @@ class SubCategory(models.Model):
if area_name:
area = Area.objects.get(urn=area_name)
# if there some restrictions with categories limit them
- if area.subcategories.count():
- sub_ids = [sub.id for sub in area.subcategories.all()]
+ if area.subcategory_set.count():
+ sub_ids = [sub.id for sub in area.subcategory_set.all()]
# if no area is defined for a category don't filter it
sub_ids += [sub.id for sub in subcategories
if not sub.areas.count()]
@@ -184,9 +186,11 @@ class Marker(models.Model):
'''
name = models.CharField(_("Name"), max_length=150)
subcategory = models.ForeignKey(SubCategory, verbose_name=_("Subcategory"))
- point = PointField(_("Localisation"))
+ point = PointField(_("Localisation"), srid=settings.EPSG_DISPLAY_PROJECTION)
picture = models.ImageField(_("Image"), upload_to='upload', blank=True,
- height_field='height', width_field='width')
+ null=True, height_field='height', width_field='width')
+ height = models.IntegerField(_("Height"), blank=True, null=True)
+ width = models.IntegerField(_("Width"), blank=True, null=True)
STATUS = (('S', _('Submited')),
('A', _('Available')),
('D', _('Disabled')),)
@@ -252,9 +256,11 @@ class Route(models.Model):
'''
name = models.CharField(_("Name"), max_length=150)
subcategory = models.ForeignKey(SubCategory, verbose_name=_("Subcategory"))
- route = RouteField(_("Route"))
+ route = RouteField(_("Route"), srid=settings.EPSG_DISPLAY_PROJECTION)
picture = models.ImageField(_("Image"), upload_to='upload', blank=True,
- height_field='height', width_field='width')
+ null=True, height_field='height', width_field='width')
+ height = models.IntegerField(_("Height"), blank=True, null=True)
+ width = models.IntegerField(_("Width"), blank=True, null=True)
STATUS = (('S', _('Submited')),
('A', _('Available')),
('D', _('Disabled')),)
@@ -391,15 +397,12 @@ class Area(models.Model, SimpleArea):
name = models.CharField(_("Name"), max_length=150)
urn = models.SlugField(_("Area urn"), max_length=50, blank=True,
unique=True)
- subcategories = ManyToManyField_NoSyncdb(SubCategory,
- related_name='subcategories', blank=True, null=True,
- db_table=u'subcategory_areas')
order = models.IntegerField(_("Order"))
available = models.BooleanField(_("Available"))
upper_left_corner = models.PointField(_("Upper left corner"),
- default='POINT(0 0)')
+ default='POINT(0 0)', srid=settings.EPSG_DISPLAY_PROJECTION)
lower_right_corner = models.PointField(_("Lower right corner"),
- default='POINT(0 0)')
+ default='POINT(0 0)', srid=settings.EPSG_DISPLAY_PROJECTION)
objects = models.GeoManager()
def __unicode__(self):
diff --git a/chimere/main/widgets.py b/chimere/main/widgets.py
index 4ad6475..e3977a1 100644
--- a/chimere/main/widgets.py
+++ b/chimere/main/widgets.py
@@ -33,11 +33,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 ManyToManyField_NoSyncdb(models.ManyToManyField):
- def __init__(self, *args, **kwargs):
- super(ManyToManyField_NoSyncdb, self).__init__(*args, **kwargs)
- self.creates_table = False
-
def getMapJS(area_name=''):
'''Variable initialization for drawing the map
'''
@@ -136,7 +131,7 @@ class PointField(models.PointField):
keys.update(defaults)
return super(PointField, self).formfield(**keys)
- def clean(self, value):
+ def clean(self, value, instance=None):
if len(value) != 2 and self.required:
raise ValidationError(_("Invalid point"))
return value
diff --git a/docs/en/INSTALL.t2t b/docs/en/INSTALL.t2t
index 01ddd9a..9cfdd25 100644
--- a/docs/en/INSTALL.t2t
+++ b/docs/en/INSTALL.t2t
@@ -30,7 +30,7 @@ Optionaly (but recommanded):
- [tinymce http://tinymce.moxiecode.com/]
-The simpliest way to obtain these packages is to get them from your favorite Linux distribution repositories (for instance python, python-django, tinymce, apache2, libapache2-mod-python, libgeos-3.0.0, proj, gdal-bin, python-psycopg2, python-imaging, postgresql-8.3 and postgresql-8.3-postgis packages for Debian Lenny). If these packages do not exist in your distribution's repository, please refer to the applications' websites.
+The simpliest way to obtain these packages is to get them from your favorite Linux distribution repositories (for instance python, python-django, tinymce, apache2, libapache2-mod-python, libgeos-3.2.0, proj, gdal-bin, python-psycopg2, python-imaging, postgresql-8.4 and postgresql-8.4-postgis packages for Debian Squeeze). If these packages do not exist in your distribution's repository, please refer to the applications' websites.
+++ Database configuration +++
@@ -57,6 +57,8 @@ Another solution is to get the last git version:
```
git clone git://www.peacefrogs.net/git/chimere
+git tag -l # list tagged versions
+git checkout v1.0.0 # checkout the desired version
```
+++ Install the sources +++