# Kod źródłowy modułu tasks.forms

    from django import forms
    from tasks.models import ApprenticeVideo

    class ApprenticeTaskAnswerForm(forms.Form):
        """Forma odpowiedzi do zadania"""

        yt_video = forms.URLField(max_length=200)
        custom_title = forms.CharField(max_length=100, required=False)
        reflection = forms.CharField(max_length=500, required=False)

        def __init__(self, request=None, *args, **kwargs):
            super(ApprenticeTaskAnswerForm, self).__init__(*args, **kwargs)

        def save(self, **kwargs):
            custom_title = self.cleaned_data.get('custom_title')
            yt_video = self.cleaned_data.get('yt_video')
            reflection = self.cleaned_data.get('reflection')
            apprentice_video = ApprenticeVideo.objects.create(yt_video=yt_video, reflection=reflection)
            return apprentice_video, custom_title