示例#1
0
    def handle(self, *args, **options):
        if options['force_update']:
            self.force_update = True

        medlem_csv = self.get_filename(args, 0, 'MEDLEM_CSV', 'nmu-medl.csv')
        lag_csv = self.get_filename(args, 1, 'LAG_CSV', 'nmu-lag.csv')
        bet_csv = self.get_filename(args, 2, 'GIRO_CSV', 'nmu-bet.csv')

        if options['importer'] == 'nmu_access':
            imp = nmu.AccessImporter(medlem_csv, lag_csv, bet_csv)
        elif options['importer'] == 'nmu_mamut':
            imp = nmu.MamutImporter(medlem_csv, lag_csv, bet_csv)
        else:
            raise CommandError("Importeren finst ikkje ({0})".format(options['importer']).encode('utf8'))

        for i in imp.import_lag().values():
            self.stdout.write(u"Lag: {0}\n".format(i))

        for i in imp.import_medlem():
            self.stdout.write(u"Medlem: {0}\n".format(i))

        for i in imp.import_bet(force_update=self.force_update):
            self.stdout.write(u"Betaling: {0}\n".format(i))

        update_denormalized_fields()
        update_lokallagstat()
        send_overvakingar()