Code Duplication    Length = 9-9 lines in 2 locations

customerportal/views.py 2 locations

@@ 232-240 (lines=9) @@
229
                company=self.company.pk)\
230
                .filter(ratecard__enabled=True)\
231
                .order_by('priority')
232
            ratecard = self.rc[0].id
233
            # import pdb; pdb.set_trace()
234
        destination = self.request.GET.get("destination")
235
        prefix = self.request.GET.get("prefix")
236
237
        if ratecard:  # and ratecard.isnumeric():
238
            qs = qs.filter(ratecard__pk=ratecard)
239
            if destination:
240
                qs = qs.filter(destination__contains=destination)
241
            if prefix:
242
                qs = qs.filter(prefix__startswith=prefix)
243
            # import pdb; pdb.set_trace()
@@ 159-167 (lines=9) @@
156
    template_name = 'customer/report.html'
157
158
    def get_context_data(self, **kwargs):
159
        context = super(ListExportCustView, self).get_context_data(**kwargs)
160
        context['day_1'] = datetime.date.today() - datetime.timedelta(days=1)
161
        context['day_2'] = datetime.date.today() - datetime.timedelta(days=2)
162
        context['day_3'] = datetime.date.today() - datetime.timedelta(days=3)
163
        context['day_4'] = datetime.date.today() - datetime.timedelta(days=4)
164
        context['day_5'] = datetime.date.today() - datetime.timedelta(days=5)
165
        context['day_6'] = datetime.date.today() - datetime.timedelta(days=6)
166
        context['day_7'] = datetime.date.today() - datetime.timedelta(days=7)
167
        dm = datetime.date.today()
168
        context['month_1'] = datetime.date(dm.year, dm.month, 1) - relativedelta(months=1)
169
        context['month_2'] = datetime.date(dm.year, dm.month, 1) - relativedelta(months=2)
170
        context['month_3'] = datetime.date(dm.year, dm.month, 1) - relativedelta(months=3)