Horje
case statement in querset django Code Example
case statement in querset django
# Creating a calculated column named 'discount' on Client table 
# Using conditional case statement with nested When -> Then logic
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')




Python

Related
read bytes from file python Code Example read bytes from file python Code Example
get most repeated instance in a queryset django Code Example get most repeated instance in a queryset django Code Example
python negation of an statement Code Example python negation of an statement Code Example
python code for system of odes Code Example python code for system of odes Code Example
SQL Query to Join Two Tables Based Off Closest Timestamp Code Example SQL Query to Join Two Tables Based Off Closest Timestamp Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7