django-recurrence icon indicating copy to clipboard operation
django-recurrence copied to clipboard

Support defining the time when recurrences should happen

Open ulope opened this issue 9 years ago • 10 comments

Please consider adding an optional "time" parameter.

ulope avatar Apr 12 '15 13:04 ulope

Can you clarify a bit what you're after? Do you mean an addition to the JavaScript widget to support something like "every 10 minutes" (which is not far off being supported by the backend code), or the ability to say things like "every 10 days, at 3pm UTC"?

dominicrodger avatar Apr 12 '15 18:04 dominicrodger

I wouldn't mind both, but what I'm interested in currently is the latter. If I understand the rrule documentation correctly it should support that with the dtstart argument containing a time portion.

ulope avatar Apr 12 '15 18:04 ulope

OK - thanks. I wouldn't object to that being added. I've tended to add that in myself with a separate widget/field, and then combine them in Python. I'm not promising to work on this soon - but I will aim to get to it at some point in the next month or two, if no one else does it first (or feel free to work on it yourself @ulope, if you're happy to).

dominicrodger avatar Apr 12 '15 18:04 dominicrodger

@dominicrodger any updates on this or a workaround?

psychok7 avatar Aug 10 '17 09:08 psychok7

Sorry @psychok7 - this isn't going to be something I work on, as it's just not something I've ever needed (I tend to just have a separate field on the model for storing the time, where the events I'm storing have times I care about). I'm not sure I see the advantage of storing it along with the recurrence.

As I said - if this is something someone wants, and they're happy to write a patch, I'd be happy to review it :)

dominicrodger avatar Aug 10 '17 09:08 dominicrodger

@dominicrodger could you give some hints on where exactly would we have to change to add this functionality??

psychok7 avatar Aug 10 '17 17:08 psychok7

@dominicrodger by the way, in my case i need something that says "from timefield_1 to timefield_2". The button in the widget would be like Add time range

psychok7 avatar Aug 10 '17 17:08 psychok7

The more I think about this, the more I'm inclined to think this doesn't belong in django-recurrence. What is the advantage of doing this in django-recurrence instead of having a separate time field.?Your use case is different to the original one in this issue - so we'd presumably end up wanting two new types of widgets - one for where there's just a start time and one for where there's a time range. I'm just not sure what the advantage of this over having separate fields on the model and separate widgets in the model forms is. I'm willing to be convinced otherwise, but I don't see it right now.

dominicrodger avatar Aug 11 '17 06:08 dominicrodger

@dominicrodger I need that because I need to associate multiple time ranges. In other words, we are already able to add multiple rules in one recurrencefield with the existing widget, with your approach, how could I tell that a time range belongs to an exact rule of the 5 rules you just added for example in a simple manne with the UI? I am using django admin. I don't want to associate 1 time range to all rules in a recurrencefield, I want to associate 1 time range per rule in a recurrencefield. Even if this is something not common I would appreciate some tips on how to implement this with you package because I need it.

psychok7 avatar Aug 11 '17 09:08 psychok7

Ah, you want this per rule? If so, that's definitely not feasible, since the rules are encoded and parsed according to an external standard. I think your only option here is to add an associated ManyToManyField model which has the time range fields and the recurrence field, and to add some JS which prevents adding multiple rules (if that's what you want). I don't think this can be done inside of django-recurrence.

dominicrodger avatar Aug 11 '17 10:08 dominicrodger