Change default ordering for SongRequest.

This commit is contained in:
Josh Washburne 2018-01-19 12:18:50 -05:00
parent cf5cea2e52
commit 616b7308cf
2 changed files with 5 additions and 2 deletions

View file

@ -1,4 +1,4 @@
# Generated by Django 2.0 on 2018-01-18 17:36 # Generated by Django 2.0 on 2018-01-19 16:46
from django.conf import settings from django.conf import settings
import django.core.validators import django.core.validators
@ -54,7 +54,7 @@ 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={
'abstract': False, 'ordering': ['-created_date'],
}, },
), ),
migrations.AddField( migrations.AddField(

View file

@ -63,6 +63,9 @@ class SongRequest(Timestampable, models.Model):
objects = models.Manager() objects = models.Manager()
music = RequestManager() music = RequestManager()
class Meta:
ordering = ['-created_date', ]
def __str__(self): def __str__(self):
req_user = self.profile.user.get_username() req_user = self.profile.user.get_username()
return "{} - Requested by {} at {}".format(self.song.title, return "{} - Requested by {} at {}".format(self.song.title,