def handle(self, *args, **options):
     l = Street.objects.order_by('schaalundmueller_district_id').distinct('schaalundmueller_district_id').values_list('schaalundmueller_district_id', flat=True)
     for num in l:
         if num:
             d = call_schaal_und_mueller_district(num)
             area, created = Area.objects.get_or_create(description=d['area'],
                                                        bag_type="gelb",
                                                        collector="Schaal+Mueller",
                                                        district_id=num)
             for _ in d['dates']:
                 dt = datetime.datetime.strptime(_, "%d.%m.%Y").date()
                 pickupdate, created = PickUpDate.objects.get_or_create(date=dt,
                                                                        area=area)
                 print(pickupdate)
Ejemplo n.º 2
0
 def handle(self, *args, **options):
     l = Street.objects.order_by('schaalundmueller_district_id').distinct(
         'schaalundmueller_district_id').values_list(
             'schaalundmueller_district_id', flat=True)
     for num in l:
         if num:
             d = call_schaal_und_mueller_district(num)
             area, created = Area.objects.get_or_create(
                 description=d['area'],
                 bag_type="gelb",
                 collector="Schaal+Mueller",
                 district_id=num)
             for _ in d['dates']:
                 dt = datetime.datetime.strptime(_, "%d.%m.%Y").date()
                 pickupdate, created = PickUpDate.objects.get_or_create(
                     date=dt, area=area)
                 print(pickupdate)
 def test_district_6(self, schaalundmueller_district_6):
     d = call_schaal_und_mueller_district(6, schaalundmueller_district_6)
     assert d['area'] == "Hafen, Unter- und Obertürkheim, Wangen"
     assert '12.12.2016' in d['dates']
 def test_district_6_live(self):
     d = call_schaal_und_mueller_district(6)
     assert d['area'] == "Hafen, Unter- und Obertürkheim, Wangen"
     assert '.201' in d['dates'][0]
 def test_district_6(self, schaalundmueller_district_6):
     d = call_schaal_und_mueller_district(6, schaalundmueller_district_6)
     assert d['area'] == "Hafen, Unter- und Obertürkheim, Wangen"
     assert '12.12.2016' in d['dates']
 def test_district_6_live(self):
     d = call_schaal_und_mueller_district(6)
     assert d['area'] == "Hafen, Unter- und Obertürkheim, Wangen"
     assert '.201' in d['dates'][0]