質問編集履歴

3

本文修正

2022/08/12 15:12

投稿

deango
deango

スコア161

test CHANGED
File without changes
test CHANGED
@@ -174,6 +174,8 @@
174
174
  {"form": {"fields": {"login": {"label": "\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9", "value": null, "help_text": "", "errors": [], "widget": {"attrs": {"placeholder": "\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9", "autocomplete": "email"}}}, "password": {"label": "\u30d1\u30b9\u30ef\u30fc\u30c9", "value": null, "help_text": "", "errors": [], "widget": {"attrs": {"placeholder": "\u30d1\u30b9\u30ef\u30fc\u30c9", "autocomplete": "current-password"}}}, "remember": {"label": "\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u307e\u307e\u306b\u3059\u308b", "value": null, "help_text": "", "errors": [], "widget": {"attrs": {}}}}, "field_order": ["login", "password", "remember"], "errors": []}, "html": "
175
175
  ~以降は上記のhtmlの内容です~
176
176
 
177
+ 以下は実際の画面です
178
+ ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2022-08-13/99b00b7b-2a84-48c1-a7aa-883f1741a064.png)
177
179
 
178
180
  ### 試したこと
179
181
  表示内容を見ると最初がフォーム処理の内容で、そのあとにhtmlの内容がそのまま載っているので、

2

本文修正

2022/08/12 15:07

投稿

deango
deango

スコア161

test CHANGED
File without changes
test CHANGED
@@ -170,7 +170,7 @@
170
170
 
171
171
  </html>
172
172
  ```
173
- 以下はログインページをタブ複製に表示される内容です。
173
+ 以下はログインページをタブ複製したときに表示される内容です。
174
174
  {"form": {"fields": {"login": {"label": "\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9", "value": null, "help_text": "", "errors": [], "widget": {"attrs": {"placeholder": "\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9", "autocomplete": "email"}}}, "password": {"label": "\u30d1\u30b9\u30ef\u30fc\u30c9", "value": null, "help_text": "", "errors": [], "widget": {"attrs": {"placeholder": "\u30d1\u30b9\u30ef\u30fc\u30c9", "autocomplete": "current-password"}}}, "remember": {"label": "\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u307e\u307e\u306b\u3059\u308b", "value": null, "help_text": "", "errors": [], "widget": {"attrs": {}}}}, "field_order": ["login", "password", "remember"], "errors": []}, "html": "
175
175
  ~以降は上記のhtmlの内容です~
176
176
 

1

本文修正

2022/08/12 15:07

投稿

deango
deango

スコア161

test CHANGED
File without changes
test CHANGED
@@ -5,17 +5,179 @@
5
5
  F5でページ更新すると正常に画面が見えます。
6
6
 
7
7
  開発環境、本番環境どちらも発生します。
8
+ django-allauthを使用した認証画面(ログイン、サインインなど)以外では発生しません。
8
9
 
9
10
  ### 実現したいこと
10
11
  タブ複製後、F5でページ更新しなくても正常に画面が見えるようにしたいです。
11
12
 
12
13
  ### 発生している問題・エラーメッセージ
13
- 実際の本番環境のページでご確認いただけまと幸いです
14
- ログイン画面をタブ複製してください。
15
- nyapumap.com
14
+ 以下はログインページのhtmlです。
15
+ ```login.html
16
+ {% extends 'base.html' %}
17
+
18
+ {% block title %}ログイン | にゃっぷ{% endblock %}
19
+
20
+ {% block active_login %}active{% endblock %}
21
+
22
+ {% block contents %}
23
+ <div class="container my-div-style">
24
+ <div class="row">
25
+ <div class="mt-2 col-sm-6 mx-auto">
26
+ <div class="text-center">
27
+ <strong>ログイン</strong>
28
+ <hr>
29
+ </div>
30
+ <div class="text-center">
31
+ <form method="post" action="{% url 'account_login' %}">
32
+ {% csrf_token %}
33
+
34
+ {{ form.as_p }}
35
+
36
+ {% if redirect_field_value %}
37
+ <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
38
+ {% endif %}
39
+
40
+ <button class="btn btn-primary" type="submit">ログイン</button>
41
+ <br>
42
+ <a class="button btn-sm" href="{% url 'account_reset_password' %}">パスワードを忘れましたか?</a>
43
+ </form>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ {% endblock %}
49
+ ```
50
+ 以下のbase.htmlを含ませています。
51
+ ```
52
+ {% load static %}
53
+
54
+ <html lang="ja">
55
+
56
+ <head>
57
+ <meta charset="utf-8">
58
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
59
+ <meta name="description" content="">
60
+ <meta name="author" content="">
61
+
62
+ <title>{% block title %}{% endblock %}</title>
63
+
64
+ <link rel="icon" type="image/x-icon" href="{% static 'assets/favicon.ico' %}">
65
+ <!-- Font Awesome icons (free version)-->
66
+ <script src="https://use.fontawesome.com/releases/v5.15.4/js/all.js" crossorigin="anonymous"></script>
67
+ <!-- Google fonts-->
68
+ <link href="https://fonts.googleapis.com/css?family=Catamaran:100,200,300,400,500,600,600,800,900" rel="stylesheet">
69
+ <link href="https://fonts.googleapis.com/css?family=Lato:100,100i,300,300i,400,400i,700,700i,900,900i" rel="stylesheet">
70
+ <!-- leaflet -->
71
+ <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin=""/>
72
+ <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>
73
+
74
+ <script src="https://code.jquery.com/jquery-3.5.0.min.js" integrity="sha256-xNzN2a4ltkB44Mc/Jz3pT4iU1cmeR0FkXs4pru/JxaQ=" crossorigin="anonymous"></script>
75
+ <script src="{% static 'js/ajax.js' %}"></script>
76
+ <script src="{% static 'js/script.js' %}"></script>
77
+ <script src="{% static 'js/jquery.waypoints.min.js' %}"></script>
78
+ <script src="{% static 'js/infinite.min.js' %}"></script>
79
+ {% block extrajs %}{% endblock %}
80
+
81
+ <!-- Core theme CSS (includes Bootstrap)-->
82
+ <link href="{% static 'css/styles.css' %}" rel="stylesheet">
83
+ <!-- My style -->
84
+ <link href="{% static 'css/mystyle.css' %}" rel="stylesheet">
85
+ </head>
86
+
87
+
88
+ <body>
89
+ <div id="wrapper">
90
+ <!-- Navigation-->
91
+ <nav class="navbar navbar-expand-lg navbar-light navbar-custom fixed-top border">
92
+ <div class="container px-5">
93
+ <img src="{% static 'assets/img/nyapu.png' %}" height="40"/>
94
+ <a class="navbar-brand" href="{% url 'diary:diary' %}">にゃっぷ</a>
95
+ <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
96
+ <span class="navbar-toggler-icon"></span></button>
97
+ <div class="collapse navbar-collapse" id="navbarResponsive">
98
+ <ul class="navbar-nav ms-auto">
99
+ {% if user.is_authenticated %}
100
+ <li class="nav-item">
101
+ <a class="nav-link" href="{% url 'diary:diary_create' %}">投稿する</a>
102
+ </li>
103
+ <li class="nav-item">
104
+ <a class="nav-link" href="{% url 'diary:diary' %}">ホーム</a>
105
+ </li>
106
+ <li class="nav-item dropdown">
107
+ <a class="nav-link dropdown-toggl" id="navbarDropdownMenuLink" role="button"
108
+ data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
109
+ アカウントメニュー
110
+ </a>
111
+ <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
112
+ <a class="dropdown-item" href="{% url 'diary:diary_list' request.user %}">プロフィール</a>
113
+ <a class="dropdown-item" href="{% url 'diary:like_diary_list' %}">いいねした日記</a>
114
+ <a class="dropdown-item" href="{% url 'diary:followings' %}">フォロー</a>
115
+ <a class="dropdown-item" href="{% url 'diary:followers' %}">フォロワー</a>
116
+ <a class="dropdown-item" href="{% url 'accounts:userlist' %}">ユーザーリスト</a>
117
+ <a class="dropdown-item" href="{% url 'account_logout' %}">ログアウト</a>
118
+ <a class="dropdown-item" href="{% url 'diary:map' %}">にゃっぷ</a>
119
+ </div>
120
+ </li>
121
+ {% else %}
122
+ <li class="nav-item {% block active_signup %}{% endblock %}">
123
+ <a class="nav-link" href="{% url 'account_signup' %}">ユーザ登録</a>
124
+ </li>
125
+ <li class="nav-item {% block active_login %}{% endblock %}">
126
+ <a class="nav-link" href="{% url 'account_login' %}">ログイン</a>
127
+ </li>
128
+ {% endif %}
129
+ <li class="nav-item {% block active_inquiry %}{% endblock %}">
130
+ <a class="nav-link" href="{% url 'diary:inquiry' %}">お問い合わせ</a>
131
+ </li>
132
+ </ul>
133
+ </div>
134
+ </div>
135
+ </nav>
136
+ {% block header %}{% endblock %}
137
+ {% if massages %}
138
+ <div class="container">
139
+ <div class="row">
140
+ <div class="my-div-style w-100">
141
+ <ul class="massages" style="list-style: none;">
142
+ {% for message in messages %}
143
+ <li {% if message.tags %} class="{{ message.tags }}" {% endif %}>
144
+ {{ message }}
145
+ </li>
146
+ {% endfor %}
147
+ </ul>
148
+ </div>
149
+ </div>
150
+ </div>
151
+ {% endif %}
152
+
153
+ {% block contents %}{% endblock %}
154
+ <!-- Footer-->
155
+ <footer class="py-3 bg-black fixed-bottom">
156
+ <div class="container px-5"><p class="m-0 text-center text-white small">Copyright &copy; にゃっぷ 2022</p></div>
157
+ </footer>
158
+
159
+ <!-- Bootstrap core JS-->
160
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
161
+ <!-- jQuery first, then Popper.js, then Bootstrap JS -->
162
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"
163
+ integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ"
164
+ crossorigin="anonymous"></script>
165
+ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"
166
+ integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm"
167
+ crossorigin="anonymous"></script>
168
+ </div>
169
+ </body>
170
+
171
+ </html>
172
+ ```
173
+ 以下はログインページをタブ複製に表示される内容です。
174
+ {"form": {"fields": {"login": {"label": "\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9", "value": null, "help_text": "", "errors": [], "widget": {"attrs": {"placeholder": "\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9", "autocomplete": "email"}}}, "password": {"label": "\u30d1\u30b9\u30ef\u30fc\u30c9", "value": null, "help_text": "", "errors": [], "widget": {"attrs": {"placeholder": "\u30d1\u30b9\u30ef\u30fc\u30c9", "autocomplete": "current-password"}}}, "remember": {"label": "\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u307e\u307e\u306b\u3059\u308b", "value": null, "help_text": "", "errors": [], "widget": {"attrs": {}}}}, "field_order": ["login", "password", "remember"], "errors": []}, "html": "
175
+ ~以降は上記のhtmlの内容です~
176
+
16
177
 
17
178
  ### 試したこと
179
+ 表示内容を見ると最初がフォーム処理の内容で、そのあとにhtmlの内容がそのまま載っているので、
18
- 調べまたが同様の情報を見つけられませんでした
180
+ django-allauthのフォーム処理が関係htmlの情報を読み込めてないようなのですが、参考になる情報見つけられていません。
19
181
 
20
182
  ### 補足情報(FW/ツールのバージョンなど)
21
183
  ・django 3.2.14