Reputation: 13
I am getting the below error when I tried to run the edit part.
Displaying the contents of database in webpage is working fine. I have put up code for just the edit part.
TypeError at /edit/
__init__()
takes exactly 1 argument (2 given)
views.py
class userUpdate(UpdateView):
model = user
fields = ['name','phone','dob','gender']
template_name_suffix = '_update_form'
urls.py
from django.conf.urls import include, url
from newapp import views
urlpatterns = [url(r'^edit/',views.userUpdate, name = 'user_update_form'),]
user_update_form.html
<form action="" method="post">{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Update" />
</form>
Upvotes: 0
Views: 50
Reputation: 599610
Class-based views need to be referenced in urls.py via their as_view
method:
url(r'^edit/', views.userUpdate.as_view(), name = 'user_update_form'),
Upvotes: 1