newbie Django form not valid -


i have form.py:

class specform(modelform):     = doctors_list.objects.values_list('specialty', flat=true)     specialty = forms.modelchoicefield(queryset=a)     class meta:         model = doctors_list 

and views.py:

from django.shortcuts import render_to_response testapp.forms import specform  def specform (request):     if request.method == 'post':         form = specform(request.post)         if form.is_valid():             form.save()     else:         form = specform()     return render_to_response('hello.html', {'form':form}) 

when run folowing error: specform() takes 1 argument (0 given) , suposse it's because considers formnot valid, why? how fix it?

my models.py:

class doctors_list(models.model):      name = models.charfield(max_length=30)     specialty = models.charfield(max_length=15)     hp_id = models.manytomanyfield(health_plan)     location = models.charfield(max_length=15)      def __unicode__(self):         return self.name 

any appreciated

it name conflict between method def specform(request) , actual object form class specform. try rename 1 of these. recommendation rename method because might call within urls.py only.

hope helps


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -