22
33import logging
44
5- from django .core .management import call_command
65from django .core .management .base import BaseCommand
76from django .utils import timezone
87from datetime import timedelta
98
109from camps .models import Camp
1110from tickets .models import TicketType
12- from shop .models import Product , SubProductRelation
11+ from shop .models import Product
12+ from shop .models import SubProductRelation
1313
1414logger = logging .getLogger (f"bornhack.{ __name__ } " )
1515
@@ -56,16 +56,16 @@ def handle(self, *args, **options) -> None:
5656 print (f"Created new TicketType { newtt } " )
5757 for product in tt .product_set .filter (sub_products__isnull = True ):
5858 newprod , created = Product .objects .get_or_create (
59- name = product .name .replace (str (fromcamp .camp . lower . year ), str (tocamp . camp . lower .year )),
59+ name = product .name .replace (str (fromcamp .year ), str (tocamp .year )),
6060 ticket_type = newtt ,
61- slug = product .slug .replace (str (fromcamp .camp . lower . year ), str (tocamp . camp . lower .year )),
61+ slug = product .slug .replace (str (fromcamp .year ), str (tocamp .year )),
6262 defaults = {
6363 "price" : product .price ,
6464 "category" : product .category ,
65- "description" : product .description .replace (str (fromcamp .camp . lower . year ), str (tocamp . camp . lower .year )),
65+ "description" : product .description .replace (str (fromcamp .year ), str (tocamp .year )),
6666 "available_in" : (timezone .now (), tocamp .camp .upper + timedelta (days = 30 )),
6767 "cost" : product .cost ,
68- "comment" : product .comment .replace (str (fromcamp .camp . lower . year ), str (tocamp . camp . lower .year )),
68+ "comment" : product .comment .replace (str (fromcamp .year ), str (tocamp .year )),
6969 }
7070 )
7171 if created :
@@ -77,15 +77,15 @@ def handle(self, *args, **options) -> None:
7777 print (product )
7878 # create bundle product
7979 newprod , created = Product .objects .get_or_create (
80- name = product .name .replace (str (fromcamp .camp . lower . year ), str (tocamp . camp . lower .year )),
81- slug = product .slug .replace (str (fromcamp .camp . lower . year ), str (tocamp . camp . lower .year )),
80+ name = product .name .replace (str (fromcamp .year ), str (tocamp .year )),
81+ slug = product .slug .replace (str (fromcamp .year ), str (tocamp .year )),
8282 defaults = {
8383 "price" : product .price ,
8484 "category" : product .category ,
85- "description" : product .description .replace (str (fromcamp .camp . lower . year ), str (tocamp . camp . lower .year )),
85+ "description" : product .description .replace (str (fromcamp .year ), str (tocamp .year )),
8686 "available_in" : (timezone .now (), tocamp .camp .upper + timedelta (days = 30 )),
8787 "cost" : product .cost ,
88- "comment" : product .comment .replace (str (fromcamp .camp . lower . year ), str (tocamp . camp . lower .year )),
88+ "comment" : product .comment .replace (str (fromcamp .year ), str (tocamp .year )),
8989 }
9090 )
9191 for spr in product .sub_product_relations .all ():
0 commit comments