-1
Hello, I’m trying to display a text from the mysql database, using Django, I’ve searched for several tutorials but nothing works, if anyone can help thank you already.
This is part of my file: index.html
<div class="col-lg-4 col-6">
<div class="small-box bg-warning">
<div class="inner">
{% for rf in indrf %}
<h3>{{rf.id}}</h3>
{% endfor %}
<p>Indicações registradas</p>
</div>
This is my model file: py.models
from django.db import models
class indications(models.Model):
name = models.CharField(max_length=50)
phone = models.CharField(max_length=15)
obs = models.TextField()
status = models.CharField(max_length=10)
user_id = models.CharField(max_length=50)
This is part of the view: py views.
def countrefused(request):
indrf = indications.objects.all()
return render(request,"index.html",{'indrf':indrf})
But every time I run, the code doesn’t return anything. Grateful!!
Thanks for your help, it worked properly.
– RAYKAVIN MEIRELES