So this is the relevant view:
def strike_list(request):
strikes = Strike.objects.all()
if request.method == 'POST':
form = StrikeModelForm(request.POST)
print(form)
if form.is_valid():
form.save()
strikes = Strike.objects.all()
context = {'form': form, 'strikes': strikes}
return render(request, 'Striker/partials/success.html')
else:
return render(request, 'Striker/partials/failure.html')
form = StrikeModelForm()
context = {'form': form, 'strikes': strikes}
return render(request, "Striker/strikes.html", context)
And this is the form object:
<tr><th><label for="id_player">Player:</label></th><td><select name="player" required id="id_player">
<option value="">---------</option>
<option value="4">zrqml, GP: 2815555</option>
<option value="5" selected>USS ALABAMA, GP: 2141053</option>
<option value="6">Stay Classy, GP: 1771606</option>
<option value="7">Kusch, GP: 1667678</option>
<option value="8">Darth2Darth, GP: 1058416</option>
<option value="9">chris, GP: 1562944</option>
<option value="10">an0nym0usj0hn, GP: 995921</option>
<option value="11">Orion AltyMcAlt, GP: 2461124</option>
<option value="12">BobsYourUncle, GP: 1924740</option>
<option value="13">Rodmanthegoat, GP: 2492075</option>
<option value="14">The last starfighter, GP: 1733162</option>
<option value="15">whitecream, GP: 1356395</option>
<option value="16">Atreides, GP: 2346727</option>
<option value="17">drewfisto1, GP: 1457420</option>
<option value="18">Ace starship, GP: 2475471</option>
<option value="19">Presbo, GP: 2484242</option>
<option value="20">Gutzag, GP: 1359311</option>
<option value="21">bebay, GP: 2288396</option>
<option value="22">Bently, GP: 1719924</option>
<option value="23">Chantza, GP: 2161487</option>
<option value="24">Beyuhz, GP: 2398208</option>
<option value="25">MightyMoe, GP: 2014423</option>
<option value="26">RustedRooster, GP: 2274490</option>
<option value="27">Slimalin, GP: 1220487</option>
<option value="28">NoJedi, GP: 1304308</option>
<option value="29">URMADKID99, GP: 1946823</option>
<option value="30">Tacobell96, GP: 1725387</option>
<option value="31">Chet Rippo, GP: 1294782</option>
<option value="32">Garnon Hald, GP: 6091381</option>
<option value="33">Ali Vaqar, GP: 5939626</option>
<option value="34">Alphasniper828, GP: 1312831</option>
<option value="35">RustyRooster, GP: 1200016</option>
<option value="36">CommanderCrosshair, GP: 1084318</option>
<option value="37">Riycer, GP: 5810429</option>
<option value="38">Fatherllama, GP: 1403024</option>
<option value="39">Tbagtooine, GP: 2368169</option>
<option value="40">Aaranvor, GP: 785152</option>
<option value="41">MINI Antares Stiasa, GP: 8625284</option>
<option value="42">ChaosTitan, GP: 8544353</option>
<option value="43">MINI The Senate, GP: 4924071</option>
<option value="44">Mots Zrawchs, GP: 1040804</option>
<option value="45">DarthNeka, GP: 7209995</option>
<option value="46">IvanTgreat, GP: 7809965</option>
<option value="47">Ayua, GP: 1004131</option>
<option value="48">Havoc Shmavoc, GP: 1286565</option>
<option value="49">ReyRey, GP: 5939626</option>
</select></td></tr>
<tr><th><label for="id_strike_date">Strike date:</label></th><td><input type="date" name="strike_date" value="2022-11-12" required id="id_strike_date"></td></tr>
<tr><th><label for="id_activity">Activity:</label></th><td><select name="activity" required id="id_activity">
<option value="">---------</option>
<option value="TW" selected>TW</option>
<option value="TB">TB</option>
<option value="Tickets">Tickets</option>
<option value="Other">Other</option>
</select></td></tr>
<tr><th><label for="id_ishard">Ishard:</label></th><td><input type="checkbox" name="ishard" id="id_ishard" checked></td></tr>
<tr><th><label for="id_comments">Comments:</label></th><td><textarea name="comments" cols="40" rows="5" maxlength="200" id="id_comments">
Today asdfasdfasdfsadfasdf asdf asdf </textarea></td></tr>
I think I might need to make an instance (?) but if so I’m not sure what to use to set it.