Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

Commit 3ad73b5

Browse files
authored
Fix bulk coupon script (#1394)
1 parent 7d2e20d commit 3ad73b5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

p3/management/commands/create_bulk_coupons.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def handle(self, *args, **options):
7171
reader = csv.DictReader(csv_file)
7272
for row in reader:
7373
code = row['code'].strip()
74-
if not code:
74+
if not code or code == '0':
7575
# Skip lines without code
7676
continue
7777
if code in all_codes:
@@ -86,7 +86,7 @@ def handle(self, *args, **options):
8686
c.description = row.get('description', '')
8787
if not self.dry_run:
8888
c.save()
89-
c.fares = all_fares.filter(
89+
c.fares.set(all_fares.filter(
9090
code__in = [x.strip()
91-
for x in row['fares'].split(',')])
92-
print ('Coupond %r created' % c.code)
91+
for x in row['fares'].split(',')]))
92+
print ('Coupon %r created' % c.code)

0 commit comments

Comments
 (0)