Use flask-login instead of client-side sessions for storing selected location and orders
This commit is contained in:
+12
-2
@@ -15,10 +15,10 @@
|
||||
<li{{ " class=current-page" if request.path.startswith("/entry") else "" }}><a href="/entry">Eintragen</a></li>
|
||||
<li{{ " class=current-page" if request.path.startswith("/location") else "" }}>
|
||||
<a href="/location">
|
||||
{% if "location" not in session %}
|
||||
{% if not current_user.data.location %}
|
||||
Raum wählen
|
||||
{% else %}
|
||||
Raum: {{ session.location.location_name }}
|
||||
Raum: {{ current_user.data.location.location_name }}
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
@@ -30,6 +30,16 @@
|
||||
<details>
|
||||
<summary><code>config</code></summary>
|
||||
<pre>{% for key, value in config.items() %}{{ key }} = {{ value }}
|
||||
{% endfor %}</pre>
|
||||
</details>
|
||||
<details>
|
||||
<summary><code>session</code></summary>
|
||||
<pre>{% for key, value in session.items() %}{{ key }} = {{ value }}
|
||||
{% endfor %}</pre>
|
||||
</details>
|
||||
<details>
|
||||
<summary><code>current_user.data</code></summary>
|
||||
<pre>{% for key, value in current_user.data.__dict__.items() %}{{ key }} = {{ value }}
|
||||
{% endfor %}</pre>
|
||||
</details>
|
||||
{% endif %}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<th>VK-Preis (Brutto)</th>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
{% for cart_item in cart %}
|
||||
{% for cart_item in current_user.data.orders %}
|
||||
<tr>
|
||||
<td><code>{{ cart_item.barcode }}</code></td>
|
||||
<td>{{ cart_item.name }}</td>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
{% block content %}
|
||||
<form method="POST">
|
||||
<select name="location_id">
|
||||
<option value="" {{ "selected" if "location" not in session else ""}}>-</option>
|
||||
<option value="" {{ "selected" if not current_user.data.location else ""}}>-</option>
|
||||
{% for location in locations %}
|
||||
<option value="{{ location.location_id }}" {{ "selected" if "location" in session and session.location.location_id == location.location_id else "" }}>{{ location.location_name }}</option>
|
||||
<option value="{{ location.location_id }}" {{ "selected" if current_user.data.location.location_id == location.location_id else "" }}>{{ location.location_name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user