Addressbook

- location field.. has to be refactored
This commit is contained in:
Martin Bauer
2013-09-22 11:11:48 +02:00
parent 49ba4e5223
commit 230f1e6a36
28 changed files with 587 additions and 463 deletions

View File

@@ -7,7 +7,7 @@ import os
INSTRUMENTS = (
('TR', _('Trumpet') ),
('TRB', _('Trombone') ),
('EUPH',_('Euphonium') ),
('HRN',_('Horn') ),
('TUBA',_('Tuba') )
)
@@ -16,14 +16,20 @@ def musicianPictureName( musician, originalName ):
fileExtension = os.path.splitext(originalName)[1]
return "user_images/" + musician.user.username + fileExtension
def musicianSmallPictureName( musician, originalName ):
fileExtension = os.path.splitext(originalName)[1]
return "user_images/" + musician.user.username + "_thumb" + fileExtension
class Musician( models.Model ):
# Link to user object, contains first name and last name
user = models.OneToOneField( User, verbose_name=_("user") )
# Properties
image = models.ImageField( upload_to = musicianPictureName, verbose_name=_("image") )
image = models.ImageField( upload_to = musicianPictureName, verbose_name=_("image") )
small_image = models.ImageField( upload_to = musicianSmallPictureName, verbose_name = _("circular thumbnail") )
# Properties
instrument = models.CharField( max_length=4, choices=INSTRUMENTS, blank=True, verbose_name=_("instrument") )
birthday = models.DateField( null=True, verbose_name=_("birthday") )
@@ -36,7 +42,13 @@ class Musician( models.Model ):
phone_mobile = models.CharField( max_length=18, blank=True, verbose_name=_("phone_mobile") )
phone_work = models.CharField( max_length=18, blank=True, verbose_name=_("phone_work") )
@property
def isDeepBrass(self):
return self.instrument == 'TRB' or self.instrument == "EUPH" or self.instrument == "TUBA" or self.instrument == "HRN"
@property
def isHighBrass(self):
return self.instrument == 'TR'
public_description = models.TextField( blank=True, verbose_name=_("public_description") )