diff --git a/vrobbler/apps/music/migrations/0004_track_thumbs.py b/vrobbler/apps/music/migrations/0004_track_thumbs.py new file mode 100644 index 0000000..1dd21d9 --- /dev/null +++ b/vrobbler/apps/music/migrations/0004_track_thumbs.py @@ -0,0 +1,25 @@ +# Generated by Django 4.1.5 on 2023-01-09 16:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('music', '0003_album_uuid_artist_uuid_track_uuid'), + ] + + operations = [ + migrations.AddField( + model_name='track', + name='thumbs', + field=models.IntegerField( + choices=[ + (-1, 'Thumbs down'), + (0, 'No opinion'), + (1, 'Thumbs up'), + ], + default=0, + ), + ), + ] diff --git a/vrobbler/apps/music/models.py b/vrobbler/apps/music/models.py index ba5e50a..6f4f113 100644 --- a/vrobbler/apps/music/models.py +++ b/vrobbler/apps/music/models.py @@ -42,6 +42,11 @@ class Artist(TimeStampedModel): class Track(TimeStampedModel): + class Opinion(models.IntegerChoices): + DOWN = -1, 'Thumbs down' + NEUTRAL = 0, 'No opinion' + UP = 1, 'Thumbs up' + uuid = models.UUIDField(default=uuid4, editable=False, **BNULL) title = models.CharField(max_length=255, **BNULL) artist = models.ForeignKey(Artist, on_delete=models.DO_NOTHING) @@ -49,6 +54,7 @@ class Track(TimeStampedModel): musicbrainz_id = models.CharField(max_length=255, **BNULL) run_time = models.CharField(max_length=8, **BNULL) run_time_ticks = models.PositiveBigIntegerField(**BNULL) + thumbs = models.IntegerField(default=Opinion.NEUTRAL, choices=Opinion.choices) def __str__(self): return f"{self.title} by {self.artist}"