Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
5490aad0
Commit
5490aad0
authored
Feb 08, 2016
by
Jitka Novotna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preferences
parent
dae26b87
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
3 deletions
+73
-3
weblate/accounts/forms.py
weblate/accounts/forms.py
+20
-1
weblate/accounts/migrations/0015_auto_20160208_1535.py
weblate/accounts/migrations/0015_auto_20160208_1535.py
+25
-0
weblate/accounts/models.py
weblate/accounts/models.py
+23
-0
weblate/accounts/views.py
weblate/accounts/views.py
+4
-2
weblate/html/accounts/profile.html
weblate/html/accounts/profile.html
+1
-0
No files found.
weblate/accounts/forms.py
View file @
5490aad0
...
...
@@ -217,7 +217,7 @@ class SubscriptionSettingsForm(forms.ModelForm):
class UserSettingsForm(forms.ModelForm):
'''
User s
ubscription management
.
User s
ettings form
.
'''
class Meta(object):
model = Profile
...
...
@@ -227,6 +227,25 @@ class UserSettingsForm(forms.ModelForm):
'
hide_source_secondary
',
)
class DashboardSettingsForm(forms.ModelForm):
'''
Dashboard settings form.
'''
class Meta(object):
model = Profile
fields = (
'
dashboard_view
',
'
dashboard_component_list
',
)
def clean(self):
'''
Check if component list is selected when required.
'''
if self.cleaned_data['
dashboard_view
']==Profile.DASHBOARD_COMPONENT_LIST and
\
self.cleaned_data['
dashboard_component_list
'] is None:
raise forms.ValidationError(
_("Componest list must be selected when used as default."))
class UserForm(forms.ModelForm):
'''
...
...
weblate/accounts/migrations/0015_auto_20160208_1535.py
0 → 100644
View file @
5490aad0
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'trans'
,
'0059_auto_20160205_1349'
),
(
'accounts'
,
'0014_auto_20160205_1349'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'profile'
,
name
=
'dashboard_component_list'
,
field
=
models
.
ForeignKey
(
verbose_name
=
'Default component list'
,
blank
=
True
,
to
=
'trans.ComponentList'
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'profile'
,
name
=
'dashboard_view'
,
field
=
models
.
IntegerField
(
default
=
0
,
verbose_name
=
'Default dashboard view'
),
),
]
weblate/accounts/models.py
View file @
5490aad0
...
...
@@ -496,6 +496,29 @@ class Profile(models.Model):
default
=
False
)
DASHBOARD_SUBSCRIPTIONS
=
0
DASHBOARD_LANGUAGES
=
1
DASHBOARD_ALL
=
2
DASHBOARD_COMPONENT_LIST
=
3
DASHBOARD_CHOICES
=
(
(
DASHBOARD_SUBSCRIPTIONS
,
_
(
'Your subscriptions'
)),
(
DASHBOARD_LANGUAGES
,
_
(
'Your languages'
)),
(
DASHBOARD_ALL
,
_
(
'All projects'
)),
(
DASHBOARD_COMPONENT_LIST
,
_
(
'Component list'
)),
)
dashboard_view
=
models
.
IntegerField
(
choices
=
DASHBOARD_CHOICES
,
verbose_name
=
_
(
'Default dashboard view'
),
default
=
DASHBOARD_SUBSCRIPTIONS
,
)
dashboard_component_list
=
models
.
ForeignKey
(
'trans.ComponentList'
,
verbose_name
=
_
(
'Default component list'
),
blank
=
True
,
null
=
True
,
)
subscriptions
=
models
.
ManyToManyField
(
'trans.Project'
,
verbose_name
=
_
(
'Subscribed projects'
),
...
...
weblate/accounts/views.py
View file @
5490aad0
...
...
@@ -53,7 +53,7 @@ from weblate.accounts.models import set_lang, remove_user, Profile
from
weblate.trans.models
import
Change
,
Project
,
SubProject
from
weblate.accounts.forms
import
(
ProfileForm
,
SubscriptionForm
,
UserForm
,
ContactForm
,
SubscriptionSettingsForm
,
UserSettingsForm
SubscriptionSettingsForm
,
UserSettingsForm
,
DashboardSettingsForm
)
from
weblate
import
appsettings
...
...
@@ -147,6 +147,7 @@ def user_profile(request):
SubscriptionForm
,
SubscriptionSettingsForm
,
UserSettingsForm
,
DashboardSettingsForm
,
]
if
request
.
method
==
'POST'
:
...
...
@@ -201,7 +202,8 @@ def user_profile(request):
'subscriptionform'
:
forms
[
1
],
'subscriptionsettingsform'
:
forms
[
2
],
'usersettingsform'
:
forms
[
3
],
'userform'
:
forms
[
4
],
'dashboardsettingsform'
:
forms
[
4
],
'userform'
:
forms
[
5
],
'profile'
:
profile
,
'title'
:
_
(
'User profile'
),
'licenses'
:
license_projects
,
...
...
weblate/html/accounts/profile.html
View file @
5490aad0
...
...
@@ -66,6 +66,7 @@
<div
class=
"panel-heading"
><h4
class=
"panel-title"
>
{% trans "Preferences" %}
</h4></div>
<div
class=
"panel-body"
>
{{ usersettingsform|crispy }}
{{ dashboardsettingsform|crispy }}
</div>
<div
class=
"panel-footer"
>
<input
type=
"submit"
value=
"{% trans "
Save
"
%}"
class=
"btn btn-default"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment