From: olivier <> Date: Wed, 20 Jan 2010 15:51:49 +0000 (+0000) Subject: model: add __unicode__() where missing X-Git-Tag: 1.1~592 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=4fccc65a368d0ab965bde4ee75b4b796ed892c6e;p=telemeta.git model: add __unicode__() where missing --- diff --git a/telemeta/models/crem.py b/telemeta/models/crem.py index 4dc5141c..a6662410 100755 --- a/telemeta/models/crem.py +++ b/telemeta/models/crem.py @@ -328,6 +328,9 @@ class Enumeration(ModelCore): "Abstract enumerations base class" value = models.CharField(max_length=250, unique=True) + def __unicode__(self): + return self.value + class Meta(MetaCore): abstract = True @@ -398,6 +401,9 @@ class Instrument(ModelCore): class Meta(MetaCore): db_table = 'instruments' + def __unicode__(self): + return self.name + class InstrumentAlias(ModelCore): "Instrument other name" name = models.CharField(max_length=250) @@ -405,6 +411,9 @@ class InstrumentAlias(ModelCore): class Meta(MetaCore): db_table = 'instrument_aliases' + def __unicode__(self): + return self.name + class InstrumentRelation(ModelCore): "Instrument family" instrument = models.ForeignKey('Instrument', related_name="parent_relation") @@ -450,6 +459,9 @@ class User(ModelCore): class Meta(MetaCore): db_table = 'users' + def __unicode__(self): + return self.username + class Playlist(ModelCore): "Item or collection playlist" owner_username = models.ForeignKey('User', related_name="playlists", db_column="owner_username") @@ -458,6 +470,9 @@ class Playlist(ModelCore): class Meta(MetaCore): db_table = 'playlists' + def __unicode__(self): + return self.name + class PlaylistResource(ModelCore): "Playlist components" RESOURCE_TYPE_CHOICES = (('item', 'item'), ('collection', 'collection')) @@ -519,6 +534,9 @@ class LocationAlias(ModelCore): alias = models.CharField(max_length=150) is_authoritative = models.BooleanField(default=0) + def __unicode__(self): + return self.alias + class Meta(MetaCore): db_table = 'location_aliases' unique_together = (('location', 'alias'),) @@ -560,6 +578,9 @@ class PublisherCollection(ModelCore): publisher = models.ForeignKey('Publisher', related_name="publisher_collections") value = models.CharField(max_length=250) + def __unicode__(self): + return self.value + class Meta(MetaCore): db_table = 'publisher_collections'