码迷,mamicode.com
首页 > 其他好文 > 详细

django - generic views

时间:2015-04-21 14:40:19      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:django   generic   views   

ListView

from django.views.generic import ListView
-----------------------------------
class ListView Found at: django.views.generic.list

class ListView(MultipleObjectTemplateResponseMixin, BaseListView):
    """
    Render some list of objects, set by `self.model` or `self.queryset`.
    `self.queryset` can actually be any iterable of items, not just a queryset.
    """

DetailView

from django.views.generic import DetailView
-------------------------------------------
class DetailView Found at: django.views.generic.detail

class DetailView(SingleObjectTemplateResponseMixin, BaseDetailView):
    """
    Render a "detail" view of an object.

    By default this is a model instance looked up from `self.queryset`, but the
    view will support display of *any* object by overriding `self.get_object()`.
    """

CreateView

from django.views.generic.edit import CreateView
------------------------------------------------
class CreateView Found at: django.views.generic.edit

class CreateView(SingleObjectTemplateResponseMixin, BaseCreateView):
    """
    View for creating a new object instance,
    with a response rendered by template.
    """
    template_name_suffix = ‘_form‘

UpdateView

from django.views.generic.edit import UpdateView
------------------------------------------------
class UpdateView Found at: django.views.generic.edit

class UpdateView(SingleObjectTemplateResponseMixin, BaseUpdateView):
    """
    View for updating an object,
    with a response rendered by template.
    """
    template_name_suffix = ‘_form‘

DeleteView

from django.views.generic.edit import DeleteView
------------------------------------------------
class DeleteView Found at: django.views.generic.edit

class DeleteView(SingleObjectTemplateResponseMixin, BaseDeleteView):
    """
    View for deleting an object retrieved with `self.get_object()`,
    with a response rendered by template.
    """
    template_name_suffix = ‘_confirm_delete‘

FormView

from django.views.generic.edit import FormView
----------------------------------------------
class FormView Found at: django.views.generic.edit

class FormView(TemplateResponseMixin, BaseFormView):
    """
    A view for displaying a form, and rendering a template response.
    """

django - generic views

标签:django   generic   views   

原文地址:http://blog.csdn.net/tmpbook/article/details/45169741

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!