Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

django docs case when

Client.objects.annotate(
     discount=Case(
         When(account_type=Client.GOLD, then=Value('5%')),
         When(account_type=Client.PLATINUM, then=Value('10%')),
         default=Value('0%'),
     ),
 ).values_list('name', 'discount')
Comment

PREVIOUS NEXT
Code Example
Python :: parse youtube video id from youtube link python 
Python :: rename multiple pandas columns with list 
Python :: python string list to list 
Python :: increase limit of recusrion python 
Python :: Pytube mp3 
Python :: python install libs 
Python :: python generate table 
Python :: pyqt5 change button color 
Python :: plotly grid lines color 
Python :: count how many duplicates python pandas 
Python :: pip version 
Python :: python console animation 
Python :: panda dataframe to list 
Python :: type(type) == type 
Python :: pip neat 
Python :: how to loop the length of an array pytoh 
Python :: pandas groupby as new column 
Python :: remove negative numbers from list python 
Python :: like in mysqldb python 
Python :: center buttons tkinter 
Python :: upload file in colab 
Python :: min max and avg function of python 
Python :: interpoltaion search formula python 
Python :: how to minimize command console python 
Python :: sns seaborn set theme 
Python :: get all file names in a folder python 
Python :: add self role with discord bot python 
Python :: pandas sample rows 
Python :: print time python 
Python :: today date python 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =