On Sun, 2008-07-06 at 13:44 -0700, Rob Hudson wrote: > So if I understand correctly, you are saying make author a > not-required field so is_valid() will validate to True. Then in my > view do the commit=False on save, check if author is present and if > not, set the default author, then call save(). Something like that?
That's probably slight overkill, in that you don't need to go as far as getting back to the view and calling save(commit=False). You got the cleaning process exactly right the first time. Looks like the only thing that is going "wrong" (it's going right, actually -- doing exactly what you specified) is that the author field is required by the model and hence by the ModelForm. Since the field's validation includes checking "required-ness" and, if that fails, clean_*() isn't called, you're seeing the problem. You can set self.field["author"].required = False in your form's __init__ method to avoid this. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---