forked from Github-Mirrors/canaille
fix non-generic model attribute calls
This commit is contained in:
parent
abf9a23ac8
commit
88179b23b8
5 changed files with 13 additions and 9 deletions
|
@ -31,8 +31,8 @@ def locale_selector():
|
|||
|
||||
user = current_user()
|
||||
available_language_codes = getattr(g, "available_language_codes", [])
|
||||
if user is not None and user.preferredLanguage in available_language_codes:
|
||||
return user.preferredLanguage
|
||||
if user is not None and user.preferred_language in available_language_codes:
|
||||
return user.preferred_language
|
||||
|
||||
if current_app.config.get("LANGUAGE"):
|
||||
return current_app.config.get("LANGUAGE")
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
<td><a href="{{ url_for('oidc.authorizations.view', authorization_id=authorization.authorization_code_id) }}">{{ authorization.authorization_code_id }}</a></td>
|
||||
<td><a href="{{ url_for('oidc.clients.edit', client_id=authorization.client.client_id) }}">{{ authorization.client.client_id }}</a></td>
|
||||
<td>
|
||||
<a href="{{ url_for("account.profile_edition", username=authorization.subject.uid[0]) }}">
|
||||
{{ authorization.subject.uid[0] }}
|
||||
<a href="{{ url_for("account.profile_edition", username=authorization.subject.user_name[0]) }}">
|
||||
{{ authorization.subject.user_name[0] }}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ authorization.issue_date }}</td>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
{% if user.can_edit_self %}
|
||||
<a class="item {% if menuitem == "profile" %}active{% endif %}"
|
||||
href="{{ url_for('account.profile_edition', username=user.uid[0]) }}">
|
||||
href="{{ url_for('account.profile_edition', username=user.user_name[0]) }}">
|
||||
<i class="id card icon"></i>
|
||||
{% trans %}Profile{% endtrans %}
|
||||
</a>
|
||||
|
|
|
@ -46,7 +46,7 @@ def test_preferred_language(slapd_server, testclient, logged_user):
|
|||
|
||||
|
||||
def test_form_translations(slapd_server, testclient, logged_user):
|
||||
logged_user.preferredLanguage = "fr"
|
||||
logged_user.preferred_language = "fr"
|
||||
logged_user.save()
|
||||
|
||||
res = testclient.get("/profile/user", status=200)
|
||||
|
|
|
@ -21,7 +21,7 @@ def test_authorization_list_pagination(testclient, logged_admin, client):
|
|||
authorizations = []
|
||||
for _ in range(26):
|
||||
code = AuthorizationCode(
|
||||
authorization_code_id=gen_salt(48), client=client, subject=client
|
||||
authorization_code_id=gen_salt(48), client=client, subject=logged_admin
|
||||
)
|
||||
code.save()
|
||||
authorizations.append(code)
|
||||
|
@ -66,11 +66,15 @@ def test_authorization_list_bad_pages(testclient, logged_admin):
|
|||
|
||||
def test_authorization_list_search(testclient, logged_admin, client):
|
||||
id1 = gen_salt(48)
|
||||
auth1 = AuthorizationCode(authorization_code_id=id1, client=client, subject=client)
|
||||
auth1 = AuthorizationCode(
|
||||
authorization_code_id=id1, client=client, subject=logged_admin
|
||||
)
|
||||
auth1.save()
|
||||
|
||||
id2 = gen_salt(48)
|
||||
auth2 = AuthorizationCode(authorization_code_id=id2, client=client, subject=client)
|
||||
auth2 = AuthorizationCode(
|
||||
authorization_code_id=id2, client=client, subject=logged_admin
|
||||
)
|
||||
auth2.save()
|
||||
|
||||
res = testclient.get("/admin/authorization")
|
||||
|
|
Loading…
Reference in a new issue