@@ -18,7 +18,7 @@ def add_arguments(self, parser):
1818 "--listing-id" ,
1919 type = int ,
2020 default = None ,
21- help = "Add offers to an existing listing by ID instead of creating a new one " ,
21+ help = "Add offers to an existing listing by ID" ,
2222 )
2323
2424 def handle (self , * args , ** options ):
@@ -48,16 +48,24 @@ def handle(self, *args, **options):
4848 bob .set_password ("testpassword123" )
4949 bob .save ()
5050
51- self .stdout .write (self .style .SUCCESS ("Buyers ready: Alice Johnson, Bob Williams" ))
51+ self .stdout .write (
52+ self .style .SUCCESS ("Buyers ready: Alice Johnson, Bob Williams" )
53+ )
5254
5355 listing_id = options ["listing_id" ]
5456 if listing_id :
5557 try :
5658 listing = Listing .objects .get (pk = listing_id )
5759 except Listing .DoesNotExist :
58- self .stdout .write (self .style .ERROR (f"Listing with id={ listing_id } not found" ))
60+ self .stdout .write (
61+ self .style .ERROR (f"Listing with id={ listing_id } not found" )
62+ )
5963 return
60- self .stdout .write (self .style .SUCCESS (f"Using existing listing: { listing .title } (id={ listing .id } )" ))
64+ self .stdout .write (
65+ self .style .SUCCESS (
66+ f"Using existing listing: { listing .title } (id={ listing .id } )"
67+ )
68+ )
6169 else :
6270 seller , _ = User .objects .get_or_create (
6371 username = "lautaro" ,
@@ -69,7 +77,9 @@ def handle(self, *args, **options):
6977 )
7078 seller .set_password ("testpassword123" )
7179 seller .save ()
72- self .stdout .write (self .style .SUCCESS (f"Seller ready: { seller .get_full_name ()} " ))
80+ self .stdout .write (
81+ self .style .SUCCESS (f"Seller ready: { seller .get_full_name ()} " )
82+ )
7383
7484 category , _ = Category .objects .get_or_create (name = "Furniture" )
7585 listing = Item .objects .create (
@@ -105,5 +115,11 @@ def handle(self, *args, **options):
105115 new_count = sum ([created_alice , created_bob ])
106116 skipped = 2 - new_count
107117
108- self .stdout .write (self .style .SUCCESS (f"Created { new_count } offers, skipped { skipped } (already existed)" ))
109- self .stdout .write (self .style .SUCCESS (f"\n Done! Offers added to listing id={ listing .id } " ))
118+ self .stdout .write (
119+ self .style .SUCCESS (
120+ f"Created { new_count } offers, skipped { skipped } (already existed)"
121+ )
122+ )
123+ self .stdout .write (
124+ self .style .SUCCESS (f"\n Done! Offers added to listing id={ listing .id } " )
125+ )
0 commit comments