Total Lines | 28 |
Duplicated Lines | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
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 | # Copyright 2018 Mathias WOLFF |
||
27 | View Code Duplication | class Acc(models.Model): |
|
|
|||
28 | |||
29 | # Fields |
||
30 | method = CharField(max_length=16, default='', help_text=_(u"A method is the primary function that a request is meant to invoke on a server.")) |
||
31 | from_tag = CharField(max_length=64, default='', help_text=_(u"The tag parameter serves as a general mechanism to identify a dialog, which is the combination of the Call-ID along with two tags, one from participant in the dialog.")) |
||
32 | to_tag = CharField(max_length=64, default='', help_text=_(u"The tag parameter serves as a general mechanism to identify a dialog, which is the combination of the Call-ID along with two tags, one from participant in the dialog.")) |
||
33 | callid = CharField(max_length=255, default='', db_index=True, help_text=_(u"Call-ID header field uniquely identifies a particular invitation or all registrations of a particular client.")) |
||
34 | sip_code = CharField(max_length=3, default='', help_text=_(u"SIP reply code.")) |
||
35 | sip_reason = CharField(max_length=128, default='', help_text=_(u"SIP reply reason")) |
||
36 | time = DateTimeField(help_text=_(u"Date and time when this record was written.")) |
||
37 | time_attr = models.IntegerField(help_text=_(u"Unix timestamp")) |
||
38 | time_exten = models.IntegerField(help_text=_(u"extended value related to the time of event")) |
||
39 | |||
40 | |||
41 | class Meta: |
||
42 | db_table = 'acc' |
||
43 | app_label = 'accounting' |
||
44 | ordering = ('-pk',) |
||
45 | |||
46 | def __unicode__(self): |
||
47 | return u'%s' % self.pk |
||
48 | |||
49 | def get_absolute_url(self): |
||
50 | return reverse('accounting_acc_detail', args=(self.pk,)) |
||
51 | |||
52 | |||
53 | def get_update_url(self): |
||
54 | return reverse('accounting_acc_update', args=(self.pk,)) |
||
55 | |||
107 |