fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'img-playground' of ssh://epsilon.fnp/home/rczajka/workspace/redakcja...
[redakcja.git]
/
apps
/
catalogue
/
helpers.py
diff --git
a/apps/catalogue/helpers.py
b/apps/catalogue/helpers.py
index
7bc2481
..
df64ade
100644
(file)
--- a/
apps/catalogue/helpers.py
+++ b/
apps/catalogue/helpers.py
@@
-1,3
+1,4
@@
+from datetime import date
from functools import wraps
from django.db.models import Count
from functools import wraps
from django.db.models import Count
@@
-28,3
+29,10
@@
def cached_in_field(field_name):
return value
return wrapped
return decorator
return value
return wrapped
return decorator
+
+
+def parse_isodate(isodate):
+ try:
+ return date(*[int(p) for p in isodate.split('-')])
+ except (AttributeError, TypeError, ValueError):
+ raise ValueError("Not a date in ISO format.")