Reputation: 8985
Do I need to convert this_object_id
to int before I can pass to id
?
obj = Class.objects.get(id=this_object_id)
Why or why not?
Upvotes: 1
Views: 217
Reputation: 72
Accepts both. Ultimately you are building an SQL query statement, so passing an int that gets converted to a string or a string that gets inserted both work. See http://django.readthedocs.org/en/latest/ref/models/lookups.html#lookup-reference for the lhs and rhs sides of the clause that is being constructed.
Upvotes: 1