fix some issues with dynamic initial values confusing inline formsets (for inline formsets not bound to a urlfeed).
--- a/qrurls/admin.py Sat Aug 31 19:21:41 2013 +0300
+++ b/qrurls/admin.py Sat Aug 31 21:36:49 2013 +0300
@@ -29,6 +29,7 @@
if not isinstance(urlfeed, URL) :
urlfeed = None
+ # XXX: initial values must be stable across form GET/POST, or django will be confused and think the form has been filled out
kwargs.update(initial=[
# Either generic from today, or based on the actual urlfeed
dict(published=publish) for publish in URLAdmin.publishing_schedule(urlfeed, count=extra)
@@ -49,15 +50,11 @@
"""Yield URLItem.published values for feed, or defaults."""
if urlfeed :
date, time, offset = urlfeed.publishing_schedule()
+
+ return URL.apply_publishing_schedule(date, time, offset, count)
else:
- # no data... use defaults
- tznow = timezone.now() # with tzinfo
-
- date = tznow.date()
- time = tznow.timetz()
- offset = datetime.timedelta(days=1)
-
- return URL.apply_publishing_schedule(date, time, offset, count)
+ # no data... no defaults
+ return []
def timezone (self, obj) :
now = timezone.localtime(obj.now())