apluslms / mooc-grader

Automatic assessment framework compatible with A-plus LMS.
14 stars 29 forks source link

Replace harcoded login urls #139

Closed EerikSaksi closed 1 year ago

EerikSaksi commented 1 year ago

Rather than hardcoding /login/, use the url template tag and reverse_lazy

Fixes #136

Description

In a few locations, the hardcoded /login/ url was used.

Why?

If the login url used is different from /login/ this causes issues

How?

Using the {% url %} tag in the template, and reverse_lazy in the Python code. reverse_lazy is necessary as the url conf has not yet been loaded.

"It is useful for when you need to use a URL reversal before your project’s URLConf is loaded." https://docs.djangoproject.com/en/4.1/ref/urlresolvers/#reverse-lazy

Fixes #136

Testing

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

What type of test did you run?

Ensuring that the template links to the same /login url despite changes, ensuring that the reverse_lazy does not cause issues.

Did you test the changes in

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

Translation

Programming style

Have you updated the README or other relevant documentation?

Is it Done?

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