def load_monthly(self, filename):
        with open(filename, 'rU') as csvfile:
            csvreader = csv.reader(csvfile, delimiter=',', quotechar='"')

            # Delete all items in tables
            Monthly.objects.all().delete()

            # Remove the first line which is the header line
            csvreader.next()

            for row in csvreader:

                insurer, min_ltv, max_ltv, min_fico, max_fico, loan_term, pmt_type, min_loan_amt, max_loan_amt, premium = row

                m = Monthly()
                
                m.insurer = insurer.strip().upper()
                m.min_ltv = Decimal(min_ltv)
                m.max_ltv = Decimal(max_ltv)
                m.min_fico = int(min_fico)
                m.max_fico = int(max_fico)
                m.loan_term = int(loan_term)
                m.pmt_type = pmt_type.strip().upper()
                m.min_loan_amt = Decimal(min_loan_amt)
                m.max_loan_amt = Decimal(max_loan_amt)
                m.premium = Decimal(premium)

                m.save()

            self.stdout.write('\nSuccessfully loaded data from %s\n\n' % filename)
    def load_monthly(self, filename):
        with open(filename, 'rU') as csvfile:
            csvreader = csv.reader(csvfile, delimiter=',', quotechar='"')

            # Delete all items in tables
            Monthly.objects.all().delete()

            # Remove the first line which is the header line
            csvreader.next()

            for row in csvreader:

                insurer, min_ltv, max_ltv, min_fico, max_fico, loan_term, pmt_type, min_loan_amt, max_loan_amt, premium = row

                m = Monthly()

                m.insurer = insurer.strip().upper()
                m.min_ltv = Decimal(min_ltv)
                m.max_ltv = Decimal(max_ltv)
                m.min_fico = int(min_fico)
                m.max_fico = int(max_fico)
                m.loan_term = int(loan_term)
                m.pmt_type = pmt_type.strip().upper()
                m.min_loan_amt = Decimal(min_loan_amt)
                m.max_loan_amt = Decimal(max_loan_amt)
                m.premium = Decimal(premium)

                m.save()

            self.stdout.write('\nSuccessfully loaded data from %s\n\n' %
                              filename)