I want to access the id of content_type of the Voting model where user belongs to the Info model also.
If I check with content_type.id it gives Object but I need id of the content_type which belongs to Voting for a specific user. How can I access that?
For example,
There is a forum post, which is Info Model. Any user can do the post. Any other user can Vote that post(either helpful or unhelpful). Now, I want to get the Vote done by supplied user id. With this: Info.objects.filter(user=some_user)
I think we will get the post done by user. I want vote done by user instead.
Here I am getting the user who voted.
voter = Voting.objects.get(user=request.user)
Now, I want to know the id of the Info for which user voted.
I don’t know. I don’t understand your data structures. Your reliance upon generic foreign keys without any referent isn’t clear.
You say that you want instances of a Vote model, but you don’t show the definition for a Vote model. You now show a reference to a votinginfo object which appears to be an object of type Info - but you mentioned you don’t want an Info.
You don’t provide any definition as to the relationships among these models or any context of what they are or how they’re used to help us understand what the real issue is.
So all this is to say that I can’t answer your last question because I don’t know what you’re trying to do.
I don’t know what you don’t know because its all data structure that I have and the votes has GenericRelation if you clearly see the question I posted. Question is very clear and consise and I believe that this is not big issue as well but I am stuck.