Commits

cla...@bcc190cf-cafb-0310-a4f2-bffc1f526a37  committed 4911e8d

Fixed #18033 -- Removed function-based generic views, as per official deprecation timeline. Rest in peace! Thanks Anssi Kääriäinen for the review.

  • Participants
  • Parent commits 7a90fa3

Comments (0)

Files changed (38)

File django/views/generic/create_update.py

-from django.forms.models import ModelFormMetaclass, ModelForm
-from django.template import RequestContext, loader
-from django.http import Http404, HttpResponse, HttpResponseRedirect
-from django.core.xheaders import populate_xheaders
-from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
-from django.utils.translation import ugettext
-from django.contrib.auth.views import redirect_to_login
-from django.views.generic import GenericViewError
-from django.contrib import messages
-
-import warnings
-warnings.warn(
-    'Function-based generic views have been deprecated; use class-based views instead.',
-    DeprecationWarning
-)
-
-
-def apply_extra_context(extra_context, context):
-    """
-    Adds items from extra_context dict to context.  If a value in extra_context
-    is callable, then it is called and the result is added to context.
-    """
-    for key, value in extra_context.iteritems():
-        if callable(value):
-            context[key] = value()
-        else:
-            context[key] = value
-
-def get_model_and_form_class(model, form_class):
-    """
-    Returns a model and form class based on the model and form_class
-    parameters that were passed to the generic view.
-
-    If ``form_class`` is given then its associated model will be returned along
-    with ``form_class`` itself.  Otherwise, if ``model`` is given, ``model``
-    itself will be returned along with a ``ModelForm`` class created from
-    ``model``.
-    """
-    if form_class:
-        return form_class._meta.model, form_class
-    if model:
-        # The inner Meta class fails if model = model is used for some reason.
-        tmp_model = model
-        # TODO: we should be able to construct a ModelForm without creating
-        # and passing in a temporary inner class.
-        class Meta:
-            model = tmp_model
-        class_name = model.__name__ + 'Form'
-        form_class = ModelFormMetaclass(class_name, (ModelForm,), {'Meta': Meta})
-        return model, form_class
-    raise GenericViewError("Generic view must be called with either a model or"
-                           " form_class argument.")
-
-def redirect(post_save_redirect, obj):
-    """
-    Returns a HttpResponseRedirect to ``post_save_redirect``.
-
-    ``post_save_redirect`` should be a string, and can contain named string-
-    substitution place holders of ``obj`` field names.
-
-    If ``post_save_redirect`` is None, then redirect to ``obj``'s URL returned
-    by ``get_absolute_url()``.  If ``obj`` has no ``get_absolute_url`` method,
-    then raise ImproperlyConfigured.
-
-    This function is meant to handle the post_save_redirect parameter to the
-    ``create_object`` and ``update_object`` views.
-    """
-    if post_save_redirect:
-        return HttpResponseRedirect(post_save_redirect % obj.__dict__)
-    elif hasattr(obj, 'get_absolute_url'):
-        return HttpResponseRedirect(obj.get_absolute_url())
-    else:
-        raise ImproperlyConfigured(
-            "No URL to redirect to.  Either pass a post_save_redirect"
-            " parameter to the generic view or define a get_absolute_url"
-            " method on the Model.")
-
-def lookup_object(model, object_id, slug, slug_field):
-    """
-    Return the ``model`` object with the passed ``object_id``.  If
-    ``object_id`` is None, then return the object whose ``slug_field``
-    equals the passed ``slug``.  If ``slug`` and ``slug_field`` are not passed,
-    then raise Http404 exception.
-    """
-    lookup_kwargs = {}
-    if object_id:
-        lookup_kwargs['%s__exact' % model._meta.pk.name] = object_id
-    elif slug and slug_field:
-        lookup_kwargs['%s__exact' % slug_field] = slug
-    else:
-        raise GenericViewError(
-            "Generic view must be called with either an object_id or a"
-            " slug/slug_field.")
-    try:
-        return model.objects.get(**lookup_kwargs)
-    except ObjectDoesNotExist:
-        raise Http404("No %s found for %s"
-                      % (model._meta.verbose_name, lookup_kwargs))
-
-def create_object(request, model=None, template_name=None,
-        template_loader=loader, extra_context=None, post_save_redirect=None,
-        login_required=False, context_processors=None, form_class=None):
-    """
-    Generic object-creation function.
-
-    Templates: ``<app_label>/<model_name>_form.html``
-    Context:
-        form
-            the form for the object
-    """
-    if extra_context is None: extra_context = {}
-    if login_required and not request.user.is_authenticated():
-        return redirect_to_login(request.path)
-
-    model, form_class = get_model_and_form_class(model, form_class)
-    if request.method == 'POST':
-        form = form_class(request.POST, request.FILES)
-        if form.is_valid():
-            new_object = form.save()
-
-            msg = ugettext("The %(verbose_name)s was created successfully.") %\
-                                    {"verbose_name": model._meta.verbose_name}
-            messages.success(request, msg, fail_silently=True)
-            return redirect(post_save_redirect, new_object)
-    else:
-        form = form_class()
-
-    # Create the template, context, response
-    if not template_name:
-        template_name = "%s/%s_form.html" % (model._meta.app_label, model._meta.object_name.lower())
-    t = template_loader.get_template(template_name)
-    c = RequestContext(request, {
-        'form': form,
-    }, context_processors)
-    apply_extra_context(extra_context, c)
-    return HttpResponse(t.render(c))
-
-def update_object(request, model=None, object_id=None, slug=None,
-        slug_field='slug', template_name=None, template_loader=loader,
-        extra_context=None, post_save_redirect=None, login_required=False,
-        context_processors=None, template_object_name='object',
-        form_class=None):
-    """
-    Generic object-update function.
-
-    Templates: ``<app_label>/<model_name>_form.html``
-    Context:
-        form
-            the form for the object
-        object
-            the original object being edited
-    """
-    if extra_context is None: extra_context = {}
-    if login_required and not request.user.is_authenticated():
-        return redirect_to_login(request.path)
-
-    model, form_class = get_model_and_form_class(model, form_class)
-    obj = lookup_object(model, object_id, slug, slug_field)
-
-    if request.method == 'POST':
-        form = form_class(request.POST, request.FILES, instance=obj)
-        if form.is_valid():
-            obj = form.save()
-            msg = ugettext("The %(verbose_name)s was updated successfully.") %\
-                                    {"verbose_name": model._meta.verbose_name}
-            messages.success(request, msg, fail_silently=True)
-            return redirect(post_save_redirect, obj)
-    else:
-        form = form_class(instance=obj)
-
-    if not template_name:
-        template_name = "%s/%s_form.html" % (model._meta.app_label, model._meta.object_name.lower())
-    t = template_loader.get_template(template_name)
-    c = RequestContext(request, {
-        'form': form,
-        template_object_name: obj,
-    }, context_processors)
-    apply_extra_context(extra_context, c)
-    response = HttpResponse(t.render(c))
-    populate_xheaders(request, response, model, getattr(obj, obj._meta.pk.attname))
-    return response
-
-def delete_object(request, model, post_delete_redirect, object_id=None,
-        slug=None, slug_field='slug', template_name=None,
-        template_loader=loader, extra_context=None, login_required=False,
-        context_processors=None, template_object_name='object'):
-    """
-    Generic object-delete function.
-
-    The given template will be used to confirm deletetion if this view is
-    fetched using GET; for safty, deletion will only be performed if this
-    view is POSTed.
-
-    Templates: ``<app_label>/<model_name>_confirm_delete.html``
-    Context:
-        object
-            the original object being deleted
-    """
-    if extra_context is None: extra_context = {}
-    if login_required and not request.user.is_authenticated():
-        return redirect_to_login(request.path)
-
-    obj = lookup_object(model, object_id, slug, slug_field)
-
-    if request.method == 'POST':
-        obj.delete()
-        msg = ugettext("The %(verbose_name)s was deleted.") %\
-                                    {"verbose_name": model._meta.verbose_name}
-        messages.success(request, msg, fail_silently=True)
-        return HttpResponseRedirect(post_delete_redirect)
-    else:
-        if not template_name:
-            template_name = "%s/%s_confirm_delete.html" % (model._meta.app_label, model._meta.object_name.lower())
-        t = template_loader.get_template(template_name)
-        c = RequestContext(request, {
-            template_object_name: obj,
-        }, context_processors)
-        apply_extra_context(extra_context, c)
-        response = HttpResponse(t.render(c))
-        populate_xheaders(request, response, model, getattr(obj, obj._meta.pk.attname))
-        return response

File django/views/generic/date_based.py

-import datetime
-import time
-
-from django.template import loader, RequestContext
-from django.core.exceptions import ObjectDoesNotExist
-from django.core.xheaders import populate_xheaders
-from django.db.models.fields import DateTimeField
-from django.http import Http404, HttpResponse
-from django.utils import timezone
-
-import warnings
-warnings.warn(
-    'Function-based generic views have been deprecated; use class-based views instead.',
-    DeprecationWarning
-)
-
-
-def archive_index(request, queryset, date_field, num_latest=15,
-        template_name=None, template_loader=loader,
-        extra_context=None, allow_empty=True, context_processors=None,
-        mimetype=None, allow_future=False, template_object_name='latest'):
-    """
-    Generic top-level archive of date-based objects.
-
-    Templates: ``<app_label>/<model_name>_archive.html``
-    Context:
-        date_list
-            List of years
-        latest
-            Latest N (defaults to 15) objects by date
-    """
-    if extra_context is None: extra_context = {}
-    model = queryset.model
-    if not allow_future:
-        queryset = queryset.filter(**{'%s__lte' % date_field: timezone.now()})
-    date_list = queryset.dates(date_field, 'year')[::-1]
-    if not date_list and not allow_empty:
-        raise Http404("No %s available" % model._meta.verbose_name)
-
-    if date_list and num_latest:
-        latest = queryset.order_by('-'+date_field)[:num_latest]
-    else:
-        latest = None
-
-    if not template_name:
-        template_name = "%s/%s_archive.html" % (model._meta.app_label, model._meta.object_name.lower())
-    t = template_loader.get_template(template_name)
-    c = RequestContext(request, {
-        'date_list' : date_list,
-        template_object_name : latest,
-    }, context_processors)
-    for key, value in extra_context.items():
-        if callable(value):
-            c[key] = value()
-        else:
-            c[key] = value
-    return HttpResponse(t.render(c), mimetype=mimetype)
-
-def archive_year(request, year, queryset, date_field, template_name=None,
-        template_loader=loader, extra_context=None, allow_empty=False,
-        context_processors=None, template_object_name='object', mimetype=None,
-        make_object_list=False, allow_future=False):
-    """
-    Generic yearly archive view.
-
-    Templates: ``<app_label>/<model_name>_archive_year.html``
-    Context:
-        date_list
-            List of months in this year with objects
-        year
-            This year
-        object_list
-            List of objects published in the given month
-            (Only available if make_object_list argument is True)
-    """
-    if extra_context is None: extra_context = {}
-    model = queryset.model
-    now = timezone.now()
-
-    lookup_kwargs = {'%s__year' % date_field: year}
-
-    # Only bother to check current date if the year isn't in the past and future objects aren't requested.
-    if int(year) >= now.year and not allow_future:
-        lookup_kwargs['%s__lte' % date_field] = now
-    date_list = queryset.filter(**lookup_kwargs).dates(date_field, 'month')
-    if not date_list and not allow_empty:
-        raise Http404
-    if make_object_list:
-        object_list = queryset.filter(**lookup_kwargs)
-    else:
-        object_list = []
-    if not template_name:
-        template_name = "%s/%s_archive_year.html" % (model._meta.app_label, model._meta.object_name.lower())
-    t = template_loader.get_template(template_name)
-    c = RequestContext(request, {
-        'date_list': date_list,
-        'year': year,
-        '%s_list' % template_object_name: object_list,
-    }, context_processors)
-    for key, value in extra_context.items():
-        if callable(value):
-            c[key] = value()
-        else:
-            c[key] = value
-    return HttpResponse(t.render(c), mimetype=mimetype)
-
-def archive_month(request, year, month, queryset, date_field,
-        month_format='%b', template_name=None, template_loader=loader,
-        extra_context=None, allow_empty=False, context_processors=None,
-        template_object_name='object', mimetype=None, allow_future=False):
-    """
-    Generic monthly archive view.
-
-    Templates: ``<app_label>/<model_name>_archive_month.html``
-    Context:
-        date_list:
-            List of days in this month with objects
-        month:
-            (date) this month
-        next_month:
-            (date) the first day of the next month, or None if the next month is in the future
-        previous_month:
-            (date) the first day of the previous month
-        object_list:
-            list of objects published in the given month
-    """
-    if extra_context is None: extra_context = {}
-    try:
-        tt = time.strptime("%s-%s" % (year, month), '%s-%s' % ('%Y', month_format))
-        date = datetime.date(*tt[:3])
-    except ValueError:
-        raise Http404
-
-    model = queryset.model
-    now = timezone.now()
-
-    # Calculate first and last day of month, for use in a date-range lookup.
-    first_day = date.replace(day=1)
-    if first_day.month == 12:
-        last_day = first_day.replace(year=first_day.year + 1, month=1)
-    else:
-        last_day = first_day.replace(month=first_day.month + 1)
-    lookup_kwargs = {
-        '%s__gte' % date_field: first_day,
-        '%s__lt' % date_field: last_day,
-    }
-
-    # Only bother to check current date if the month isn't in the past and future objects are requested.
-    if last_day >= now.date() and not allow_future:
-        lookup_kwargs['%s__lte' % date_field] = now
-    object_list = queryset.filter(**lookup_kwargs)
-    date_list = object_list.dates(date_field, 'day')
-    if not object_list and not allow_empty:
-        raise Http404
-
-    # Calculate the next month, if applicable.
-    if allow_future:
-        next_month = last_day
-    elif last_day <= datetime.date.today():
-        next_month = last_day
-    else:
-        next_month = None
-
-    # Calculate the previous month
-    if first_day.month == 1:
-        previous_month = first_day.replace(year=first_day.year-1,month=12)
-    else:
-        previous_month = first_day.replace(month=first_day.month-1)
-
-    if not template_name:
-        template_name = "%s/%s_archive_month.html" % (model._meta.app_label, model._meta.object_name.lower())
-    t = template_loader.get_template(template_name)
-    c = RequestContext(request, {
-        'date_list': date_list,
-        '%s_list' % template_object_name: object_list,
-        'month': date,
-        'next_month': next_month,
-        'previous_month': previous_month,
-    }, context_processors)
-    for key, value in extra_context.items():
-        if callable(value):
-            c[key] = value()
-        else:
-            c[key] = value
-    return HttpResponse(t.render(c), mimetype=mimetype)
-
-def archive_week(request, year, week, queryset, date_field,
-        template_name=None, template_loader=loader,
-        extra_context=None, allow_empty=True, context_processors=None,
-        template_object_name='object', mimetype=None, allow_future=False):
-    """
-    Generic weekly archive view.
-
-    Templates: ``<app_label>/<model_name>_archive_week.html``
-    Context:
-        week:
-            (date) this week
-        object_list:
-            list of objects published in the given week
-    """
-    if extra_context is None: extra_context = {}
-    try:
-        tt = time.strptime(year+'-0-'+week, '%Y-%w-%U')
-        date = datetime.date(*tt[:3])
-    except ValueError:
-        raise Http404
-
-    model = queryset.model
-    now = timezone.now()
-
-    # Calculate first and last day of week, for use in a date-range lookup.
-    first_day = date
-    last_day = date + datetime.timedelta(days=7)
-    lookup_kwargs = {
-        '%s__gte' % date_field: first_day,
-        '%s__lt' % date_field: last_day,
-    }
-
-    # Only bother to check current date if the week isn't in the past and future objects aren't requested.
-    if last_day >= now.date() and not allow_future:
-        lookup_kwargs['%s__lte' % date_field] = now
-    object_list = queryset.filter(**lookup_kwargs)
-    if not object_list and not allow_empty:
-        raise Http404
-    if not template_name:
-        template_name = "%s/%s_archive_week.html" % (model._meta.app_label, model._meta.object_name.lower())
-    t = template_loader.get_template(template_name)
-    c = RequestContext(request, {
-        '%s_list' % template_object_name: object_list,
-        'week': date,
-    })
-    for key, value in extra_context.items():
-        if callable(value):
-            c[key] = value()
-        else:
-            c[key] = value
-    return HttpResponse(t.render(c), mimetype=mimetype)
-
-def archive_day(request, year, month, day, queryset, date_field,
-        month_format='%b', day_format='%d', template_name=None,
-        template_loader=loader, extra_context=None, allow_empty=False,
-        context_processors=None, template_object_name='object',
-        mimetype=None, allow_future=False):
-    """
-    Generic daily archive view.
-
-    Templates: ``<app_label>/<model_name>_archive_day.html``
-    Context:
-        object_list:
-            list of objects published that day
-        day:
-            (datetime) the day
-        previous_day
-            (datetime) the previous day
-        next_day
-            (datetime) the next day, or None if the current day is today
-    """
-    if extra_context is None: extra_context = {}
-    try:
-        tt = time.strptime('%s-%s-%s' % (year, month, day),
-                           '%s-%s-%s' % ('%Y', month_format, day_format))
-        date = datetime.date(*tt[:3])
-    except ValueError:
-        raise Http404
-
-    model = queryset.model
-    now = timezone.now()
-
-    if isinstance(model._meta.get_field(date_field), DateTimeField):
-        lookup_kwargs = {'%s__range' % date_field: (datetime.datetime.combine(date, datetime.time.min), datetime.datetime.combine(date, datetime.time.max))}
-    else:
-        lookup_kwargs = {date_field: date}
-
-    # Only bother to check current date if the date isn't in the past and future objects aren't requested.
-    if date >= now.date() and not allow_future:
-        lookup_kwargs['%s__lte' % date_field] = now
-    object_list = queryset.filter(**lookup_kwargs)
-    if not allow_empty and not object_list:
-        raise Http404
-
-    # Calculate the next day, if applicable.
-    if allow_future:
-        next_day = date + datetime.timedelta(days=1)
-    elif date < datetime.date.today():
-        next_day = date + datetime.timedelta(days=1)
-    else:
-        next_day = None
-
-    if not template_name:
-        template_name = "%s/%s_archive_day.html" % (model._meta.app_label, model._meta.object_name.lower())
-    t = template_loader.get_template(template_name)
-    c = RequestContext(request, {
-        '%s_list' % template_object_name: object_list,
-        'day': date,
-        'previous_day': date - datetime.timedelta(days=1),
-        'next_day': next_day,
-    }, context_processors)
-    for key, value in extra_context.items():
-        if callable(value):
-            c[key] = value()
-        else:
-            c[key] = value
-    return HttpResponse(t.render(c), mimetype=mimetype)
-
-def archive_today(request, **kwargs):
-    """
-    Generic daily archive view for today. Same as archive_day view.
-    """
-    today = datetime.date.today()
-    kwargs.update({
-        'year': str(today.year),
-        'month': today.strftime('%b').lower(),
-        'day': str(today.day),
-    })
-    return archive_day(request, **kwargs)
-
-def object_detail(request, year, month, day, queryset, date_field,
-        month_format='%b', day_format='%d', object_id=None, slug=None,
-        slug_field='slug', template_name=None, template_name_field=None,
-        template_loader=loader, extra_context=None, context_processors=None,
-        template_object_name='object', mimetype=None, allow_future=False):
-    """
-    Generic detail view from year/month/day/slug or year/month/day/id structure.
-
-    Templates: ``<app_label>/<model_name>_detail.html``
-    Context:
-        object:
-            the object to be detailed
-    """
-    if extra_context is None: extra_context = {}
-    try:
-        tt = time.strptime('%s-%s-%s' % (year, month, day),
-                           '%s-%s-%s' % ('%Y', month_format, day_format))
-        date = datetime.date(*tt[:3])
-    except ValueError:
-        raise Http404
-
-    model = queryset.model
-    now = timezone.now()
-
-    if isinstance(model._meta.get_field(date_field), DateTimeField):
-        lookup_kwargs = {'%s__range' % date_field: (datetime.datetime.combine(date, datetime.time.min), datetime.datetime.combine(date, datetime.time.max))}
-    else:
-        lookup_kwargs = {date_field: date}
-
-    # Only bother to check current date if the date isn't in the past and future objects aren't requested.
-    if date >= now.date() and not allow_future:
-        lookup_kwargs['%s__lte' % date_field] = now
-    if object_id:
-        lookup_kwargs['%s__exact' % model._meta.pk.name] = object_id
-    elif slug and slug_field:
-        lookup_kwargs['%s__exact' % slug_field] = slug
-    else:
-        raise AttributeError("Generic detail view must be called with either an object_id or a slug/slugfield")
-    try:
-        obj = queryset.get(**lookup_kwargs)
-    except ObjectDoesNotExist:
-        raise Http404("No %s found for" % model._meta.verbose_name)
-    if not template_name:
-        template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower())
-    if template_name_field:
-        template_name_list = [getattr(obj, template_name_field), template_name]
-        t = template_loader.select_template(template_name_list)
-    else:
-        t = template_loader.get_template(template_name)
-    c = RequestContext(request, {
-        template_object_name: obj,
-    }, context_processors)
-    for key, value in extra_context.items():
-        if callable(value):
-            c[key] = value()
-        else:
-            c[key] = value
-    response = HttpResponse(t.render(c), mimetype=mimetype)
-    populate_xheaders(request, response, model, getattr(obj, obj._meta.pk.name))
-    return response

File django/views/generic/list_detail.py

-from django.template import loader, RequestContext
-from django.http import Http404, HttpResponse
-from django.core.xheaders import populate_xheaders
-from django.core.paginator import Paginator, InvalidPage
-from django.core.exceptions import ObjectDoesNotExist
-
-import warnings
-warnings.warn(
-    'Function-based generic views have been deprecated; use class-based views instead.',
-    DeprecationWarning
-)
-
-
-def object_list(request, queryset, paginate_by=None, page=None,
-        allow_empty=True, template_name=None, template_loader=loader,
-        extra_context=None, context_processors=None, template_object_name='object',
-        mimetype=None):
-    """
-    Generic list of objects.
-
-    Templates: ``<app_label>/<model_name>_list.html``
-    Context:
-        object_list
-            list of objects
-        is_paginated
-            are the results paginated?
-        results_per_page
-            number of objects per page (if paginated)
-        has_next
-            is there a next page?
-        has_previous
-            is there a prev page?
-        page
-            the current page
-        next
-            the next page
-        previous
-            the previous page
-        pages
-            number of pages, total
-        hits
-            number of objects, total
-        last_on_page
-            the result number of the last of object in the
-            object_list (1-indexed)
-        first_on_page
-            the result number of the first object in the
-            object_list (1-indexed)
-        page_range:
-            A list of the page numbers (1-indexed).
-    """
-    if extra_context is None: extra_context = {}
-    queryset = queryset._clone()
-    if paginate_by:
-        paginator = Paginator(queryset, paginate_by, allow_empty_first_page=allow_empty)
-        if not page:
-            page = request.GET.get('page', 1)
-        try:
-            page_number = int(page)
-        except ValueError:
-            if page == 'last':
-                page_number = paginator.num_pages
-            else:
-                # Page is not 'last', nor can it be converted to an int.
-                raise Http404
-        try:
-            page_obj = paginator.page(page_number)
-        except InvalidPage:
-            raise Http404
-        c = RequestContext(request, {
-            '%s_list' % template_object_name: page_obj.object_list,
-            'paginator': paginator,
-            'page_obj': page_obj,
-            'is_paginated': page_obj.has_other_pages(),
-
-            # Legacy template context stuff. New templates should use page_obj
-            # to access this instead.
-            'results_per_page': paginator.per_page,
-            'has_next': page_obj.has_next(),
-            'has_previous': page_obj.has_previous(),
-            'page': page_obj.number,
-            'next': page_obj.next_page_number(),
-            'previous': page_obj.previous_page_number(),
-            'first_on_page': page_obj.start_index(),
-            'last_on_page': page_obj.end_index(),
-            'pages': paginator.num_pages,
-            'hits': paginator.count,
-            'page_range': paginator.page_range,
-        }, context_processors)
-    else:
-        c = RequestContext(request, {
-            '%s_list' % template_object_name: queryset,
-            'paginator': None,
-            'page_obj': None,
-            'is_paginated': False,
-        }, context_processors)
-        if not allow_empty and len(queryset) == 0:
-            raise Http404
-    for key, value in extra_context.items():
-        if callable(value):
-            c[key] = value()
-        else:
-            c[key] = value
-    if not template_name:
-        model = queryset.model
-        template_name = "%s/%s_list.html" % (model._meta.app_label, model._meta.object_name.lower())
-    t = template_loader.get_template(template_name)
-    return HttpResponse(t.render(c), mimetype=mimetype)
-
-def object_detail(request, queryset, object_id=None, slug=None,
-        slug_field='slug', template_name=None, template_name_field=None,
-        template_loader=loader, extra_context=None,
-        context_processors=None, template_object_name='object',
-        mimetype=None):
-    """
-    Generic detail of an object.
-
-    Templates: ``<app_label>/<model_name>_detail.html``
-    Context:
-        object
-            the object
-    """
-    if extra_context is None: extra_context = {}
-    model = queryset.model
-    if object_id:
-        queryset = queryset.filter(pk=object_id)
-    elif slug and slug_field:
-        queryset = queryset.filter(**{slug_field: slug})
-    else:
-        raise AttributeError("Generic detail view must be called with either an object_id or a slug/slug_field.")
-    try:
-        obj = queryset.get()
-    except ObjectDoesNotExist:
-        raise Http404("No %s found matching the query" % (model._meta.verbose_name))
-    if not template_name:
-        template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower())
-    if template_name_field:
-        template_name_list = [getattr(obj, template_name_field), template_name]
-        t = template_loader.select_template(template_name_list)
-    else:
-        t = template_loader.get_template(template_name)
-    c = RequestContext(request, {
-        template_object_name: obj,
-    }, context_processors)
-    for key, value in extra_context.items():
-        if callable(value):
-            c[key] = value()
-        else:
-            c[key] = value
-    response = HttpResponse(t.render(c), mimetype=mimetype)
-    populate_xheaders(request, response, model, getattr(obj, obj._meta.pk.name))
-    return response

File django/views/generic/simple.py

-from django.template import loader, RequestContext
-from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone
-from django.utils.log import getLogger
-
-import warnings
-warnings.warn(
-    'Function-based generic views have been deprecated; use class-based views instead.',
-    DeprecationWarning
-)
-
-logger = getLogger('django.request')
-
-
-def direct_to_template(request, template, extra_context=None, mimetype=None, **kwargs):
-    """
-    Render a given template with any extra URL parameters in the context as
-    ``{{ params }}``.
-    """
-    if extra_context is None: extra_context = {}
-    dictionary = {'params': kwargs}
-    for key, value in extra_context.items():
-        if callable(value):
-            dictionary[key] = value()
-        else:
-            dictionary[key] = value
-    c = RequestContext(request, dictionary)
-    t = loader.get_template(template)
-    return HttpResponse(t.render(c), content_type=mimetype)
-
-def redirect_to(request, url, permanent=True, query_string=False, **kwargs):
-    """
-    Redirect to a given URL.
-
-    The given url may contain dict-style string formatting, which will be
-    interpolated against the params in the URL.  For example, to redirect from
-    ``/foo/<id>/`` to ``/bar/<id>/``, you could use the following URLconf::
-
-        urlpatterns = patterns('',
-            ('^foo/(?P<id>\d+)/$', 'django.views.generic.simple.redirect_to', {'url' : '/bar/%(id)s/'}),
-        )
-
-    If the given url is ``None``, a HttpResponseGone (410) will be issued.
-
-    If the ``permanent`` argument is False, then the response will have a 302
-    HTTP status code. Otherwise, the status code will be 301.
-
-    If the ``query_string`` argument is True, then the GET query string
-    from the request is appended to the URL.
-
-    """
-    args = request.META.get('QUERY_STRING', '')
-
-    if url is not None:
-        if kwargs:
-            url = url % kwargs
-
-        if args and query_string:
-            url = "%s?%s" % (url, args)
-
-        klass = permanent and HttpResponsePermanentRedirect or HttpResponseRedirect
-        return klass(url)
-    else:
-        logger.warning('Gone: %s', request.path,
-                    extra={
-                        'status_code': 410,
-                        'request': request
-                    })
-        return HttpResponseGone()

File docs/glossary.txt

         A higher-order :term:`view` function that provides an abstract/generic
         implementation of a common idiom or pattern found in view development.
 
-        See :doc:`/ref/generic-views`.
+        See :doc:`/ref/class-based-views`.
 
     model
         Models store your application's data.

File docs/index.txt

 * :doc:`Unicode in Django <ref/unicode>`
 * :doc:`Web design helpers <ref/contrib/webdesign>`
 * :doc:`Validators <ref/validators>`
-* Function-based generic views (Deprecated) :doc:`Overview<topics/generic-views>` | :doc:`Built-in generic views<ref/generic-views>` | :doc:`Migration guide<topics/generic-views-migration>`
 
 The Django open-source project
 ==============================

File docs/internals/deprecation.txt

 
 * The function-based generic view modules will be removed in favor of their
   class-based equivalents, outlined :doc:`here
-  </topics/generic-views-migration>`:
+  </topics/class-based-views>`:
 
 * The :class:`~django.core.servers.basehttp.AdminMediaHandler` will be
   removed.  In its place use

File docs/intro/tutorial04.txt

 Run the server, and use your new polling app based on generic views.
 
 For full details on generic views, see the :doc:`generic views documentation
-</topics/http/generic-views>`.
+</topics/class-based-views>`.
 
 Coming soon
 ===========

File docs/misc/api-stability.txt

 - :doc:`HTTP request/response handling </topics/http/index>`, including file
   uploads, middleware, sessions, URL resolution, view, and shortcut APIs.
 
-- :doc:`Generic views </topics/http/generic-views>`.
+- :doc:`Generic views </topics/class-based-views>`.
 
 - :doc:`Internationalization </topics/i18n/index>`.
 

File docs/ref/class-based-views.txt

 
 .. note::
     Prior to Django 1.3, generic views were implemented as functions. The
-    function-based implementation has been deprecated in favor of the
+    function-based implementation has been removed in favor of the
     class-based approach described here.
 
-    For details on the previous generic views implementation,
-    see the :doc:`topic guide </topics/generic-views>` and
-    :doc:`detailed reference </ref/generic-views>`.
-
 Writing Web applications can be monotonous, because we repeat certain patterns
 again and again. Django tries to take away some of that monotony at the model
 and template layers, but Web developers also experience this boredom at the view

File docs/ref/contrib/messages.txt

                          fail_silently=True)
     messages.info(request, 'Hello world.', fail_silently=True)
 
-Internally, Django uses this functionality in the create, update, and delete
-:doc:`generic views </topics/http/generic-views>` so that they work even if the
-message framework is disabled.
-
 .. note::
    Setting ``fail_silently=True`` only hides the ``MessageFailure`` that would
    otherwise occur when the messages framework disabled and one attempts to

File docs/ref/contrib/sitemaps.txt

 
 .. class:: GenericSitemap
 
-    The :class:`django.contrib.sitemaps.GenericSitemap` class works with any
-    :doc:`generic views </ref/generic-views>` you already have.
-    To use it, create an instance, passing in the same :data:`info_dict` you pass to
-    the generic views. The only requirement is that the dictionary have a
-    :data:`queryset` entry. It may also have a :data:`date_field` entry that specifies a
-    date field for objects retrieved from the :data:`queryset`. This will be used for
-    the :attr:`~Sitemap.lastmod` attribute in the generated sitemap. You may
-    also pass :attr:`~Sitemap.priority` and :attr:`~Sitemap.changefreq`
-    keyword arguments to the :class:`~django.contrib.sitemaps.GenericSitemap`
-    constructor to specify these attributes for all URLs.
+    The :class:`django.contrib.sitemaps.GenericSitemap` class allows you to
+    create a sitemap by passing it a dictionary which has to contain at least
+    a :data:`queryset` entry. This queryset will be used to generate the items
+    of the sitemap. It may also have a :data:`date_field` entry that
+    specifies a date field for objects retrieved from the :data:`queryset`.
+    This will be used for the :attr:`~Sitemap.lastmod` attribute in the
+    generated sitemap. You may also pass :attr:`~Sitemap.priority` and
+    :attr:`~Sitemap.changefreq` keyword arguments to the
+    :class:`~django.contrib.sitemaps.GenericSitemap`  constructor to specify
+    these attributes for all URLs.
 
 Example
 -------

File docs/ref/generic-views.txt

-=============
-Generic views
-=============
-
-
-.. versionchanged:: 1.3
-
-.. note::
-
-    From Django 1.3, function-based generic views have been deprecated in favor
-    of a class-based approach, described in the class-based views :doc:`topic
-    guide </topics/class-based-views>` and :doc:`detailed reference
-    </ref/class-based-views>`.
-
-Writing Web applications can be monotonous, because we repeat certain patterns
-again and again. In Django, the most common of these patterns have been
-abstracted into "generic views" that let you quickly provide common views of
-an object without actually needing to write any Python code.
-
-A general introduction to generic views can be found in the :doc:`topic guide
-</topics/generic-views>`.
-
-This reference contains details of Django's built-in generic views, along with
-a list of all keyword arguments that a generic view expects. Remember that
-arguments may either come from the URL pattern or from the ``extra_context``
-additional-information dictionary.
-
-Most generic views require the ``queryset`` key, which is a ``QuerySet``
-instance; see :doc:`/topics/db/queries` for more information about ``QuerySet``
-objects.
-
-.. module:: django.views.generic.simple
-
-"Simple" generic views
-======================
-
-The ``django.views.generic.simple`` module contains simple views to handle a
-couple of common cases: rendering a template when no view logic is needed,
-and issuing a redirect.
-
-``django.views.generic.simple.direct_to_template``
---------------------------------------------------
-
-**Description:**
-
-Renders a given template, passing it a ``{{ params }}`` template variable,
-which is a dictionary of the parameters captured in the URL.
-
-**Required arguments:**
-
-* ``template``: The full name of a template to use.
-
-**Optional arguments:**
-
-* ``extra_context``: A dictionary of values to add to the template
-  context. By default, this is an empty dictionary. If a value in the
-  dictionary is callable, the generic view will call it
-  just before rendering the template.
-
-* ``mimetype``: The MIME type to use for the resulting document. Defaults
-  to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting.
-
-**Example:**
-
-Given the following URL patterns::
-
-    from django.views.generic.simple import direct_to_template
-
-    urlpatterns = patterns('',
-        (r'^foo/$',             direct_to_template, {'template': 'foo_index.html'}),
-        (r'^foo/(?P<id>\d+)/$', direct_to_template, {'template': 'foo_detail.html'}),
-    )
-
-... a request to ``/foo/`` would render the template ``foo_index.html``, and a
-request to ``/foo/15/`` would render the ``foo_detail.html`` with a context
-variable ``{{ params.id }}`` that is set to ``15``.
-
-``django.views.generic.simple.redirect_to``
--------------------------------------------
-
-**Description:**
-
-Redirects to a given URL.
-
-The given URL may contain dictionary-style string formatting, which will be
-interpolated against the parameters captured in the URL. Because keyword
-interpolation is *always* done (even if no arguments are passed in), any ``"%"``
-characters in the URL must be written as ``"%%"`` so that Python will convert
-them to a single percent sign on output.
-
-If the given URL is ``None``, Django will return an ``HttpResponseGone`` (410).
-
-**Required arguments:**
-
-* ``url``: The URL to redirect to, as a string. Or ``None`` to raise a 410
-  (Gone) HTTP error.
-
-**Optional arguments:**
-
-* ``permanent``: Whether the redirect should be permanent. The only
-  difference here is the HTTP status code returned. If ``True``, then the
-  redirect will use status code 301. If ``False``, then the redirect will
-  use status code 302. By default, ``permanent`` is ``True``.
-
-* ``query_string``: Whether to pass along the GET query string to
-  the new location. If ``True``, then the query string is appended
-  to the URL. If ``False``, then the query string is discarded. By
-  default, ``query_string`` is ``False``.
-
-.. versionadded:: 1.3
-    The ``query_string`` keyword argument is new in Django 1.3.
-
-**Example:**
-
-This example issues a permanent redirect (HTTP status code 301) from
-``/foo/<id>/`` to ``/bar/<id>/``::
-
-    from django.views.generic.simple import redirect_to
-
-    urlpatterns = patterns('',
-        ('^foo/(?P<id>\d+)/$', redirect_to, {'url': '/bar/%(id)s/'}),
-    )
-
-This example issues a non-permanent redirect (HTTP status code 302) from
-``/foo/<id>/`` to ``/bar/<id>/``::
-
-    from django.views.generic.simple import redirect_to
-
-    urlpatterns = patterns('',
-        ('^foo/(?P<id>\d+)/$', redirect_to, {'url': '/bar/%(id)s/', 'permanent': False}),
-    )
-
-This example returns a 410 HTTP error for requests to ``/bar/``::
-
-    from django.views.generic.simple import redirect_to
-
-    urlpatterns = patterns('',
-        ('^bar/$', redirect_to, {'url': None}),
-    )
-
-This example shows how ``"%"`` characters must be written in the URL in order
-to avoid confusion with Python's string formatting markers. If the redirect
-string is written as ``"%7Ejacob/"`` (with only a single ``%``), an exception would be raised::
-
-    from django.views.generic.simple import redirect_to
-
-    urlpatterns = patterns('',
-        ('^bar/$', redirect_to, {'url': '%%7Ejacob.'}),
-    )
-
-.. module:: django.views.generic.date_based
-
-Date-based generic views
-========================
-
-Date-based generic views (in the module ``django.views.generic.date_based``)
-are views for displaying drilldown pages for date-based data.
-
-``django.views.generic.date_based.archive_index``
--------------------------------------------------
-
-**Description:**
-
-A top-level index page showing the "latest" objects, by date. Objects with
-a date in the *future* are not included unless you set ``allow_future`` to
-``True``.
-
-**Required arguments:**
-
-* ``queryset``: A ``QuerySet`` of objects for which the archive serves.
-
-* ``date_field``: The name of the ``DateField`` or ``DateTimeField`` in
-  the ``QuerySet``'s model that the date-based archive should use to
-  determine the objects on the page.
-
-**Optional arguments:**
-
-* ``num_latest``: The number of latest objects to send to the template
-  context. By default, it's 15.
-
-* ``template_name``: The full name of a template to use in rendering the
-  page. This lets you override the default template name (see below).
-
-* ``template_loader``: The template loader to use when loading the
-  template. By default, it's ``django.template.loader``.
-
-* ``extra_context``: A dictionary of values to add to the template
-  context. By default, this is an empty dictionary. If a value in the
-  dictionary is callable, the generic view will call it
-  just before rendering the template.
-
-* ``allow_empty``: A boolean specifying whether to display the page if no
-  objects are available. If this is ``False`` and no objects are available,
-  the view will raise a 404 instead of displaying an empty page. By
-  default, this is ``True``.
-
-* ``context_processors``: A list of template-context processors to apply to
-  the view's template.
-
-* ``mimetype``: The MIME type to use for the resulting document. Defaults
-  to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting.
-
-* ``allow_future``: A boolean specifying whether to include "future"
-  objects on this page, where "future" means objects in which the field
-  specified in ``date_field`` is greater than the current date/time. By
-  default, this is ``False``.
-
-* ``template_object_name``: Designates the name of the template variable
-  to use in the template context. By default, this is ``'latest'``.
-
-**Template name:**
-
-If ``template_name`` isn't specified, this view will use the template
-``<app_label>/<model_name>_archive.html`` by default, where:
-
-* ``<model_name>`` is your model's name in all lowercase. For a model
-  ``StaffMember``, that'd be ``staffmember``.
-
-* ``<app_label>`` is the right-most part of the full Python path to
-  your model's app. For example, if your model lives in
-  ``apps/blog/models.py``, that'd be ``blog``.
-
-**Template context:**
-
-In addition to ``extra_context``, the template's context will be:
-
-* ``date_list``: A ``DateQuerySet`` object containing all years that have
-  have objects available according to ``queryset``, represented as
-  ``datetime.datetime`` objects. These are ordered in reverse. This is
-  equivalent to ``queryset.dates(date_field, 'year')[::-1]``.
-
-* ``latest``: The ``num_latest`` objects in the system, ordered descending
-  by ``date_field``. For example, if ``num_latest`` is ``10``, then
-  ``latest`` will be a list of the latest 10 objects in ``queryset``.
-
-  This variable's name depends on the ``template_object_name`` parameter,
-  which is ``'latest'`` by default. If ``template_object_name`` is
-  ``'foo'``, this variable's name will be ``foo``.
-
-``django.views.generic.date_based.archive_year``
-------------------------------------------------
-
-**Description:**
-
-A yearly archive page showing all available months in a given year. Objects
-with a date in the *future* are not displayed unless you set ``allow_future``
-to ``True``.
-
-**Required arguments:**
-
-* ``year``: The four-digit year for which the archive serves.
-
-* ``queryset``: A ``QuerySet`` of objects for which the archive serves.
-
-* ``date_field``: The name of the ``DateField`` or ``DateTimeField`` in
-  the ``QuerySet``'s model that the date-based archive should use to
-  determine the objects on the page.
-
-**Optional arguments:**
-
-* ``template_name``: The full name of a template to use in rendering the
-  page. This lets you override the default template name (see below).
-
-* ``template_loader``: The template loader to use when loading the
-  template. By default, it's ``django.template.loader``.
-
-* ``extra_context``: A dictionary of values to add to the template
-  context. By default, this is an empty dictionary. If a value in the
-  dictionary is callable, the generic view will call it
-  just before rendering the template.
-
-* ``allow_empty``: A boolean specifying whether to display the page if no
-  objects are available. If this is ``False`` and no objects are available,
-  the view will raise a 404 instead of displaying an empty page. By
-  default, this is ``False``.
-
-* ``context_processors``: A list of template-context processors to apply to
-  the view's template.
-
-* ``template_object_name``:  Designates the name of the template variable
-  to use in the template context. By default, this is ``'object'``. The
-  view will append ``'_list'`` to the value of this parameter in
-  determining the variable's name.
-
-* ``make_object_list``: A boolean specifying whether to retrieve the full
-  list of objects for this year and pass those to the template. If ``True``,
-  this list of objects will be made available to the template as
-  ``object_list``. (The name ``object_list`` may be different; see the docs
-  for ``object_list`` in the "Template context" section below.) By default,
-  this is ``False``.
-
-* ``mimetype``: The MIME type to use for the resulting document. Defaults
-  to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting.
-
-* ``allow_future``: A boolean specifying whether to include "future"
-  objects on this page, where "future" means objects in which the field
-  specified in ``date_field`` is greater than the current date/time. By
-  default, this is ``False``.
-
-**Template name:**
-
-If ``template_name`` isn't specified, this view will use the template
-``<app_label>/<model_name>_archive_year.html`` by default.
-
-**Template context:**
-
-In addition to ``extra_context``, the template's context will be:
-
-* ``date_list``: A ``DateQuerySet`` object containing all months that have
-  have objects available according to ``queryset``, represented as
-  ``datetime.datetime`` objects, in ascending order.
-
-* ``year``: The given year, as a four-character string.
-
-* ``object_list``: If the ``make_object_list`` parameter is ``True``, this
-  will be set to a list of objects available for the given year, ordered by
-  the date field. This variable's name depends on the
-  ``template_object_name`` parameter, which is ``'object'`` by default. If
-  ``template_object_name`` is ``'foo'``, this variable's name will be
-  ``foo_list``.
-
-  If ``make_object_list`` is ``False``, ``object_list`` will be passed to
-  the template as an empty list.
-
-``django.views.generic.date_based.archive_month``
--------------------------------------------------
-
-**Description:**
-
-A monthly archive page showing all objects in a given month. Objects with a
-date in the *future* are not displayed unless you set ``allow_future`` to
-``True``.
-
-**Required arguments:**
-
-* ``year``: The four-digit year for which the archive serves (a string).
-
-* ``month``: The month for which the archive serves, formatted according to
-  the ``month_format`` argument.
-
-* ``queryset``: A ``QuerySet`` of objects for which the archive serves.
-
-* ``date_field``: The name of the ``DateField`` or ``DateTimeField`` in
-  the ``QuerySet``'s model that the date-based archive should use to
-  determine the objects on the page.
-
-**Optional arguments:**
-
-* ``month_format``: A format string that regulates what format the ``month``
-  parameter uses. This should be in the syntax accepted by Python's
-  :func:`~time.strftime`. It's set to ``"%b"`` by default, which is a
-  three-letter month abbreviation. To change it to use numbers, use
-  ``"%m"``.
-
-* ``template_name``: The full name of a template to use in rendering the
-  page. This lets you override the default template name (see below).
-
-* ``template_loader``: The template loader to use when loading the
-  template. By default, it's ``django.template.loader``.
-
-* ``extra_context``: A dictionary of values to add to the template
-  context. By default, this is an empty dictionary. If a value in the
-  dictionary is callable, the generic view will call it
-  just before rendering the template.
-
-* ``allow_empty``: A boolean specifying whether to display the page if no
-  objects are available. If this is ``False`` and no objects are available,
-  the view will raise a 404 instead of displaying an empty page. By
-  default, this is ``False``.
-
-* ``context_processors``: A list of template-context processors to apply to
-  the view's template.
-
-* ``template_object_name``:  Designates the name of the template variable
-  to use in the template context. By default, this is ``'object'``. The
-  view will append ``'_list'`` to the value of this parameter in
-  determining the variable's name.
-
-* ``mimetype``: The MIME type to use for the resulting document. Defaults
-  to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting.
-
-* ``allow_future``: A boolean specifying whether to include "future"
-  objects on this page, where "future" means objects in which the field
-  specified in ``date_field`` is greater than the current date/time. By
-  default, this is ``False``.
-
-**Template name:**
-
-If ``template_name`` isn't specified, this view will use the template
-``<app_label>/<model_name>_archive_month.html`` by default.
-
-**Template context:**
-
-.. versionadded:: 1.2
-   The inclusion of ``date_list`` in the template's context is new.
-
-In addition to ``extra_context``, the template's context will be:
-
-* ``date_list``: A ``DateQuerySet`` object containing all days that have
-  have objects available in the given month, according to ``queryset``,
-  represented as ``datetime.datetime`` objects, in ascending order.
-
-* ``month``: A ``datetime.date`` object representing the given month.
-
-* ``next_month``: A ``datetime.date`` object representing the first day of
-  the next month. If the next month is in the future, this will be
-  ``None``.
-
-* ``previous_month``: A ``datetime.date`` object representing the first day
-  of the previous month. Unlike ``next_month``, this will never be
-  ``None``.
-
-* ``object_list``: A list of objects available for the given month. This
-  variable's name depends on the ``template_object_name`` parameter, which
-  is ``'object'`` by default. If ``template_object_name`` is ``'foo'``,
-  this variable's name will be ``foo_list``.
-
-``django.views.generic.date_based.archive_week``
-------------------------------------------------
-
-**Description:**
-
-A weekly archive page showing all objects in a given week. Objects with a date
-in the *future* are not displayed unless you set ``allow_future`` to ``True``.
-
-**Required arguments:**
-
-* ``year``: The four-digit year for which the archive serves (a string).
-
-* ``week``: The week of the year for which the archive serves (a string).
-  Weeks start with Sunday.
-
-* ``queryset``: A ``QuerySet`` of objects for which the archive serves.
-
-* ``date_field``: The name of the ``DateField`` or ``DateTimeField`` in
-  the ``QuerySet``'s model that the date-based archive should use to
-  determine the objects on the page.
-
-**Optional arguments:**
-
-* ``template_name``: The full name of a template to use in rendering the
-  page. This lets you override the default template name (see below).
-
-* ``template_loader``: The template loader to use when loading the
-  template. By default, it's ``django.template.loader``.
-
-* ``extra_context``: A dictionary of values to add to the template
-  context. By default, this is an empty dictionary. If a value in the
-  dictionary is callable, the generic view will call it
-  just before rendering the template.
-
-* ``allow_empty``: A boolean specifying whether to display the page if no
-  objects are available. If this is ``False`` and no objects are available,
-  the view will raise a 404 instead of displaying an empty page. By
-  default, this is ``True``.
-
-* ``context_processors``: A list of template-context processors to apply to
-  the view's template.
-
-* ``template_object_name``:  Designates the name of the template variable
-  to use in the template context. By default, this is ``'object'``. The
-  view will append ``'_list'`` to the value of this parameter in
-  determining the variable's name.
-
-* ``mimetype``: The MIME type to use for the resulting document. Defaults
-  to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting.
-
-* ``allow_future``: A boolean specifying whether to include "future"
-  objects on this page, where "future" means objects in which the field
-  specified in ``date_field`` is greater than the current date/time. By
-  default, this is ``False``.
-
-**Template name:**
-
-If ``template_name`` isn't specified, this view will use the template
-``<app_label>/<model_name>_archive_week.html`` by default.
-
-**Template context:**
-
-In addition to ``extra_context``, the template's context will be:
-
-* ``week``: A ``datetime.date`` object representing the first day of the
-  given week.
-
-* ``object_list``: A list of objects available for the given week. This
-  variable's name depends on the ``template_object_name`` parameter, which
-  is ``'object'`` by default. If ``template_object_name`` is ``'foo'``,
-  this variable's name will be ``foo_list``.
-
-``django.views.generic.date_based.archive_day``
------------------------------------------------
-
-**Description:**
-
-A day archive page showing all objects in a given day. Days in the future throw
-a 404 error, regardless of whether any objects exist for future days, unless
-you set ``allow_future`` to ``True``.
-
-**Required arguments:**
-
-* ``year``: The four-digit year for which the archive serves (a string).
-
-* ``month``: The month for which the archive serves, formatted according to
-  the ``month_format`` argument.
-
-* ``day``: The day for which the archive serves, formatted according to the
-  ``day_format`` argument.
-
-* ``queryset``: A ``QuerySet`` of objects for which the archive serves.
-
-* ``date_field``: The name of the ``DateField`` or ``DateTimeField`` in
-  the ``QuerySet``'s model that the date-based archive should use to
-  determine the objects on the page.
-
-**Optional arguments:**
-
-* ``month_format``: A format string that regulates what format the ``month``
-  parameter uses. This should be in the syntax accepted by Python's
-  :func:`~time.strftime`. It's set to ``"%b"`` by default, which is a
-  three-letter month abbreviation. To change it to use numbers, use
-  ``"%m"``.
-
-* ``day_format``: Like ``month_format``, but for the ``day`` parameter.
-  It defaults to ``"%d"`` (day of the month as a decimal number, 01-31).
-
-* ``template_name``: The full name of a template to use in rendering the
-  page. This lets you override the default template name (see below).
-
-* ``template_loader``: The template loader to use when loading the
-  template. By default, it's ``django.template.loader``.
-
-* ``extra_context``: A dictionary of values to add to the template
-  context. By default, this is an empty dictionary. If a value in the
-  dictionary is callable, the generic view will call it
-  just before rendering the template.
-
-* ``allow_empty``: A boolean specifying whether to display the page if no
-  objects are available. If this is ``False`` and no objects are available,
-  the view will raise a 404 instead of displaying an empty page. By
-  default, this is ``False``.
-
-* ``context_processors``: A list of template-context processors to apply to
-  the view's template.
-
-* ``template_object_name``:  Designates the name of the template variable
-  to use in the template context. By default, this is ``'object'``. The
-  view will append ``'_list'`` to the value of this parameter in
-  determining the variable's name.
-
-* ``mimetype``: The MIME type to use for the resulting document. Defaults
-  to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting.
-
-* ``allow_future``: A boolean specifying whether to include "future"
-  objects on this page, where "future" means objects in which the field
-  specified in ``date_field`` is greater than the current date/time. By
-  default, this is ``False``.
-
-**Template name:**
-
-If ``template_name`` isn't specified, this view will use the template
-``<app_label>/<model_name>_archive_day.html`` by default.
-
-**Template context:**
-
-In addition to ``extra_context``, the template's context will be:
-
-* ``day``: A ``datetime.date`` object representing the given day.
-
-* ``next_day``: A ``datetime.date`` object representing the next day. If
-  the next day is in the future, this will be ``None``.
-
-* ``previous_day``: A ``datetime.date`` object representing the previous day.
-  Unlike ``next_day``, this will never be ``None``.
-
-* ``object_list``: A list of objects available for the given day. This
-  variable's name depends on the ``template_object_name`` parameter, which
-  is ``'object'`` by default. If ``template_object_name`` is ``'foo'``,
-  this variable's name will be ``foo_list``.
-
-``django.views.generic.date_based.archive_today``
--------------------------------------------------
-
-**Description:**
-
-A day archive page showing all objects for *today*. This is exactly the same as
-``archive_day``, except the ``year``/``month``/``day`` arguments are not used,
-and today's date is used instead.
-
-``django.views.generic.date_based.object_detail``
--------------------------------------------------
-
-**Description:**
-
-A page representing an individual object. If the object has a date value in the
-future, the view will throw a 404 error by default, unless you set
-``allow_future`` to ``True``.
-
-**Required arguments:**
-
-* ``year``: The object's four-digit year (a string).
-
-* ``month``: The object's month , formatted according to the
-  ``month_format`` argument.
-
-* ``day``: The object's day , formatted according to the ``day_format``
-  argument.
-
-* ``queryset``: A ``QuerySet`` that contains the object.
-
-* ``date_field``: The name of the ``DateField`` or ``DateTimeField`` in
-  the ``QuerySet``'s model that the generic view should use to look up the
-  object according to ``year``, ``month`` and ``day``.
-
-* Either ``object_id`` or (``slug`` *and* ``slug_field``) is required.
-
-  If you provide ``object_id``, it should be the value of the primary-key
-  field for the object being displayed on this page.
-
-  Otherwise, ``slug`` should be the slug of the given object, and
-  ``slug_field`` should be the name of the slug field in the ``QuerySet``'s
-  model. By default, ``slug_field`` is ``'slug'``.
-
-**Optional arguments:**
-
-* ``month_format``: A format string that regulates what format the ``month``
-  parameter uses. This should be in the syntax accepted by Python's
-  :func:`~time.strftime`. It's set to ``"%b"`` by default, which is a
-  three-letter month abbreviation. To change it to use numbers, use
-  ``"%m"``.
-
-* ``day_format``: Like ``month_format``, but for the ``day`` parameter.
-  It defaults to ``"%d"`` (day of the month as a decimal number, 01-31).
-
-* ``template_name``: The full name of a template to use in rendering the
-  page. This lets you override the default template name (see below).
-
-* ``template_name_field``: The name of a field on the object whose value is
-  the template name to use. This lets you store template names in the data.
-  In other words, if your object has a field ``'the_template'`` that
-  contains a string ``'foo.html'``, and you set ``template_name_field`` to
-  ``'the_template'``, then the generic view for this object will use the
-  template ``'foo.html'``.
-
-  It's a bit of a brain-bender, but it's useful in some cases.
-
-* ``template_loader``: The template loader to use when loading the
-  template. By default, it's ``django.template.loader``.
-
-* ``extra_context``: A dictionary of values to add to the template
-  context. By default, this is an empty dictionary. If a value in the
-  dictionary is callable, the generic view will call it
-  just before rendering the template.
-
-* ``context_processors``: A list of template-context processors to apply to
-  the view's template.
-
-* ``template_object_name``:  Designates the name of the template variable
-  to use in the template context. By default, this is ``'object'``.
-
-* ``mimetype``: The MIME type to use for the resulting document. Defaults
-  to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting.
-
-* ``allow_future``: A boolean specifying whether to include "future"
-  objects on this page, where "future" means objects in which the field
-  specified in ``date_field`` is greater than the current date/time. By
-  default, this is ``False``.
-
-**Template name:**
-
-If ``template_name`` isn't specified, this view will use the template
-``<app_label>/<model_name>_detail.html`` by default.
-
-**Template context:**
-
-In addition to ``extra_context``, the template's context will be:
-
-* ``object``: The object. This variable's name depends on the
-  ``template_object_name`` parameter, which is ``'object'`` by default. If
-  ``template_object_name`` is ``'foo'``, this variable's name will be
-  ``foo``.
-
-.. module:: django.views.generic.list_detail
-
-List/detail generic views
-=========================
-
-The list-detail generic-view framework (in the
-``django.views.generic.list_detail`` module) is similar to the date-based one,
-except the former simply has two views: a list of objects and an individual
-object page.
-
-``django.views.generic.list_detail.object_list``
-------------------------------------------------
-
-**Description:**
-
-A page representing a list of objects.
-
-**Required arguments:**
-
-* ``queryset``: A ``QuerySet`` that represents the objects.
-
-**Optional arguments:**
-
-* ``paginate_by``: An integer specifying how many objects should be
-  displayed per page. If this is given, the view will paginate objects with
-  ``paginate_by`` objects per page. The view will expect either a ``page``
-  query string parameter (via ``GET``) or a ``page`` variable specified in
-  the URLconf. See `Notes on pagination`_ below.
-
-* ``page``: The current page number, as an integer, or the string
-  ``'last'``. This is 1-based. See `Notes on pagination`_ below.
-
-* ``template_name``: The full name of a template to use in rendering the
-  page. This lets you override the default template name (see below).
-
-* ``template_loader``: The template loader to use when loading the
-  template. By default, it's ``django.template.loader``.
-
-* ``extra_context``: A dictionary of values to add to the template
-  context. By default, this is an empty dictionary. If a value in the
-  dictionary is callable, the generic view will call it
-  just before rendering the template.
-
-* ``allow_empty``: A boolean specifying whether to display the page if no
-  objects are available. If this is ``False`` and no objects are available,
-  the view will raise a 404 instead of displaying an empty page. By
-  default, this is ``True``.
-
-* ``context_processors``: A list of template-context processors to apply to
-  the view's template.
-
-* ``template_object_name``:  Designates the name of the template variable
-  to use in the template context. By default, this is ``'object'``. The
-  view will append ``'_list'`` to the value of this parameter in
-  determining the variable's name.
-
-* ``mimetype``: The MIME type to use for the resulting document. Defaults
-  to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting.
-
-**Template name:**
-
-If ``template_name`` isn't specified, this view will use the template
-``<app_label>/<model_name>_list.html`` by default.
-
-**Template context:**
-
-In addition to ``extra_context``, the template's context will be:
-
-* ``object_list``: The list of objects. This variable's name depends on the
-  ``template_object_name`` parameter, which is ``'object'`` by default. If
-  ``template_object_name`` is ``'foo'``, this variable's name will be
-  ``foo_list``.
-
-* ``is_paginated``: A boolean representing whether the results are
-  paginated. Specifically, this is set to ``False`` if the number of
-  available objects is less than or equal to ``paginate_by``.
-
-If the results are paginated, the context will contain these extra variables:
-
-* ``paginator``: An instance of ``django.core.paginator.Paginator``.
-
-* ``page_obj``: An instance of ``django.core.paginator.Page``.
-
-Notes on pagination
-~~~~~~~~~~~~~~~~~~~
-
-If ``paginate_by`` is specified, Django will paginate the results. You can
-specify the page number in the URL in one of two ways:
-
-* Use the ``page`` parameter in the URLconf. For example, this is what
-  your URLconf might look like::
-
-    (r'^objects/page(?P<page>[0-9]+)/$', 'object_list', dict(info_dict))
-
-* Pass the page number via the ``page`` query-string parameter. For
-  example, a URL would look like this::
-
-    /objects/?page=3
-
-* To loop over all the available page numbers, use the ``page_range``
-  variable. You can iterate over the list provided by ``page_range``
-  to create a link to every page of results.
-
-These values and lists are 1-based, not 0-based, so the first page would be
-represented as page ``1``.
-
-For more on pagination, read the :doc:`pagination documentation
-</topics/pagination>`.
-
-As a special case, you are also permitted to use ``last`` as a value for
-``page``::
-
-    /objects/?page=last
-
-This allows you to access the final page of results without first having to
-determine how many pages there are.
-
-Note that ``page`` *must* be either a valid page number or the value ``last``;
-any other value for ``page`` will result in a 404 error.
-
-``django.views.generic.list_detail.object_detail``
---------------------------------------------------
-
-A page representing an individual object.
-
-**Description:**
-
-A page representing an individual object.
-
-**Required arguments:**
-
-* ``queryset``: A ``QuerySet`` that contains the object.
-
-* Either ``object_id`` or (``slug`` *and* ``slug_field``) is required.
-
-  If you provide ``object_id``, it should be the value of the primary-key
-  field for the object being displayed on this page.
-
-  Otherwise, ``slug`` should be the slug of the given object, and
-  ``slug_field`` should be the name of the slug field in the ``QuerySet``'s
-  model. By default, ``slug_field`` is ``'slug'``.
-
-**Optional arguments:**
-
-* ``template_name``: The full name of a template to use in rendering the
-  page. This lets you override the default template name (see below).
-
-* ``template_name_field``: The name of a field on the object whose value is
-  the template name to use. This lets you store template names in the data.
-  In other words, if your object has a field ``'the_template'`` that
-  contains a string ``'foo.html'``, and you set ``template_name_field`` to
-  ``'the_template'``, then the generic view for this object will use the
-  template ``'foo.html'``.
-
-  It's a bit of a brain-bender, but it's useful in some cases.
-
-* ``template_loader``: The template loader to use when loading the
-  template. By default, it's ``django.template.loader``.
-
-* ``extra_context``: A dictionary of values to add to the template
-  context. By default, this is an empty dictionary. If a value in the
-  dictionary is callable, the generic view will call it
-  just before rendering the template.
-
-* ``context_processors``: A list of template-context processors to apply to
-  the view's template.
-
-* ``template_object_name``:  Designates the name of the template variable
-  to use in the template context. By default, this is ``'object'``.
-
-* ``mimetype``: The MIME type to use for the resulting document. Defaults
-  to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting.
-
-**Template name:**
-
-If ``template_name`` isn't specified, this view will use the template
-``<app_label>/<model_name>_detail.html`` by default.
-
-**Template context:**
-
-In addition to ``extra_context``, the template's context will be:
-
-* ``object``: The object. This variable's name depends on the
-  ``template_object_name`` parameter, which is ``'object'`` by default. If
-  ``template_object_name`` is ``'foo'``, this variable's name will be
-  ``foo``.
-
-.. module:: django.views.generic.create_update
-
-Create/update/delete generic views
-==================================
-
-The ``django.views.generic.create_update`` module contains a set of functions
-for creating, editing and deleting objects.
-
-``django.views.generic.create_update.create_object``
-----------------------------------------------------
-
-**Description:**
-
-A page that displays a form for creating an object, redisplaying the form with
-validation errors (if there are any) and saving the object.
-
-**Required arguments:**
-
-* Either ``form_class`` or ``model`` is required.
-
-  If you provide ``form_class``, it should be a ``django.forms.ModelForm``
-  subclass. Use this argument when you need to customize the model's form.
-  See the :doc:`ModelForm docs </topics/forms/modelforms>` for more
-  information.
-
-  Otherwise, ``model`` should be a Django model class and the form used
-  will be a standard ``ModelForm`` for ``model``.
-
-**Optional arguments:**
-
-* ``post_save_redirect``: A URL to which the view will redirect after
-  saving the object. By default, it's ``object.get_absolute_url()``.
-
-  ``post_save_redirect`` may contain dictionary string formatting, which
-  will be interpolated against the object's field attributes. For example,
-  you could use ``post_save_redirect="/polls/%(slug)s/"``.
-
-* ``login_required``: A boolean that designates whether a user must be
-  logged in, in order to see the page and save changes. This hooks into the
-  Django :doc:`authentication system </topics/auth>`. By default, this is
-  ``False``.
-
-  If this is ``True``, and a non-logged-in user attempts to visit this page
-  or save the form, Django will redirect the request to ``/accounts/login/``.
-
-* ``template_name``: The full name of a template to use in rendering the
-  page. This lets you override the default template name (see below).
-
-* ``template_loader``: The template loader to use when loading the
-  template. By default, it's ``django.template.loader``.
-
-* ``extra_context``: A dictionary of values to add to the template
-  context. By default, this is an empty dictionary. If a value in the
-  dictionary is callable, the generic view will call it
-  just before rendering the template.
-
-* ``context_processors``: A list of template-context processors to apply to
-  the view's template.
-
-**Template name:**
-
-If ``template_name`` isn't specified, this view will use the template
-``<app_label>/<model_name>_form.html`` by default.
-
-**Template context:**
-
-In addition to ``extra_context``, the template's context will be:
-
-* ``form``: A ``django.forms.ModelForm`` instance representing the form
-  for creating the object. This lets you refer to form fields easily in the
-  template system.
-
-  For example, if the model has two fields, ``name`` and ``address``::
-
-      <form action="" method="post">
-      <p>{{ form.name.label_tag }} {{ form.name }}</p>
-      <p>{{ form.address.label_tag }} {{ form.address }}</p>
-      </form>
-
-  See the :doc:`forms documentation </topics/forms/index>` for more
-  information about using ``Form`` objects in templates.
-
-``django.views.generic.create_update.update_object``
-----------------------------------------------------
-
-**Description:**
-
-A page that displays a form for editing an existing object, redisplaying the
-form with validation errors (if there are any) and saving changes to the
-object. This uses a form automatically generated from the object's
-model class.
-
-**Required arguments:**
-
-* Either ``form_class`` or ``model`` is required.
-
-  If you provide ``form_class``, it should be a ``django.forms.ModelForm``
-  subclass. Use this argument when you need to customize the model's form.
-  See the :doc:`ModelForm docs </topics/forms/modelforms>` for more
-  information.
-
-  Otherwise, ``model`` should be a Django model class and the form used
-  will be a standard ``ModelForm`` for ``model``.
-
-* Either ``object_id`` or (``slug`` *and* ``slug_field``) is required.
-
-  If you provide ``object_id``, it should be the value of the primary-key
-  field for the object being displayed on this page.
-
-  Otherwise, ``slug`` should be the slug of the given object, and
-  ``slug_field`` should be the name of the slug field in the ``QuerySet``'s
-  model. By default, ``slug_field`` is ``'slug'``.
-
-**Optional arguments:**
-
-* ``post_save_redirect``: A URL to which the view will redirect after
-  saving the object. By default, it's ``object.get_absolute_url()``.
-
-  ``post_save_redirect`` may contain dictionary string formatting, which
-  will be interpolated against the object's field attributes. For example,
-  you could use ``post_save_redirect="/polls/%(slug)s/"``.
-
-* ``login_required``: A boolean that designates whether a user must be
-  logged in, in order to see the page and save changes. This hooks into the
-  Django :doc:`authentication system </topics/auth>`. By default, this is
-  ``False``.
-
-  If this is ``True``, and a non-logged-in user attempts to visit this page
-  or save the form, Django will redirect to :setting:`LOGIN_URL` (which
-  defaults to ``/accounts/login/``).
-
-* ``template_name``: The full name of a template to use in rendering the
-  page. This lets you override the default template name (see below).
-
-* ``template_loader``: The template loader to use when loading the
-  template. By default, it's ``django.template.loader``.
-
-* ``extra_context``: A dictionary of values to add to the template
-  context. By default, this is an empty dictionary. If a value in the
-  dictionary is callable, the generic view will call it
-  just before rendering the template.
-
-* ``context_processors``: A list of template-context processors to apply to
-  the view's template.
-
-* ``template_object_name``:  Designates the name of the template variable
-  to use in the template context. By default, this is ``'object'``.
-
-**Template name:**
-
-If ``template_name`` isn't specified, this view will use the template
-``<app_label>/<model_name>_form.html`` by default.
-
-**Template context:**
-
-In addition to ``extra_context``, the template's context will be:
-
-* ``form``: A ``django.forms.ModelForm`` instance representing the form
-  for editing the object. This lets you refer to form fields easily in the
-  template system.
-
-  For example, if the model has two fields, ``name`` and ``address``::
-
-      <form action="" method="post">
-      <p>{{ form.name.label_tag }} {{ form.name }}</p>
-      <p>{{ form.address.label_tag }} {{ form.address }}</p>
-      </form>
-
-  See the :doc:`forms documentation </topics/forms/index>` for more
-  information about using ``Form`` objects in templates.
-
-* ``object``: The original object being edited. This variable's name
-  depends on the ``template_object_name`` parameter, which is ``'object'``
-  by default. If ``template_object_name`` is ``'foo'``, this variable's
-  name will be ``foo``.
-
-``django.views.generic.create_update.delete_object``
-----------------------------------------------------
-
-**Description:**
-
-A view that displays a confirmation page and deletes an existing object. The
-given object will only be deleted if the request method is ``POST``. If this