Skip to content

Fix FIXME in ModelBaseMixin on dual injection paths. - #1555

Merged
ihalaij1 merged 1 commit into
apluslms:masterfrom
sayravai:fix_ModelBaseMixin
Oct 9, 2026
Merged

ihalaij1 merged 1 commit into
apluslms:masterfrom
sayravai:fix_ModelBaseMixin

Conversation

@sayravai

@sayravai sayravai commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Description

Do not inject the "model" string parameter into the template, as Django already does this via kwargs (parameters passed via the requested URL) so it would be passed twice using the same name. We now inject a "is_exercise" boolean instead, which simply states if the model is "exercise" or not. There was one template using the "model" parameter, so we update that to use "is_exercise" instead.

Why?

To make it more explicit that we use the "noted" parameters instead of those injected by Django, as Django behaviour can change.

How?

Rename the injected parameter from "model" to "is_exercise" to avoid confusion and make the purpose more explicit. Also move the renamed parameter from get_resource_objects to get_common_objects as it has no effect on whether the request is valid or not, only on what is displayed on the page.

Testing

Remember to add or update unit tests for new features and changes.

What type of test did you run?

  • Accessibility test using the WAVE extension.
  • Django unit tests.
  • Playwright tests.
  • Other test. (Add a description below)
  • Manual testing.

[ADD A DESCRIPTION ABOUT WHAT YOU TESTED MANUALLY]

Did you test the changes in

  • Chrome
  • Firefox
  • This pull request cannot be tested in the browser.

Think of what is affected by these changes and could become broken

Translation

Programming style

  • Did you follow our style guides?
  • Did you use Python type hinting in all functions that you added or edited? (type hints for function parameters and return values)

Have you updated the README or other relevant documentation?

  • documents inside the doc directory.
  • README.md.
  • Aplus Manual.
  • Other documentation (mention below which documentation).

Is it Done?

  • Reviewer has finished the code review
  • After the review, the developer has made changes accordingly
  • Customer/Teacher has accepted the implementation of the feature

Clean up your git commit history before submitting the pull request!

@ihalaij1
ihalaij1 force-pushed the fix_ModelBaseMixin branch from e713399 to 9cce0eb Compare October 9, 2026 08:48

@ihalaij1 ihalaij1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@ihalaij1 ihalaij1 self-assigned this Oct 9, 2026
@ihalaij1
ihalaij1 merged commit 3728126 into apluslms:master Oct 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants