chellow 1690551015.0.0__py3-none-any.whl → 1690962871.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of chellow might be problematic. Click here for more details.

chellow/e/views.py CHANGED
@@ -3950,23 +3950,30 @@ def supplier_batch_edit_get(batch_id):
3950
3950
  return render_template("supplier_batch_edit.html", batch=batch)
3951
3951
 
3952
3952
 
3953
+ @e.route("/supplier_batches/<int:batch_id>/edit", methods=["DELETE"])
3954
+ def supplier_batch_edit_delete(batch_id):
3955
+ try:
3956
+ batch = Batch.get_by_id(g.sess, batch_id)
3957
+ contract_id = batch.contract.id
3958
+ batch.delete(g.sess)
3959
+ g.sess.commit()
3960
+ return hx_redirect(f"/supplier_batches?supplier_contract_id={contract_id}", 303)
3961
+ except BadRequest as e:
3962
+ flash(e.description)
3963
+ return make_response(
3964
+ render_template("supplier_batch_edit.html", batch=batch), 400
3965
+ )
3966
+
3967
+
3953
3968
  @e.route("/supplier_batches/<int:batch_id>/edit", methods=["POST"])
3954
3969
  def supplier_batch_edit_post(batch_id):
3955
3970
  try:
3956
3971
  batch = Batch.get_by_id(g.sess, batch_id)
3957
- if "update" in request.values:
3958
- reference = req_str("reference")
3959
- description = req_str("description")
3960
- batch.update(g.sess, reference, description)
3961
- g.sess.commit()
3962
- return chellow_redirect(f"/supplier_batches/{batch.id}", 303)
3963
- elif "delete" in request.values:
3964
- contract_id = batch.contract.id
3965
- batch.delete(g.sess)
3966
- g.sess.commit()
3967
- return chellow_redirect(
3968
- f"/supplier_batches?supplier_contract_id={contract_id}", 303
3969
- )
3972
+ reference = req_str("reference")
3973
+ description = req_str("description")
3974
+ batch.update(g.sess, reference, description)
3975
+ g.sess.commit()
3976
+ return chellow_redirect(f"/supplier_batches/{batch.id}", 303)
3970
3977
  except BadRequest as e:
3971
3978
  flash(e.description)
3972
3979
  return make_response(
chellow/models.py CHANGED
@@ -29,6 +29,7 @@ from sqlalchemy import (
29
29
  Text,
30
30
  and_,
31
31
  create_engine,
32
+ delete,
32
33
  event,
33
34
  not_,
34
35
  null,
@@ -932,9 +933,7 @@ class Batch(Base, PersistentClass):
932
933
  )
933
934
 
934
935
  def delete(self, sess):
935
- sess.execute(
936
- "delete from bill where batch_id = :batch_id", {"batch_id": self.id}
937
- )
936
+ sess.execute(delete(Bill).where(Bill.batch == self))
938
937
  sess.delete(self)
939
938
 
940
939
  def insert_bill(
@@ -16,31 +16,21 @@
16
16
  {% endblock %}
17
17
 
18
18
  {% block content %}
19
- {% if request.method == 'GET' and request.values.confirm_delete %}
20
- <form method="post" action="">
21
- <fieldset>
22
- <legend>Are you sure you want to delete this batch and all its bills?</legend>
23
- <input type="submit" name="delete" value="Delete">
24
- <a href="/e/supplier_batches/{{batch.id}}/edit">Cancel</a>
25
- </fieldset>
26
- </form>
27
-
28
- {% else %}
29
19
 
30
- <form action="" method="post">
31
- <fieldset>
32
- <legend>Update batch</legend>
33
- <label>Reference</label> {{input_text('reference', batch.reference)}}
34
- <label>Description</label> {{input_text('description', batch.description)}}
35
- <input type="submit" name="update" value="Update">
36
- </fieldset>
37
- </form>
20
+ <form action="/e/supplier_batches/{{batch.id}}/edit" method="post">
21
+ <fieldset>
22
+ <legend>Update batch</legend>
23
+ <label>Reference</label> {{input_text('reference', batch.reference)}}
24
+ <label>Description</label> {{input_text('description', batch.description)}}
25
+ <input type="submit" name="update" value="Update">
26
+ </fieldset>
27
+ </form>
38
28
 
39
- <form action="">
40
- <fieldset>
41
- <legend>Delete this batch</legend>
42
- <input type="submit" name="confirm_delete" value="Delete">
43
- </fieldset>
44
- </form>
45
- {% endif %}
29
+ <form hx-delete="/e/supplier_batches/{{batch.id}}/edit"
30
+ hx-confirm="Are you sure you want to delete this batch and all its bills?">
31
+ <fieldset>
32
+ <legend>Delete this batch</legend>
33
+ <input type="submit" name="confirm_delete" value="Delete">
34
+ </fieldset>
35
+ </form>
46
36
  {% endblock %}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chellow
3
- Version: 1690551015.0.0
3
+ Version: 1690962871.0.0
4
4
  Summary: Web Application for checking UK energy bills.
5
5
  Project-URL: Homepage, https://github.com/WessexWater/chellow
6
6
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
@@ -5,7 +5,7 @@ chellow/commands.py,sha256=ESBe9ZWj1c3vdZgqMZ9gFvYAB3hRag2R1PzOwuw9yFo,1302
5
5
  chellow/dloads.py,sha256=ZeHIu75t71FWJBfew_8sqi03KcMZmDlTWVn7QyyADu4,3942
6
6
  chellow/edi_lib.py,sha256=het3R0DBGtXEo-Sy1zvXQuX9EWQ1X6Y33G4l1hYYuds,51859
7
7
  chellow/general_import.py,sha256=BIv7SLjNVQuDSclWG1-ePCUsethlwm7_NVHI4SlyI8g,58612
8
- chellow/models.py,sha256=3iCwWh2NAHdATUrC_keQ8SBzQUocLTJXwgeFVItBkc4,234629
8
+ chellow/models.py,sha256=T6tFYr_yXf56xgRWRrSk5g7_eM5ix2F_-20xRiVS6qk,234589
9
9
  chellow/national_grid.py,sha256=Y0ckPONIpMnip2qB9ptXBLxs6jJCk14c98eCkyd2fNM,4427
10
10
  chellow/proxy.py,sha256=Mzssi9nTf6s_G4RSn8k5oAHqzVYIxMsfbudj1amYucI,1387
11
11
  chellow/rate_server.py,sha256=xVk15pdSovcD8K8BWcOmjwo_L3a8LYry7L2Gvw56OEQ,5696
@@ -34,7 +34,7 @@ chellow/e/scenario.py,sha256=IuyE494XaBLq3FW7NdJePD6J4cTzPogfACO6dThiY00,23239
34
34
  chellow/e/system_price.py,sha256=IPBLSRPzGA3yca4tpR8PJemwPbgqVjn1WnljOMUyWnA,8145
35
35
  chellow/e/tlms.py,sha256=gXBZTHXqGVcaTGHaYGVA5Ir5pzoBDqFC1Kl1mQ0IDqU,9549
36
36
  chellow/e/tnuos.py,sha256=kxp9EXPCXv_yAbMRbpqa5b6fsw3KJ290zNaGU3piWgo,20647
37
- chellow/e/views.py,sha256=JC6phMmKpu-NmLEkDvFpMCiruQj-nmt9KSQRu0Q0I30,179019
37
+ chellow/e/views.py,sha256=0R7pmtYQnaW3vCBA5ipCUhWFXcbBcRluric5wqEs4w8,179212
38
38
  chellow/e/bill_parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  chellow/e/bill_parsers/activity_mop_stark_xlsx.py,sha256=v1s4O8phVJVn9sOs9HKrKYcECAP0ApnUgqCaa2ARYiQ,4234
40
40
  chellow/e/bill_parsers/annual_mop_stark_xlsx.py,sha256=4dAWjaxsDnnGBnRAjgFe7IZLxIcLMGiTuXh1uqNnnlQ,4382
@@ -279,7 +279,7 @@ chellow/templates/e/ssc.html,sha256=NiTbn9yLYYG_DV4j9S73rnIVmzTAzTbyaXomverHNnI,
279
279
  chellow/templates/e/sscs.html,sha256=r4uVLWSCMVhYeN_r5e9QVJGLPc4R9yhdJxGXON9Xma8,983
280
280
  chellow/templates/e/supplier_batch.html,sha256=xr17ydDxKALMOcs8rfz-9T4wGyHKJqPpOQqz9brT9eY,5013
281
281
  chellow/templates/e/supplier_batch_add.html,sha256=RabJ20yLpsF_npSLL5aeLlPDa2tL99fENaIzDYZJy1w,1240
282
- chellow/templates/e/supplier_batch_edit.html,sha256=imgRWTg4W0Db8BwqYnN8ZYno5SBZxRTj2Mkhi113HQg,1420
282
+ chellow/templates/e/supplier_batch_edit.html,sha256=wFnhGHLo51omagJdE8viIYgmift7Y3n0C39sMru7XWU,1190
283
283
  chellow/templates/e/supplier_batch_file.html,sha256=fohdthY3ibO9a_2BJsYWyJhZL369F0gaUV7McFzWhMQ,1226
284
284
  chellow/templates/e/supplier_batch_file_add.html,sha256=q3rvpNOVFYmLjce-9qi2pACRXCicVvnnIqknphzWWiE,7618
285
285
  chellow/templates/e/supplier_batch_file_edit.html,sha256=g_1NKT3B79qKjbItZ4od7VyRXyS3cOsUvEiBN6kGWXQ,2009
@@ -352,6 +352,6 @@ chellow/templates/g/supply_note_edit.html,sha256=6UQf_qbhFDys3cVsTp-c7ABWZpggW9R
352
352
  chellow/templates/g/supply_notes.html,sha256=WR3YwGh_qqTklSJ7JqWX6BKBc9rk_jMff4RiWZiF2CM,936
353
353
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
354
354
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
355
- chellow-1690551015.0.0.dist-info/METADATA,sha256=I9OVq5ATkHIdFjol7NTWY6hXK92bC0sFRL_18NFzduA,12161
356
- chellow-1690551015.0.0.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
357
- chellow-1690551015.0.0.dist-info/RECORD,,
355
+ chellow-1690962871.0.0.dist-info/METADATA,sha256=0YbEgijfjNOQ6hPQ1jq5jbGrvGpx1U5z6XCUHc9spOM,12161
356
+ chellow-1690962871.0.0.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
357
+ chellow-1690962871.0.0.dist-info/RECORD,,