Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

MultipleObjectsReturned: get() returned more than one Question -- it returned 3!

Model.objects.get(field_name=some_param)

# So instead of using get() you should use filter() 
# which will return multiple records. Such as

Model.objects.filter(field_name=some_param)
Comment

.MultipleObjectsReturned: get() returned more than one

If you want only one answer instead of multipe:

You need to use .filter() method
e.g Model.objects.filter(fname=first_name)
Now you may perform more filters like Model.objects.filter(fname=first_name).first() if you want only first
record or others as required.
Comment

PREVIOUS NEXT
Code Example
Shell :: awk print all columns 
Shell :: cp all files except .git 
Shell :: what is appmenu-gtk-module 
Shell :: Check Available SSH Keys on Your Computer 
Shell :: jenkins graphic installation ubuntu 18.04 
Shell :: mamp mac debug logs 
Shell :: powershell add to path 
Shell :: how to install altair graphql on manjaro linux 
Shell :: Problem 1: problem with installed package podman-docker-2.2.1-7.module_el8.3.0+699+d61d9c41.noarch 
Shell :: how to use github code 
Shell :: fish add to path 
Shell :: create a tar with folder content only 
Shell :: nano edit a file 
Shell :: remove xcode archives 
Shell :: cmd command pipe file to clipboard 
Shell :: libodbc1 2.3.7 ubuntu 
Shell :: NGINX: connect() to unix:/var/run/php7.2-fpm.sock failed (2: No such file or directory) 
Shell :: kubernetes ui tools 
Shell :: how to delete a git branch locally and remotely 
Shell :: push local to remote git 
Shell :: linux echo variable value 
Shell :: sh how to not store a command in history 
Shell :: recover commits done on HEAD 
Shell :: where is office folder 
Shell :: vscode regex src 
Shell :: change php version devilbox 
Shell :: run command on ctrl-c in shell script 
Shell :: Install nomachine in jetson nano 
Shell :: powershell array index 
Shell :: how to download nessus to kali debian 64 bit vm 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =