Reduce number of lines in notes field
This commit is contained in:
parent
5fc79b9486
commit
65d604de15
2 changed files with 23 additions and 9 deletions
21
gym/forms.py
Normal file
21
gym/forms.py
Normal 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
|
11
gym/views.py
11
gym/views.py
|
@ -7,6 +7,7 @@ from django.shortcuts import get_object_or_404
|
|||
from django.urls import reverse
|
||||
from django.views import generic
|
||||
|
||||
from gym.forms import RoundForm
|
||||
from gym.mixins import SessionResetMixin, QuickActionsMixin
|
||||
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):
|
||||
model = Round
|
||||
fields = [
|
||||
"equipment",
|
||||
"session",
|
||||
"theoretical_max_percentage",
|
||||
"chosen_weight",
|
||||
"repetition_number",
|
||||
"work_form",
|
||||
"notes",
|
||||
]
|
||||
template_name = "gym/round_edit.html"
|
||||
equipment = None
|
||||
session = None
|
||||
form_class = RoundForm
|
||||
|
||||
def get_quick_actions(self):
|
||||
return [
|
||||
|
|
Loading…
Reference in a new issue