django-recurrence
django-recurrence copied to clipboard
Widget should include a field for dtstart
The javascript part of RecurrenceWidget should include a way to add a start date to a rule. Right now none is saved. This leads to a dtstart of datetime.now() when the occurrences are generated. For most users this is probably not a desired behavior.
I'm conflicted here. I wonder if that's better obtained separately - not all uses of django-recurrence will want that (in my apps I always want datetime.now ()
for dtstart
as it happens).
If you want something different, you can do this with RecurrenceField
already, just add another date field on your form and use:
obj.recurrences.occurences (dtstart=obj.other_date)
when generating recurrences.
Does that work for you?
The alternative is adding another field type (probably just a form field type), with an extra date selector, but I'd prefer to avoid complicating the JS further if we can.
Dom
For my use-case, it would make sense to have dtstart
and dtend
as part of the main widget. I'd suggest making this an option that gets passed into the widget. And with an optional keyword argument that can be passed into the model and form field definition. That way it can be backwards compatible for existing users but is easy to add for users that need it.
I have a use case when the admin must specify a recurring set of promo dates that begins on a specific date. For example, every Tuesday for 3 months, starting from 1 of June. Now we need to remember to generate that before the first Tuesday of June to create this properly, and it is a bit awkward.
Solution described by @stefanfoulis would be perfect.
In my current use case it would also make sense to be able to set dtstart
directly in the form widget. I like @stefanfoulis backwards-compatible solution. If there is a fair chance of it being merged, I would take a shot at tackling this (optional) feature in a pull request.
Hi @zepp-lee - I'm open to merging something like @stefanfoulis suggests if it can be done without adding too much complication to the JS.
Has this completed being ignored?
If someone has a patch for this that can be merged, without complicating the JS too much, it'll be merged.