36 lines
1012 B
Python
36 lines
1012 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from django import forms
|
|
from frontend.models import ProjectContext
|
|
from crispy_forms.helper import FormHelper
|
|
from crispy_forms.layout import Submit, Layout
|
|
|
|
class NewProjectContextForm(forms.ModelForm):
|
|
def __init__(self, *args, **kwargs):
|
|
super(NewProjectContextForm, self).__init__(*args, **kwargs)
|
|
self.helper = FormHelper()
|
|
self.helper.form_class = 'form-horizontal'
|
|
self.helper.label_class = 'col-lg-2'
|
|
self.helper.field_class = 'col-lg-4'
|
|
self.helper.form_method = 'post'
|
|
self.helper.layout = Layout(
|
|
'name',
|
|
'description',
|
|
Submit('send', 'Senden', css_class = 'btn-default')
|
|
)
|
|
|
|
name = forms.CharField(
|
|
label = "Name",
|
|
max_length = 255,
|
|
required = True,
|
|
)
|
|
|
|
description = forms.CharField(
|
|
label = "Description",
|
|
required = True,
|
|
)
|
|
|
|
class Meta:
|
|
model = ProjectContext
|
|
fields = ['name', 'description']
|