<commit_before># -*- coding: utf-8 -*-

from django import forms

from core.models import *

class InfoPageForm(forms.ModelForm):
    class Meta():
        model = Infopage


class MessageForm(forms.ModelForm):
    class Meta():
        model = Message
        exclude = ('flags','locationId', 'sender')
        widgets = {'category':forms.CheckboxSelectMultiple(), }

    lat = forms.FloatField(widget = forms.HiddenInput)
    lon = forms.FloatField(widget = forms.HiddenInput)
    region = forms.ModelChoiceField(Region.objects.all(), label = 'Регион')
    messageType = forms.ModelChoiceField(MessageType.objects.filter(id__lt = 5), label = 'Тип сообщения')
    #msgType = forms.ChoiceField(choices = Message.MESSAGE_TYPE, label = 'Тип сообщения')
    address = forms.CharField(label = 'Адрес')
    active = forms.BooleanField(label = 'Сообщение активно',required = False) #Флаг может быть в состоянии on/off
    important = forms.BooleanField(label = 'Сообщение важно', required = False)#Флаг может быть в состоянии on/off

    def __init__(self, *args, **kwargs):
        msg = kwargs.get('instance',None)
        initial = {'address': msg.address(),'lat': msg.latitude(), 'lon': msg.longtitude(),
            'active':msg.active(), 'important': msg.important(), 'region': msg.region(),
            }
        kwargs['initial'] = initial<commit_msg>Reflect moving Message model to message application<commit_after># -*- coding: utf-8 -*-

from django import forms

from core.models import *

from message.models import Message, MessageType


class InfoPageForm(forms.ModelForm):
    class Meta():
        model = Infopage


class MessageForm(forms.ModelForm):
    class Meta():
        model = Message
        exclude = ('flags','locationId', 'sender')
        widgets = {'category':forms.CheckboxSelectMultiple(), }

    lat = forms.FloatField(widget = forms.HiddenInput)
    lon = forms.FloatField(widget = forms.HiddenInput)
    region = forms.ModelChoiceField(Region.objects.all(), label = 'Регион')
    messageType = forms.ModelChoiceField(MessageType.objects.filter(id__lt = 5), label = 'Тип сообщения')
    #msgType = forms.ChoiceField(choices = Message.MESSAGE_TYPE, label = 'Тип сообщения')
    address = forms.CharField(label = 'Адрес')
    active = forms.BooleanField(label = 'Сообщение активно',required = False) #Флаг может быть в состоянии on/off
    important = forms.BooleanField(label = 'Сообщение важно', required = False)#Флаг может быть в состоянии on/off

    def __init__(self, *args, **kwargs):
        msg = kwargs.get('instance',None)
        initial = {'address': msg.address(),'lat': msg.latitude(), 'lon': msg.longtitude(),
            'active':msg.active(), 'important': msg.important(), 'region': msg.region(),
            }
        kwargs['initial'] = initial
{'fraction_non_alphanumeric': 0.1388690050107373, 'fraction_numerical': 0.0014316392269148174, 'mean_word_length': 3.7292724196277494, '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': '3338364', 'n_tokens_mistral': 842, 'n_tokens_neox': 860, 'n_words': 196}