Django ORM Left Join query

2019-07-01 Thread Razib Hossain Shuvo
HI all, I have the follow models . I want to find all the categories from the UserCategory table along with the budget for each category from the UserBudget model. I tried with select_related and prefetch and filtered with user_id but then it only returns budget that has matched with user_id.

Django ORM Left join

2019-07-01 Thread Razib Hossain Shuvo
I have the following models. class UserBudget(models.Model): cat = models.ForeignKey('preference.Category', on_delete=models.CASCADE) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) budget = models.DecimalField(default=0.00, decimal_places=2, max_digits=2

Implementing query with Django ORM - left join with length() and replace() functions

2013-04-05 Thread Brad Buran
I'm trying to replicate a query using Django's ORM; however, I'm having a bit of difficulty figuring out how to accomplish it. The model that I'm querying is defined as: class Word(models.Model): objects = WordManager() spelling = models.CharField(max_length=128) ipa = models.Char