Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type hints for class based views (and other tools) #2060

Merged
merged 2 commits into from
Nov 20, 2023

Conversation

richardebeling
Copy link
Member

@richardebeling richardebeling commented Oct 30, 2023

Fixes #2055

@richardebeling richardebeling marked this pull request as ready for review November 6, 2023 21:20
Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

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

Everything else looks good to me

evap/evaluation/tools.py Outdated Show resolved Hide resolved
return not any(email.endswith("@" + domain) for domain in settings.INSTITUTION_EMAIL_DOMAINS)


def sort_formset(request, formset):
def sort_formset(request: HttpRequest, formset: BaseFormSet) -> None:
if request.POST: # if not, there will be no cleaned_data and the models should already be sorted anyways
formset.is_valid() # make sure all forms have cleaned_data
Copy link
Member

Choose a reason for hiding this comment

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

(not yours), but?

Suggested change
formset.is_valid() # make sure all forms have cleaned_data
assert formset.is_valid() # make sure all forms have cleaned_data

Copy link
Member Author

Choose a reason for hiding this comment

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

One test fails then. The method seems to be intended to also be callable with invalid formsets (via the default value in the line below).

evap/evaluation/tools.py Outdated Show resolved Hide resolved
@richardebeling richardebeling merged commit 419971c into e-valuation:main Nov 20, 2023
10 checks passed
@richardebeling richardebeling deleted the class-views-typing branch November 20, 2023 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Type-check class based views from #1964
2 participants