mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-12-15 15:37:11 +01:00
Add interface to create and see note sheets
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
41
apps/sheets/forms.py
Normal file
41
apps/sheets/forms.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright (C) 2018-2022 by BDE ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from django import forms
|
||||
|
||||
from member.models import Club
|
||||
from note_kfet.inputs import AmountInput, Autocomplete, DateTimePickerInput
|
||||
|
||||
from .models import Food, Meal, Sheet
|
||||
|
||||
|
||||
class SheetForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Sheet
|
||||
fields = '__all__'
|
||||
widgets = {
|
||||
'date': DateTimePickerInput(),
|
||||
}
|
||||
|
||||
|
||||
class FoodForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Food
|
||||
exclude = ('sheet', )
|
||||
widgets = {
|
||||
'price': AmountInput(),
|
||||
'club': Autocomplete(
|
||||
model=Club,
|
||||
attrs={"api_url": "/api/members/club/"},
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
class MealForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Meal
|
||||
exclude = ('sheet', )
|
||||
widgets = {
|
||||
'content': forms.CheckboxSelectMultiple(),
|
||||
'price': AmountInput(),
|
||||
}
|
||||
Reference in New Issue
Block a user