]> git.parisson.com Git - mezzo.git/commitdiff
artist : auto save names
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 23 Mar 2016 11:28:03 +0000 (12:28 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 23 Mar 2016 11:28:03 +0000 (12:28 +0100)
app/festival/models.py

index 17ec2a65acf93aa353bdcbcf0346339350f97525..3df12131c4165fe60b192f919ad0054742dac7ad 100644 (file)
@@ -78,6 +78,7 @@ class Artist(Displayable, RichText, AdminThumbMixin):
     class Meta(MetaCore):
         verbose_name = _('artist')
         db_table = app_label + '_artists'
+        ordering = ['last_name',]
 
     def __unicode__(self):
         return self.title
@@ -91,7 +92,11 @@ class Artist(Displayable, RichText, AdminThumbMixin):
 
     def clean(self):
         super(Artist, self).clean()
-        self.first_name, self.last_name = self.title.split(' ') 
+        self.first_name, self.last_name = self.title.split(' ')
+
+    def save(self, *args, **kwargs):
+        self.first_name, self.last_name = self.title.split(' ')
+        super(Artist, self).save(*args, **kwargs)
 
 
 class Media(Displayable, RichText):