From 440153e42e7c5fd32dbbcee68808c7695f078955 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Sat, 3 Oct 2015 13:08:41 +0000 Subject: [PATCH] Fixes on deployment --- INSTALLDEV.md | 4 ++-- orchestra/admin/utils.py | 16 ++++++++-------- orchestra/utils/humanize.py | 1 + requirements.txt | 4 +--- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/INSTALLDEV.md b/INSTALLDEV.md index 434b0559..5b596b6f 100644 --- a/INSTALLDEV.md +++ b/INSTALLDEV.md @@ -21,7 +21,7 @@ If you are planing to do some development you may want to consider doing it unde 3. Deploy django-orchestra development environment ```bash - bash <( curl -L https://git.io/deploy-orchestra ) --dev + bash <( curl -L http://git.io/orchestra-deploy ) --dev ``` 3. Nginx should be serving on port 80, but Django's development server can be used as well: @@ -33,5 +33,5 @@ If you are planing to do some development you may want to consider doing it unde 5. To upgrade to current master just re-run the deploy script ```bash - bash <( curl -L https://git.io/deploy-orchestra ) --dev + bash <( curl -L http://git.io/orchestra-deploy ) --dev ``` diff --git a/orchestra/admin/utils.py b/orchestra/admin/utils.py index c073a15b..2dc3e48a 100644 --- a/orchestra/admin/utils.py +++ b/orchestra/admin/utils.py @@ -9,6 +9,7 @@ from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse, NoReverseMatch from django.db import models from django.shortcuts import redirect +from django.utils import timezone from django.utils.html import escape from django.utils.safestring import mark_safe @@ -141,16 +142,15 @@ def admin_colored(*args, **kwargs): @admin_field def admin_date(*args, **kwargs): instance = args[-1] - value = get_field_value(instance, kwargs['field']) - if not value: + date = get_field_value(instance, kwargs['field']) + if not date: return kwargs.get('default', '') - if isinstance(value, datetime.datetime): - natural = humanize.naturaldatetime(value) + if isinstance(date, datetime.datetime): + natural = humanize.naturaldatetime(date) else: - natural = humanize.naturaldate(value) - return '{1}'.format( - escape(str(value)), escape(natural), - ) + natural = humanize.naturaldate(date) + local = timezone.localtime(date).strftime("%Y-%m-%d %H:%M:%S %Z") + return '{1}'.format(local, escape(natural)) def get_object_from_url(modeladmin, request): diff --git a/orchestra/utils/humanize.py b/orchestra/utils/humanize.py index e9a92b7f..d87accc8 100644 --- a/orchestra/utils/humanize.py +++ b/orchestra/utils/humanize.py @@ -82,6 +82,7 @@ def naturaldatetime(date, show_seconds=False): ).format(hours=hours, ago=ago) if delta_midnight.days == 0: + date = timezone.localtime(date) return _("yesterday at {time}").format(time=date.strftime('%H:%M')) count = 0 diff --git a/requirements.txt b/requirements.txt index c924d30c..ac887909 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,7 @@ django==1.8.2 -django-celery-email==1.0.4 django-fluent-dashboard==0.5.3 django-admin-tools==0.6.0 django-extensions==1.5.2 -django-transaction-signals==1.0.0 django-celery==3.1.16 celery==3.1.16 kombu==3.0.23 @@ -15,7 +13,7 @@ Pygments==1.6 django-filter==0.7 jsonfield==0.9.22 python-dateutil==2.2 -https://github.com/glic3rinu/passlib/archive/master.zip +passlib==1.6.2 django-iban==0.3.0 requests phonenumbers