diff --git a/musician/forms.py b/musician/forms.py
index 5fcafbe..7a66a00 100644
--- a/musician/forms.py
+++ b/musician/forms.py
@@ -17,5 +17,6 @@ class LoginForm(AuthenticationForm):
else:
self.username = username
self.token = orchestra.auth_token
+ self.user = orchestra.retrieve_profile()
return self.cleaned_data
diff --git a/musician/models.py b/musician/models.py
index de43a1a..0718aaa 100644
--- a/musician/models.py
+++ b/musician/models.py
@@ -5,6 +5,8 @@ from django.utils.dateparse import parse_datetime
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
+from . import settings as musician_settings
+
logger = logging.getLogger(__name__)
@@ -107,14 +109,20 @@ class UserAccount(OrchestraModel):
@classmethod
def new_from_json(cls, data, **kwargs):
billing = None
+ language = None
last_login = None
if 'billcontact' in data:
billing = BillingContact.new_from_json(data['billcontact'])
+ # Django expects that language code is lowercase
+ if 'language' in data:
+ language = data['language'].lower()
+
if 'last_login' in data:
last_login = parse_datetime(data['last_login'])
- return super().new_from_json(data=data, billing=billing, last_login=last_login)
+
+ return super().new_from_json(data=data, billing=billing, language=language, last_login=last_login)
class DatabaseUser(OrchestraModel):
@@ -250,9 +258,8 @@ class MailinglistService(OrchestraModel):
return "{}@{}".format(self.data['address_name'], self.data['address_domain']['name'])
@property
- def configure(self):
- # TODO(@slamora): build mailtran absolute URL
- return format_html('Mailtrain')
+ def manager_url(self):
+ return musician_settings.URL_MAILTRAIN
class SaasService(OrchestraModel):
@@ -267,6 +274,17 @@ class SaasService(OrchestraModel):
}
+ @property
+ def manager_url(self):
+ URLS = {
+ 'gitlab': musician_settings.URL_SAAS_GITLAB,
+ 'owncloud': musician_settings.URL_SAAS_OWNCLOUD,
+ 'wordpress': musician_settings.URL_SAAS_WORDPRESS,
+ }
+
+ return URLS.get(self.service, '#none')
+
+
class WebSite(OrchestraModel):
api_name = 'website'
param_defaults = {
diff --git a/musician/settings.py b/musician/settings.py
index 5581061..7dab46f 100644
--- a/musician/settings.py
+++ b/musician/settings.py
@@ -1,14 +1,41 @@
-# allowed resources limit hardcoded because cannot be retrieved from the API.
-ALLOWED_RESOURCES = {
- 'INDIVIDUAL':
- {
- # 'disk': 1024,
- # 'traffic': 2048,
- 'mailbox': 2,
+from django.conf import settings
+
+
+def getsetting(name):
+ value = getattr(settings, name, None)
+ return value or DEFAULTS.get(name)
+
+
+DEFAULTS = {
+ # allowed resources limit hardcoded because cannot be retrieved from the API.
+ "ALLOWED_RESOURCES": {
+ 'INDIVIDUAL':
+ {
+ # 'disk': 1024,
+ # 'traffic': 2048,
+ 'mailbox': 2,
+ },
+ 'ASSOCIATION': {
+ # 'disk': 5 * 1024,
+ # 'traffic': 20 * 1024,
+ 'mailbox': 10,
+ }
},
- 'ASSOCIATION': {
- # 'disk': 5 * 1024,
- # 'traffic': 20 * 1024,
- 'mailbox': 10,
- }
+ "URL_DB_PHPMYADMIN": "https://www.phpmyadmin.net/",
+ "URL_MAILTRAIN": "https://mailtrain.org/",
+ "URL_SAAS_GITLAB": "https://gitlab.org/",
+ "URL_SAAS_OWNCLOUD": "https://owncloud.org/",
+ "URL_SAAS_WORDPRESS": "https://wordpress.org/",
}
+
+ALLOWED_RESOURCES = getsetting("ALLOWED_RESOURCES")
+
+URL_DB_PHPMYADMIN = getsetting("URL_DB_PHPMYADMIN")
+
+URL_MAILTRAIN = getsetting("URL_MAILTRAIN")
+
+URL_SAAS_GITLAB = getsetting("URL_SAAS_GITLAB")
+
+URL_SAAS_OWNCLOUD = getsetting("URL_SAAS_OWNCLOUD")
+
+URL_SAAS_WORDPRESS = getsetting("URL_SAAS_WORDPRESS")
diff --git a/musician/static/musician/css/default.css b/musician/static/musician/css/default.css
index a95a573..3fbe7da 100644
--- a/musician/static/musician/css/default.css
+++ b/musician/static/musician/css/default.css
@@ -43,6 +43,9 @@ a:hover {
min-width: 280px;
max-width: 280px;
min-height: 100vh;
+
+ position: fixed;
+ z-index: 999;
display: flex;
flex-direction: column;
@@ -127,6 +130,7 @@ a:hover {
background-position: right 5% top 10%;
color: #343434;
padding-left: 2rem;
+ margin-left: 280px; /** sidebar width **/
}
/** services **/
diff --git a/musician/templates/musician/billing.html b/musician/templates/musician/billing.html
index 986cc60..d3ba915 100644
--- a/musician/templates/musician/billing.html
+++ b/musician/templates/musician/billing.html
@@ -16,11 +16,11 @@
-
Number
- Bill date
- Type
- Total
- Download PDF
+ {% trans "Number" %}
+ {% trans "Bill date" %}
+ {% trans "Type" %}
+ {% trans "Total" %}
+ {% trans "Download PDF" %}
{{ domain.mails|length }} {% trans "mail addresses created" %}
- {% if domain.address_left.alert_level %}
+ {% if domain.addresses_left.alert_level %}
- {{ domain.address_left.count }} {% trans "mail address left" %}
+ {{ domain.addresses_left.count }} {% trans "mail address left" %}
{% endif %}
{{ profile.username }}
{{ profile.type }}
-Preferred language: {{ profile.language }}
+{% trans "Preferred language:" %} {{ profile.language|language_name_local }}