If you are okay with overriding the values in you view, then can use something like:
... form = MyForm(request.POST) if form.is_valid(): ... <whatever you want to do> else: data = form.data.copy() data['field_name'] = 'default_value' form = MyForm(data) ... Not very efficient, but clean code. Thanks, Subhranath Chunder. www.subhranath.com On Sun, Aug 14, 2011 at 2:55 AM, Jonas H. <jo...@lophus.org> wrote: > On 08/13/2011 05:00 PM, Karen Tracey wrote: > >> Plus, afaik, fields can not access form instances so this code would have >>> to live in the form subclass -- not practical in my use case. >>> >>> Where I have done this (reluctantly) has been in the form (or perhaps it >> was >> the field) clean method, where self is the form. I am not sure why in your >> case you believe that to be not practical. >> > > The field's clean method does not have access to the form; but the > value-changing logic should go into the field code because I want to re-use > the field on multiple forms. Well, I guess that's just not possible with > Django's form framework. I'll have to find some workarounds. > > > -- > 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 django-users+unsubscribe@** > googlegroups.com <django-users%2bunsubscr...@googlegroups.com>. > For more options, visit this group at http://groups.google.com/** > group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en> > . > > -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.