Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The Form errors are automatically part of the administrative view.</p> <p>See <a href="http://docs.djangoproject.com/en/dev/ref/forms/validation/#ref-forms-validation" rel="nofollow noreferrer">http://docs.djangoproject.com/en/dev/ref/forms/validation/#ref-forms-validation</a></p> <p>You're happiest if you validate in a Form -- that's what Forms are for. The admin interface will use the Form you associate with your model; your own views can also use the form.</p> <p>Getting attributes from the file, should probably be a separate method of the model class. The separate method of the model class can be used by the <code>save()</code> method of the model class or invoked at other times by view functions.</p> <hr> <p>"I could never get the administration views to use them while using the ModelForm class."</p> <p><a href="http://docs.djangoproject.com/en/dev/ref/contrib/admin/#form" rel="nofollow noreferrer">http://docs.djangoproject.com/en/dev/ref/contrib/admin/#form</a></p> <p><a href="http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin" rel="nofollow noreferrer">http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin</a></p> <hr> <p>"I'm still confused about how to actually handle the validation. S.Lott says it should be a method?"</p> <p>Validation in a form is done with a <code>clean()</code> method or a <code>clean_somefield()</code> method.</p> <p>The "Adding custom validation to the admin" link (above) shows how to add the <code>clean_name</code> method to the "MyArticleAdminForm" form. </p> <p>If you're still confused, trying actually typing the code from the Django web page and see what it does.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload