Hi all, I'm trying to pass a ValidationError as a string to a template, but I can't seem to determine where to find the 'special key' that is referred to in the documentation here:
http://docs.djangoproject.com/en/dev/ref/models/instances/ {quote} Any ValidationError raised by Model.clean() will be stored under a special key that is used for errors that are tied to the entire model instead of to a specific field. You can access these errors with NON_FIELD_ERRORS: {endquote} Here's my snippet of code: try: peep.save() except ValidationError, e: errormsg = e.invalid[NON_FIELD_ERRORS] form = EditPerson() return render_to_response('personentry.html', { 'form' : form, 'errormsg': errormsg },context_instance=RequestContext(request)) The error is being thrown when when making an invalid entry into a DateField. Using the code above, if I make: erromsg = e I get: [u'Invalid date: month must be in 1..12'] or [u'Enter a valid date in YYYY-MM-DD format.'] Are two examples, depending on what is passed to the model on peep.save(). How can I find out what the 'special key' is ? Any ideas? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.