#1
by
rui123
Anyone knows what's the cause of this error? I've been stuck on it for two days. It seems like it's not caused by my codes by oTree settings.
#2
by
Chris_oTree
what page do you get this on? is it one of your own pages? if so, please provide the code of the page. and the full traceback of the error, not just the last line.
#4
by
Chris_oTree
i still need the other info such as URL & code.
#5
by
rui123
Here's the codes containing csrftoken:
{% extends "otree/Page.html" %}
{% load otree static %}
{% block styles %}
<style>
body {
font-family: sans-serif;
line-height: 1.45;
margin: 0;
padding: 20px;
background-color: #f5f5f5;
}
.page {
max-width: 900px;
margin: 0 auto;
padding: 20px;
background: white;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.timer {
margin: 12px 0;
padding: 0.5rem;
background: #fff6d6;
border-radius: 8px;
text-align: center;
font-weight: bold;
}
</style>
{% endblock %}
{% block content %}
<div class="page">
{% if timeout_seconds %}
<div class="timer">
⏰ Time left: {{ timeout_seconds }} seconds
</div>
{% endif %}
<form method="post" role="form">
{% csrf_token %}
{% block form_content %}
<!-- Page-specific content will go here -->
{% endblock %}
</form>
</div>
{% endblock %}
#6
by
Chris_oTree
Where does this code come from? It doesn't follow oTree's coding guidelines. You are not supposed to put <form> or {% csrf_token %} in your pages.