1๐
โ
If you want to select related values you have to specify all parameters you want in values()
. Otherwise you will get only the foreignkey to your user model. Try adding the values you want from your user model with __
:
query = query.filter(created__range=start_date_range).values('approved', ..., 'user_id__daily_target', 'user_id__username')
Btw if you are creating an API you should have a look at django-rest-framework
๐คilse2005
0๐
try this,
Deal.objects.filter(user_id__role_id_id=1, created__range=start_date_range).select_related('user_id').values()
or specify required fields as parameters to values().
๐คRakesh babu
- Django โ best way of storing data created on the fly for a view/template
- Django form and many2many.through field
- How part queryset in Temokate
Source:stackexchange.com