ExercisesForm.__init__()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 3
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 3
loc 3
rs 10
cc 1
1
# coding: utf-8
2
from dj_diabetes.models.sports import Exercises
3
4
from django import forms
5
6
7 View Code Duplication
class ExercisesForm(forms.ModelForm):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8
    """
9
        Exercises Form
10
    """
11
    comment = forms.CharField(widget=forms.Textarea(
12
        {'class': 'form-control', 'rows': '3'}))
13
    duration = forms.IntegerField(widget=forms.TextInput(
14
        {'class': 'form-control', 'type': 'number'}))
15
    date_exercises = forms.DateField(widget=forms.TextInput(
16
        attrs={'class': 'form-control'}))
17
    hour_exercises = forms.TimeField(widget=forms.TextInput(
18
        attrs={'class': 'form-control'}))
19
20
    class Meta:
21
        model = Exercises
22
        fields = ['sports', 'comment', 'duration',
23
                  'date_exercises', 'hour_exercises']
24
25
    def __init__(self, *args, **kwargs):
26
        super(ExercisesForm, self).__init__(*args, **kwargs)
27
        self.fields['sports'].widget.attrs['class'] = 'form-control'
28