kumify/dreams/forms.py

17 lines
534 B
Python
Raw Normal View History

2021-01-01 16:49:39 +00:00
from django.forms import ModelForm, ModelMultipleChoiceField
from multiupload.fields import MultiFileField
from .models import Dream, Theme
class DreamForm(ModelForm):
uploads = MultiFileField(required=False)
themes = ModelMultipleChoiceField(queryset=Theme.objects.all())
class Meta:
model = Dream
fields = ["timestamp", "mood", "title", "content", 'type', 'wet', 'lucid']
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["mood"].required = False