2
A curiosity that has accompanied me for a long time in Django and I never managed to heal:
Next. Let’s say I have something like:
from django.shortcuts import render from django.views import View from pagina.models import Config class BasicView(View): try: dados = { 'email': Config.objects.get(variavel = 'email').valor, } except: dados = {} class TelaView(BasicView): def get(self, request, **kwargs): self.template_name = 'base.html' return render(request, self.template_name, self.dados)
Then, in the base.html template, I would call {{email}} and Django would show the registration in the database.
Now, if I were to keep the server running and modify the email log in the database so that the new email appears in the template, it would be necessary to stop the server and run it again.
My question: Why this happens and how to get around this?
No one’s ever been through this before?
– illozzaM