Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
go
Commits
368a148c
Commit
368a148c
authored
Nov 16, 2016
by
Zosman
Browse files
This commit refreshes /useradmin once admin deletes a user to prevent null pointer error
parent
052e28ea
Pipeline
#473
passed with stage
in 7 minutes and 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
go/go/templates/admin/useradmin.html
View file @
368a148c
...
...
@@ -92,7 +92,6 @@ SRCT Go • Administration Panel
<th>
Username
</th>
<th>
Full Name
</th>
<th>
Description
</th>
<th>
Is Blocked
</th>
</tr>
</thead>
<tbody>
...
...
@@ -103,7 +102,6 @@ SRCT Go • Administration Panel
<td>
{{ blockedUsers.user }}
</td>
<td>
{{ blockedUsers.full_name }}
</td>
<td>
{{ blockedUsers.description|default:"No description provided" }}
</td>
<td>
{{ blockedUsers.blocked }}
</td>
</tr>
{% empty %}
<tr>
...
...
@@ -111,7 +109,6 @@ SRCT Go • Administration Panel
<td>
none
</td>
<td>
none
</td>
<td>
none
</td>
<td>
none
</td>
</tr>
{% endfor %}
...
...
@@ -148,7 +145,6 @@ SRCT Go • Administration Panel
<th>
Username
</th>
<th>
Full Name
</th>
<th>
Description
</th>
<th>
Is Blocked
</th>
</tr>
</thead>
<tbody>
...
...
@@ -159,7 +155,6 @@ SRCT Go • Administration Panel
<td>
{{ currentUsers.user }}
</td>
<td>
{{ currentUsers.full_name }}
</td>
<td>
{{ currentUsers.description|default:"No description provided" }}
</td>
<td>
{{ currentUsers.blocked }}
</td>
</tr>
{% empty %}
<tr>
...
...
@@ -167,7 +162,6 @@ SRCT Go • Administration Panel
<td>
none
</td>
<td>
none
</td>
<td>
none
</td>
<td>
none
</td>
</tr>
{% endfor %}
...
...
go/go/views.py
View file @
368a148c
# Django Imports
from
django.conf
import
settings
from
django.http
import
HttpResponseServerError
# Http404
from
django.http
import
HttpResponseRedirect
from
django.utils
import
timezone
from
django.core.exceptions
import
PermissionDenied
# ValidationError
from
django.core.mail
import
send_mail
,
EmailMessage
...
...
@@ -329,6 +330,7 @@ def useradmin(request):
[
user_mail
]
)
todeny
.
user
.
delete
()
return
HttpResponseRedirect
(
'useradmin'
)
elif
'_block'
in
request
.
POST
:
for
name
in
userlist
:
toblock
=
RegisteredUser
.
objects
.
get
(
user__username__exact
=
name
)
...
...
@@ -373,6 +375,7 @@ def useradmin(request):
[
user_mail
]
)
toUNblock
.
user
.
delete
()
return
HttpResponseRedirect
(
'useradmin'
)
# toUNblock.blocked = False
# toUNblock.approved = False
# toUNblock.save()
...
...
@@ -395,6 +398,7 @@ def useradmin(request):
[
user_mail
]
)
toremove
.
user
.
delete
()
return
HttpResponseRedirect
(
'useradmin'
)
need_approval
=
RegisteredUser
.
objects
.
filter
(
registered
=
True
).
filter
(
approved
=
False
)
current_users
=
RegisteredUser
.
objects
.
filter
(
approved
=
True
).
filter
(
registered
=
True
)
...
...
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