<commit_before>from django.core.management import BaseCommand

from hospitals.models import Hospitals
from podrazdeleniya.models import Podrazdeleniya
from users.models import DoctorProfile


class Command(BaseCommand):
    help = "Заполнение пустых hospital"

    def handle(self, *args, **options):
        default_h = Hospitals.get_default_hospital()
        if not default_h:
            print('Не настроена организация по умолчанию')
            return
        Podrazdeleniya.objects.filter(hospital__isnull=True).update(hospital=default_h)
        DoctorProfile.objects.filter(hospital__isnull=True).update(hospital=default_h)
<commit_msg>updater<commit_after>from django.core.management import BaseCommand

from hospitals.models import Hospitals
from podrazdeleniya.models import Podrazdeleniya
from users.models import DoctorProfile


class Command(BaseCommand):
    help = "Заполнение пустых hospital"

    def handle(self, *args, **options):
        default_h = Hospitals.get_default_hospital()
        if not default_h:
            print('Не настроена организация по умолчанию')
            return
        Podrazdeleniya.objects.filter(hospital__isnull=True, p_type=Podrazdeleniya.DEPARTMENT).update(hospital=default_h)
        Podrazdeleniya.objects.filter(hospital__isnull=False).exclude(p_type=Podrazdeleniya.DEPARTMENT).update(hospital=None)
        DoctorProfile.objects.filter(hospital__isnull=True).update(hospital=default_h)

{'fraction_non_alphanumeric': 0.0796398891966759, 'fraction_numerical': 0.0, 'mean_word_length': 4.579150579150579, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5560413', 'n_tokens_mistral': 438, 'n_tokens_neox': 439, 'n_words': 80}