You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.1 KiB
26 lines
1.1 KiB
# -*- coding: utf-8 -*-
|
|
from django.core.management.base import NoArgsCommand
|
|
from django.db.models import Q, F
|
|
from django.db import transaction
|
|
|
|
from events.common import GetCourse
|
|
from exposition.models import Exposition
|
|
from conference.models import Conference
|
|
|
|
converter = GetCourse(nocache=True)
|
|
|
|
|
|
class Command(NoArgsCommand):
|
|
def handle_noargs(self, **options):
|
|
with transaction.commit_manually():
|
|
for x in Exposition.objects.all().only('currency', 'min_closed_area'):
|
|
x.price_rub = converter.convert_or_null(x.currency, x.min_closed_area)
|
|
x.price_eur = converter.convert_to_eur_or_null(x.price_rub)
|
|
x.save(update_fields=['price_rub', 'price_eur'])
|
|
for x in Conference.objects.all().only('currency', 'min_price'):
|
|
x.price_rub = converter.convert_or_null(x.currency, x.min_price)
|
|
x.price_eur = converter.convert_to_eur_or_null(x.price_rub)
|
|
x.save(update_fields=['price_rub', 'price_eur'])
|
|
transaction.commit()
|
|
# , Conference]:
|
|
# model.objects.
|
|
|