class DailyCaloriesForm(forms.ModelForm): """ Form for the total daily calories needed """ base_calories = forms.IntegerField(label=_('Basic caloric intake'), help_text=_('Your basic caloric intake as calculated for ' 'your data'), required=False, widget=Html5NumberInput()) additional_calories = forms.IntegerField(label=_('Additional calories'), help_text=_('Additional calories to add to the base ' 'rate (to substract, enter a negative ' 'number)'), initial=0, required=False, widget=Html5NumberInput()) class Meta: model = UserProfile fields = ('calories',) def __init__(self, *args, **kwargs): super(DailyCaloriesForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_tag = False
class BmiForm(forms.ModelForm): height = forms.DecimalField(widget=Html5NumberInput(), max_value=999, label=_('Height (cm)')) weight = forms.DecimalField(widget=Html5NumberInput(), max_value=999) class Meta: model = UserProfile fields = ('height', ) def __init__(self, *args, **kwargs): super(BmiForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_action = reverse('nutrition:bmi:calculate') self.helper.form_class = 'wger-form' self.helper.form_id = 'bmi-form' self.helper.layout = Layout( Row( Column('height', css_class='form-group col-6 mb-0'), Column('weight', css_class='form-group col-6 mb-0'), css_class='form-row' ), ButtonHolder(Submit('submit', _("Calculate"), css_class='btn-success')) )
class BmiForm(forms.ModelForm): height = forms.DecimalField( widget=Html5NumberInput(), max_value=999, label=_('Height (cm)')) weight = forms.DecimalField(widget=Html5NumberInput(), max_value=999) class Meta: model = UserProfile fields = ('height', )
class BmrForm(forms.ModelForm): ''' Form for the basal metabolic rate ''' weight = forms.DecimalField(widget=Html5NumberInput()) class Meta: model = UserProfile fields = ('age', 'height', 'gender')
class MealCreateForm(forms.Form): ingredient = forms.CharField() time = forms.TimeField(widget=Html5TimeInput(), label=' Time ') weight_unit = ChoiceFieldCustom( choices=IngredientWeightUnit.objects.none(), required=False) amount = forms.DecimalField(decimal_places=2, max_digits=6, label='Amount', widget=Html5NumberInput())
class DailyCaloriesForm(forms.ModelForm): ''' Form for the total daily calories needed ''' base_calories = forms.IntegerField(label=_('Basic caloric intake'), help_text=_('Your basic caloric intake as calculated for ' 'your data'), required=False, widget=Html5NumberInput()) additional_calories = forms.IntegerField(label=_('Additional calories'), help_text=_('Additional calories to add to the base ' 'rate (to substract, enter a negative ' 'number)'), initial=0, required=False, widget=Html5NumberInput()) class Meta: model = UserProfile fields = ('calories',)
class WorkoutLogForm(ModelForm): ''' Helper form for a WorkoutLog. The field for the weight is overwritten here, activating localization (so a German user can use ',' as the separator) ''' weight = DecimalField(decimal_places=2, max_digits=5, localize=True, widget=Html5NumberInput()) class Meta: model = WorkoutLog exclude = ('exercise', )
class BmrForm(forms.ModelForm): """ Form for the basal metabolic rate """ weight = forms.DecimalField(widget=Html5NumberInput()) class Meta: model = UserProfile fields = ('age', 'height', 'gender') def __init__(self, *args, **kwargs): super(BmrForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout("age", "height", "gender", "weight") self.helper.form_tag = False
class BmiForm(forms.ModelForm): weight = forms.DecimalField(widget=Html5NumberInput()) class Meta: model = UserProfile fields = ('height', )