from django.utils.translation import ugettext_lazy as _
from django import forms
from django.utils import timezone
from markdownx.fields import MarkdownxFormField


class RendererForm(forms.Form):
    title = forms.CharField(label=_('Title'), required=False)
    show_title = forms.BooleanField(label=_('Show Title'), required=False)
    date = forms.DateField(label=_('Date'),
                           initial=lambda: timezone.now().strftime('%Y-%m-%d'),
                           widget=forms.TextInput(
                               attrs={'type': 'date'}
                           ))
    render_content = MarkdownxFormField(
        label=_('Content'),
    )

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields['show_title'].initial = True
