On Jan 15, 5:35 pm, Peter Bailey <p.h.bai...@gmail.com> wrote: > I have just recently started using forms. I was avoiding them because > I thought they were not very DRY, but discovered I need them for added > flexibility such as displaying field lengths for example. > > Anyway, I have created a Form for a Survey object that I use. If I go > to my edit page for a Survey, everything works perfectly. If I go to > do a simple add new (like right out of the docs), I always receive an > error "NoneType' object is not callable". So I am assuming I am trying > to use something not in existence yet, but it seems bizarre to me (but > I am a form noob and hoping I am doing something stupid (at least 1 > thing)). Here is my model
<snip code> > I tried commenting out the foreign key to the user but that made no > difference. I must be doing something stupid here (obvious hopefully). > > Can anyone tell me what the problem is? > > Thanks, > > Peter Why have you repeated all the definitions from the model in your form? As you say, that isn't very DRY, but there's no reason to do it at all. It would have been helpful to have posted the full traceback. I suspect your error is coming from this line: client = forms.ModelChoiceField(User.objects.all()) which should be client = forms.ModelChoiceField(queryset=User.objects.all()) However, as i note above, you don't need the line - or any of the field declarations - at all. You do, however, need an inner Meta class which defines the model the form belongs to (Survey). -- DR. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---