jazzband / django-recurrence

Utility for working with recurring dates in Django.
https://django-recurrence.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
486 stars 190 forks source link

Serialization? #157

Closed bramski closed 4 years ago

bramski commented 4 years ago

I have a model that looks like such...

class Event(BaseModel):
  ...
  recurrence_rules = recurrence.fields.RecurrenceField(blank=True, null=True)

and a Viewset with a serializer as such...

class EventSerializer(ModelSerializer)
    fields = ('id', 'recurrence_rules')

When I attempt to save the model with the following string: FREQ=DAILY;INTERVAL=2;COUNT=4 I get back: {'recurrence_rules': ['malformed data']} How does one serialize the recurrence rule field?

bramski commented 4 years ago

Hello @dominicrodger do you have any input here? Appears to be a bug or missing feature to me. Most django fields are serializable.

bramski commented 4 years ago

Alright enough digging and I figured out what was missing in my example recurrence, needed a RRULE: in front to make it a valid RRULE like: RRULE:FREQ=DAILY;INTERVAL=2;COUNT=4 The message is pretty shit if you ask me for figuring out what is wrong. But I'll close the bug.