X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/95045552540ca917d273954ebfa20b47a306bb93..9c5d9a4e77a10b4e60d89d3890e49002bd7f3993:/apps/sponsors/fields.py diff --git a/apps/sponsors/fields.py b/apps/sponsors/fields.py index b3fa36124..c2098ec97 100644 --- a/apps/sponsors/fields.py +++ b/apps/sponsors/fields.py @@ -32,7 +32,7 @@ def loads(str): class JSONFormField(forms.CharField): widget = forms.Textarea - + def clean(self, value): try: loads(value) @@ -55,7 +55,7 @@ class JSONField(models.TextField): def contribute_to_class(self, cls, name): super(JSONField, self).contribute_to_class(cls, name) - + def get_value(model_instance): return loads(getattr(model_instance, self.attname, None)) setattr(cls, 'get_%s_value' % self.name, get_value)