1๐
โ
You can do it two ways, first. Raw sql
business = Business.objects.raw("Select * from business where id={0}".format(pk))
or if you want to call your managers super class, assuming your custom manager is called BusinessManager
business = super(BusinessManager, Business.objects).get(pk=id)
But as a good practice you should never overwrite the normal objects
attribute, that should be kept as is.
๐คHenrik Andersson
0๐
You can write RAW SQL queries without using django ORM. Just install a library to perform SQL queries directly on your database.
You can also try by writing Raw SQL in Django, but it may not solve your problem : https://docs.djangoproject.com/en/1.6/topics/db/sql/
EDIT : Well it seems I was wrong, it can actually solve your issue : https://docs.djangoproject.com/en/1.6/topics/db/sql/#executing-custom-sql-directly
๐คRaphael Laurent
- [Answer]-Why absolute paths in Django settings
- [Answer]-Automatic HTTPRedirect in Django view if user is authenticated?
- [Answer]-Django โ Confirmation on first visit
Source:stackexchange.com