Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get a list of ids from queryset django

author = Blog.objects.filter(author=author)
ids    = author.values_list('pk', flat=True)

# list method get ids without parse the returning queryset

print(list(ids))
Comment

PREVIOUS NEXT
Code Example
Python :: find the max value in dictionary python 
Python :: python string to datetime 
Python :: how to find no of times a elements in list python 
Python :: read a large dataframe in pandas 
Python :: get all h1 beautifulsoup 
Python :: what is cleaned data in django 
Python :: dataframe rename column 
Python :: How to Convert Strings to Datetime in Pandas DataFrame 
Python :: data dictionary python into numpy 
Python :: sending email in django 
Python :: missingno python 
Python :: python bz2 install 
Python :: mob psycho 100 
Python :: generate gif py 
Python :: import matplotlib 
Python :: sys.executable 
Python :: how to create a role and give it to the author discord.py 
Python :: how to do an if input = python 
Python :: python zip extract directory 
Python :: python convert dictionary to pandas dataframe 
Python :: strip comma from string python 
Python :: multiple inputs in python 
Python :: how to print to a file in python 
Python :: python check folder 
Python :: add hour minutes second python 
Python :: remove outliers python dataframe 
Python :: minimum of two columns in pandas 
Python :: how to use ggplot matplotlib 
Python :: how to restart program in python 
Python :: dataframe summary pandas 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =