Add a show field to reports

This commit is contained in:
Evert Prants 2018-03-03 11:39:56 +02:00
parent f3bf9a4e44
commit 8a33f6da59
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 9 additions and 0 deletions

View File

@ -330,6 +330,7 @@ def ReportForm(req, abbr, rid):
new_report = form.save(commit=False)
new_report.reporter = user
new_report.url = url
new_report.show = show
new_report.save()
return HttpResponseRedirect('%s/discuss/board/%d-%s'%(show.url(), reply.board.pk, slugify(reply.board.title)))

View File

@ -196,6 +196,13 @@ class Report(TimestampedModel):
help_text='The URL of the content being reported',
verbose_name = 'Content URL'
)
show = models.ForeignKey(
Show,
on_delete=models.CASCADE,
null=True,
blank=True,
help_text='The show associated with the reported url',
)
read_by = models.ForeignKey(
User,
on_delete=models.SET_NULL,

View File

@ -452,6 +452,7 @@ def ReportSubmission(req, abbr, submission):
new_report = form.save(commit=False)
new_report.reporter = user
new_report.url = url
new_report.show = show
new_report.save()
return HttpResponseRedirect('%s/episode/%d/%d'%(show.url(), episode.season.number, episode.episode))