chrisjrn / registrasion

A conference registration app, built on top of the Symposion conference management system
Apache License 2.0
18 stars 14 forks source link

Voucher form needs to be processed first #144

Open jamezpolley opened 6 years ago

jamezpolley commented 6 years ago

Because otherwise, the first form (which will not be in a valid start) throws errors which prevent the voucher form from ever being processed.

I believe this fixes #133

Our logs match those reported there:

  File "/app/symposion_app/vendor/registrasion/registrasion/views.py", line 996, in amend_registration
    current_cart.apply_voucher(voucher_form.cleaned_data["voucher"])
  File "/app/symposion_app/vendor/registrasion/registrasion/controllers/cart.py", line 41, in inner
    return func(self, *a, **k)
  File "/app/symposion_app/vendor/registrasion/registrasion/controllers/cart.py", line 281, in apply_voucher
    voucher = inventory.Voucher.objects.get(code=voucher_code.upper())
  File "/usr/local/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 380, in get
    self.model._meta.object_name

the core problem seems to be trying to operate on the top formset even though the bottom button was clicked

It's possible that simply moving lines 955-969 inf the formset.is_valid() on line 976 would sufficiently resolve the problem too; but this solution is one that I've tested and found to work