|
1 | 1 | from django.db.models import fields |
2 | 2 | from django.utils.six import string_types |
3 | | -from django.core.exceptions import ValidationError |
4 | 3 | import recurrence |
5 | 4 | from recurrence import forms |
6 | 5 | from recurrence.compat import Creator |
@@ -30,24 +29,14 @@ def to_python(self, value): |
30 | 29 | if value is None or isinstance(value, recurrence.Recurrence): |
31 | 30 | return value |
32 | 31 | value = super(RecurrenceField, self).to_python(value) or u'' |
33 | | - try: |
34 | | - return recurrence.deserialize(value, self.include_dtstart) |
35 | | - except recurrence.DeserializationError as e: |
36 | | - raise ValidationError( |
37 | | - str(e), code='invalid', params={'value': value} |
38 | | - ) |
| 32 | + return recurrence.deserialize(value, self.include_dtstart) |
39 | 33 |
|
40 | 34 | def from_db_value(self, value, *args, **kwargs): |
41 | 35 | return self.to_python(value) |
42 | 36 |
|
43 | 37 | def get_prep_value(self, value): |
44 | 38 | if not isinstance(value, string_types): |
45 | | - try: |
46 | | - value = recurrence.serialize(value) |
47 | | - except recurrence.SerializationError as e: |
48 | | - raise ValidationError( |
49 | | - str(e), code='invalid', params={'value': value} |
50 | | - ) |
| 39 | + value = recurrence.serialize(value) |
51 | 40 | return value |
52 | 41 |
|
53 | 42 | def contribute_to_class(self, cls, *args, **kwargs): |
|
0 commit comments