get_profile does not exist anymore (django 1.7)

This commit is contained in:
Basile Clement 2016-05-24 00:02:25 +02:00
parent 28bd07a433
commit 4857af0f7f
8 changed files with 19 additions and 19 deletions

View file

@ -97,7 +97,7 @@ class FkeyLookup(object):
def ProfileInfo(field, short_description, boolean = False):
def getter(self):
try:
return getattr(self.get_profile(), field)
return getattr(self.profile, field)
except CofProfile.DoesNotExist:
return ""
getter.short_description = short_description
@ -116,14 +116,14 @@ User.profile_mailing_bda_revente = ProfileInfo("mailing_bda_revente", "ML BDA-R"
class UserProfileAdmin(UserAdmin):
def is_buro(self, obj):
try:
return obj.get_profile().is_buro
return obj.profile.is_buro
except CofProfile.DoesNotExist:
return False
is_buro.short_description = 'Membre du Buro'
is_buro.boolean = True
def is_cof(self, obj):
try:
return obj.get_profile().is_cof
return obj.profile.is_cof
except CofProfile.DoesNotExist:
return False
is_cof.short_description = 'Membre du COF'
@ -212,14 +212,14 @@ class VoterAdmin(UserProfileAdmin):
def is_cof(self, obj):
try:
return obj.get_profile().is_cof
return obj.profile.is_cof
except CofProfile.DoesNotExist:
return False
is_cof.short_description = 'Membre du COF'
is_cof.boolean = True
def a_vote(self, obj):
try:
if not obj.get_profile().eav.a_vot:
if not obj.profile.eav.a_vot:
return False
else:
return True