Python django.views.generic.UpdateView() Examples
The following are 7
code examples of django.views.generic.UpdateView().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.views.generic
, or try the search function
.
Example #1
Source File: views.py From InvenTree with MIT License | 6 votes |
def get(self, request, *args, **kwargs): """ Respond to GET request - Render a DELETE confirmation form to JSON - Return rendered form to client """ super(UpdateView, self).get(request, *args, **kwargs) form = self.get_form() context = self.get_context_data() context[self.context_object_name] = self.get_object() return self.renderJsonResponse(request, form, context=context)
Example #2
Source File: views.py From django-generic-scaffold with MIT License | 6 votes |
def get_update_class_view(self): name = '{0}_{1}'.format(self.get_name(), 'UpdateView') options_dict = { 'kind': 'update', 'model': self.model, 'fields': '__all__', } if hasattr(self, 'form_template_name') and self.form_template_name: options_dict['template_name'] = self.form_template_name if hasattr(self, 'form_class') and self.form_class: options_dict['form_class'] = self.form_class options_dict['fields'] = None parent_classes_list = [FallbackTemplateMixin] parent_classes_list.extend(self.update_mixins) parent_classes_list.append(self.update_view_class) klazz = type(name, tuple(parent_classes_list), options_dict ) klazz.get_context_data = self.get_get_context_data(klazz) return klazz
Example #3
Source File: views.py From pythonjobs.ie with GNU General Public License v2.0 | 5 votes |
def get_context_data(self, **kwargs): context = super(generic.UpdateView, self).get_context_data(**kwargs) context['cities'] = Job.cities context['categories'] = Job.categories return context
Example #4
Source File: abstract.py From django-flexible-subscriptions with GNU General Public License v3.0 | 5 votes |
def get_context_data(self, **kwargs): """Overriding get_context_data to add additional context.""" context = super(UpdateView, self).get_context_data(**kwargs) # Provides the base template to extend from context['template_extends'] = self.template_extends return context
Example #5
Source File: views.py From InvenTree with MIT License | 5 votes |
def get(self, request, *args, **kwargs): """ Respond to GET request. - Populates form with object data - Renders form to JSON and returns to client """ super(UpdateView, self).get(request, *args, **kwargs) return self.renderJsonResponse(request, self.get_form(), context=self.get_context_data())
Example #6
Source File: tests.py From django-generic-scaffold with MIT License | 5 votes |
def test_views_have_correct_parent_class(self): self.assertEquals(self.list_view.__bases__[-1].__name__, "ListView") self.assertEquals(self.create_view.__bases__[-1].__name__, "CreateView") self.assertEquals(self.update_view.__bases__[-1].__name__, "UpdateView") self.assertEquals(self.delete_view.__bases__[-1].__name__, "DeleteView") self.assertEquals(self.detail_view.__bases__[-1].__name__, "DetailView")
Example #7
Source File: tests.py From django-generic-scaffold with MIT License | 5 votes |
def test_views_have_correct_parent_class(self): self.assertEquals(self.list_view.__bases__[-1].__name__, "ListView") self.assertEquals(self.create_view.__bases__[-1].__name__, "CreateView") self.assertEquals(self.update_view.__bases__[-1].__name__, "UpdateView") self.assertEquals(self.delete_view.__bases__[-1].__name__, "DeleteView") self.assertEquals(self.detail_view.__bases__[-1].__name__, "DetailView")