Code Duplication    Length = 30-35 lines in 4 locations

pyfreebilling/did/models/ratesDid.py 1 location

@@ 22-56 (lines=35) @@
19
from django.utils.translation import ugettext_lazy as _
20
21
22
class ProviderRatesDid(models.Model):
23
    """ Provider Rates Model for Did"""
24
    name = models.CharField(_(u'name'), max_length=128)
25
    rate = models.DecimalField(_(u'Rate'),
26
                               max_digits=11,
27
                               decimal_places=5)
28
    block_min_duration = models.IntegerField(_(u'block min duration'),
29
                                             default=1)
30
    interval_duration = models.IntegerField(_(u'Interval duration'),
31
                                            default=1)
32
    provider = models.ForeignKey(
33
        'pyfreebill.Company',
34
        on_delete=models.CASCADE,
35
        verbose_name=_(u"provider"),
36
        limit_choices_to={'supplier_enabled': True})
37
    enabled = models.BooleanField(_(u"Enabled / Disabled"),
38
                                  default=True)
39
    date_added = models.DateTimeField(_(u'date added'),
40
                                      auto_now_add=True)
41
    date_modified = models.DateTimeField(_(u'date modified'),
42
                                         auto_now=True)
43
44
    class Meta:
45
        db_table = 'provider_rates_did'
46
        app_label = 'did'
47
        ordering = ('provider', 'name')
48
        unique_together = ("name", "provider")
49
        verbose_name = _(u'DID provider rate')
50
        verbose_name_plural = _(u'DID provider rates')
51
52
    def __unicode__(self):
53
        return u"n: %s -r: %s : %s/%s - " % (self.name,
54
                                             self.rate,
55
                                             self.block_min_duration,
56
                                             self.interval_duration)
57
58
59
class CustomerRatesDid(models.Model):

pyfreebilling/pyfreebill/models.py 3 locations

@@ 951-983 (lines=33) @@
948
                                  blank=True,
949
                                  default='',
950
                                  max_length=15)
951
    date_added = models.DateTimeField(_(u'date added'),
952
                                      auto_now_add=True)
953
    date_modified = models.DateTimeField(_(u'date modified'),
954
                                         auto_now=True)
955
956
    class Meta:
957
        db_table = 'customer_norm_rules'
958
        app_label = 'pyfreebill'
959
        ordering = ('company', 'prefix')
960
        verbose_name = _(u'Customer Normalization Rule')
961
        verbose_name_plural = _(u'Customer Normalization Rules')
962
963
    def __unicode__(self):
964
        return u"%s -> %s -%s +%s" % (self.company,
965
                                      self.prefix,
966
                                      self.remove_prefix,
967
                                      self.add_prefix)
968
969
970
class CarrierNormalizationRules(models.Model):
971
    """ Carrier Normalization Rules """
972
    company = models.ForeignKey(Company,
973
                                verbose_name=_(u"provider"))
974
    prefix = models.CharField(_(u'prefix'),
975
                              max_length=30)
976
    description = models.TextField(_(u'description'),
977
                                   blank=True)
978
    remove_prefix = models.CharField(_(u"remove prefix"),
979
                                     blank=True,
980
                                     default='',
981
                                     max_length=15)
982
    add_prefix = models.CharField(_(u"add prefix"),
983
                                  blank=True,
984
                                  default='',
985
                                  max_length=15)
986
    date_added = models.DateTimeField(_(u'date added'),
@@ 1021-1052 (lines=32) @@
1018
                                  blank=True,
1019
                                  default='',
1020
                                  max_length=15)
1021
    date_added = models.DateTimeField(_(u'date added'),
1022
                                      auto_now_add=True)
1023
    date_modified = models.DateTimeField(_(u'date modified'),
1024
                                         auto_now=True)
1025
1026
    class Meta:
1027
        db_table = 'customer_cid_norm_rules'
1028
        app_label = 'pyfreebill'
1029
        ordering = ('company', )
1030
        verbose_name = _(u'Customer CallerID Normalization Rule')
1031
        verbose_name_plural = _(u'Customer CallerID Normalization Rules')
1032
1033
    def __unicode__(self):
1034
        return u"%s -> -%s +%s" % (self.company,
1035
                                   self.remove_prefix,
1036
                                   self.add_prefix)
1037
1038
1039
class CarrierCIDNormalizationRules(models.Model):
1040
    """ Carrier Caller ID Number Normalization Rules """
1041
    company = models.ForeignKey(Company,
1042
                                verbose_name=_(u"provider"))
1043
    prefix = models.CharField(_(u'prefix'),
1044
                              max_length=30)
1045
    description = models.TextField(_(u'description'),
1046
                                   blank=True)
1047
    remove_prefix = models.CharField(_(u"remove prefix"),
1048
                                     blank=True,
1049
                                     default='',
1050
                                     max_length=15)
1051
    add_prefix = models.CharField(_(u"add prefix"),
1052
                                  blank=True,
1053
                                  default='',
1054
                                  max_length=15)
1055
    date_added = models.DateTimeField(_(u'date added'),
@@ 243-272 (lines=30) @@
240
    """Group model."""
241
    name = models.CharField(_(u'name'),
242
                            max_length=200,
243
                            unique=True)
244
    slug = models.SlugField(_(u'slug'),
245
                            max_length=50,
246
                            unique=True)
247
    about = models.TextField(_(u'about'),
248
                             blank=True)
249
    people = models.ManyToManyField(Person,
250
                                    verbose_name=_(u'people'),
251
                                    blank=True)
252
    companies = models.ManyToManyField(Company,
253
                                       verbose_name=_(u'companies'),
254
                                       blank=True)
255
    date_added = models.DateTimeField(_(u'date added'),
256
                                      auto_now_add=True)
257
    date_modified = models.DateTimeField(_(u'date modified'),
258
                                         auto_now=True)
259
260
    class Meta:
261
        db_table = 'contacts_groups'
262
        app_label = 'pyfreebill'
263
        ordering = ('name',)
264
        verbose_name = _(u'group')
265
        verbose_name_plural = _(u'groups')
266
267
    def __unicode__(self):
268
        return u"%s" % self.name
269
270
271
PHONE_LOCATION_CHOICES = (
272
    ('work', _(u'Work')),
273
    ('mobile', _(u'Mobile')),
274
    ('fax', _(u'Fax')),
275
    ('pager', _(u'Pager')),