forked from DGNum/gestioCOF
get_profile does not exist anymore (django 1.7)
This commit is contained in:
parent
28bd07a433
commit
4857af0f7f
8 changed files with 19 additions and 19 deletions
|
@ -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
|
||||
|
|
|
@ -2,7 +2,7 @@ from django_cas.decorators import user_passes_test
|
|||
|
||||
def is_cof(user):
|
||||
try:
|
||||
profile = user.get_profile()
|
||||
profile = user.profile
|
||||
return profile.is_cof
|
||||
except:
|
||||
return False
|
||||
|
@ -12,7 +12,7 @@ cof_required_customdenied = user_passes_test(lambda u: is_cof(u), login_url = "c
|
|||
|
||||
def is_buro(user):
|
||||
try:
|
||||
profile = user.get_profile()
|
||||
profile = user.profile
|
||||
return profile.is_buro
|
||||
except:
|
||||
return False
|
||||
|
|
|
@ -37,7 +37,7 @@ class COFCASBackend(CASBackend):
|
|||
if user is None:
|
||||
return user
|
||||
try:
|
||||
profile = user.get_profile()
|
||||
profile = user.profile
|
||||
except CofProfile.DoesNotExist:
|
||||
profile, created = CofProfile.objects.get_or_create(user = user)
|
||||
profile.save()
|
||||
|
|
|
@ -53,7 +53,7 @@ def login_ext(request):
|
|||
@login_required
|
||||
def logout(request):
|
||||
try:
|
||||
profile = request.user.get_profile()
|
||||
profile = request.user.profile
|
||||
except CofProfile.DoesNotExist:
|
||||
profile, created = CofProfile.objects.get_or_create(user = request.user)
|
||||
if profile.login_clipper:
|
||||
|
@ -409,12 +409,12 @@ class UserProfileForm(forms.ModelForm):
|
|||
def profile(request):
|
||||
success = False
|
||||
if request.method == "POST":
|
||||
form = UserProfileForm(request.POST, instance = request.user.get_profile())
|
||||
form = UserProfileForm(request.POST, instance = request.user.profile)
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
success = True
|
||||
else:
|
||||
form = UserProfileForm(instance = request.user.get_profile())
|
||||
form = UserProfileForm(instance = request.user.profile)
|
||||
return render(request, "profile.html", {"form": form, "success": success})
|
||||
|
||||
class RegistrationUserForm(forms.ModelForm):
|
||||
|
@ -713,7 +713,7 @@ def csv_export_mega(filename, qs):
|
|||
|
||||
for reg in qs.all():
|
||||
user = reg.user
|
||||
profile = user.get_profile()
|
||||
profile = user.profile
|
||||
comments = "---".join([comment.content for comment in reg.comments.all()])
|
||||
bits = [user.username, user.first_name, user.last_name, user.email, profile.phone, profile.num, profile.comments if profile.comments else "", comments]
|
||||
writer.writerow([unicode(bit) for bit in bits])
|
||||
|
@ -732,7 +732,7 @@ def export_mega_remarksonly(request):
|
|||
for val in commentfield.values.all():
|
||||
reg = val.registration
|
||||
user = reg.user
|
||||
profile = user.get_profile()
|
||||
profile = user.profile
|
||||
bits = [user.username, user.first_name, user.last_name, user.email, profile.phone, profile.num, profile.comments, val.content]
|
||||
writer.writerow([unicode(bit) for bit in bits])
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<h1>Attribution</h1>
|
||||
<h2>Token : {{ token }}</h2>
|
||||
<h2>Placés : {{ total_slots }} ; Déçus : {{ total_losers }}</h2>
|
||||
{% if user.get_profile.is_buro %}<h2>Déficit total: {{ total_deficit }} €, Opéra: {{ opera_deficit }} €, Attribué: {{ total_sold }} €</h2>{% endif %}
|
||||
{% if user.profile.is_buro %}<h2>Déficit total: {{ total_deficit }} €, Opéra: {{ opera_deficit }} €, Attribué: {{ total_sold }} €</h2>{% endif %}
|
||||
<h2>Temps de calcul : {{ duration|floatformat }}s</h2>
|
||||
|
||||
{% for show, members, losers in results %}
|
||||
|
@ -17,7 +17,7 @@
|
|||
<h2>{{ show.title }} - {{ show.date_no_seconds }} @ {{ show.location }}</h2>
|
||||
<p>
|
||||
<strong>{{ show.nrequests }} demandes pour {{ show.slots }} places</strong>
|
||||
{{ show.price }}€ par place{% if user.get_profile.is_buro and show.nrequests < show.slots %}, {{ show.deficit }}€ de déficit{% endif %}
|
||||
{{ show.price }}€ par place{% if user.profile.is_buro and show.nrequests < show.slots %}, {{ show.deficit }}€ de déficit{% endif %}
|
||||
</p>
|
||||
Places :
|
||||
<ul>
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
<h1>Attribution</h1>
|
||||
<h2>Token : {{ token }}</h2>
|
||||
<h2>Placés : {{ total_slots }} ; Déçus : {{ total_losers }}</h2>
|
||||
{% if user.get_profile.is_buro %}<h2>Déficit total: {{ total_deficit }} €, Opéra: {{ opera_deficit }} €, Attribué: {{ total_sold }} €</h2>{% endif %}
|
||||
{% if user.profile.is_buro %}<h2>Déficit total: {{ total_deficit }} €, Opéra: {{ opera_deficit }} €, Attribué: {{ total_sold }} €</h2>{% endif %}
|
||||
|
||||
{% for show, members, losers in results %}
|
||||
<div class="attribresult">
|
||||
<h2>{{ show.title }} - {{ show.date_no_seconds }} @ {{ show.location }}</h2>
|
||||
<p>
|
||||
<strong>{{ show.nrequests }} demandes pour {{ show.slots }} places</strong>
|
||||
{{ show.price }}€ par place{% if user.get_profile.is_buro and show.nrequests < show.slots %}, {{ show.deficit }}€ de déficit{% endif %}
|
||||
{{ show.price }}€ par place{% if user.profile.is_buro and show.nrequests < show.slots %}, {{ show.deficit }}€ de déficit{% endif %}
|
||||
</p>
|
||||
Places :
|
||||
<ul>
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
<li><a href="{% url "gestioncof.views.logout" %}">Se déconnecter</a></li>
|
||||
</ul>
|
||||
|
||||
{% if user.get_profile.is_buro %}
|
||||
{% if user.profile.is_buro %}
|
||||
<h3>Administration</h3>
|
||||
<ul>
|
||||
<li><a href="{% url "admin:index" %}">Administration générale</a></li>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<h2>Inscription d'un nouveau membre</h2>
|
||||
{% if success %}
|
||||
<p class="success">L'inscription de {{ member.first_name }} {{ member.last_name }} (<tt>{{ member.username }}</tt>) a été enregistrée avec succès.
|
||||
{% if member.get_profile.is_cof %}Il est désormais membre du COF n°{{ member.get_profile.num }} !{% endif %}</p>
|
||||
{% if member.profile.is_cof %}Il est désormais membre du COF n°{{ member.profile.num }} !{% endif %}</p>
|
||||
{% endif %}
|
||||
<div id="form-placeholder">
|
||||
{% include "registration_form.html" %}
|
||||
|
|
Loading…
Reference in a new issue