kumify/mood/forms.py

17 lines
536 B
Python
Raw Normal View History

2020-12-27 17:49:54 +00:00
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(), required=False)
2020-12-27 17:49:54 +00:00
class Meta:
model = Status
fields = ["timestamp", "mood", "title", "text"]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["mood"].required = False