Update View¶
- class pyramid_views.views.edit.UpdateView(**kwargs)¶
View for updating an object, with a response rendered by template.
- success_url = None¶
The URL to redirect to upon successful update.
- fields = None¶
Fields which should be presented to the user. If None, all fields will be available with certain field exclusion rules.
Important
It is highly recommended you specify this field in order to prevent fields becoming unintentionally presented to the user.
- model = None¶
The model of which an instance will be updated.
- query = None¶
Limit updating to only objects provided by query. If you specify this then you can omit model.
- get_query()¶
Return the Query that will be used to look up the object.
Note that this method is called by the default implementation of get_object and may not be called if get_object is overriden.
- get_object(query=None)¶
Returns the object the view is displaying.
By default this requires self.query and a pk or slug argument in the URLconf, but subclasses can override this to return any object.
- slug_field = u'slug'¶
- get_slug_field()¶
Get the name of a slug field to be used to look up by slug.
- slug_url_kwarg = u'slug'¶
- pk_url_kwarg = u'pk'¶
- form_class = None¶
- get_form_class()¶
Returns the form class to use in this view.
- get_form(form_class)¶
Returns an instance of the form to be used in this view.
- form_invalid(form)¶
If the form is invalid, re-render the context data with the data-filled form and errors.
- form_valid(form)¶
If the form is valid, save the associated model.
- prefix = None¶
- get_prefix()¶
Returns the prefix to use for forms on this view
- initial = {}¶
- get_initial()¶
Returns the initial data to use for forms on this view.
- get_form_kwargs()¶
Returns the keyword arguments for instantiating the form.
- template_name = None¶
- content_type = None¶
- get_context_data(**kwargs)¶
- macro_names = None¶
- get_macro_names()¶
Return a directory of macro names.
Values should be template paths, and keys will be used as the lookup key in the template. Eg. macros.<key>.<macro>.
- get(request, *args, **kwargs)¶
- post(request, *args, **kwargs)¶