Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
c1e5cebd
Verified
Commit
c1e5cebd
authored
4 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Allow site local configuration of available languages
parent
5af9f95a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!381
Resolve "Allow site-local configuration of available languages"
Pipeline
#4282
passed
4 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/preferences.py
+13
-0
13 additions, 0 deletions
aleksis/core/preferences.py
aleksis/core/templates/core/partials/language_form.html
+1
-2
1 addition, 2 deletions
aleksis/core/templates/core/partials/language_form.html
with
14 additions
and
2 deletions
aleksis/core/preferences.py
+
13
−
0
View file @
c1e5cebd
from
django.conf
import
settings
from
django.forms
import
EmailField
,
ImageField
,
URLField
from
django.forms.widgets
import
SelectMultiple
from
django.utils.translation
import
gettext_lazy
as
_
from
dynamic_preferences.preferences
import
Section
...
...
@@ -22,6 +23,7 @@ notification = Section("notification")
footer
=
Section
(
"
footer
"
)
account
=
Section
(
"
account
"
)
auth
=
Section
(
"
auth
"
,
verbose_name
=
_
(
"
Authentication
"
))
internationalisation
=
Section
(
"
internationalisation
"
,
verbose_name
=
_
(
"
Internationalisation
"
))
@site_preferences_registry.register
...
...
@@ -196,3 +198,14 @@ class AuthenticationBackends(MultipleChoicePreference):
def
get_choices
(
self
):
return
[(
b
,
b
)
for
b
in
settings
.
CUSTOM_AUTHENTICATION_BACKENDS
]
@site_preferences_registry.register
class
AvailableLanguages
(
MultipleChoicePreference
):
section
=
internationalisation
name
=
"
languages
"
default
=
[
code
[
0
]
for
code
in
settings
.
LANGUAGES
]
widget
=
SelectMultiple
verbose_name
=
_
(
"
Available languages
"
)
field_attribute
=
{
"
initial
"
:
[]}
choices
=
settings
.
LANGUAGES
This diff is collapsed.
Click to expand it.
aleksis/core/templates/core/partials/language_form.html
+
1
−
2
View file @
c1e5cebd
...
...
@@ -8,8 +8,7 @@
<input
name=
"next"
type=
"hidden"
value=
"{{ request.get_full_path }}"
>
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% get_language_info_list for request.site.preferences.internationalisation__languages as languages %}
{# Select #}
<div
class=
"input-field language-field"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment