def update_profile_view(request): try: profile = UserProfile.objects.get(pk=request.user.id) return update_object( request, model = UserProfile, object_id = int(request.user.id), #extra_context = { 'UserProfile': UserProfile._meta, }, login_required = True, post_save_redirect = '/home/', ) except UserProfile.DoesNotExist: return create_object( request, model = UserProfile, #extra_context = { 'UserProfile': UserProfile._meta, }, login_required = True, post_save_redirect = '/home/', ) # The error message when trying to update an existing profile: ProgrammingError at /profile/ ERROR: column "acis" does not exist SELECT 1 FROM "profiles_userprofile" WHERE "user_id"=acis LIMIT 1 For some reason it's using the username instead of the user_id.