@@ -30,7 +30,6 @@ Django Timezone Utils: Time Zone Utilities For Models
30
30
:alt: Development Status
31
31
32
32
33
-
34
33
**django-timezone-utils ** adds automatic time zone conversions and support
35
34
utilities to Django.
36
35
@@ -41,7 +40,7 @@ welcomed and appreciated.
41
40
Installation
42
41
------------
43
42
44
- *django-timezone-utils * works with Django 1.4, 1.5, 1.6 and 1.7.
43
+ ** django-timezone-utils * * works with Django 1.4, 1.5, 1.6 and 1.7.
45
44
46
45
To install it, simply:
47
46
@@ -100,13 +99,14 @@ Imagine you have the models ``Location`` and ``LocationReportingPeriod``:
100
99
101
100
def _get_reporting_period_timzone (obj ):
102
101
""" Called as `obj` being the LocationReportingPeriodInstance.
103
-
102
+
104
103
Note:
105
104
populate_from=lambda: instance: instance.location.timezone is not valid.
106
105
107
106
"""
108
107
return obj.location.timezone
109
108
109
+
110
110
class LocationReportingPeriod (models .Model )
111
111
location = models .ForeignKey (
112
112
verbose_name = _ (' location' ),
@@ -161,8 +161,8 @@ For each location, let's say that the client wants to see the start and end of
161
161
the reporting period in that location's time zone. One thing to remember is that
162
162
just because you saved the LocationReportingPeriod start/end dates as a
163
163
particular time zone, it does not mean that they will come that way from the
164
- database. For example, if your application's settings.TIME_ZONE is set to
165
- `` UTC ``, you would get back:
164
+ database. For example, if your application's `` settings.TIME_ZONE = 'UTC' ``,
165
+ you would get back:
166
166
167
167
.. code-block :: python
168
168
@@ -183,6 +183,7 @@ Here is how we would handle the displaying conversions from view to template:
183
183
# App
184
184
from app_label.models import LocationReportingPeriod
185
185
186
+
186
187
class LocationReportingPeriodListView (ListView ):
187
188
model = LocationReportingPeriod
188
189
template_name = ' app_label/period_list.html'
0 commit comments