Staging syntax error while creating Django model instance

from customer.models import Customer; cust = Customer.objects.create_user(first_name=\"'first_name'\", last_name='\"'last_name'\", uuid='\"'uuid'\");

Getting these errors for the last name: Staging: -c: unexpected EOF while looking for matching `"' Staging: -c: syntax error: unexpected end of file

I have tried last_name=$'last_name' but that does not work and I need it to still be a string if given an empty string. This is in a bash script.

you are not using the escape character " properly :

change it like this :

from customer.models import Customer; 
cust = Customer.objects.create_user(first_name="\'first_name\'", last_name="\'last_name\'", uuid="\'uuid\'" );

but you don't really need using the escape character you can simply write :

from customer.models import Customer; 
cust = Customer.objects.create_user(first_name="'first_name'", last_name="'last_name'", uuid="'uuid'" );
Back to Top