Closed UEWBot closed 1 year ago
The form is rendered with <select name="player" required id="id_player">
.
That particular part is a PlayerChoicefield
, derived from ModelChoiceField
. All fields default to required=True
.
So all we need to do is add required=False
to the player field in PlayerForm
.
But PlayerForm
is also used in tournament_player_views.index()
, in PlayerFormset
.
Regarded as a standalone form, PlayerForm.player
being mandatory does make sense.
I think the solution is to have two distinct HTML forms on the page, one for updating the background, and one for player comparison. That way, the "required" should just apply within the second form, not the first.
After adding the "Compare with another player" section, the form insists that picking a player to compare to is mandatory, even if the user presses the "Update background" button. Ideally, it should be mandatory for the "Submit" button but not for the other. Failing that, it should be optional and we should error for comparing with nobody.