You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.3 KiB
40 lines
1.3 KiB
from django import forms
|
|
from .models import Prospect, Event
|
|
import datetime
|
|
|
|
class SmallTextArea(forms.Textarea):
|
|
def __init__(self, *args, **kwargs):
|
|
kwargs.setdefault('attrs', {})
|
|
kwargs['attrs'].update({
|
|
'rows': 2,
|
|
'cols': 100,
|
|
'style': 'height: 80px; width: 800px;'
|
|
})
|
|
super().__init__(*args, **kwargs)
|
|
|
|
class CSVImportForm(forms.Form):
|
|
csv_file = forms.FileField()
|
|
|
|
class BulkEmailForm(forms.Form):
|
|
prospects = forms.ModelMultipleChoiceField(
|
|
queryset=Prospect.objects.all(),
|
|
widget=forms.CheckboxSelectMultiple
|
|
)
|
|
subject = forms.CharField(max_length=200)
|
|
content = forms.CharField(widget=forms.Textarea)
|
|
|
|
class EventForm(forms.ModelForm):
|
|
prospects = forms.ModelMultipleChoiceField(
|
|
queryset=Prospect.objects.all(),
|
|
widget=forms.SelectMultiple(attrs={'class': 'select2'}),
|
|
required=False
|
|
)
|
|
description = forms.CharField(widget=SmallTextArea)
|
|
attachment_text = forms.CharField(widget=SmallTextArea)
|
|
|
|
class Meta:
|
|
model = Event
|
|
fields = ['date', 'type', 'description', 'attachment_text', 'prospects', 'status']
|
|
widgets = {
|
|
'date': forms.DateTimeInput(attrs={'type': 'datetime-local'}),
|
|
}
|
|
|