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)
|
2021-01-04 06:38:28 +00:00
|
|
|
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
|