当前位置: 首页>>代码示例>>Python>>正文


Python edit.DeleteView类代码示例

本文整理汇总了Python中django.views.generic.edit.DeleteView的典型用法代码示例。如果您正苦于以下问题:Python DeleteView类的具体用法?Python DeleteView怎么用?Python DeleteView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DeleteView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete

    def delete(self, request, *args, **kwargs):
        relacion = self.get_object()
        (validez, mensaje) = self.valid_eliminar_rel(relacion)
        if validez:
            messages.success(request, mensaje)

            return DeleteView.delete(self, request, *args, **kwargs)

        else:
            messages.error(request, "ERROR : " + mensaje)
            return redirect(self.get_success_url())

        return DeleteView.delete(self, request, *args, **kwargs)
开发者ID:nelsondspy,项目名称:projectmn,代码行数:13,代码来源:view_itemrelacion.py

示例2: __init__

    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'
        ))
开发者ID:solvo,项目名称:organilab,代码行数:26,代码来源:laboratory.py

示例3: get_object

 def get_object(self, queryset=None):
     self.comment = DeleteView.get_object(self, queryset=queryset)
     self.comment_id = self.comment.id
     if self.comment.editable_by(self.request.user):
         return self.comment
     else:
         raise PermissionDenied
开发者ID:Orhideous,项目名称:ponyFiction,代码行数:7,代码来源:comment.py

示例4: delete

    def delete(self, request, *args, **kwargs):
        application = Application.objects.get(person = self.request.user, id = self.kwargs['pk'])

        # We do not want the user to delete an application already approved
        # this will mess up with class counts and expectations
        if not application.approved:
            # Delete application permit file associated with this application
            try:
                applicationpermit = ApplicationPermit.objects.get(application = application)

                if logger.isEnabledFor(logging.DEBUG):
                    logger.debug("İzin yazısı silindi: %s , request.user='%s' , request.META['REMOTE_ADDR']='%s'" %
                                 (applicationpermit, request.user, request.META["REMOTE_ADDR"]))

                applicationpermit.delete()
                messages.info(request, _('Your previously uploaded permit is deleted'))
            except ApplicationPermit.DoesNotExist:
                pass

            messages.info(request, _('Your application is deleted'))
            messages.info(request, _('Your previous choices for this event are deleted'))

            if logger.isEnabledFor(logging.DEBUG):
                logger.debug("Başvuru silindi: %s , request.user='%s' , request.META['REMOTE_ADDR']='%s'" %
                             (application, request.user, request.META["REMOTE_ADDR"]))

            return DeleteView.delete(self, request, *args, **kwargs)

        else:
            messages.error(request, _('You are not allowed to cancel an application after it is approved'))
            return render_to_response('kurs/hata.html',
                        context_instance=RequestContext(request))
开发者ID:ebayer,项目名称:lkd-kurs,代码行数:32,代码来源:views.py

示例5: get_object

 def get_object(self, queryset=None):
     self.story = DeleteView.get_object(self, queryset=queryset)
     self.story_id = self.story.id
     if self.story.editable_by(self.request.user):
         return self.story
     else:
         raise PermissionDenied
开发者ID:Orhideous,项目名称:ponyFiction,代码行数:7,代码来源:story.py

示例6: url

        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'
    ),
]
开发者ID:victor-o-silva,项目名称:db_file_storage,代码行数:31,代码来源:urls.py

示例7: url

    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/$', ListView.as_view(
            queryset=Change.objects.filter(of__published=True).order_by('-at'),
            paginate_by=30),
        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/(?P<slug>.+)/$', 'change', name='change'),


    # Relations:
    ## Class-Views
    url(r'^relations/list', ListView.as_view(queryset=Relation.objects.all()), 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'),
开发者ID:pombredanne,项目名称:denigma,代码行数:31,代码来源:urls.py

示例8: patterns

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'),
)
开发者ID:MechanisM,项目名称:tinygraph,代码行数:23,代码来源:urls.py

示例9: patterns

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)),
)
开发者ID:CPSC473Team4,项目名称:corrupted_half,代码行数:30,代码来源:urls.py

示例10: include


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/$',
开发者ID:nikolas,项目名称:rolf,代码行数:29,代码来源:urls.py

示例11: url

    url(r'^admin/', include(admin.site.urls)),
)

# model form tests
urlpatterns += patterns('',
    url(r'^starter/$', ListView.as_view(model=Starter), name="list_page"),
    url(r'^starter/create/$', CreateView.as_view(
            model=Starter,
            success_url=reverse_lazy('list_page')), 
        name="create_page"),
    url(r'^starter/(?P<pk>\d+)/update/$', UpdateView.as_view(
            model=Starter, 
            success_url=reverse_lazy('list_page')),
        name="update_page"),
    url(r'^starter/(?P<pk>\d+)/delete/$', DeleteView.as_view(
            model=Starter, 
            success_url = reverse_lazy('list_page'),
            template_name_suffix="_confirm_delete"),
        name="delete_page"),
    url(r'^starter/(?P<pk>\d+)/$', DetailView.as_view(model=Starter), name="detail_page"),
    )

###################################
## development and test settings ##
###################################

if settings.DEBUG:
    #development site property directories
    
    static_dir = os.path.join(
        os.path.dirname(__file__), '../static'
    )
开发者ID:jimfmunro,项目名称:django-starter,代码行数:32,代码来源:urls.py

示例12: EventoDeleteView

class EventoDeleteView(DeleteView):
    def get(self, request, *args, **kwargs):
        self.object = self.get_object()
        if self.object.owner != request.user:
            raise Http404

        context = self.get_context_data(object=self.object)
        return self.render_to_response(context)

    def delete(self, request, *args, **kwargs):
        if self.object.owner != request.user:
            raise Http404
        self.object = self.get_object()
        self.object.delete()
        return HttpResponseRedirect(self.get_success_url())


evento_delete = user_passes_test(
    lambda u: u.is_superuser)(DeleteView.as_view(model=CalendarioEvento, template_name='confirm_delete.html', success_url=reverse_lazy('meus_eventos')))


departamento_create = user_passes_test(
    lambda u: u.is_superuser)(CreateView.as_view(form_class=DepartamentoForm, model=Departamento, success_url=reverse_lazy('departamento_list')))
departamento_delete = user_passes_test(
    lambda u: u.is_superuser)(DeleteView.as_view(model=Departamento, template_name='confirm_delete.html', success_url=reverse_lazy('departamento_list')))
departamento_list = user_passes_test(
    lambda u: u.is_superuser)(ListView.as_view(queryset=Departamento.objects.all(), paginate_by=10))
departamento_update = user_passes_test(
    lambda u: u.is_superuser)(UpdateView.as_view(form_class=DepartamentoForm, model=Departamento, success_url=reverse_lazy('departamento_list')))
开发者ID:zokis,项目名称:TODO-agenda,代码行数:29,代码来源:views.py

示例13: url

            name="vendor-detail",
        ),
    url(r'^signup/$', 
        login_required(CreateView.as_view(
            form_class=VendorForm,)),
            name="vendor-signup",
        ), # Signup as a new vendor
    url(r'^(?P<slug>[-\w]+)/edit/$', 
        login_required(UpdateView.as_view(
            model=Vendor,
            form_class=VendorForm, 
            slug_field='slug', )),
            name="vendor-edit",
        ), # Edit your vendor profile
    url(r'^(?P<slug>[-\w]+)/delete/$', 
        login_required(DeleteView.as_view(
            model=Vendor, )),
            name="vendor-delete",
       ), # Delete your vendor profile

    # Having to do with applications for vendors
    #url(r'^(?P<slug>[-\w]+)/applications/$', 
    #    login_required(VendorApplicationList.as_view(
    #        name="vendor-application-list",
    #    ))),
    url(r'^(?P<slug>[-\w]+)/applications/create/$', 
        login_required(CreateView.as_view(
            form_class=ApplicationForm)),
            name="vendor-application-create",
        ),
    #url(r'^(?P<slug>[-\w]+)/applications/(?P<year>\d{4})/$', 
    #    login_required(VendorApplicationDetail.as_view(
开发者ID:powellc,项目名称:django-vendors,代码行数:32,代码来源:urls.py

示例14: url

}

recipe_info_dict = {
    'model': Recipe,
    'template_name': 'rolf/recipe_detail.html',
}


accounts_tuple = url(r'^accounts/', include('django.contrib.auth.urls'))

urlpatterns = [
    url(r'^$', index),
    url(r'^category/add/', add_category),
    url(r'^category/(?P<object_id>\d+)/$', generic_detail, category_info_dict),
    url(r'^category/(?P<object_id>\d+)/add_application/$', add_application),
    url(r'^category/(?P<pk>\d+)/delete/$', DeleteView.as_view(
        model=Category, success_url="/")),

    url(r'^application/(?P<object_id>\d+)/$', generic_detail,
        application_info_dict),
    url(r'^application/(?P<object_id>\d+)/add_deployment/$', add_deployment),
    url(r'^application/(?P<pk>\d+)/delete/$', DeleteView.as_view(
        model=Application, success_url="/")),

    url(r'^deployment/(?P<object_id>\d+)/$', generic_detail,
        deployment_info_dict, name='deployment_detail'),
    url(r'^deployment/(?P<object_id>\d+)/add_setting/$', add_setting),
    url(r'^deployment/(?P<object_id>\d+)/edit_settings/$', edit_settings),
    url(r'^deployment/(?P<object_id>\d+)/add_stage/$', add_stage),
    url(r'^deployment/(?P<object_id>\d+)/clone/$', clone_deployment),
    url(r'^deployment/(?P<object_id>\d+)/push/$', push),
    url(r'^deployment/(?P<object_id>\d+)/remove_permission/$',
开发者ID:ccnmtl,项目名称:rolf,代码行数:32,代码来源:urls.py

示例15: url

    # /music/2/
    url(r'^(?P<pk>\d+)/$', DetailView.as_view(model=Album,
                                              template_name='music/detail.html'), name='detail'),

    # /music/alubm/add/
    url(r'^album/add/$', CreateView.as_view(model=Album,
                                            fields="__all__"), name="album-add"),

    # /music/alubm/3/update/
    url(r'^album/(?P<pk>\d+)/update/$',
        UpdateView.as_view(model=Album, fields="__all__"), name="album-update"),

    # /music/alubm/3/delete/
    url(r'^album/(?P<pk>\d+)/delete/$',
        DeleteView.as_view(model=Album, success_url=reverse_lazy('music:index')), name="album-delete"),

    # Song Part
    # /music/songs/
    url(r'^songs/$', ListView.as_view(model=Song,
                                      context_object_name="songs"), name="songs"),

    # /music/songs/add/
    url(r'^songs/add/$', CreateView.as_view(model=Song,
                                            fields="__all__"), name='song-add'),

    # /music/songs/2/update/
    url(r'^songs/(?P<pk>\d+)/update/$', UpdateView.as_view(model=Song,
                                                           fields="__all__"), name="song-update"),

    # /music/songs/2/delete/
开发者ID:suqingdong,项目名称:Sources,代码行数:30,代码来源:urls.py


注:本文中的django.views.generic.edit.DeleteView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。