本文整理汇总了Python中django.views.generic.edit.DeleteView.as_view方法的典型用法代码示例。如果您正苦于以下问题:Python DeleteView.as_view方法的具体用法?Python DeleteView.as_view怎么用?Python DeleteView.as_view使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.views.generic.edit.DeleteView
的用法示例。
在下文中一共展示了DeleteView.as_view方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
def __init__(self):
self.create = login_required(CreateView.as_view(
model=self.model,
fields=('name',),
success_url=reverse_lazy('laboratory:laboratory_list'),
template_name=self.template_name_base + 'form.html'
))
self.edit = login_required(UpdateView.as_view(
model=self.model,
fields=('name',),
success_url=reverse_lazy('laboratory:laboratory_list'),
template_name=self.template_name_base + 'form.html'
))
self.delete = login_required(DeleteView.as_view(
model=self.model,
success_url=reverse_lazy('laboratory:laboratory_list'),
template_name=self.template_name_base + 'delete.html'
))
self.list = login_required(ListView.as_view(
model=self.model,
paginate_by=10,
template_name=self.template_name_base + 'list.html'
))
示例2: url
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
url(r'^manage/$', (NoteCreateView.as_view(template_name='note-manage.html',
success_url=reverse_lazy('notes-view-notes'),
)), name='notes-manage-note'),
url(r'^manage/(?P<pk>\d+)/$', (UpdateView.as_view(queryset=Note.objects.all(),
form_class=NoteForm,
template_name='note-manage.html',
)), name='notes-manage-note-id'),
url(r'^manage/(?P<model>\w+)/(?P<pk>\d+)/(?P<source_url>.*)$',
(NoteCreateView.as_view(template_name='note-manage.html',
form_class=NoteFormMinimal)),
name='notes-manage-note-model-id',
),
url(r'^manage/(?P<model>\w+)/(?P<pk>\d+)/$',
(NoteCreateView.as_view(template_name='note-manage.html',
success_url=reverse_lazy('notes-view-notes'),
form_class=NoteFormMinimal)),
name='notes-manage-note-model-id',
),
url(r'^delete/(?P<pk>\d+)/$',
permission_required('notes.delete_note', reverse_lazy('home'))(DeleteView.as_view(model=Note,
template_name='generic-delete.html',
success_url=reverse_lazy('notes-view-notes'))
), name='notes-delete-note-id'),
)
示例3: patterns
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
from django.conf.urls.defaults import *
from django.views.generic.edit import CreateView, DeleteView
from tinygraph.apps.definitions.models import Package
from tinygraph.apps.definitions.forms import PackageForm
urlpatterns = patterns('definitions.views',
url(r'^mibs/$', 'mib_upload_list', name='mib_upload_list'),
url(r'^packages/$', 'package_list', name='package_list'),
url(r'^packages/add/$', CreateView.as_view(
model=Package,
template_name='definitions/packages/package_form.html',
form_class=PackageForm,
), name='package_add'),
url(r'^packages/(?P<package_slug>[-\w]+)/$', 'package_detail', name='package_detail'),
url(r'^packages/(?P<slug>[-\w]+)/delete$', DeleteView.as_view(
model=Package,
template_name='definitions/packages/package_delete.html',
success_url='/data/packages/',
), name='package_delete'),
url(r'^$', 'data_object_list', name='data_object_list'),
)
示例4: patterns
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.detail import DetailView
from django.views.generic.edit import DeleteView
from paste.models import Paste
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'paste.views.home', name='home'),
url(r'^paste/(?P<pk>\d+)$', DetailView.as_view(model=Paste,
context_object_name='paste',
template_name='paste.html'
), name='paste'),
url(r'^repaire/(?P<pk>\d+)$', 'paste.views.home', name='repaire'),
url(r'^delete/(?P<pk>\d+)$', DeleteView.as_view(model=Paste,
success_url='/',
template_name='item_confirm_delete.html'
), name='delete'),
url(r'^admin/', include(admin.site.urls)),
(r'^i18n/', include('django.conf.urls.i18n')),
)
示例5: patterns
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
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"),
)
示例6: url
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
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(
model=SoundDevice,
form_class=SoundDeviceForm,
template_name='model_filefields_example/sound_device_form.html',
success_url=reverse_lazy('model_files:book.list')
),
name='sound_device.add'
),
]
示例7: include
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
site_media_root = os.path.join(os.path.dirname(__file__), "../media")
accounts_tuple = (r'^accounts/', include('django.contrib.auth.urls'))
urlpatterns = patterns(
'',
(r'^$', 'rolf.rolf_main.views.index'),
(r'^category/add/', 'rolf.rolf_main.views.add_category'),
(r'^category/(?P<object_id>\d+)/$',
'rolf.rolf_main.views.generic_detail', category_info_dict),
(r'^category/(?P<object_id>\d+)/add_application/$',
'rolf.rolf_main.views.add_application'),
(r'^category/(?P<pk>\d+)/delete/$',
DeleteView.as_view(model=Category, success_url="/")),
(r'^application/(?P<object_id>\d+)/$',
'rolf.rolf_main.views.generic_detail', application_info_dict),
(r'^application/(?P<object_id>\d+)/add_deployment/$',
'rolf.rolf_main.views.add_deployment'),
(r'^application/(?P<pk>\d+)/delete/$',
DeleteView.as_view(model=Application, success_url="/")),
(r'^deployment/(?P<object_id>\d+)/$',
'rolf.rolf_main.views.generic_detail', deployment_info_dict),
(r'^deployment/(?P<object_id>\d+)/add_setting/$',
'rolf.rolf_main.views.add_setting'),
(r'^deployment/(?P<object_id>\d+)/edit_settings/$',
'rolf.rolf_main.views.edit_settings'),
(r'^deployment/(?P<object_id>\d+)/add_stage/$',
示例8: import
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
from django.views.generic.list import ListView
from django.core.urlresolvers import reverse_lazy
from views import (InvitationListView, InvitationCreateView,
CircleCreateView, CircleListView, UserInfoUpdateView,
ContactListView, ContactCreateView)
from models import Invitation, Contact, Circle, UserInfo
urlpatterns = patterns('',
url(r'^invitation-list/$', InvitationListView.as_view(), name='invitation_list'),##
url(r'^invitation-creation/$', InvitationCreateView.as_view(), name='invitation_create'),##
url(r'^(?P<pk>\d+)/invitation/$', DetailView.as_view(model=Invitation), name='invitation_detail'),
url(r'^contact/(?P<pk>\d+)/$', DetailView.as_view(model=Contact), name='contact_detail'),##
url(r'contact/(?P<pk>\d+)/delete/$',
DeleteView.as_view(model=Contact,
success_url=reverse_lazy('contact_list')),
name='contact_delete'),##
url(r'^contact-list/$', ContactListView.as_view(), name='contact_list'),##
url(r'^contact/(?P<pk>\d+)/update/$', UserInfoUpdateView.as_view(), name='contact_update'),##
url(r'circle-list/$', CircleListView.as_view(model=Circle), name='circle_list'),#
url(r'circle/(?P<pk>\d+)/$', DetailView.as_view(model=Circle), name='circle_detail'),##
url(r'circle/(?P<pk>\d+)/delete/$',
DeleteView.as_view(model=Circle,
success_url=reverse_lazy('circle_list')),
name='circle_delete'),
url(r'circle/create/$', CircleCreateView.as_view(), name='circle_create'),##
)
示例9: patterns
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'corrupted_half.views.home', name='home'),
url(r'^$', 'reviews.views.home'),
url(r'^home/', 'reviews.views.home'),
# url(r'^auth/(?P<action>\w+)', 'reviews.views.auth'),
url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'reviews/auth/login.html'}),
url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}),
url(r'^accounts/user/$', 'reviews.views.user', {}, name='view_user'),
url(r'^accounts/user/add/$', RegisterUser.as_view(), {}, name='register_user'),
url(r'^accounts/add/$', CreateView.as_view(model=User, form_class=UserCreateForm), name='user_add'),
url(r'^search/.*$', SearchView.as_view(), name='search'),
url(r'^businesses/$', BusinessListView.as_view()),
url(r'^businesses/(?P<pk>\d+)/$', BusinessDetail.as_view(), name='business_detail'),
url(r'^businesses/add/$', login_required(BusinessCreate.as_view()), name='business_add'),
url(r'^businesses/(?P<pk>\d+)/edit/$', permission_required('business.can_update')(BusinessUpdate.as_view(model=Business, form_class=BusinessForm)), name='business_update'),
url(r'^businesses/(?P<pk>\d+)/delete/$', permission_required('business.can_delete')(DeleteView.as_view(model=Business)), name='business_delete'),
url(r'^businesses/(?P<pk>\d+)/reviews/add/$', login_required(ReviewCreate.as_view()), name='review_add'),
(r'^media/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT }),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)
示例10: modelform_factory
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
from contatos.core.forms import EmpresaForm
from contatos.core.models import CategoriaEmpresa, Empresa
CategoriaEmpresaForm = modelform_factory(CategoriaEmpresa)
index = TemplateView.as_view(template_name='index.html')
categoria_create = CreateView.as_view(
model=CategoriaEmpresa,
success_url=reverse_lazy('categoria_list'),
form_class=CategoriaEmpresaForm
)
categoria_delete = DeleteView.as_view(
template_name='confirm_delete.html',
model=CategoriaEmpresa,
success_url=reverse_lazy('categoria_list')
)
categoria_list = ListView.as_view(
model=CategoriaEmpresa,
paginate_by=15
)
categoria_update = UpdateView.as_view(
model=CategoriaEmpresa,
success_url=reverse_lazy('categoria_list')
)
empresa_create = CreateView.as_view(model=Empresa, success_url=reverse_lazy('empresa_list'), form_class=EmpresaForm)
empresa_delete = DeleteView.as_view(template_name='confirm_delete.html', model=Empresa, success_url=reverse_lazy('empresa_list'))
empresa_list = ListView.as_view(model=Empresa, paginate_by=15)
示例11: url
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
url(r"^hierarchy/list/$", HierarchyList.as_view(), name="list-hierarchy"),
## Function-Views:
url(r"^entries/$", "entries", name="entries"),
url(r"^hierarchy/$", "hierarchy", name="hierarchy"),
url(r"^entry/(?P<slug>.+)", "entry", name="data_entry"), # Classic view.
url(r"^entry/add", "add_entry", name="add_entry"),
url(r"^entry/edit", "edit_entry", name="edit_view"),
url(r"^entry/remove", "remove_entry", name="remove_entry"),
url(
r"^entry/breadcrump/(?P<slug>.+)", "breadcrump", name="breadcrump"
), # An experimental view to display breadcrump.
# Changes:
## Class-Views
url(r"^changes/list/$", ChangeList.as_view(), name="list-changes"),
url(r"^change/details/(?P<pk>\d+)", DetailView.as_view(model=Change), name="detail-change"), # detail-change
url(r"^change/delete/(?P<pk>\d+)", DeleteView.as_view(model=Change), name="delete-change"),
## Function-Views:
url(r"^changes/(?P<pk>\d*)", "changes", name="changes"),
url(r"^change/remove/(?P<slug>.+)/$", "remove_change", name="remove_change"),
url(r"^change/feed/$", ChangeFeed(), name="data-change-feed"),
url(r"^change/(?P<pk>\d*)/$", ChangeView.as_view(), name="change"),
url(r"^change/(?P<slug>.+)/$", ChangeView.as_view(), name="change"),
# Relations:
## Class-Views
url(r"^relations/list", RelationList.as_view(), name="list-relations"),
url(r"^relation/(?P<pk>\d+)", DetailView.as_view(model=Relation), name="relation-details"),
url(r"^relation/create", RelationCreate.as_view(), name="create-relation"),
url(r"^relation/update/(?P<pk>\d+)", login_required(RelationUpdate.as_view()), name="update-relation"),
url(r"^relation/delete", login_required(DeleteView.as_view(model=Relation)), name="delete-relation"),
## Function-Views:
url(r"^relations/$", "relations", name="relations"),
示例12: url
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
paginate_by=30,
), name='view_questions'),
url(r'^tags/', ListView.as_view(
model=models.Tag,
template_name="tags/tags.html",
context_object_name='tags',
paginate_by=30,
), name='view_tags'),
url(r'^ask/', views.AskQuestionView.as_view(), name='ask_question'),
url(r'^q/(?P<pk>\d+)', views.QuestionDetailView.as_view(), name="show_question"),
url(r'^q_tag/(?P<pk>\d+)', views.AddTagView.as_view(), name="add_tag"),
url(r'^tag/(?P<pk>\d+)', views.TagDetailView.as_view(), name="view_tag"),
url(r'^dtag/(?P<pk>\d+)', DeleteView.as_view(
model=models.Tag,
success_url='/tags/',), name="delete_tag"),
# Voting redirect views
url(r'^Qdownvote/(?P<pk>\d+)', views.QuestionDownvoteView.as_view(),
name='question_downvote'),
url(r'^QCupvote/(?P<pk>\d+)', views.QuestionCommentUpvoteView.as_view(),
name='question_comment_upvote'),
# on answers
url(r'^Aupvote/(?P<pk>\d+)', views.AnswerUpvoteView.as_view(),
name='answer_upvote'),
url(r'^Adownvote/(?P<pk>\d+)', views.AnswerDownvoteView.as_view(),
name='answer_downvote'),
url(r'^Qupvote/(?P<pk>\d+)', views.QuestionUpvoteView.as_view(),
name='question_upvote'),
url(r'^ACupvote/(?P<pk>\d+)', views.AnswerCommentUpvoteView.as_view(),
示例13: url
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
from django.conf.urls import url
from django.views.generic import DetailView, ListView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from milo.users.models import User
urlpatterns = [
url(r'^$', ListView.as_view(
queryset=User.objects.order_by('-id'),
context_object_name='users_list',
template_name='users/users_list.html'),
name='users-list'),
url(r'^create/$', CreateView.as_view(
model=User,
template_name_suffix='_create_form',
fields=['username','password','birthday_date','random_number']),
name='user-create'),
url(r'^edit/(?P<pk>[^/]+)/$', UpdateView.as_view(
model=User,
template_name_suffix='_edit_form',
fields=['username','password','birthday_date','random_number']),
name='user-edit'),
url(r'^delete/(?P<pk>[^/]+)/$', DeleteView.as_view(
model=User,
template_name_suffix='_delete_form',
success_url='/'),
name='user-delete'),
url(r'^csv_export/$', 'milo.users.views.export_csv',name='csv-list'),
]
示例14: url
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
# Plans
url(r'^$',
PlanListView.as_view(),
name="plan_list"),
url(r'^plans/$',
PlanListView.as_view(),
name="plan_list"),
url(r'^plans/create/$',
CreateView.as_view(model=Plan),
name="plan_add"),
url(r'^plans/edit/(?P<pk>\d+)$',
UpdateView.as_view(model=Plan),
name="plan_edit"),
url(r'^plans/delete/(?P<pk>\d+)$',
DeleteView.as_view(model=Plan,
success_url="/plans/"),
name="plan_delete"),
url(r'^plans/star/(?P<pk>\d+)$',
'motes.views.plan_star',
name="plan_star"),
url(r'^plans/(?P<plan_id>\d+)$',
'motes.views.plan_view',
name='plan_view'),
url(r'^plans/(?P<plan_id>\d+)/edit/(?P<mote_id>\d+)$',
'motes.views.mote_edit',
name='mote_edit'),
url(r'^plans/(?P<plan_id>\d+)/delete/(?P<pk>\d+)$',
DeleteView.as_view(model=Mote,
template_name="motes/mote_confirm_delete.html",
success_url="/plans/"),
name='mote_delete'),
示例15: patterns
# 需要导入模块: from django.views.generic.edit import DeleteView [as 别名]
# 或者: from django.views.generic.edit.DeleteView import as_view [as 别名]
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from django.views.generic import ListView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from videowm.models import *
from videowm.forms import *
from views import *
urlpatterns = patterns("",
url(r"^$", login_required(WebminarGestionList.as_view()), name="webminar_gestion_lista"),
url(r"^nuevo/$", login_required(CreateView.as_view(model=Webminar,form_class=WebminarForm)), name="webminar_nuevo"),
url(r"^editar/(?P<pk>\d+)/$", login_required(UpdateView.as_view(model=Webminar,form_class=WebminarForm)), name="webminar_editar"),
url(r"^borrar/(?P<pk>\d+)/$", login_required(DeleteView.as_view(model=Webminar,success_url="/gestion/")), name="webminar_borrar"),
url(r"^realizar/(?P<pk>\d+)/$", login_required(WebminarRealizar.as_view()), name="webminar_realizar"),
url(r"^exportar/(?P<pk>\d+)/mensajes/$", exportar_mensajes, name="webminar_exportar_mensajes"),
url(r"^exportar/(?P<pk>\d+)/visitas/$", exportar_visitas, name="webminar_exportar_visitas"),
)