I would appreciate if you check my code and tell me what should I change. The code finally works but it could be much clear in my opinion.This is all about creating an order which is a Job object. The order is an order of translation of some text or file. There are models Job, Language and Level. In one page, user is able to create multiple orders because you can translate one language into multiple different languages. So user can choose multiple Language Level tuples.VIEWS.PYdef create_order(request):    LanguageLevelFormSet = formset_factory(LanguageLevelForm, extra=5, max_num=5)    language_level_formset = LanguageLevelFormSet(request.POST or None)    job_creation_form = JobCreationForm(request.POST or None, request.FILES or None)    context = {'job_creation_form': job_creation_form,               'formset': language_level_formset}    if request.method == 'POST':        if job_creation_form.is_valid() and language_level_formset.is_valid():            cleaned_data_job_creation_form = job_creation_form.cleaned_data            cleaned_data_language_level_formset = language_level_formset.cleaned_data            for language_level_form in [d for d in cleaned_data_language_level_formset if d]:                language = language_level_form['language']                level = language_level_form['level']                job = Job(                        customer=request.user,                        text_to_translate=cleaned_data_job_creation_form['text_to_translate'],                        file=cleaned_data_job_creation_form['file'],                        short_description=cleaned_data_job_creation_form['short_description'],                        notes=cleaned_data_job_creation_form['notes'],                        language_from=cleaned_data_job_creation_form['language_from'],                        language_to=language,                        level=level,                )                job.save()            return HttpResponseRedirect('/order-success')        else:            return render(request, 'auth/jobs/create-job.html', context=context)    return render(request, 'auth/jobs/create-job.html', context=context)FORMS.PYclass JobCreationForm(forms.ModelForm):    text_to_translate = forms.CharField(widget=forms.Textarea(attrs={'placeholder': 'Specification'}), required=False)    file = forms.FileField(required=False)    delivery_date = forms.DateField(label='Deadline',widget=SelectDateWidget(years=[y for y in range(1930, 2050)]))    class Meta:        model = Job        fields = (            'short_description', 'language_from', 'text_to_translate', 'file', 'notes', 'delivery_date'        )        widgets = {            'text_to_translate': forms.Textarea(attrs={'class': 'form-control'}),            # 'level':forms.Select(attrs={'class': 'form-control'}),        }    def __init__(self, *args, **kwargs):        super(JobCreationForm, self).__init__(*args, **kwargs)        self.fields['text_to_translate'].widget.attrs['class'] = 'grouprequired'        self.fields['file'].widget.attrs['class'] = 'grouprequired'class LanguageLevelForm(forms.Form):    language = forms.ModelChoiceField(Language.objects,widget=forms.Select(attrs={'class':'select-language'}) )    level = forms.ModelChoiceField(Level.objects,widget=forms.Select(attrs={'class':'select-level'}))    class Meta:        fields = '__all__'MODELS.PYclass Language(models.Model):    shortcut = models.CharField(max_length=40,                                help_text=_('Shortcut of the language'),                                unique=True)    name = models.CharField(max_length=40,                            help_text=_('Name of the language'),                            unique=True)    quiz = models.OneToOneField(Quiz, null=True, blank=True,                                help_text=_('Choose a test for this language (leave blank if there is no test yet'))    quiz_slug = models.CharField(max_length=20, default='not-yet',                                 help_text=_('String of url (somethig like english or english-language'))    def __str__(self):        return self.name    @staticmethod    def get_active_languages():         returns all languages having at least one standard level         language_levels = LanguageLevel.objects.exclude(level__name__in=[0])        languages = set()        for language_level in language_levels:            languages.add(language_level.language)        return list(languages)    @property    def languages_to(self):        userprofiles = UserProfile.objects.all()        result = set()        for up in userprofiles:            if self in up.languages_verified:                result.update(up.languages_verified)        if self in result:            result.remove(self)        return result    @property    def levels(self):        levels_result = []        from django.db.models import Count        all_active_language_levels = LanguageLevel.objects.all().annotate(                translators_count=Count('translators__id')).filter(                translators_count__gte=1)        this_language_active_language_levels = all_active_language_levels.filter(                language=self)        levels = [x.level for x in this_language_active_language_levels.exclude(level__name=0)]        if any(x.name == 1 for x in levels):            levels_result.extend(Level.objects.exclude(name=0).exclude(name=3).exclude(name=2))        print Level.objects.all()        if any(x.name == 2 for x in levels):            levels_result.extend(Level.objects.exclude(name=0).exclude(name=3))        if any(x.name == 3 for x in levels):            levels_result.extend(Level.objects.exclude(name=0))        return levels_result    @property    def translators(self):        translators = []        for translator in UserProfile.objects.all():            if self in translator.languages_verified:                translators.append(translator)        return translators    def get_possible_translation_levels(self, language):        highest_level = Level.objects.get(name=0)        for translator in UserProfile.objects.all():            if language in translator.languages_verified:                level = translator.language_levels.get(language=language).level                if highest_level.name <= level.name:                    highest_level = level        levels = Level.objects.filter(name__lte=highest_level.name).exclude(name=0)        return levelsclass Job(models.Model):    # job_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)    customer = models.ForeignKey(User, related_name='orders', help_text=_(Customer), on_delete=models.CASCADE)    translator = models.ForeignKey(User, related_name='jobs', null=True, blank=True, help_text=_(uTranslator))    price = models.FloatField(null=True, blank=True, help_text=_(uPrice))    language_from = models.ForeignKey(Language, related_name='jobs_from', null=True)    language_to = models.ForeignKey(Language, related_name='jobs_to', null=True)    # ZADAVA CUSTOMER    short_description = models.CharField(max_length=40, blank=False,                                         help_text=_(uVery short description of this order))    notes = models.TextField(help_text=_(Notes))    text_to_translate = models.TextField(verbose_name='Text to translate', blank=True, null=True,                                         help_text=uText, ktor chcete preloi (ak neprikladte sbor).)    file = models.FileField(null=True, blank=True, help_text=uUpload file)    level = models.ForeignKey(Level, null=False, default=None)    delivery_date = models.DateField(null=True, blank=True, help_text=_('Deadline'))    PROGRESS_CHOICES = (        ('translator_not_assigned_yet', 'Translator not assigned yet'),        ('in_translation_process', 'In translation process'),        ('translated', 'Translated'),        ('complete', 'Complete')    )    progress = models.CharField(choices=PROGRESS_CHOICES, max_length=40, default='translator_not_assigned_yet')    # AUTOMATICKY GENEROVANE    created = models.DateTimeField(auto_now_add=True)    modified = models.DateTimeField(auto_now=True)    is_active = models.BooleanField(default=False)    is_done = models.BooleanField(default=False)    @property    def has_translator(self):        return self.translator_id is not None    def __str__(self):        return '{}: {} to {} | {}'.format(self.customer, self.language_from, self.language_to, self.short_description)class Level(models.Model):    LEVEL_CHOICES = (        (0, _('Unknown')),        (1, _('Standard level')),        (2, _('Professional level')),        (3, _('Native speaker level')),    )    name = models.IntegerField(choices=LEVEL_CHOICES, blank=False, null=False,                               help_text=_('Choose a level'))    threshold = models.PositiveIntegerField(default=0, validators=[MinValueValidator(0), MaxValueValidator(100)])    def __str__(self):        return '{}'.format(self.get_name_display())class LanguageLevel(models.Model):    language = models.ForeignKey(Language,                                 help_text=_('Choose a language'), related_name='language_levels')    level = models.ForeignKey(Level,                              help_text=_('Choose a level of the language'))    price_multiplier = models.FloatField(default=0.0,                                         help_text=_('Type a price multiplier'))    def __str__(self):        return '{}: {}'.format(self.language, self.level)    class Meta:        unique_together = (('level', 'language'),)
Creating multiple objects using two forms
python;python 2.7;django