python - ModelForm has no attribute get -


i´m getting modelform has no attribute 'get' error on django 1.8 project. i´ve read similar questions on topic haven´t found solutions:

django 'user' object has no attribute 'get' error

object has no attribute 'get'

when visiting url: patients/add i´m getting above error:

here´s code:

forms.py

class addpatient(forms.modelform):     class meta:         model = patientuser         fields = ['gender'] 

views.py

  def add_patient(request):         if request.method == "get":             form = addpatient(data=request.post)             if form.is_valid():                 new_user = patient.objects.create_user(**form.cleaned_data)                 # login(new_user)                 # redirect, or want main view                 return httpresponseredirect('base.html')         else:             form = addpatient()          return render(request, 'addpatient.html', {'form':form}) 

models.py

class patientuser(models.model):     children_quantity = models.charfield(max_length=1,      choices=children_quantity_choices, default=cero)     merried_lastname = models.charfield(max_length=175, blank=true)     date_of_birth = models.datefield(null=true)     citenzenship = models.charfield(max_length=175, blank=true) 

urls.py

from django.conf.urls import include, url, patterns django.contrib import admin django.conf import settings . import views  admin.autodiscover()  urlpatterns = (     url(r'^$', views.records_general, name="records_general"),     url(r'^search/$', views.records_search, name="records_search"),     url(r'^single/(?p<id>\d+)/$', views.records_single, name="records_single"),     url(r'^add/$', views.addpatient, name="addpatient"),  ) 

can me identify problem in code?

thank you.

you've pointed url addpatient, that's form. view add_patient.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -