Code Duplication    Length = 16-18 lines in 2 locations

omaha_server/sparkle/forms.py 1 location

@@ 35-52 (lines=18) @@
32
__all__ = ['SparkleVersionAdminForm']
33
34
35
class SparkleVersionAdminForm(forms.ModelForm):
36
    class Meta:
37
        model = SparkleVersion
38
        exclude = []
39
        widgets = {
40
            'app': LinkedSelect,
41
            'release_notes': RedactorWidget(editor_options={'lang': 'en',
42
                                                            'minHeight': 150}),
43
            'file_size': widgets.TextInput(attrs=dict(disabled='disabled')),
44
        }
45
46
    def clean_file_size(self):
47
        if 'file' not in self.cleaned_data:
48
            raise ValidationError('')
49
        _file = self.cleaned_data["file"]
50
        if isinstance(_file, UploadedFile):
51
            return _file.size
52
        return self.initial["file_size"]
53

omaha_server/omaha/forms.py 1 location

@@ 55-70 (lines=16) @@
52
        }
53
54
55
class VersionAdminForm(forms.ModelForm):
56
    class Meta:
57
        model = Version
58
        exclude = []
59
        widgets = {
60
            'app': LinkedSelect,
61
            'release_notes': RedactorWidget(editor_options={'lang': 'en',
62
                                                            'minHeight': 150}),
63
            'file_size': widgets.TextInput(attrs=dict(disabled='disabled')),
64
        }
65
66
    def clean_file_size(self):
67
        if 'file' not in self.cleaned_data:
68
            raise ValidationError('')
69
        _file = self.cleaned_data["file"]
70
        return _file.size
71
72
73
class ActionAdminForm(forms.ModelForm):