Total Lines | 23 |
Duplicated Lines | 100 % |
Changes | 4 | ||
Bugs | 0 | Features | 1 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | # coding: utf-8 |
||
18 | View Code Duplication | class Examinations(models.Model): |
|
|
|||
19 | |||
20 | """ |
||
21 | Examinations |
||
22 | """ |
||
23 | user = models.ForeignKey(User, on_delete=models.CASCADE) |
||
24 | examination_types = models.ForeignKey(ExaminationTypes, |
||
25 | on_delete=models.CASCADE) |
||
26 | comments = models.TextField() |
||
27 | date_examinations = models.DateField() |
||
28 | hour_examinations = models.TimeField(null=True) |
||
29 | created = models.DateTimeField(auto_now_add=True) |
||
30 | modified = models.DateTimeField(auto_now=True) |
||
31 | |||
32 | class Meta: |
||
33 | verbose_name = 'Examinations' |
||
34 | verbose_name_plural = 'Examinations' |
||
35 | |||
36 | def __str__(self): |
||
37 | return "%s (date %s) (comment: %s)" % ( |
||
38 | self.examination_types, |
||
39 | self.date_examinations, |
||
40 | self.comments) |
||
41 | |||
60 |