python - Django: Display a custom error message for admin validation error -
i'm using django 1.2.4. have model has field needs validated. when validation fails, i'd display custom error message user. model editing done in admin interface.
this i'm doing currently:
def clean_fields(self, exclude=none): # validation if problem: raise validationerror({'field_name': "error message"}) unfortunately, print out separate validation message on admin page each character in value of field_name.
what proper way signal error message want?
without looking, sounds admin looking iterable value field_name. try:
raise validationerror({'field_name': ["error message",]}) i think admin expects number of validation messages associated each field on form.
Comments
Post a Comment