# coding: utf-8 # Author: Grizzly # # Forms for litl. The main form is for creating the link. from django import forms from django.core.exceptions import ValidationError from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from .models import Slug class SlugAddForm(forms.Form): destination = forms.CharField(label="Destination", max_length=300,required=True) slug = forms.CharField(label="Slug", max_length=20,required=False) bulk = forms.BooleanField(label="Bulk", required=False) def __init__(self, *args, **kwargs): super(SlugAddForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.add_input(Submit('submit', 'Shorten', css_class='btn-primary')) self.helper.form_method = 'POST'