Django ORM QuerySet-1(select,from,where in mysql)



Image result for django queryset


Mysql Query:
SELECTFROM `user_profiles` WHERE `user_profiles`.`user_id` = 4
 
Django ORM QuerySet Syntax:
user_profile_obj = UserProfile.objects.get(user=request.user)

Keys Used :
Django: objects,get
Mysql: select,from,where
Note:
- UserProfile is the class in model
- request.user value is 4

No comments:

Post a Comment