How To Get Queryset From Django Orm Create
i want to get queryset as a return value when i use the create in django orm newUserTitle = User_Title.objects.none() newUserTitle = newUserQuestTitle | newUserReviewTitle newU
Solution 1:
newUserTitle = User_Title.objects.none()
newUserTitle = newUserTitle.union(newUserQuestTitle)
newUserTitle = newUserTitle.union(newUserReviewTitle)
newUserTitle = newUserTitle.union(newUserlevelTitle)
if newUserQuestTitle, newUserReviewTitle and newUserlevelTitle also the query set then this will work.
I did not understand your question completely but This might help you.
Solution 2:
I really don't understand what you are asking, or why you want to do this - if you have three elements from the database already, I don't see why you need a queryset. But the way to do it would be to get the PKs of those items and query them:
pks = [newUserQuestTitle.pk, newUserReviewTitle.pk, newUserlevelTitle.pk]
newUserTitle = User_Title.objects.filter(pk__in=pks)
(Separately, please use proper Python style; User_Title should be UserTitle, and the other objects should be lower_case_with_underscore: new_user_title
, new_user_review_title
etc.)
Post a Comment for "How To Get Queryset From Django Orm Create"