diff --git a/applefruitmoth/templates/applefruitmoth/index.html b/applefruitmoth/templates/applefruitmoth/index.html index 99d7500701930d5a49e74f4b65a202aaf2acc0f2..d34197b4126c55cbeef89abf10b8bb21d49f1770 100644 --- a/applefruitmoth/templates/applefruitmoth/index.html +++ b/applefruitmoth/templates/applefruitmoth/index.html @@ -31,7 +31,7 @@ <div class="col-md-6"> <p>{% trans "Description of apple fruit moth forecasting"%}</p> <h2>{% trans "Messages" %}</h2> - {% for message in vips_messages %} + {% for message in vips_messages|dictsort:"date_pub" reversed %} <div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> diff --git a/applefruitmoth/views.py b/applefruitmoth/views.py index 2323013643a75e207d2c1e57fb531fe20c0cec46..2636be88df7de06fcf1856fa2b5a5a6f503760f1 100644 --- a/applefruitmoth/views.py +++ b/applefruitmoth/views.py @@ -1,7 +1,7 @@ from django.shortcuts import render # Create your views here. -from vips_messages.models import Message, MessageTag +from vips_messages.models import Message def index(request): vips_messages = Message.get_messages_by_tag(4) # Getting apple fruit moth messages diff --git a/vips_messages/models.py b/vips_messages/models.py index f9a657f67181c2bb13707b6a416ebd41578ff59f..7bc4a291d4717c787e87a2e63fbdd5bca07bf789 100644 --- a/vips_messages/models.py +++ b/vips_messages/models.py @@ -88,7 +88,7 @@ class Message: self.illustration_caption = illustration_caption self.created_by = created_by self.message_crop_organism_ids = message_crop_organism_ids - + def get_illustration_url(self): return "http://%s/static/images/messages/%s/%s" % (settings.VIPSLOGIC_SERVER_NAME,self.organization_id,self.illustration_file_name)