kumify/dreams/forms.py

17 lines
550 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)
2021-01-04 06:38:42 +00:00
themes = ModelMultipleChoiceField(queryset=Theme.objects.all(), required=False)
2021-01-01 16:49:39 +00:00
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