Answer the question
In order to leave comments, you need to log in
How to make django queryset global?
In general, I have such a problem:
If I go to the console, then Bb.objects works without any complaints. If I declare the .objects class outside the console, in the controller, for example, then the python does not understand what I require from it, it thinks that I refer to a specific objects field and gives an error like there is no such field. The Pycharm IDE also suggests creating an object field in the Bb class. I think you need to add django or somehow highlight the queryset in the PATH variable for Windows, so that you can call it from anywhere.
I tried through conda and through the virtual environment all the same.
Please advise how to solve
Python 3.7
Django 3
Window 10 problem
Answer the question
In order to leave comments, you need to log in
And what is it for? output in a template? - context_processors
Call in other views? - I would use cbv's and write a mixin, and call it where necessary at the right time (not the fact that I'm doing it right, but it works). It is possible to describe this logic in the model, so it’s probably much more correct
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question