#17413: Serialization or getting non-HTML version of form errors is not easy -------------------------------------+------------------------------------- Reporter: kmike | Owner: nobody Type: New feature | Status: new Component: Forms | Version: Severity: Normal | Resolution: Keywords: form errors | Triage Stage: Accepted serialization | Needs documentation: 0 Has patch: 0 | Patch needs improvement: 0 Needs tests: 0 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by merb): Wouldn't it be better to rewrite {{{ class ErrorDict(dict) }}} and add as_json or as_dict? Currently it has as_text and as_ul This is how the ErrorDict got returned, so a simple {{{ @property def errors(self): "Returns an ErrorDict for the data provided for the form" if self._errors is None: self.full_clean() return self._errors }}} The next snippet would call the json.dumps of the error dict. {{{ print json.dumps(form.errors.as_dict()) }}} I apped a patch that would do the following. If this is wished we only need a small test. -- Ticket URL: <https://code.djangoproject.com/ticket/17413#comment:3> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.d8ca1fd842bb8f7b846972b3f376c017%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.