Bans - Add option to delete all submissions by offender
This commit is contained in:
parent
4c2e0d0f91
commit
04ec755daf
@ -27,7 +27,8 @@
|
|||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<p>Banning user <b>{{ target.display_name }}</b></p>
|
<p>Banning user <b>{{ target.display_name }}</b></p>
|
||||||
{{ form }}
|
{{ form }}
|
||||||
<input type="submit" value="Submit" />
|
<input type="submit" value="Ban" />
|
||||||
|
<input type="submit" name="delete" value="Ban and Delete all submissions" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -140,7 +140,6 @@ def SubmissionModForm(req, abbr, submission):
|
|||||||
|
|
||||||
# Handle POST
|
# Handle POST
|
||||||
if req.method == 'POST':
|
if req.method == 'POST':
|
||||||
|
|
||||||
if 'delete' in req.POST:
|
if 'delete' in req.POST:
|
||||||
submission.delete()
|
submission.delete()
|
||||||
return HttpResponseRedirect('/show/%s/episode/%d/%d'%(abbr, episode.season.number, episode.episode))
|
return HttpResponseRedirect('/show/%s/episode/%d/%d'%(abbr, episode.season.number, episode.episode))
|
||||||
@ -329,6 +328,10 @@ def BanFromShowForm(req, abbr):
|
|||||||
# Add show to scope
|
# Add show to scope
|
||||||
new_ban.scope.add(show)
|
new_ban.scope.add(show)
|
||||||
|
|
||||||
|
# Delete all of the user's submissions for this show
|
||||||
|
if 'delete' in req.POST:
|
||||||
|
Submission.objects.filter(episode__show=show,user=banTarget).delete()
|
||||||
|
|
||||||
return HttpResponseRedirect('/show/%s'%(abbr))
|
return HttpResponseRedirect('/show/%s'%(abbr))
|
||||||
else:
|
else:
|
||||||
ctx['error'] = 'Invalid fields!'
|
ctx['error'] = 'Invalid fields!'
|
||||||
|
Reference in New Issue
Block a user