Re: Trouble raising forms.ValidationError in save() override in admin.py

2018-05-03 Thread Gonzalo Amadio
This is very old, but in the case someone red this. If you do it on the save method of the admin, you MUST save the model. So you should override admin's form. Check it here how to do it : http://itegram.com/2018/05/03/ add-extra-control-to-admin-save-method/

Re: Trouble raising forms.ValidationError in save() override in admin.py

2011-03-31 Thread Daniel Roseman
On Thursday, March 31, 2011 11:09:17 AM UTC+1, Lloyd Dube wrote: > > Hi Shawn, > > Thanks for the feedback. I read the docs and defined a clean_audio_file > method in my ModelAdmin class. That's not what the docs say. They say you should create it on the Form. And where did you get the idea

Re: Trouble raising forms.ValidationError in save() override in admin.py

2011-03-31 Thread Sithembewena Lloyd Dube
Hi Shawn, Thanks for the feedback. I read the docs and defined a clean_audio_file method in my ModelAdmin class. I dropped the Podcast table, made the field not mandatory in the model and did a syncdb (to test my clean method). Still a podcast can be saved without the audio_file: the code in the

Re: Trouble raising forms.ValidationError in save() override in admin.py

2011-03-30 Thread Shawn Milochik
No, the forms.ValidationError has to be raised in one of the clean() methonds of your model. Otherwise it will result in a stack trace. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Trouble raising forms.ValidationError in save() override in admin.py

2011-03-30 Thread Sithembewena Lloyd Dube
Hi all, In the admin.py code of my project, I have an override to a save() method where I check a file upload's extension and, based on that, should either save the instance object or update show an error message on the admin form as follows: def save_model(self, request, obj, form, change):