kumify/mood/forms.py
2020-12-27 18:49:54 +01:00

17 lines
No EOL
520 B
Python

from django.forms import ModelForm, ModelMultipleChoiceField
from multiupload.fields import MultiFileField
from .models import Status, Activity
class StatusForm(ModelForm):
uploads = MultiFileField(required=False)
activities = ModelMultipleChoiceField(queryset=Activity.objects.all())
class Meta:
model = Status
fields = ["timestamp", "mood", "title", "text"]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["mood"].required = False