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
2ad9d3b3
Commit
2ad9d3b3
authored
Apr 25, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Require user email in the admin interface
Fixes #1086 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
f066ffe1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
weblate/accounts/admin.py
weblate/accounts/admin.py
+25
-0
No files found.
weblate/accounts/admin.py
View file @
2ad9d3b3
...
@@ -18,8 +18,10 @@
...
@@ -18,8 +18,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
from
django
import
forms
from
django.contrib
import
admin
from
django.contrib
import
admin
from
django.contrib.auth.admin
import
UserAdmin
from
django.contrib.auth.admin
import
UserAdmin
from
django.contrib.auth.forms
import
UserCreationForm
,
UserChangeForm
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
weblate.accounts.models
import
Profile
,
VerifiedEmail
,
AutoGroup
from
weblate.accounts.models
import
Profile
,
VerifiedEmail
,
AutoGroup
...
@@ -53,12 +55,35 @@ class AutoGroupAdmin(admin.ModelAdmin):
...
@@ -53,12 +55,35 @@ class AutoGroupAdmin(admin.ModelAdmin):
admin
.
site
.
register
(
AutoGroup
,
AutoGroupAdmin
)
admin
.
site
.
register
(
AutoGroup
,
AutoGroupAdmin
)
class
WeblateUserChangeForm
(
UserChangeForm
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
WeblateUserChangeForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'email'
].
required
=
True
class
WeblateUserCreationForm
(
UserCreationForm
):
class
Meta
(
object
):
fields
=
(
'username'
,
'email'
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
WeblateUserCreationForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'email'
].
required
=
True
class
WeblateUserAdmin
(
UserAdmin
):
class
WeblateUserAdmin
(
UserAdmin
):
'''
'''
Custom UserAdmin to add listing of group membership and whether user is
Custom UserAdmin to add listing of group membership and whether user is
active.
active.
'''
'''
list_display
=
UserAdmin
.
list_display
+
(
'is_active'
,
'user_groups'
,
'id'
)
list_display
=
UserAdmin
.
list_display
+
(
'is_active'
,
'user_groups'
,
'id'
)
form
=
WeblateUserChangeForm
add_form
=
WeblateUserCreationForm
add_fieldsets
=
(
(
None
,
{
'classes'
:
(
'wide'
,),
'fields'
:
(
'username'
,
'email'
,
'password1'
,
'password2'
),
}),
)
def
user_groups
(
self
,
obj
):
def
user_groups
(
self
,
obj
):
"""
"""
...
...
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