Re: writing most common queries as model class method!

2022-11-12 Thread Chukwudi Onwusa
Write that method in your views, and return render(request,'templateName.html', optional) and go to your templates and call your desired or important attribute with the instance of the class using Django template tag {{class_instanceInMethodInsideView.modelsAtrributeName}} as many attribute as

writing most common queries as model class method!

2022-11-11 Thread Amir Jamshidi
Hi, I tried to write a classmothods/ instance method in a Model in order to run most common query from the model but got errors like below : ""AttributeError: Manager isn't accessible via ... instances"" example code: class Profile(model.Model): name = model.Charfield(...) address =