diff options
Diffstat (limited to 'chimere/main/models.py')
| -rw-r--r-- | chimere/main/models.py | 29 |
1 files changed, 16 insertions, 13 deletions
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): |
