]> git.parisson.com Git - mezzo.git/commitdiff
rm nationalities, fix str in admin person
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 15 Jul 2016 16:17:41 +0000 (18:17 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 15 Jul 2016 16:17:41 +0000 (18:17 +0200)
app/organization/team/migrations/0005_remove_person_nationality.py [new file with mode: 0644]
app/organization/team/models.py
app/organization/team/nationalities/fields.py

diff --git a/app/organization/team/migrations/0005_remove_person_nationality.py b/app/organization/team/migrations/0005_remove_person_nationality.py
new file mode 100644 (file)
index 0000000..78bda7a
--- /dev/null
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-15 16:15
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('organization-team', '0004_auto_20160715_1807'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='person',
+            name='nationality',
+        ),
+    ]
index 74d9206659e9e3e559637b5009ad47a60c6b17bc..bd006b629eb9aae9ce032e98964eed725ac3759b 100644 (file)
@@ -115,8 +115,7 @@ class Person(AdminThumbMixin, Photo):
     gender = models.CharField(_('gender'), max_length=16, choices=GENDER_CHOICES, blank=True)
     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)
-    birthday = models.DateField(_('birthday'), blank=True)
-    nationality = NationalityField(_('nationality'), blank=True)
+    birthday = models.DateField(_('birthday'), blank=True, null=True)
     bio = RichTextField(_('biography'), blank=True)
     organization = models.ForeignKey('Organization', verbose_name=_('organization'), blank=True, null=True, on_delete=models.SET_NULL)
 
@@ -124,8 +123,8 @@ class Person(AdminThumbMixin, Photo):
         verbose_name = _('person')
         ordering = ['last_name',]
 
-    def __unicode__(self):
-        return ' '.join((self.user.first_name, self.user.last_name))
+    def __str__(self):
+        return ' '.join((self.first_name, self.last_name))
 
     # def get_absolute_url(self):
     #     return reverse("festival-artist-detail", kwargs={'slug': self.slug})
index 5dff15ebcec5c4cebeec53a1e897e79a3666f04c..17924066aba1b72ad31098f97597c405a94076e3 100644 (file)
@@ -1,6 +1,5 @@
 from django.db.models.fields import CharField
 
-
 class Nationality(object):
     """
     Class represents a nationality.
@@ -20,16 +19,16 @@ class Nationality(object):
         self.code = code
 
     def __unicode__(self):
-        return self.code or ''
+        return str(self.code or '')
 
     def __eq__(self, other):
-        return self.code == other
+        return self.code == str(other)
 
     def __ne__(self, other):
         return not self.__eq__(other)
 
     def __cmp__(self, other):
-        return cmp(self.code, other)
+        return cmp(self.code, str(other))
 
     def __hash__(self):
         return hash(self.code)
@@ -67,7 +66,7 @@ class NationalityDescriptor(object):
         return Nationality(code=instance.__dict__[self.field.name])
 
     def __set__(self, instance, value):
-        instance.__dict__[self.field.name] = value
+        instance.__dict__[self.field.name] = str(value)
 
 
 class NationalityField(CharField):
@@ -106,7 +105,7 @@ class NationalityField(CharField):
         # Convert the Nationality to unicode for database insertion.
         if value is None:
             return None
-        return value
+        return str(value)
 
 
 # If south is installed, ensure that NationalityField will be introspected just