mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 03:49:24 +00:00
Fix subscription and improve views
This commit is contained in:
@ -201,6 +201,10 @@ class User(AbstractBaseUser, PermissionsMixin):
|
||||
return True
|
||||
return False
|
||||
|
||||
def can_be_edited_by(self, user):
|
||||
return user.is_in_group(settings.AE_GROUPS['board']['name']) or user.is_in_group(settings.AE_GROUPS['root']['name'])
|
||||
|
||||
|
||||
class AnonymousUser(AuthAnonymousUser):
|
||||
def __init__(self, request):
|
||||
super(AnonymousUser, self).__init__()
|
||||
|
@ -24,8 +24,16 @@
|
||||
You're seeing the profile of <strong>{{ profile.get_full_name() }}</strong><br/>
|
||||
<strong>{{ profile.nick_name }}</strong><br/>
|
||||
<em>{{ profile.date_of_birth|date("d/m/Y") }}</em>
|
||||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{% if get_subscriber(profile).is_subscribed() %}
|
||||
User is subscriber until {{ get_subscriber(profile).subscriptions.last().subscription_end }}
|
||||
{% else %}
|
||||
User is not subscribed. <a href="{{ url('subscription:subscription') }}?member={{ profile.id }}">New subscription</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@ -9,9 +9,12 @@
|
||||
<p><a href="{{ url('core:user_profile', user_id=request.user.id) }}">Back to profile</a></p>
|
||||
|
||||
<ul>
|
||||
{% if user.has_perms('core.add_group') %}
|
||||
{% if user.is_in_group(settings.AE_GROUPS['root']['name']) %}
|
||||
<li><a href="{{ url('core:group_list') }}">Groups</a></li>
|
||||
{% endif %}
|
||||
{% if user.is_in_group(settings.AE_GROUPS['root']['name']) or user.is_in_group(settings.AE_GROUPS['board']['name']) %}
|
||||
<li><a href="{{ url('subscription:subscription') }}">Subscriptions</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user