Reduce number of lines in notes field

This commit is contained in:
Gabriel Augendre 2019-06-23 15:54:59 +02:00
parent 5fc79b9486
commit 65d604de15
2 changed files with 23 additions and 9 deletions

21
gym/forms.py Normal file
View file

@ -0,0 +1,21 @@
from django.forms import ModelForm
from gym.models import Round
class RoundForm(ModelForm):
class Meta:
model = Round
fields = [
"equipment",
"session",
"theoretical_max_percentage",
"chosen_weight",
"repetition_number",
"work_form",
"notes",
]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["notes"].widget.attrs["rows"] = 3

View file

@ -7,6 +7,7 @@ from django.shortcuts import get_object_or_404
from django.urls import reverse from django.urls import reverse
from django.views import generic from django.views import generic
from gym.forms import RoundForm
from gym.mixins import SessionResetMixin, QuickActionsMixin from gym.mixins import SessionResetMixin, QuickActionsMixin
from gym.models import Room, Equipment, Setting, Session, Round, TheoreticalMax from gym.models import Room, Equipment, Setting, Session, Round, TheoreticalMax
@ -454,18 +455,10 @@ class SessionDetailView(LoginRequiredMixin, QuickActionsMixin, generic.DetailVie
class RoundCreateView(LoginRequiredMixin, QuickActionsMixin, generic.CreateView): class RoundCreateView(LoginRequiredMixin, QuickActionsMixin, generic.CreateView):
model = Round model = Round
fields = [
"equipment",
"session",
"theoretical_max_percentage",
"chosen_weight",
"repetition_number",
"work_form",
"notes",
]
template_name = "gym/round_edit.html" template_name = "gym/round_edit.html"
equipment = None equipment = None
session = None session = None
form_class = RoundForm
def get_quick_actions(self): def get_quick_actions(self):
return [ return [