本文整理汇总了Python中django.views.generic.edit.UpdateView类的典型用法代码示例。如果您正苦于以下问题:Python UpdateView类的具体用法?Python UpdateView怎么用?Python UpdateView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UpdateView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: item_metadata
def item_metadata(request, item_id):
return UpdateView.as_view(request,
form_class = ItemMetadataForm,
object_id = item_id,
template_name = "spindle/item_metadata.html",
template_object_name = "item",
post_save_redirect = reverse(item_metadata, kwargs={'item_id': item_id}))
示例2: get_context_data
def get_context_data(self, **kwargs):
context = UpdateView.get_context_data(self, **kwargs)
context['title'] = '%s <small>(%s)</small>' % (
self.object.get_full_name(),
self.object.email)
return context
示例3: get_context_data
def get_context_data(self, **kwargs):
context = UpdateView.get_context_data(self, **kwargs)
context['pk'] = self.kwargs['pk']
context['action'] = reverse('item_editar', kwargs={'pk':self.kwargs['pk']})
if self.ocurrio_error :
context['nodefault'] = '__panel.html'
return context
示例4: get_context_data
def get_context_data(self, **kwargs):
context = UpdateView.get_context_data(self, **kwargs)
enroll = Enroll.objects.filter(student=self.object).order_by('enroll_date')
context['enroll'] = enroll.filter(enroll_activate=True, enroll_finished=True)
context['pre_enroll'] = enroll.filter(enroll_activate=True, enroll_finished=False)
return context
示例5: render_to_response
def render_to_response(self, context):
if self.request.is_ajax():
return JSONHybridProcessFormViewMixin.render_to_response(self,
context)
return UpdateView.render_to_response(self, context)
示例6: get
def get(self, request, *args, **kwargs):
"""
Save the initial referer
"""
self.referer = request.META.get('HTTP_REFERER', '')
request.session['login_referer'] = self.referer
return UpdateView.get(self, request, *args, **kwargs)
示例7: patterns
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.edit import UpdateView
from tests.models import SimpleConcurrentModel
try:
from django.apps import AppConfig # noqa
import django
django.setup()
except ImportError:
pass
admin.autodiscover()
urlpatterns = patterns('',
url('cm/(?P<pk>\d+)/',
UpdateView.as_view(model=SimpleConcurrentModel),
name='concurrent-edit'),
(r'^admin/', include(include(admin.site.urls))),
(r'', include(include(admin.site.urls))))
示例8: get_context_data
def get_context_data(self, **kwargs):
context = UpdateView.get_context_data(self, **kwargs)
context['action'] = reverse('rol_permisos_edita',kwargs={'pk':self.kwargs['pk']})
if self.templ_base_error:
context['nodefault'] = self.templ_base_error
return context
示例9: patterns
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.base import TemplateView
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import UpdateView, CreateView
from web.barns.models import Barn
urlpatterns = patterns('',
url(r'^$', ListView.as_view(model=Barn, template_name='generic/list.html'), name='list'),
url(r'^/(?P<pk>\d+)$', DetailView.as_view(model=Barn, template_name='generic/detail.html'), name='detail'),
url(r'^/new$', CreateView.as_view(model=Barn, template_name='generic/form.html', success_url='/barns/%(id)s'), name='create'),
url(r'^/(?P<pk>\d+)/edit$', UpdateView.as_view(model=Barn, template_name='generic/form.html', success_url='/barns/%(id)s'), name='edit'),
)
示例10: form_valid
def form_valid(self, form):
form.save()
return UpdateView.form_valid(self, form)
示例11: url
),
url(
r'^cds/add/$',
CreateView.as_view(
model=CD,
form_class=CDForm,
template_name='model_filefields_example/cd_form.html',
success_url=reverse_lazy('model_files:cd.list')
),
name='cd.add'
),
url(
r'^cds/edit/(?P<pk>\d+)/$',
UpdateView.as_view(
model=CD,
form_class=CDForm,
template_name='model_filefields_example/cd_form.html',
success_url=reverse_lazy('model_files:cd.list')
),
name='cd.edit'
),
url(
r'^cds/delete/(?P<pk>\d+)/$',
DeleteView.as_view(
model=CD,
success_url=reverse_lazy('model_files:cd.list')
),
name='cd.delete'
),
url(
r'^sound_devices/add/$',
CreateView.as_view(
示例12: url
),
url(
r'^books/add/$',
CreateView.as_view(
model=Book,
form_class=BookForm,
template_name='model_filefields_example/book_form.html',
success_url=reverse_lazy('model_files:book.list')
),
name='book.add'
),
url(
r'^books/edit/(?P<pk>\d+)/$',
UpdateView.as_view(
model=Book,
form_class=BookForm,
template_name='model_filefields_example/book_form.html',
success_url=reverse_lazy('model_files:book.list')
),
name='book.edit'
),
url(
r'^books/delete/(?P<pk>\d+)/$',
DeleteView.as_view(
model=Book,
success_url=reverse_lazy('model_files:book.list')
),
name='book.delete'
),
url(
r'^sound_devices/add/$',
CreateView.as_view(
示例13: patterns
from django.conf.urls import patterns, url
from django.views.generic import DetailView, ListView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse_lazy
from dydict.views import contactView, HelpView, CreateDict, dictList
from dydict.models import Dict
from dydict.forms import WordForm
urlpatterns = patterns('dydict.views',
# Generic views
url(r'^list/(?P<page>\d+)$', login_required(dictList), name="list"),
url(r'^(?P<pk>\d+)/details/$', DetailView.as_view(model=Dict),
name="details"),
url(r'^(?P<pk>\d+)/update/$', UpdateView.as_view(model=Dict,
form_class=WordForm), name='update'),
url(r'^create/$', CreateDict.as_view(), name='create'),
url(r'^(?P<pk>\d+)/delete/$', DeleteView.as_view(
model=Dict, success_url=reverse_lazy('list')), name='delete'),
#url(r'^show_words/?$', 'listWords'),
#url(r'^show_words/(?P<page_number>\d{1})/?$', 'listWords'),
url(r'^contact/$', contactView, name="contact"),
url(r'^help/$', HelpView.as_view(), name="dydict_help"),
)
示例14: get_context_data
def get_context_data(self, **kwargs):
context = UpdateView.get_context_data(self, **kwargs)
context['action'] = reverse('solicitud_edita', \
kwargs={'pk':self.kwargs['pk']})
return context
示例15: url
'geoevents.director.views.ReportLink', name='reports-linkage'),
url(r'^report/$', ListView.as_view(queryset=Report.objects.filter(public=1),
template_name='report-list.html',
paginate_by=25,
), name='reports-view-reports'),
url(r'^report/(?P<pk>\d+)/$', DetailView.as_view(queryset=Report.objects.all(),
template_name='report.html',
), name='reports-view-report'),
url(r'^report/add/$', permission_required('director.add_report', reverse_lazy('home'))(
ReportCreateView.as_view(template_name='report-manage.html',
success_url=reverse_lazy('reports-view-reports'),
)), name='reports-manage-report'),
url(r'^report/manage/(?P<pk>\d+)/$',
permission_required('director.change_report', reverse_lazy('home'))(
UpdateView.as_view(queryset=Report.objects.all(),
form_class=ReportForm,
template_name='report-manage.html',
)), name='reports-manage-report-id'),
url(r'^report/delete/(?P<pk>\d+)/$',
permission_required('director.delete_report', reverse_lazy('home'))(
DeleteView.as_view(model=Report,
template_name='generic-delete.html',
success_url=reverse_lazy('reports-view-reports'))
), name='reports-delete-report-id'),
url(r'^action/(?P<pk>\d+)/$', DetailView.as_view(queryset=Actions.objects.all(),
template_name='report.html',
), name='actions-view-report'),
url(r'^action/new/$', 'geoevents.director.views.ActionNew', name='actions-submit-new'),
url(r'^action/add/(?P<success_url>.*)$',
ActionCreateView.as_view(template_name='report-manage.html', ),