Project for the UPV to develop an app like BlaBlaCar but only for UPV people.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fixed timezone on notifications

+14 -9
+1 -1
upvcarshare/journeys/models.py
··· 136 136 arrival = models.DateTimeField(verbose_name=_("fecha y hora de llegada estimada*"), null=True, blank=True) 137 137 time_window = models.PositiveIntegerField( 138 138 verbose_name=_("ventana de tiempo"), 139 - help_text=_("Se buscaran por los viajes que salgan hasta con estos minutos de antelación"), 139 + help_text=_("Se buscarán por los viajes que salgan hasta con estos minutos de antelación"), 140 140 default=DEFAULT_TIME_WINDOW, 141 141 blank=True 142 142 )
+13 -8
upvcarshare/notifications/models.py
··· 8 8 from django.core.urlresolvers import reverse 9 9 from django.db import models 10 10 from django.templatetags.l10n import localize 11 + from django.utils import timezone 11 12 from django.utils.html import strip_tags 12 13 from django.utils.safestring import mark_safe 13 14 from django.utils.six import python_2_unicode_compatible 15 + from django.utils.timezone import pytz 14 16 from django.utils.translation import ugettext_lazy as _ 15 17 from django_extensions.db.models import TimeStampedModel 16 18 ··· 60 62 """Creates the text representation of the notification.""" 61 63 value = "" 62 64 try: 65 + time_zone = pytz.timezone("Europe/Madrid") 66 + target_date = timezone.localtime(self.target.departure, time_zone) 67 + target_date = localize(target_date) 63 68 if self.verb == JOIN: 64 69 # actor is a user and target is a journey 65 70 value = _("%(user)s se ha <strong>unido</strong> al viaje <strong>%(journey)s</strong> del %(date)s") % { 66 71 "user": six.text_type(self.actor), 67 72 "journey": six.text_type(self.target).lower(), 68 - "date": localize(self.target.departure), 73 + "date": target_date, 69 74 } 70 75 elif self.verb == LEAVE: 71 76 value = _("%(user)s ha <strong>abandonado</strong> el viaje <strong>%(journey)s</strong> del %(date)s") % { 72 77 "user": six.text_type(self.actor), 73 78 "journey": six.text_type(self.target).lower(), 74 - "date": localize(self.target.departure), 79 + "date": target_date, 75 80 } 76 81 elif self.verb == THROW_OUT: 77 - value = _("%(user)s te ha <strong>expulsado</strong> el viaje <strong>%(journey)s</strong> del %(date)s") % { 82 + value = _("%(user)s te ha <strong>expulsado</strong> del viaje <strong>%(journey)s</strong> del %(date)s") % { 78 83 "user": six.text_type(self.actor), 79 84 "journey": six.text_type(self.target).lower(), 80 - "date": localize(self.target.departure), 85 + "date": target_date, 81 86 } 82 87 elif self.verb == CONFIRM: 83 88 value = _("%(user)s te ha <strong>confirmado</strong> para el viaje <strong>%(journey)s</strong> del %(date)s") % { 84 89 "user": six.text_type(self.actor), 85 90 "journey": six.text_type(self.target).lower(), 86 - "date": localize(self.target.departure), 91 + "date": target_date, 87 92 } 88 93 elif self.verb == REJECT: 89 94 value = _("%(user)s te ha <strong>rechazado</strong> para el viaje <strong>%(journey)s</strong> del %(date)s") % { 90 95 "user": six.text_type(self.actor), 91 96 "journey": six.text_type(self.target).lower(), 92 - "date": localize(self.target.departure), 97 + "date": target_date, 93 98 } 94 99 elif self.verb == CANCEL: 95 100 value = _("El viaje <strong>%(journey)s</strong> del %(date)s ha sido <strong>cancelado</strong>") % { 96 101 "journey": six.text_type(self.actor).lower(), 97 - "date": localize(self.actor.departure), 102 + "date": target_date, 98 103 } 99 104 elif self.verb == MESSAGE: 100 105 value = _("%(user)s ha mandado un <strong>nuevo mensaje</strong> en <strong>%(journey)s</strong> del %(date)s") % { 101 106 "user": six.text_type(self.actor), 102 107 "journey": six.text_type(self.target).lower(), 103 - "date": localize(self.target.departure), 108 + "date": target_date, 104 109 } 105 110 except AttributeError: 106 111 pass