Bugfix no project selected on join crash#168
Conversation
employees/views.py
Outdated
|
|
||
| def _create_project_join_form(self) -> ProjectJoinForm: | ||
| project_form_queryset = Project.objects.exclude(members__id=self.request.user.id).order_by("name") | ||
| if not project_form_queryset: |
There was a problem hiding this comment.
if not project_form_queryset.exists()
|
This solution seems OK, what I would just do is separate the message display logic from form creation - form still could be created with empty queryset (instead of returning I would also add some validation to the form itself, in case if someone tries to still manually call POST on this view, that checks if queryset is empty and then raise ValidationError. This way we will secure it in both frontend (message) and backend (validation). |
40b0ed4 to
2c77800
Compare
|
I introduced fixes that change the current implementation to one that's closer to what @rwrzesien suggested. |
When there are no projects the user can join to, the form in join popup is replaced with appropriate message.
25aed35 to
4f4298b
Compare
Resolves #141
Done: