Hello everyone!
I'm having trouble trying to run a simple script in my web app and I can't see why it won't work.
This is the piece of code I'm trying to make work:
from contratos.models import Contrato
from django.db.models import Q
def gerar_relatorio_chassis():
contratos = Contrato.objects.exclude(
Q(proposta=True) |
Q(status='Pendente') |
Q(numero=None)
)
Nothing fancy, right? Just a simple query in Django, but when I try running this code using the command python manage.py shell < file_name.py I get an error.
NameError: name 'Contrato' is not defined
Of course when I try running the same code on my machine it works hahaha. And yes, I'm running the command while my virtual environment is activated.
Can somebody help me?
PS: I have a similar code in another web app and it works fine.