From: Guillaume Pellerin Date: Wed, 23 Mar 2016 11:16:26 +0000 (+0100) Subject: add first and last name to Artist X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=2a7f36f6d1e705f966b1fc4784d6bcfca631f8e5;p=mezzo.git add first and last name to Artist --- diff --git a/app/festival/migrations/0011_auto_20160323_1159.py b/app/festival/migrations/0011_auto_20160323_1159.py new file mode 100644 index 00000000..35fabf98 --- /dev/null +++ b/app/festival/migrations/0011_auto_20160323_1159.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-03-23 10:59 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('festival', '0010_playlist'), + ] + + operations = [ + migrations.AddField( + model_name='artist', + name='first_name', + field=models.CharField(blank=True, max_length=255, null=True, verbose_name='first name'), + ), + migrations.AddField( + model_name='artist', + name='last_name', + field=models.CharField(blank=True, max_length=255, null=True, verbose_name='last name'), + ), + ] diff --git a/app/festival/models.py b/app/festival/models.py index bc10e2a6..17ec2a65 100644 --- a/app/festival/models.py +++ b/app/festival/models.py @@ -61,6 +61,8 @@ class PageCategory(BaseNameModel): class Artist(Displayable, RichText, AdminThumbMixin): """Artist""" + first_name = models.CharField(_('first name'), max_length=255, blank=True, null=True) + last_name = models.CharField(_('last name'), max_length=255, blank=True, null=True) bio = RichTextField(_('biography'), blank=True) photo = FileField(_('photo'), upload_to='images/photos', max_length=1024, blank=True, format="Image") photo_credits = models.CharField(_('photo credits'), max_length=255, blank=True, null=True) @@ -87,6 +89,10 @@ class Artist(Displayable, RichText, AdminThumbMixin): def get_absolute_url(self): return reverse("festival-artist-detail", kwargs={'slug': self.slug}) + def clean(self): + super(Artist, self).clean() + self.first_name, self.last_name = self.title.split(' ') + class Media(Displayable, RichText): """Media"""