<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> from django import forms as django_forms <EOL> from datetimewidget import widgets as datetime_widgets <EOL> from services . common import simulation <EOL> from services . configuration . models import tle as tle_models <EOL> from services . leop import utils as leop_utils <EOL> from services . leop . models import launch as launch_models <EOL> class LaunchForm ( django_forms . ModelForm ) : <EOL> """<STR_LIT>""" <EOL> tle_l1 = django_forms . CharField ( <EOL> label = '<STR_LIT>' , <EOL> max_length = tle_models . TwoLineElement . MAX_TLE_LINE_LEN , <EOL> error_messages = { '<STR_LIT>' : "<STR_LIT>" } , <EOL> widget = django_forms . Textarea <EOL> ) <EOL> tle_l2 = django_forms . CharField ( <EOL> label = '<STR_LIT>' , <EOL> max_length = tle_models . TwoLineElement . MAX_TLE_LINE_LEN , <EOL> error_messages = { '<STR_LIT>' : "<STR_LIT>" } , <EOL> widget = django_forms . Textarea <EOL> ) <EOL> class Meta : <EOL> """<STR_LIT>""" <EOL> model = launch_models . Launch <EOL> fields = ( '<STR_LIT>' , '<STR_LIT:date>' ) <EOL> widgets = { <EOL> '<STR_LIT:date>' : datetime_widgets . DateTimeWidget ( <EOL> usel10n = True , bootstrap_version = <NUM_LIT:3> <EOL> ) <EOL> } <EOL> def clean ( self ) : <EOL> """<STR_LIT>""" <EOL> cleaned_data = super ( LaunchForm , self ) . clean ( ) <EOL> tle_l1 = cleaned_data . get ( '<STR_LIT>' ) <EOL> tle_l2 = cleaned_data . get ( '<STR_LIT>' ) <EOL> tle_id = leop_utils . generate_cluster_tle_id ( <EOL> cleaned_data . get ( '<STR_LIT>' ) <EOL> ) <EOL> try : <EOL> simulation . OrbitalSimulator . check_tle_format ( <EOL> tle_id , tle_l1 , tle_l2 <EOL> ) <EOL> except Exception as ex : <EOL> raise django_forms . ValidationError ( '<STR_LIT>' + str ( ex ) ) <EOL> return cleaned_data </s>
