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


Python UpdateView.as_view方法代码示例

本文整理汇总了Python中django.views.generic.edit.UpdateView.as_view方法的典型用法代码示例。如果您正苦于以下问题:Python UpdateView.as_view方法的具体用法?Python UpdateView.as_view怎么用?Python UpdateView.as_view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.views.generic.edit.UpdateView的用法示例。


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

示例1: item_metadata

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
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}))
开发者ID:Krazylee,项目名称:spindle-code,代码行数:9,代码来源:views.py

示例2: patterns

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
urlpatterns = patterns('',
                       url(r'^$', ListView.as_view(queryset=Note.objects.filter(public=1),
                                                   template_name='note-list.html',
                                                   paginate_by=25,
                       ), name='notes-view-notes'),

                       url(r'^(?P<pk>\d+)/$', DetailView.as_view(queryset=Note.objects.all(),
                                                                 template_name='note.html',
                       ), name='notes-view-note'),

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

示例3: patterns

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
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))))
开发者ID:MikeAmy,项目名称:django-concurrency,代码行数:24,代码来源:urls.py

示例4: patterns

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
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'),
)
开发者ID:rfadams,项目名称:python-django-heroku,代码行数:17,代码来源:urls.py

示例5: url

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
 ),
 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(
开发者ID:wooyek,项目名称:db_file_storage,代码行数:34,代码来源:urls.py

示例6: EntryActionMixin

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
# class EntryActionMixin(object):

#     @property
#     def action(self):
#         msg = "{0} is missing action.".format(self.__class__)
#         raise NotImplementedError(msg)

#     def form_valid(self, form):
#         msg = "Entrada {0}!".format(self.action)
#         messages.info(self.request, msg)
#         return super(EntryActionMixin, self).form_valid(form)

entry_create = CreateView.as_view(model=Entry, form_class=EntryForm)

entry_update = UpdateView.as_view(model=Entry, form_class=EntryForm)


class ProposalList(ProposalMixin, ListView):
    model = Proposal
    paginate_by = 10


proposal_detail = DetailView.as_view(model=Proposal)

# class ProposalDetail(DetailView):
#     template_name = 'core/proposal/proposal_detail.html'
#     model = Proposal

#     def get_context_data(self, **kwargs):
#         try:
开发者ID:paulo-romano,项目名称:orcamentos,代码行数:32,代码来源:views.py

示例7:

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
from django.shortcuts import resolve_url as r
from django.views.generic import CreateView, ListView, DetailView
from django.views.generic.edit import UpdateView
from orcamentos.crm.models import Person, Customer
from orcamentos.crm.forms import PersonForm, CustomerForm

# FirstnameSearchMixin
person_list = ListView.as_view(model=Person, paginate_by=10)

person_detail = DetailView.as_view(model=Person)

# LoginRequiredMixin
person_create = CreateView.as_view(model=Person, form_class=PersonForm)

# LoginRequiredMixin
person_update = UpdateView.as_view(model=Person, form_class=PersonForm)

customer_list = ListView.as_view(model=Customer, paginate_by=10)

customer_detail = DetailView.as_view(model=Customer)

# LoginRequiredMixin
customer_create = CreateView.as_view(model=Customer, form_class=CustomerForm)

# LoginRequiredMixin
customer_update = UpdateView.as_view(model=Customer, form_class=CustomerForm)
开发者ID:paulo-romano,项目名称:orcamentos,代码行数:28,代码来源:views.py

示例8: url

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
 ),
 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(
开发者ID:victor-o-silva,项目名称:db_file_storage,代码行数:34,代码来源:urls.py

示例9: url

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
    # Album Part
    # /music/
    url(r'^$', ListView.as_view(model=Album, template_name='music/index.html',
                                context_object_name='album_list'), name='index'),

    # /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/
开发者ID:suqingdong,项目名称:Sources,代码行数:33,代码来源:urls.py

示例10: url

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
        {'document_root':'../media'}),

    url(r'^tinymce/', include('tinymce.urls')),

    # 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+)$',
开发者ID:tomusher,项目名称:Diffuse,代码行数:33,代码来源:urls.py

示例11: patterns

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
from django.conf.urls import patterns, include, url
from django.views.generic import ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.contrib.auth.decorators import login_required, permission_required

from models import *
from views import *
from forms import *

urlpatterns = patterns('',
    url(r'^$', CursosListView.as_view(),name="cursos_lista"),
    url(r'calendario/(?P<curso_id>\d+)/(?P<ano>\d+)/(?P<mes>\d+)/$',login_required(calendario_mes), name="curso_calendario_mes"),
    url(r'nuevo/$',login_required(CreateView.as_view(model=Curso,form_class = CursoForm)), name="curso_nuevo"),
    url(r'clases/(?P<cliente_id>\d+)/nueva/$',login_required(CreateView.as_view(model=Clase)), name="clase_curso_nueva"),
    url(r'clases/nueva$',login_required(CreateView.as_view(model=Clase)), name="clase_nueva"),
    url(r'clases/(?P<pk>\d+)/editar/$',login_required(UpdateView.as_view(model=Clase)), name="clase_editar"),
    url(r'clases/(?P<pk>\d+)/borrar/$',ClaseDeleteView.as_view(), name="clase_borrar"),
    url(r'(?P<pk>\d+)/$',CursoDetailView.as_view(), name="curso_detalle"),
    url(r'(?P<pk>\d+)/borrar/$',CursoDeleteView.as_view(), name="curso_borrar"),
    url(r'(?P<pk>\d+)/editar/$',login_required(UpdateView.as_view(model=Curso)), name="curso_editar"),
)
开发者ID:Etxea,项目名称:gestion_eide_web,代码行数:23,代码来源:urls.py

示例12: modelform_factory

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
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)
empresa_update = UpdateView.as_view(model=Empresa, success_url=reverse_lazy('empresa_list'), form_class=EmpresaForm)
开发者ID:pumpkinlink,项目名称:auladjango,代码行数:32,代码来源:views.py

示例13: patterns

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
# coding=utf-8
from django.conf.urls import patterns, url
from django.views.generic.edit import UpdateView, CreateView
from apps.travel.models import TravelReview

__author__ = 'alexy'


urlpatterns = patterns(
    'apps.travel.views',
    url(r'^review/(?P<slug>[\w-]+)$', 'travel_detail', name='detail'),
    url(r'^review-change/(?P<slug>[\w-]+)$', UpdateView.as_view(model=TravelReview, template_name='travel/travel_change.html'), name='change'),
    url(r'^review-add/$', CreateView.as_view(model=TravelReview, template_name='travel/travel_add.html'), name='add'),
    url(r'^', 'travel_list', name='list'),
)
开发者ID:AlexProfi,项目名称:safari,代码行数:17,代码来源:urls.py

示例14: EntryList

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
class EntryList(EntryMixin, ListView):
    model = Entry
    paginate_by = 10


def entry_detail_json(request, pk):
    data = Entry.objects.filter(pk=pk)
    s = serializers.serialize("json", data)
    return HttpResponse(s)


entry_detail = DetailView.as_view(model=Entry)

entry_create = CreateView.as_view(model=Entry, form_class=EntryForm)

entry_update = UpdateView.as_view(model=Entry, form_class=EntryForm)


class ProposalList(ProposalMixin, ListView):
    model = Proposal
    paginate_by = 10


class ProposalDetail(ProposalDetailMixin, DetailView):
    model = Proposal


class ProposalUpdate(LoginRequiredMixin, UpdateView):
    model = Proposal
    form_class = ProposalForm
开发者ID:rg3915,项目名称:orcamentos,代码行数:32,代码来源:views.py

示例15: employee_create

# 需要导入模块: from django.views.generic.edit import UpdateView [as 别名]
# 或者: from django.views.generic.edit.UpdateView import as_view [as 别名]
from django.shortcuts import render
from django.views.generic import CreateView, ListView, DetailView
from django.views.generic.edit import UpdateView
from orcamentos.crm.models import Person
from orcamentos.crm.forms import PersonForm, EmployeeForm

# FirstnameSearchMixin
person_list = ListView.as_view(model=Person, paginate_by=10)

person_detail = DetailView.as_view(model=Person)

# LoginRequiredMixin
person_create = CreateView.as_view(model=Person, form_class=PersonForm)

# LoginRequiredMixin
person_update = UpdateView.as_view(model=Person, form_class=PersonForm)

# customer_list = ListView.as_view(model=Customer, paginate_by=10)

# customer_detail = DetailView.as_view(model=Customer)

# # LoginRequiredMixin
# customer_create = CreateView.as_view(model=Customer, form_class=CustomerForm)

# # LoginRequiredMixin
# customer_update = UpdateView.as_view(model=Customer, form_class=CustomerForm)


def employee_create(request):
    if request.method == 'POST':
        form = EmployeeForm(request.POST)
开发者ID:luiz158,项目名称:orcamentos-1,代码行数:33,代码来源:views.py


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