mirror of
https://github.com/wger-project/wger.git
synced 2026-02-18 00:17:51 +01:00
@@ -40,6 +40,7 @@ Improvements:
|
||||
* BMI calculator now works with pounds as well (thanks `@petervanderdoes`_) `#318`_
|
||||
* Give feedback when autocompleter didn't find any results `#293`_
|
||||
* Better GUI consistency in modal dialogs (thanks `@jstoebel`_ ) `#274`_
|
||||
* Fields in workout log form are no longer required, making it possible to only log weight for certain exercises `#334`_
|
||||
* The dashboard page was improved and made more user friendly `#201`_ (partly)
|
||||
* Replace jquery UI's autocompleter and sortable this reduces size of JS and CSS `#78`_ and `#79`_
|
||||
* Update to D3js v4 `#314`_, `#302`_
|
||||
@@ -83,6 +84,7 @@ Other improvements and bugfixes: `#25`_, `#243`_, `#279`_, `#275`_, `#270`_,
|
||||
.. _#325: https://github.com/wger-project/wger/issues/325
|
||||
.. _#330: https://github.com/wger-project/wger/issues/330
|
||||
.. _#331: https://github.com/wger-project/wger/issues/331
|
||||
.. _#334: https://github.com/wger-project/wger/issues/334
|
||||
.. _@petervanderdoes: https://github.com/petervanderdoes
|
||||
.. _@DeveloperMal: https://github.com/DeveloperMal
|
||||
.. _@alelevinas: https://github.com/alelevinas
|
||||
|
||||
@@ -26,6 +26,8 @@ from django.forms import (
|
||||
MultipleHiddenInput,
|
||||
ModelForm,
|
||||
DateField,
|
||||
IntegerField,
|
||||
DecimalField,
|
||||
CharField,
|
||||
widgets,
|
||||
ModelChoiceField
|
||||
@@ -138,7 +140,7 @@ class WorkoutLogForm(ModelForm):
|
||||
'''
|
||||
Helper form for a WorkoutLog.
|
||||
|
||||
The repetition and weight units are defined here only to make them optional
|
||||
These fields are re-defined here only to make them optional
|
||||
'''
|
||||
repetition_unit = ModelChoiceField(queryset=RepetitionUnit.objects.all(),
|
||||
label=_('Unit'),
|
||||
@@ -146,6 +148,14 @@ class WorkoutLogForm(ModelForm):
|
||||
weight_unit = ModelChoiceField(queryset=WeightUnit.objects.all(),
|
||||
label=_('Unit'),
|
||||
required=False)
|
||||
exercise = ModelChoiceField(queryset=Exercise.objects.all(),
|
||||
label=_('Exercise'),
|
||||
required=False)
|
||||
reps = IntegerField(label=_('Repetitions'),
|
||||
required=False)
|
||||
weight = DecimalField(label=_('Weight'),
|
||||
initial=0,
|
||||
required=False)
|
||||
|
||||
class Meta:
|
||||
model = WorkoutLog
|
||||
|
||||
@@ -173,10 +173,11 @@ def add(request, pk):
|
||||
instance.instance = session
|
||||
instance.save()
|
||||
|
||||
# Log entries
|
||||
instances = formset.save(commit=False)
|
||||
# Log entries (only the ones with actual content)
|
||||
instances = [i for i in formset.save(commit=False) if i.reps]
|
||||
for instance in instances:
|
||||
|
||||
if not instance.weight:
|
||||
instance.weight = 0
|
||||
instance.user = request.user
|
||||
instance.workout = day.training
|
||||
instance.date = log_date
|
||||
|
||||
Reference in New Issue
Block a user