python - bulk_create for foreign key list giving unexpected output -


bulk_create giving unexpected output , wrong here...????

class user(models.model):     first_name =  models.charfield(max_length=50)     last_name = models.charfield(max_length=50)  class messagepost(models.model):     send_to = models.foreignkey(user)     media_def = models.textfield(blank=true)     message = models.textfield()  #userlist fetched db userlist = [user(first_name='a',last_name='b'),user(first_name='x',last_name='y')]  messagepost.objects.bulk_create([messagepost(send_to=u , media_def='media/images/1.png' , message='hai everyone') u in userlist ]) 

here on using bulk_create gives following erroneous output :

typeerror : expected string or buffer 


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -