Skip to content

Voucher form needs to be processed first#144

Open
jamezpolley wants to merge 1 commit intochrisjrn:masterfrom
jamezpolley:fix_voucher_form
Open

Voucher form needs to be processed first#144
jamezpolley wants to merge 1 commit intochrisjrn:masterfrom
jamezpolley:fix_voucher_form

Conversation

@jamezpolley
Copy link
Copy Markdown

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

Because otherwise, the firstform (which will not be in a valid start)
throws errors which prevent the voucher form from ever being processed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Applying voucher code through "amend" view gives a 500 server error

1 participant