TypeError: save() missing 1 required positional argument: 'self' : DjangoRestframework

satyajit

I'm getting an error, save() missing 1 required positional argument: 'self' .
I have no idea where I made mistake, it would be great if anybody could figure out the mistake, they would be much appreciated.

serializers.py

           UserOtherInfo_obj = User(
                device_token    =   device_token,
                device_type     =   device_type,
                phone_number    =   phone_number,
                country_code    =   country_code,
                login_type      =   login_type
            )    
            
            UserOtherInfo_temp  =  User.save()
            
            temp_user1 = User.objects.filter(user=temp_user)
            print('temp_user1',temp_user1)
            UserOtherObj = temp_user1.first()    

Biplove Lamichhane

I think it should be:

UserOtherInfo_temp  =  UserOtherInfo_obj.save()

Before, you directly were calling save on User model, but you can save only the instance of User model, which you instantiated just a line above i.e:

UserOtherInfo_obj = User(
                device_token    =   device_token,
                device_type     =   device_type,
                phone_number    =   phone_number,
                country_code    =   country_code,
                login_type      =   login_type
            ) 

Here, UserOtherInfo_obj is instance of User model.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

TypeError at / save() missing 1 required positional argument: 'self'

TypeError: save() missing 1 required positional argument: 'self'

TypeError at /listing: save() missing 1 required positional argument: 'self'

save() missing 1 required positional argument 'self'

TypeError: Missing 1 required positional argument: 'self'

TypeError at /api/products/1 save() missing 1 required positional argument: 'self'

problems with this TypeError: save() missing 1 required positional argument: 'self' in pycharm django

How to resolve the error: TypeError at /signup save() missing 1 required positional argument: 'self'

How to Solve this " TypeError: read() missing 1 required positional argument: 'self' "

TypeError: gassens() missing 1 required positional argument: 'self'

TypeError: open_file() missing 1 required positional argument: 'self'

TypeError: get_params() missing 1 required positional argument: 'self'

TypeError: Function() missing 1 required positional argument: 'self'

TypeError: GetSize() missing 1 required positional argument: 'self'

TypeError: endturn() missing 1 required positional argument: 'self'

Python - TypeError: listen() missing 1 required positional argument: 'self'

TypeError : kollision() missing 1 required positional argument: 'self'

TypeError: close() missing 1 required positional argument: 'self'

TypeError: player_attack() missing 1 required positional argument: 'self'

TypeError: str() missing 1 required positional argument: 'self'

TypeError: grid_configure() missing 1 required positional argument: 'self'

TypeError: main() missing 1 required positional argument: 'self'

TypeError: check() missing 1 required positional argument: 'self'

Getting TypeError fit() missing 1 required positional argument: 'self'

TypeError: draw_shape() missing 1 required positional argument: 'self'

TypeError: GoogleAuth.LocalWebserverAuth() missing 1 required positional argument: 'self'

Missing 1 required positional argument: 'self' missing

python: missing 1 required positional argument: 'self'

fit() missing 1 required positional argument: 'self'