A view that displays a form for editing an existing object, redisplaying the form with validation errors (if there are any) and saving changes to the object. This uses a form automatically generated from the object’s model class (unless a form class is manually specified).
Ancestors (MRO)
This view inherits methods and attributes from the following views:
Attributes
The UpdateView page displayed to a GET request uses a template_name_suffix of '_form'. For example, changing this attribute to '_update_form' for a view updating objects for the example Author model would cause the default template_name to be 'myapp/author_update_form.html'.
When using UpdateView you have access to self.object, which is the object being updated.
Example myapp/views.py:
from django.views.generic.edit import UpdateView from myapp.models import Author class AuthorUpdate(UpdateView): model = Author fields = ['name'] template_name_suffix = '_update_form'
Example myapp/author_update_form.html:
<form action="" method="post">{% csrf_token %} {{ form.as_p }} <input type="submit" value="Update" /> </form>
__init__() takes exactly 1 argument (2 given)
Request Method: | GET |
---|---|
Request URL: | http://127.0.0.1:8080/gateway/config/generalconfig/ |
Django Version: | 1.7.1 |
Exception Type: | TypeError |
Exception Value: | __init__() takes exactly 1 argument (2 given) |
Exception Location: | C:\jython2.7b2\Lib\site-packages\django-1.7.1-py2.7.egg\django\core\handlers\base.py in get_response, line 111 |
Python Executable: | None |
Python Version: | 2.7.0 |
Python Path: | ['C:\\Users\\mike\\workspace\\ciscoebondinggateway', 'C:\\Users\\mike\\workspace\\ciscoebondinggateway', 'C:\\Users\\mike\\workspace\\lwc\\lib\\postgresql-9.3-1102.jdbc41.jar', 'C:\\jython2.7b2\\Lib\\site-packages\\setuptools-5.7-py2.7.egg', 'C:\\jython2.7b2\\Lib\\site-packages\\pip-1.5.6-py2.7.egg', 'C:\\jython2.7b2\\Lib\\site-packages\\django_jython-1.7.0b2-py2.7.egg', 'C:\\jython2.7b2\\Lib\\site-packages', 'C:\\jython2.7b2\\Lib', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\resources.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\rt.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\jsse.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\jce.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\charsets.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\jfr.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\ext\\access-bridge-32.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\ext\\dnsns.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\ext\\jaccess.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\ext\\localedata.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\ext\\sunec.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\ext\\sunjce_provider.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\ext\\sunmscapi.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\ext\\sunpkcs11.jar', 'C:\\Program Files (x86)\\Java\\jre7\\lib\\ext\\zipfs.jar', 'C:\\jython2.7b2\\Lib\\site-packages\\django-1.7.1-py2.7.egg', '__classpath__', '__pyclasspath__/'] |
Server time: | Wed, 17 Sep 2014 02:23:28 -0700 |
Exception Value: | Generic detail view GeneralConfigurationUpdate must be called with either an object pk or a slug. |
---|
are you calling as_view() when installing your view in urls.py?Could you post the rest of the traceback?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/86cd4f96-f6ed-4e79-a35a-e8a27e3cbd79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAD0urK3QzNmnXDVGf9d5%2B0VcaMPBCuWJwEmCUKHorkB7inoJxA%40mail.gmail.com.