質問編集履歴
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -9,8 +9,9 @@
|
|
9
9
|
from basicauth.decorators import basic_auth_required
|
10
10
|
|
11
11
|
@basic_auth_required
|
12
|
+
class BookTitleView(View):
|
12
|
-
def
|
13
|
+
def get(self, request, *args, **kwargs):
|
13
|
-
|
14
|
+
|
14
15
|
```
|
15
16
|
|
16
17
|
```python
|
@@ -39,9 +40,8 @@
|
|
39
40
|
from basicauth.decorators import basic_auth_required
|
40
41
|
|
41
42
|
@basic_auth_required
|
42
|
-
class BookTitleView(View):
|
43
|
-
|
43
|
+
def index(request):
|
44
|
-
|
44
|
+
return render(request, 'app/book_title.html')
|
45
45
|
```
|
46
46
|
|
47
47
|
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
[参考サイト](https://houdoukyokucho.com/2021/08/21/post-3412/)を参みながら作成しました。
|
2
2
|
以下のように作成しました。しかし、```AttributeError: 'function' object has no attribute 'as_view'```というエラーが出ます。
|
3
3
|
どうしたら良いでしょうか。
|
4
|
+
|
5
|
+
```@basic_auth_required```はbasic認証をかけるページに遷移するclassの上に書けば良いのかと思い以下のようにしてみました。
|
4
6
|
```python
|
5
7
|
#views.py
|
6
8
|
コード
|