In Django I'm developing a Library project! (I'm new to Django, I've never worked with web development)
In summary, I have a model library and a model book in the models.py file, in the Model book there is a ForeignKey Library.
The entire project is in GitHub , where you can view models.py, forms.py, and views.py
p>Marked red in the image, this is the error generated on my page.
Mytemplatecode:
{%extends'base.html'%}{%loadstaticfiles%}{%blocktitle%}Chameleon|CadastrodeLivro{%endblock%}{%blockEstilo%}<linkhref="{% static 'css/cadastros.css' %}" rel="stylesheet">
{% endblock %}
{% block Corpo %}
<div class="container">
<form class="form-signin" role="form" action="." method="post"> {% csrf_token %}
<h2 class="form-signin-heading">Cadastro</h2>
<input type="text" class="form-control" id="codigo" name= "codigo" placeholder="Codigo" required autofocus>
<input type="text" class="form-control" id="titulo" name= "titulo" placeholder="Titulo" required>
<input type="text" class="form-control" id="autor" name= "autor" placeholder="Autor" required>
<input type="text" class="form-control" id="editora" name= "editora" placeholder="Editora" required>
<input type="text" class="form-control" id="genero" name= "genero" placeholder="Genero" required>
<input type="text" class="form-control" id="publicacao" name= "publicacao" placeholder="Ano: 0000" required>
<textarea id="sinopse" name="sinopse" placeholder="Sinopse" rows = 10 cols = 63 required></textarea><hr>
<select id="biblioteca" name="biblioteca">
<option value="" selected="selected"> ------------- </option>
<option value="{{ form.biblioteca }}" selected="selected"></option>
</select><hr>
<br><p><button class="btn btn-lg btn-primary btn-block" type="submit">Salvar</button></p>
</form>
</div>
{% endblock %}
{% block JScript %}
{% endblock %}
When I display the source code of the page, the part of the tag <select>
looks like this:
<!-- Inicio Select -->
<select id="id_biblioteca" name="biblioteca">
<option value="" selected="selected"> ------------- </option>
<option value= "<select id="id_biblioteca" name="biblioteca"><option value="" selected="selected">---------</option><option value="1">Chameleon</option></select>" selected="selected"></option>
</select><hr>
<!-- Fim Select -->