Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

django foreign key error Cannot assign must be a instance

# This error is because you're trying to assign an instance.id instead of 
# the instance itself. If its a foreign key field you assigned the instance i.e.
yourTable.yourCol = relatedTable.objects.get(relatedTableColumn = yourColValue)
#-or-
Orders.Dept_id = Department.objects.get(id = yourValueHere)
Orders.save()
Comment

PREVIOUS NEXT
Code Example
Python :: print progress without next line python 
Python :: how to change the rate of speech in pyttsx3 
Python :: simple thresholding with OpenCV 
Python :: python multiply list bt number 
Python :: Scrape the text of all paragraph in python 
Python :: pandas merge dataframes from a list 
Python :: python string exclude non alphabetical characters 
Python :: type hint tuple 
Python :: argparse multiple arguments as list 
Python :: how to make index column as a normal column 
Python :: discord python bot require one of two roles for command 
Python :: button in flask 
Python :: make csv lowercase python 
Python :: print items in object python 
Python :: md5 hash python 
Python :: make beep python 
Python :: decode base64 with python 
Python :: get the system boot time in python 
Python :: supprimer ligne python dataframe 
Python :: pygame.set_volume(2.0) max volume 
Python :: unpack tuple python 
Python :: python sort 2d list 
Python :: space to underscore python 
Python :: get local python api image url 
Python :: pandas where based another column 
Python :: pyaudio install error ubuntu 
Python :: tkinter entry read only 
Python :: python snake game 
Python :: how to know where python is installed on windows 
Python :: shift axis in python 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =