Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5ab1002f
authored
Mar 10, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fixed save button on group add user
parent
ad7b9ac7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
circle/dashboard/templates/dashboard/group-detail.html
+1
-1
circle/dashboard/views.py
+14
-9
No files found.
circle/dashboard/templates/dashboard/group-detail.html
View file @
5ab1002f
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
<textarea
name=
"list-new-list"
class=
"form-control"
></textarea>
<textarea
name=
"list-new-
name
list"
class=
"form-control"
></textarea>
<div
class=
"form-actions"
>
<div
class=
"form-actions"
>
<button
type=
"submit"
class=
"btn btn-success"
>
{% trans "Save" %}
</button>
<button
type=
"submit"
class=
"btn btn-success"
>
{% trans "Save" %}
</button>
</div>
</div>
...
...
circle/dashboard/views.py
View file @
5ab1002f
...
@@ -595,30 +595,35 @@ class GroupDetailView(CheckedDetailView):
...
@@ -595,30 +595,35 @@ class GroupDetailView(CheckedDetailView):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
if
request
.
POST
.
get
(
'new_name'
):
if
request
.
POST
.
get
(
'new_name'
):
return
self
.
__set_name
(
request
)
return
self
.
__set_name
(
request
)
if
request
.
POST
.
get
(
'list-new-name'
)
is
not
None
:
if
request
.
POST
.
get
(
'list-new-name'
):
return
self
.
__add_user
(
request
)
return
self
.
__add_user
(
request
)
elif
request
.
POST
.
get
(
'list-new-list'
)
is
not
None
:
if
request
.
POST
.
get
(
'list-new-namelist'
)
:
return
self
.
__add_list
(
request
)
return
self
.
__add_list
(
request
)
if
(
request
.
POST
.
get
(
'list-new-name'
)
is
not
None
)
and
\
(
request
.
POST
.
get
(
'list-new-namelist'
)
is
not
None
):
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
kwargs
=
{
'pk'
:
self
.
get_object
()
.
pk
}))
def
__add_user
(
self
,
request
):
def
__add_user
(
self
,
request
):
name
=
request
.
POST
[
'list-new-name'
]
name
=
request
.
POST
[
'list-new-name'
]
return
self
.
__add_username
(
request
,
name
)
self
.
__add_username
(
request
,
name
)
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
def
__add_username
(
self
,
request
,
name
):
def
__add_username
(
self
,
request
,
name
):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
if
not
name
:
if
not
name
:
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
return
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
try
:
try
:
entity
=
User
.
objects
.
get
(
username
=
name
)
entity
=
User
.
objects
.
get
(
username
=
name
)
self
.
object
.
user_set
.
add
(
entity
)
self
.
object
.
user_set
.
add
(
entity
)
except
User
.
DoesNotExist
:
except
User
.
DoesNotExist
:
warning
(
request
,
_
(
'User "
%
s" not found.'
)
%
name
)
warning
(
request
,
_
(
'User "
%
s" not found.'
)
%
name
)
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
def
__add_list
(
self
,
request
,
name
):
def
__add_list
(
self
,
request
):
userlist
=
request
.
POST
.
get
(
'list-new-namelist'
)
.
split
(
'
\r\n
'
)
for
line
in
userlist
:
self
.
__add_username
(
request
,
line
)
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
...
...
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