Commit 368a148c authored by Zosman's avatar 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
......@@ -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 &bull; 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 &bull; Administration Panel
<td>none</td>
<td>none</td>
<td>none</td>
<td>none</td>
</tr>
{% endfor %}
......@@ -148,7 +145,6 @@ SRCT Go &bull; 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 &bull; 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 &bull; Administration Panel
<td>none</td>
<td>none</td>
<td>none</td>
<td>none</td>
</tr>
{% endfor %}
......
# 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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment