diff --git a/VIPSWeb/settings.py b/VIPSWeb/settings.py index ac1cb4cef88518da881029962340a42c4ad49c1b..f1eb89488c4e58488cebdc8e74a8f17c337bf024 100755 --- a/VIPSWeb/settings.py +++ b/VIPSWeb/settings.py @@ -106,6 +106,7 @@ TEMPLATES = [ 'context_processors':[ 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.request', + 'django.contrib.messages.context_processors.messages', 'VIPSWeb.context_processors.settings' ] }, diff --git a/common/middleware/whodid.py b/common/middleware/whodid.py index 97b59e2dc4cad5035cda4b2d768d5b1f9273a57d..8a40f0042b4ddcd23925ee697e881f0f360f43e1 100755 --- a/common/middleware/whodid.py +++ b/common/middleware/whodid.py @@ -36,7 +36,7 @@ class WhodidMiddleware(object): def process_request(self, request): if not request.method in ('GET', 'HEAD', 'OPTIONS', 'TRACE'): - if hasattr(request, 'user') and request.user.is_authenticated(): + if hasattr(request, 'user') and request.user.is_authenticated: user = request.user else: user = None diff --git a/forecasts/models.py b/forecasts/models.py index b4d6c235a38c998963aff18542fad62bfb478f1c..7234e0b2c8ec3aeb59d54bda0f93834bfe920f6e 100755 --- a/forecasts/models.py +++ b/forecasts/models.py @@ -501,6 +501,9 @@ class MeasurementUnit(models.Model): opposite = models.BooleanField(default=False) def __unicode__(self): return self.name + def __str__(self): + return self.name + class Meta: ordering = ['name'] @@ -548,6 +551,9 @@ class HighChartsType(models.Model): name = models.CharField(max_length=63) def __unicode__(self): return self.name + + def __str__(self): + return self.name class ModelGraphParameter(models.Model): model_id = models.CharField(max_length=10, validators=[validate_model_id_length]) @@ -557,3 +563,6 @@ class ModelGraphParameter(models.Model): def __unicode__(self): return self.model_id + "/" + self.resultparameter.getNamespaceKey() + + def __str__(self): + return self.model_id + "/" + self.resultparameter.getNamespaceKey() diff --git a/information/models.py b/information/models.py index 5b2871fc8d42c845ad02f0557b2be6e66c115798..6594c756b70db36f6bbf1a057b1eb5b7efacdde2 100755 --- a/information/models.py +++ b/information/models.py @@ -10,6 +10,10 @@ from django.utils import translation class Information(models.Model): def __unicode__(self): return InformationLocale.get_heading_with_fallback(self.id) + + def __str__(self): + return InformationLocale.get_heading_with_fallback(self.id) + parent_information = models.ForeignKey('self', blank=True, null=True, related_name='children', verbose_name=_("Parent information"),on_delete=models.CASCADE) main_illustration = models.ImageField(upload_to='images/information', blank=True, verbose_name=_("Main illustration") ) ordering = models.IntegerField(default=0, verbose_name=_("Ordering")) diff --git a/vips_messages/models.py b/vips_messages/models.py index 59a5e34cf68c96262b518457da820db53a6efcb3..16803ab6314b9590a858f01e9d8482a7c1d214b5 100755 --- a/vips_messages/models.py +++ b/vips_messages/models.py @@ -192,6 +192,8 @@ class Message: class Advertisement(models.Model): def __unicode__(self): return self.ad_heading + def __str__(self): + return self.ad_heading """ Represents an advertisement to be shown on the frontpage """ ad_heading = models.CharField(max_length=200, verbose_name=_("Headline")) ad_text = models.TextField()