Port to new django version - not yet fully working

- location field makes problems
This commit is contained in:
Martin Bauer
2019-01-05 11:27:15 +01:00
parent 72a9642a8e
commit 663185fd40
168 changed files with 797 additions and 5967 deletions

View File

@@ -5,55 +5,54 @@ from django.utils.translation import ugettext as _
import os
INSTRUMENTS = (
('TR', _('Trumpet') ),
('TRB', _('Trombone') ),
('HRN',_('Horn') ),
('TUBA',_('Tuba') )
('TR', _('Trumpet')),
('TRB', _('Trombone')),
('HRN', _('Horn')),
('TUBA', _('Tuba'))
)
def musicianPictureName( musician, originalName ):
def musicianPictureName(musician, originalName):
fileExtension = os.path.splitext(originalName)[1]
return "user_images/" + musician.user.username + fileExtension
def musicianSmallPictureName( musician, originalName ):
def musicianSmallPictureName(musician, originalName):
fileExtension = os.path.splitext(originalName)[1]
return "user_images/" + musician.user.username + "_thumb" + fileExtension
class Musician( models.Model ):
class Musician(models.Model):
# Link to user object, contains first name and last name
user = models.OneToOneField( User, verbose_name=_("user") )
image = models.ImageField( upload_to = musicianPictureName, verbose_name=_("image") )
small_image = models.ImageField( upload_to = musicianSmallPictureName, verbose_name = _("circular thumbnail") )
user = models.OneToOneField(User, verbose_name=_("user"), on_delete=models.CASCADE)
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") )
street = models.CharField( max_length=80, blank=True, verbose_name=_("street") )
city = models.CharField( max_length=40, blank=True, verbose_name=_("city") )
zip_code = models.IntegerField( null=True, verbose_name=_("zip_code") )
phone_home = models.CharField( max_length=18, blank=True, verbose_name=_("phone_home") )
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") )
position = models.IntegerField( null=True, verbose_name=_("Position") )
public_description = models.TextField( blank=True, verbose_name=_("public_description") )
instrument = models.CharField(max_length=4, choices=INSTRUMENTS, blank=True, verbose_name=_("instrument"))
birthday = models.DateField(null=True, verbose_name=_("birthday"))
street = models.CharField(max_length=80, blank=True, verbose_name=_("street"))
city = models.CharField(max_length=40, blank=True, verbose_name=_("city"))
zip_code = models.IntegerField(null=True, verbose_name=_("zip_code"))
phone_home = models.CharField(max_length=18, blank=True, verbose_name=_("phone_home"))
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"))
position = models.IntegerField(null=True, verbose_name=_("Position"))
public_description = models.TextField(blank=True, verbose_name=_("public_description"))
@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'
def __unicode__( self ):
def __unicode__(self):
return self.user.username