#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "chenwei"
# Date: 2019/7/8

from api.models import Coupon
from gm_types.gaia import DOCTOR_USE_COUPON_TYPE
from django.core.management import BaseCommand


class Command(BaseCommand):
    def handle(self, *args, **kwargs):
        print("------start to update---------")
        c_sets = Coupon.objects.filter(doctor_id__isnull=False)
        c_sets.update(
            doctor_coupon_use_type=DOCTOR_USE_COUPON_TYPE.PART_GENERAL)
        print("------end update, total: %d-----" % c_sets.count())


