Skip to content

Instantly share code, notes, and snippets.

@cezar77
Created December 15, 2017 08:26
Show Gist options
  • Select an option

  • Save cezar77/236e47f5ff361bcbbc29e1727a03b298 to your computer and use it in GitHub Desktop.

Select an option

Save cezar77/236e47f5ff361bcbbc29e1727a03b298 to your computer and use it in GitHub Desktop.
Break long lines in Python without using backslash (SO question 47808863)
orders = Order.objects.filter(
adjustments__type='payment',
adjustments__location__isnull=False,
status__gte=200,
status__lt=300
).exclude(
adjustments__location__zipcode__in=['', '0000', '00000', 0000, 00000]
).values(
# 'id',
'adjustments__location__city',
'adjustments__location__state',
'adjustments__location__country'
).annotate(
bookings=Count('amount'), #, distinct=True),
total_booking_value=Sum('amount'),
average_booking_value=Avg('amount')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment