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.
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
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
3 matches
Mail list logo