Change related names to something more helpful.
This commit is contained in:
parent
704a792e49
commit
2fdcb38aa8
2 changed files with 25 additions and 24 deletions
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 2.0.3 on 2018-03-30 15:24
|
# Generated by Django 3.0.3 on 2020-03-10 14:19
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import django.core.validators
|
import django.core.validators
|
||||||
|
@ -11,8 +11,8 @@ class Migration(migrations.Migration):
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
('radio', '0005_replaygain_data'),
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
('radio', '0002_naming_and_sorting'),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
@ -25,21 +25,7 @@ class Migration(migrations.Migration):
|
||||||
('disabled_reason', models.TextField(blank=True, verbose_name='reason for disabling')),
|
('disabled_reason', models.TextField(blank=True, verbose_name='reason for disabling')),
|
||||||
('created_date', models.DateTimeField(auto_now_add=True, verbose_name='added on')),
|
('created_date', models.DateTimeField(auto_now_add=True, verbose_name='added on')),
|
||||||
('modified_date', models.DateTimeField(auto_now=True, verbose_name='last modified')),
|
('modified_date', models.DateTimeField(auto_now=True, verbose_name='last modified')),
|
||||||
('favorites', models.ManyToManyField(related_name='song_favorites', to='radio.Song')),
|
('favorites', models.ManyToManyField(related_name='favorited_by', to='radio.Song')),
|
||||||
],
|
|
||||||
options={
|
|
||||||
'abstract': False,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Rating',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('created_date', models.DateTimeField(auto_now_add=True, verbose_name='added on')),
|
|
||||||
('modified_date', models.DateTimeField(auto_now=True, verbose_name='last modified')),
|
|
||||||
('value', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)], verbose_name='song rating')),
|
|
||||||
('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rating_profile', to='profiles.RadioProfile')),
|
|
||||||
('song', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='radio.Song')),
|
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'abstract': False,
|
'abstract': False,
|
||||||
|
@ -57,22 +43,36 @@ class Migration(migrations.Migration):
|
||||||
('song', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='radio.Song')),
|
('song', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='radio.Song')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ['-created_date'],
|
'ordering': ['-queued_at', '-created_date'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Rating',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('created_date', models.DateTimeField(auto_now_add=True, verbose_name='added on')),
|
||||||
|
('modified_date', models.DateTimeField(auto_now=True, verbose_name='last modified')),
|
||||||
|
('value', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)], verbose_name='song rating')),
|
||||||
|
('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rating_profile', to='profiles.RadioProfile')),
|
||||||
|
('song', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='radio.Song')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='radioprofile',
|
model_name='radioprofile',
|
||||||
name='ratings',
|
name='ratings',
|
||||||
field=models.ManyToManyField(related_name='song_ratings', through='profiles.Rating', to='radio.Song'),
|
field=models.ManyToManyField(related_name='ratings', through='profiles.Rating', to='radio.Song'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='radioprofile',
|
model_name='radioprofile',
|
||||||
name='song_requests',
|
name='song_requests',
|
||||||
field=models.ManyToManyField(related_name='song_requests', through='profiles.SongRequest', to='radio.Song'),
|
field=models.ManyToManyField(related_name='request_history', through='profiles.SongRequest', to='radio.Song'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='radioprofile',
|
model_name='radioprofile',
|
||||||
name='user',
|
name='user',
|
||||||
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -18,14 +18,15 @@ radio_settings = global_preferences_registry.manager()
|
||||||
class RadioProfile(Disableable, Timestampable, models.Model):
|
class RadioProfile(Disableable, Timestampable, models.Model):
|
||||||
user = models.OneToOneField(settings.AUTH_USER_MODEL,
|
user = models.OneToOneField(settings.AUTH_USER_MODEL,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
|
related_name='profile',
|
||||||
null=True,
|
null=True,
|
||||||
blank=True)
|
blank=True)
|
||||||
favorites = models.ManyToManyField(Song, related_name='song_favorites')
|
favorites = models.ManyToManyField(Song, related_name='favorited_by')
|
||||||
ratings = models.ManyToManyField(Song,
|
ratings = models.ManyToManyField(Song,
|
||||||
related_name='song_ratings',
|
related_name='ratings',
|
||||||
through='Rating')
|
through='Rating')
|
||||||
song_requests = models.ManyToManyField(Song,
|
song_requests = models.ManyToManyField(Song,
|
||||||
related_name='song_requests',
|
related_name='request_history',
|
||||||
through='SongRequest')
|
through='SongRequest')
|
||||||
|
|
||||||
def disable(self, reason=''):
|
def disable(self, reason=''):
|
||||||
|
|
Loading…
Reference in a new issue