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 4
4
"""
5
5
# pylint: disable=missing-docstring
6
6
7
+ from django .db import models
7
8
from 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
9
13
10
14
11
15
class BoringView (TemplateView ):
@@ -23,3 +27,24 @@ def post(self, request):
23
27
# do something with objects but don't use
24
28
# self or request
25
29
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