Code Duplication    Length = 25-27 lines in 2 locations

pyfreebilling/pyfreebill/models.py 2 locations

@@ 482-508 (lines=27) @@
479
    """ CallerID List """
480
    name = models.CharField(_(u'name'),
481
                            max_length=128,
482
                            unique=True)
483
    description = models.TextField(_(u'description'),
484
                                   blank=True)
485
    date_added = models.DateTimeField(_(u'date added'),
486
                                      auto_now_add=True)
487
    date_modified = models.DateTimeField(_(u'date modified'),
488
                                         auto_now=True)
489
490
    class Meta:
491
        db_table = 'callerid_prefix_list'
492
        app_label = 'pyfreebill'
493
        ordering = ('name',)
494
        verbose_name = _(u'CallerID prefix list')
495
        verbose_name_plural = _(u'CallerID prefix lists')
496
497
    def __unicode__(self):
498
        return u"%s" % self.name
499
500
    def prefix(self):
501
        html = '<span><a href="/extranet/pyfreebill/calleridprefix/?calleridprefixlist__id__exact={0}" class="btn btn-inverse btn-mini">Prefix <i class="icon-plus-sign"></i></a></span>'
502
        return format_html(html, (self.id))
503
    prefix.allow_tags = True
504
    prefix.short_description = _(u'prefix')
505
506
507
class CalleridPrefix(models.Model):
508
    """ Customer Rates Model """
509
    calleridprefixlist = models.ForeignKey(
510
        CalleridPrefixList,
511
        verbose_name=_(u"callerid prefix list"))
@@ 704-728 (lines=25) @@
701
    provider_tariff = models.ForeignKey(ProviderTariff,
702
                                        verbose_name=_(u"Provider tariff"))
703
    date_added = models.DateTimeField(_(u'date added'),
704
                                      auto_now_add=True)
705
    date_modified = models.DateTimeField(_(u'date modified'),
706
                                         auto_now=True)
707
708
    class Meta:
709
        db_table = 'lcr_providers'
710
        app_label = 'pyfreebill'
711
        verbose_name = _(u'LCR provider')
712
        verbose_name_plural = _(u'LCR providers')
713
714
    def __unicode__(self):
715
        return u"%s - %s " % (self.lcr, self.provider_tariff)
716
717
    def rates(self):
718
        html = '<span><a href="/extranet/pyfreebill/providerrates/?provider_tariff__id__exact={0}" class="btn btn-inverse btn-mini">Rates <i class="icon-plus-sign"></i></a></span>'
719
        return format_html(html, (self.provider_tariff))
720
    rates.allow_tags = True
721
    rates.short_description = _(u'rates')
722
723
724
# Ratecard
725
def default_time():
726
    return timezone.now() + timezone.timedelta(days=3650)
727
728
class RateCard(models.Model):
729
    """ RateCard Model """
730
    name = models.CharField(_(u'name'),
731
                            max_length=128,