Skip to content

Commit

Permalink
Merge branch 'develop' into 30107-preferences-json-update-profile
Browse files Browse the repository at this point in the history
  • Loading branch information
robertavram authored Jun 17, 2022
2 parents 234b8a8 + 1360dad commit 766a395
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/etools/applications/users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class ProfileAdmin(admin.ModelAdmin):
search_fields = (
'tenant_profile__office__name',
'country__name',
'user__email'
'user__email',
'guid'
)
readonly_fields = (
'user',
Expand Down
5 changes: 5 additions & 0 deletions src/etools/applications/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import connection, models
from django.db.models.signals import post_save
from django.urls import reverse
from django.utils.functional import cached_property
from django.utils.translation import gettext_lazy as _

Expand Down Expand Up @@ -105,6 +106,10 @@ def get_staff_member_country(self):
return country
return None

def get_admin_url(self):
info = (self._meta.app_label, self._meta.model_name)
return reverse('admin:%s_%s_change' % info, args=(self.pk,))

def save(self, *args, **kwargs):
if self.email != self.email.lower():
raise ValidationError("Email must be lowercase.")
Expand Down
2 changes: 1 addition & 1 deletion src/etools/applications/users/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AzureUserMapper:
'mail',
'surname',
'userType',
('companyName', ['UNICEF', ]),
# ('companyName', ['UNICEF', ]),
]

USER_ATTR_MAP = {
Expand Down
3 changes: 3 additions & 0 deletions src/etools/templates/admin/base_site.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@
<div id="user-tools">
{% block welcome-msg %}
{% trans 'Welcome,' %}
<a href="{{ user.get_admin_url }}">
<strong>{% firstof user.get_short_name user.get_username %}</strong>.
</a>

{% endblock %}
{% block userlinks %}
<a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>
Expand Down

0 comments on commit 766a395

Please sign in to comment.