UpdateView
- class django.views.generic.edit.UpdateView
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:
- django.views.generic.detail.SingleObjectTemplateResponseMixin
- django.views.generic.base.TemplateResponseMixin
- django.views.generic.edit.BaseUpdateView
- django.views.generic.edit.ModelFormMixin
- django.views.generic.edit.FormMixin
- django.views.generic.detail.SingleObjectMixin
- django.views.generic.edit.ProcessFormView
- django.views.generic.base.View
Attributes
- template_name_suffix
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'.
- object
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 |
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAD0urK1SRtKMx-X7MP4N5FCZT_a_pt%2BSYe8pBLn-2gccVVBsEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment