hi derek, thanks for your hints - was I really that unclear? hm.
anyway, could you please give an example about how to "override/check the value for that field after the form POST"? I don't seem to be able to do that, and believe me, I have read the docs. I think cleaned_data is only available after is_valid() was called, but is_valid() throws an exception because the required field is missing - and I can't set it. The hidden field thing is the last thing I wanted to try. bad style, you know :) , cause security risk. thanks! Axel. 2010/12/29 derek <gamesb...@gmail.com> > Axel > > Not sure I have followed all your requirements, but perhaps you can > try: > * set a default value for the required field > * mask the required field on the form being shown to the user (make it > hidden) > * override/check the value for that field after the form POST and data > "clean" (see: > http://docs.djangoproject.com/en/dev/topics/forms/?from=olddocs#processing-the-data-from-a-form > ) > > HTH > Derek > > On Dec 28, 10:21 pm, Axel Bock <justsomeoneoutth...@gmail.com> wrote: > > Hi all, > > > > I have this little problem. In my little webapp I have a data model which > > defines several required fields. Depending on WHO is logged on, some of > > these fields should not be changed by the user and be pre-filled (or > better: > > post-filled) by the application. > > > > Currently I delete the fields out of the formset like this: > > # prevent entering missions for all other bases > > del missionform.fields['base'] > > > > so the field gets not rendered in the view. Which works nicely. > > > > Unfortunately base is required, so the validation fails. Now how can I > > insert the missing values into the POST data? I tried this: > > if request.user.userflag.is_student: > > logging.error("studen") > > inst=FlownMission( > > student=request.user, > > base=request.user.studentinfo.current_base > > ) > > flownmission = FlownMissionForm(request.POST, instance=inst) > > > > which does not work at all :( . The validation fails all the time ... . I > > just need to inject 2 required values somewhere in the POST data, but I > have > > no clue how. > > > > Any help would be greatly appreciated, and I am a total django "newb" ... > :) > > > > Thanks & greetings, > > Axel. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > 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-us...@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.