-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
while putting custom validator in form, in form Meta, django required fields statement #124
Comments
No, that opens a potential security hole, which we cover extensively in the security chapter. Unfortunately, I can't tell you how to fix your problem without adding that security hole unless source code is posted. |
OK, I read went through the security chapter again (can't hurt). Sorry to mention
Still, following the code in the book, I got an error, which I got past by adding an explicit fields list to the Meta. Am I missing anything? Does adding a fields list to the Meta open any security hole? Thanks! |
Without seeing the code throwing the error, or even the stack trace of the error, there's nothing I can do. |
I got past the error -- that problem is solved -- my code is working I had copied verbatim the code in "Example 11.5: Adding Custom Validators to a Model Form" for my model named Brand. That is the code that threw the error. What you might want to do is determine whether in general the code in the example needs a fields list to work, and if so, in future versions of the book, add a fields list to the example code. Sorry for the trouble! Bottom line is the book has been extremely helpful for me! I appreciate your help. |
Location within the Book page 150
Description
I followed your code for my model named 'Brand', but kept getting an error from Django:
django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form BrandForm needs updating.
I finally got pass the error by moving my fields list from the view to the form Class Meta.
So based on my experience, I think your Example 11.5 needs one additional line at the bottom, such as:
Or substitute an actual fields list.
The text was updated successfully, but these errors were encountered: