<s> from __future__ import absolute_import <EOL> from django . contrib . auth . decorators import login_required <EOL> from django . core . paginator import Paginator <EOL> from django . core . urlresolvers import reverse <EOL> from django . utils . decorators import method_decorator <EOL> from django . views import generic <EOL> from . forms import AuthorForm <EOL> from . models import Artist , Author , Book , Page <EOL> class CustomTemplateView ( generic . TemplateView ) : <EOL> template_name = '<STR_LIT>' <EOL> def get_context_data ( self , ** kwargs ) : <EOL> return { <EOL> '<STR_LIT>' : kwargs , <EOL> '<STR_LIT:key>' : '<STR_LIT:value>' <EOL> } <EOL> class ObjectDetail ( generic . DetailView ) : <EOL> template_name = '<STR_LIT>' <EOL> def get_object ( self ) : <EOL> return { '<STR_LIT:foo>' : '<STR_LIT:bar>' } <EOL> class ArtistDetail ( generic . DetailView ) : <EOL> queryset = Artist . objects . all ( ) <EOL> class AuthorDetail ( generic . DetailView ) : <EOL> queryset = Author . objects . all ( ) <EOL> class PageDetail ( generic . DetailView ) : <EOL> queryset = Page . objects . all ( ) <EOL> template_name_field = '<STR_LIT>' <EOL> class DictList ( generic . ListView ) : <EOL> """<STR_LIT>""" <EOL> queryset = [ <EOL> { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } , <EOL> { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> ] <EOL> template_name = '<STR_LIT>' <EOL> class ArtistList ( generic . ListView ) : <EOL> template_name = '<STR_LIT>' <EOL> queryset = Artist . objects . all ( ) <EOL> class AuthorList ( generic . ListView ) : <EOL> queryset = Author . objects . all ( ) <EOL> class CustomPaginator ( Paginator ) : <EOL> def __init__ ( self , queryset , page_size , orphans = <NUM_LIT:0> , allow_empty_first_page = True ) : <EOL> super ( CustomPaginator , self ) . __init__ ( <EOL> queryset , <EOL> page_size , <EOL> orphans = <NUM_LIT:2> , <EOL> allow_empty_first_page = allow_empty_first_page ) <EOL> class AuthorListCustomPaginator ( AuthorList ) : <EOL> paginate_by = <NUM_LIT:5> <EOL> def get_paginator ( self , queryset , page_size , orphans = <NUM_LIT:0> , allow_empty_first_page = True ) : <EOL> return super ( AuthorListCustomPaginator , self ) . get_paginator ( <EOL> queryset , <EOL> page_size , <EOL> orphans = <NUM_LIT:2> , <EOL> allow_empty_first_page = allow_empty_first_page ) <EOL> class ArtistCreate ( generic . CreateView ) : <EOL> model = Artist <EOL> class NaiveAuthorCreate ( generic . CreateView ) : <EOL> queryset = Author . objects . all ( ) <EOL> class AuthorCreate ( generic . CreateView ) : <EOL> model = Author <EOL> success_url = '<STR_LIT>' <EOL> class SpecializedAuthorCreate ( generic . CreateView ) : <EOL> model = Author <EOL> form_class = AuthorForm <EOL> template_name = '<STR_LIT>' <EOL> context_object_name = '<STR_LIT>' <EOL> def get_success_url ( self ) : <EOL> return reverse ( '<STR_LIT>' , args = [ self . object . id , ] ) <EOL> class AuthorCreateRestricted ( AuthorCreate ) : <EOL> post = method_decorator ( login_required ) ( AuthorCreate . post ) <EOL> class ArtistUpdate ( generic . UpdateView ) : <EOL> model = Artist <EOL> class NaiveAuthorUpdate ( generic . UpdateView ) : <EOL> queryset = Author . objects . all ( ) <EOL> class AuthorUpdate ( generic . UpdateView ) : <EOL> model = Author <EOL> success_url = '<STR_LIT>' <EOL> class OneAuthorUpdate ( generic . UpdateView ) : <EOL> success_url = '<STR_LIT>' <EOL> def get_object ( self ) : <EOL> return Author . objects . get ( pk = <NUM_LIT:1> ) <EOL> class SpecializedAuthorUpdate ( generic . UpdateView ) : <EOL> model = Author <EOL> form_class = AuthorForm <EOL> template_name = '<STR_LIT>' <EOL> context_object_name = '<STR_LIT>' <EOL> def get_success_url ( self ) : <EOL> return reverse ( '<STR_LIT>' , args = [ self . object . id , ] ) <EOL> class NaiveAuthorDelete ( generic . DeleteView ) : <EOL> queryset = Author . objects . all ( ) <EOL> class AuthorDelete ( generic . DeleteView ) : <EOL> model = Author <EOL> success_url = '<STR_LIT>' <EOL> class SpecializedAuthorDelete ( generic . DeleteView ) : <EOL> queryset = Author . objects . all ( ) <EOL> template_name = '<STR_LIT>' <EOL> context_object_name = '<STR_LIT>' <EOL> def get_success_url ( self ) : <EOL> return reverse ( '<STR_LIT>' ) <EOL> class BookConfig ( object ) : <EOL> queryset = Book . objects . all ( ) <EOL> date_field = '<STR_LIT>' <EOL> class BookArchive ( BookConfig , generic . ArchiveIndexView ) : <EOL> pass <EOL> class BookYearArchive ( BookConfig , generic . YearArchiveView ) : <EOL> pass <EOL> class BookMonthArchive ( BookConfig , generic . MonthArchiveView ) : <EOL> pass <EOL> class BookWeekArchive ( BookConfig , generic . WeekArchiveView ) : <EOL> pass <EOL> class BookDayArchive ( BookConfig , generic . DayArchiveView ) : <EOL> pass <EOL> class BookTodayArchive ( BookConfig , generic . TodayArchiveView ) : <EOL> pass <EOL> class BookDetail ( BookConfig , generic . DateDetailView ) : <EOL> pass <EOL> class AuthorGetQuerySetFormView ( generic . edit . ModelFormMixin ) : <EOL> def get_queryset ( self ) : <EOL> return Author . objects . all ( ) <EOL> class BookDetailGetObjectCustomQueryset ( BookDetail ) : <EOL> def get_object ( self , queryset = None ) : <EOL> return super ( BookDetailGetObjectCustomQueryset , self ) . get_object ( <EOL> queryset = Book . objects . filter ( pk = <NUM_LIT:2> ) ) </s>
