Skip to content

Instantly share code, notes, and snippets.

@a-rmz
Last active January 13, 2021 13:36
Show Gist options
  • Save a-rmz/3919d9aacd0c1c9840f8a39fd3e2f07e to your computer and use it in GitHub Desktop.
Save a-rmz/3919d9aacd0c1c9840f8a39fd3e2f07e to your computer and use it in GitHub Desktop.
from payments.enums import OrderStatus
from payments.models import Order
from resources.enums import BerthMooringType
orders = Order.objects.filter(
status=OrderStatus.ERROR,
comment__contains="Asiakkaan sähköpostiosoite puuttuu"
)
for order in orders:
if order.lease.berth.berth_type.mooring_type not in (BerthMooringType.DINGHY_PLACE, BerthMooringType.TRAWLER_PLACE):
order.lease.delete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment