django get field id code example
Example 1: how to get user id django
def sample_view(request):
current_user = request.user
print current_user.id
Example 2: django get item by id
obj = Class.objects.get(pk=this_object_id)
def sample_view(request):
current_user = request.user
print current_user.id
obj = Class.objects.get(pk=this_object_id)