Skip to content

Conversation

@simonLeary42
Copy link
Contributor

@simonLeary42 simonLeary42 commented Oct 23, 2025

Coldfront crashes when you try to approve an allocation change request with attribute changes.

Bug demonstrated by new regression tests: https://github.com/ubccr/coldfront/actions/runs/18820946912/job/53696360798?pr=855

Internal Server Error: /allocation/change-request/3/
Traceback (most recent call last):
  File "/srv/simon/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/srv/simon/venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/simon/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/simon/venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/simon/venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 135, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/simon/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/simon/venv/lib/python3.12/site-packages/coldfront/core/allocation/views.py", line 1900, in post
    allocation_pk=attribute_change.allocation.pk,
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'AllocationAttributeChangeRequest' object has no attribute 'allocation'

you can find AllocationAttributeChangeRequest here:

https://github.com/ubccr/coldfront/blob/a4b6b4c1d18535f61de5aa4bbfe509d7d8ca4b0f/coldfront/core/allocation/models.py#L720

Introduced in #675

@simonLeary42 simonLeary42 force-pushed the bugfix-allocation-pk branch 2 times, most recently from 99f688a to 3799c02 Compare October 25, 2025 19:16
@simonLeary42
Copy link
Contributor Author

simonLeary42 commented Oct 25, 2025

I found that formset.non_form_errors() were missed in the normal error reporting, so I added them.

edit: moved to #854

@simonLeary42 simonLeary42 force-pushed the bugfix-allocation-pk branch 2 times, most recently from d8ebfa8 to 5945c44 Compare October 26, 2025 14:29
@simonLeary42 simonLeary42 marked this pull request as ready for review October 26, 2025 14:29
@simonLeary42 simonLeary42 force-pushed the bugfix-allocation-pk branch 5 times, most recently from 1f08fff to a12393d Compare October 26, 2025 14:35
@simonLeary42 simonLeary42 changed the title AttributeError: 'AllocationAttributeChangeRequest' object has no attribute 'allocation' fix AttributeError, write more unit tests Oct 26, 2025
Signed-off-by: Simon Leary <simon.leary42@proton.me>
@simonLeary42 simonLeary42 changed the title fix AttributeError, write more unit tests fix AttributeError Oct 26, 2025
@simonLeary42
Copy link
Contributor Author

moved tests to #855 so this can be merged quickly

@aebruno aebruno merged commit 5af86e0 into coldfront:main Nov 5, 2025
1 check passed
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.

2 participants