You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
792 B
Python

# 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'