From e305e6b6e4a2b8d551f7302c703004cabc26a58f Mon Sep 17 00:00:00 2001 From: Horst Gutmann Date: Sun, 19 Feb 2012 19:54:36 +0100 Subject: [PATCH] Makes conference app fields and models localizable --- symposion_project/apps/conference/models.py | 25 ++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/symposion_project/apps/conference/models.py b/symposion_project/apps/conference/models.py index bd792a10..e5e52d3f 100644 --- a/symposion_project/apps/conference/models.py +++ b/symposion_project/apps/conference/models.py @@ -1,4 +1,5 @@ from django.db import models +from django.utils.translation import ugettext_lazy as _ from timezones.fields import TimeZoneField @@ -11,14 +12,14 @@ class Conference(models.Model): the full conference for a specific year, e.g. US PyCon 2012. """ - title = models.CharField(max_length=100) + title = models.CharField(_('title'), max_length=100) # when the conference runs - start_date = models.DateField(null=True, blank=True) - end_date = models.DateField(null=True, blank=True) + start_date = models.DateField(_('start date'), null=True, blank=True) + end_date = models.DateField(_('end date'), null=True, blank=True) # timezone the conference is in - timezone = TimeZoneField(blank=True) + timezone = TimeZoneField(_('timezone'), blank=True) def __unicode__(self): return self.title @@ -36,6 +37,10 @@ class Conference(models.Model): except KeyError: pass + class Meta(object): + verbose_name = _('conference') + verbose_name_plural = _('conferences') + class Section(models.Model): """ @@ -44,17 +49,21 @@ class Section(models.Model): scheduling process. """ - conference = models.ForeignKey(Conference) + conference = models.ForeignKey(Conference, verbose_name=_('conference')) - name = models.CharField(max_length=100) + name = models.CharField(_('name'), max_length=100) # when the section runs - start_date = models.DateField(null=True, blank=True) - end_date = models.DateField(null=True, blank=True) + start_date = models.DateField(_('start date'), null=True, blank=True) + end_date = models.DateField(_('end date'), null=True, blank=True) def __unicode__(self): return self.name + class Meta(object): + verbose_name = _('section') + verbose_name_plural = _('sections') + def current_conference(): from django.conf import settings