mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 09:12:23 +01:00
Song reporting and user stats
This commit is contained in:
committed by
Daan Sprenkels
parent
0c1f9cb08d
commit
f6fcc63450
@ -35,5 +35,27 @@ class Song(models.Model):
|
||||
db_index=True,
|
||||
help_text='hide this song from the search listings')
|
||||
|
||||
def report(self, user, note):
|
||||
report_note = ReportNote(song=self, user=user, note=note)
|
||||
report_note.save()
|
||||
|
||||
def __str__(self):
|
||||
return self.artist + ' - ' + self.title
|
||||
|
||||
class ReportNote(models.Model):
|
||||
song = models.ForeignKey(Song,
|
||||
on_delete=models.CASCADE,
|
||||
blank=False,
|
||||
null=False,
|
||||
db_index=True)
|
||||
user = models.ForeignKey(
|
||||
settings.AUTH_USER_MODEL,
|
||||
on_delete=models.CASCADE,
|
||||
blank=True,
|
||||
null=True,
|
||||
db_index=True)
|
||||
note = models.TextField(verbose_name='reason', blank=True,
|
||||
help_text='reason for edit request')
|
||||
|
||||
def __str__(self):
|
||||
return "{song.artist} - {song.title}: '{note}'".format(song=self.song, note=self.note)
|
||||
|
||||
Reference in New Issue
Block a user