Re: Models.clean() how to raise ValidationError WITH error_code and show field_based errors in the Form-Template?

2015-08-29 Thread Peter of the Norse
You are raising a dict style ValidationError. To get the actual fields you need to use the_exception.error_dict[’note’].error_list[0].code. > On Jul 30, 2015, at 4:10 AM, ThomasTheDjangoFan > wrote: > > class TestMyNotebookModelTest(unittest): > def test_clean(self): > # I'd lov

Re: Models.clean() how to raise ValidationError WITH error_code and show field_based errors in the Form-Template?

2015-08-03 Thread ThomasTheDjangoFan
Hi Jordi, thanks a lot for your response! Yeah definetly, BUT this error message could change during development and I guess that is the reason why the django-docs recon you to set error_codes. This why you wouldn't have to touch the tests when changing the error-message but keeping the error

Models.clean() how to raise ValidationError WITH error_code and show field_based errors in the Form-Template?

2015-08-02 Thread jordi collell
An easy way is to test that the rendered form has the error message raised suring rhe validation. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+u

Models.clean() how to raise ValidationError WITH error_code and show field_based errors in the Form-Template?

2015-07-30 Thread ThomasTheDjangoFan
Hi guys, I got a working model.clean() method that actually does a great job showing the errors in the assigned html-form. *The view actually marks single invalid fields red, which I find really important*. *BUT:* Now I want to *write a test* for that model and would love to *test for error_co