feat(profile): Use the local name, add a notification when no dgn account exists
This commit is contained in:
parent
35d6a7fa8c
commit
c3f0e70384
2 changed files with 15 additions and 2 deletions
|
@ -8,6 +8,15 @@ from dgsi.models import User
|
|||
class ProfileView(LoginRequiredMixin, TemplateView):
|
||||
template_name = "account/profile.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
u = self.request.user
|
||||
assert isinstance(u, User)
|
||||
|
||||
return super().get_context_data(
|
||||
displayname=f"{u.first_name} {u.last_name}",
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
class CreateUserView(StaffRequiredMixin, CreateView):
|
||||
model = User
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
{% block content %}
|
||||
<h2 class="subtitle">
|
||||
<span>{% blocktrans with displayname=user.kanidm.person.displayname %}Profil de {{ displayname }}{% endblocktrans %}</span>
|
||||
<span class="tag is-primary is-medium is-pulled-right">{{ user.kanidm.person.name }}</span>
|
||||
<span>{% blocktrans %}Profil de {{ displayname }}{% endblocktrans %}</span>
|
||||
<span class="tag is-primary is-medium is-pulled-right">{{ user.username }}</span>
|
||||
</h2>
|
||||
<hr>
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
|||
<span class="button is-fullwidth">{{ user.email }}</span>
|
||||
<br>
|
||||
|
||||
{% if user.kanidm %}
|
||||
<h2 class="subtitle mt-4">{% trans "Informations techniques" %}</h2>
|
||||
<hr>
|
||||
|
||||
|
@ -54,4 +55,7 @@
|
|||
<span class="cell button is-fullwidth is-static">{{ group }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="notification px-5 py-5 is-warning is-light has-text-centered is-size-4 mt-6">{% trans "Pas de compte DGNum répertorié." %}</div>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
|
Loading…
Reference in a new issue