Fixed date formatting issue #141

This commit is contained in:
David Taylor
2015-06-29 00:44:34 +01:00
parent 44c1704f75
commit c6e442b422
2 changed files with 27 additions and 4 deletions

View File

@@ -2,8 +2,25 @@
<button title="Changes to {{ change.field.verbose_name }}" type="button" class="btn btn-default btn-xs" data-container="body" data-html="true" data-trigger='hover' data-toggle="popover" data-content='
{% if change.new %}<div class="alert alert-success {% if change.long %}overflow-ellipsis{% endif %}">{{change.new|linebreaksbr}}</div>{% endif %}
{% if change.old %}<div class="alert alert-danger {% if change.long %}overflow-ellipsis{% endif %}">{{change.old|linebreaksbr}}</div>{% endif %}
{% if change.new %}
<div class="alert alert-success {% if change.long %}overflow-ellipsis{% endif %}">
{% if change.linebreaks %}
{{change.new|linebreaksbr}}
{% else %}
{{change.new}}
{% endif %}
</div>
{% endif %}
{% if change.old %}
<div class="alert alert-danger {% if change.long %}overflow-ellipsis{% endif %}">
{% if change.linebreaks %}
{{change.old|linebreaksbr}}
{% else %}
{{change.old}}
{% endif %}
</div>
{% endif %}
'>{{ change.field.verbose_name }}</button>

View File

@@ -16,7 +16,7 @@ import simplejson
from reversion.models import Version
from django.contrib.contenttypes.models import ContentType # Used to lookup the content_type
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.db.models import ForeignKey, IntegerField, EmailField
from django.db.models import ForeignKey, IntegerField, EmailField, TextField
from RIGS import models, forms
import datetime
@@ -56,7 +56,13 @@ def model_compare(oldObj, newObj, excluded_keys=[]):
def long(self):
if isinstance(self.field, EmailField):
return True
return False
return False
@property
def linebreaks(self):
if isinstance(self.field, TextField):
return True
return False
changes = []