File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
pylint_django/tests/input Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 44"""
55# pylint: disable=missing-docstring
66
7+ from django .db import models
78from django .http import JsonResponse
8- from django .views .generic import TemplateView , View
9+ from django .views .generic import DetailView
10+ from django .views .generic import TemplateView
11+ from django .views .generic import View
12+ from django .views .generic .edit import CreateView
913
1014
1115class BoringView (TemplateView ):
@@ -23,3 +27,24 @@ def post(self, request):
2327 # do something with objects but don't use
2428 # self or request
2529 return JsonResponse ({'rc' : 0 , 'response' : 'ok' })
30+
31+
32+ class Book (models .Model ):
33+ name = models .CharField (max_length = 100 )
34+ good = models .BooleanField (default = False )
35+
36+
37+ class GetBook (DetailView ):
38+ model = Book
39+ template_name = 'books/get.html'
40+ http_method_names = ['get' ]
41+
42+
43+ class CreateBook (CreateView ):
44+ model = Book
45+ template_name = 'books/new.html'
46+
47+ def get_context_data (self , ** kwargs ):
48+ context = super ().get_context_data (** kwargs )
49+ context ['page_title' ] = 'New book'
50+ return context
You can’t perform that action at this time.
0 commit comments