Commit 97e195f2 authored by Daniel W Bond's avatar Daniel W Bond

now the only remaining page needing block filters is the majors page

parent bfa76a06
......@@ -40,6 +40,7 @@ SRCT Roomlist • Search Students
{% endif %}
{% for result in page.object_list %}
{% if not result.object.user.student in request.user.student.blocked_kids.all %}
<tr>
<td>
<h4>{{ result.object.user.username }}</h4>
......@@ -55,6 +56,7 @@ SRCT Roomlist &bull; Search Students
{% endif %}
</td>
</tr>
{% endif %}
{% empty %}
<h3 class="text-center">No results found.</h3>
{% endfor %}
......
......@@ -418,6 +418,10 @@ class CreateConfirmation(LoginRequiredMixin, CreateView):
if flags >= 1:
return HttpResponseForbidden()
# you can't see the page if the person has banned you
if confirmer in student.blocked_kids.all():
raise Http404
return super(CreateConfirmation, self).get(request, *args, **kwargs)
......
......@@ -7,6 +7,8 @@ from django.views.generic import (View, DetailView, TemplateView)
from braces.views import LoginRequiredMixin
from cas.views import login as cas_login
from accounts.models import Student
# imports from your apps
from housing.views import shadowbanning
class HomePageView(View):
def get(self, request, *args, **kwargs):
......@@ -25,10 +27,13 @@ class LandingPage(LoginRequiredMixin, TemplateView):
context['me'] = me
# Create Dictionaries to store Students that meet criteria
context["roomies"] = Student.objects.filter(room=me.room).exclude(user__username=me)
context["floories"] = Student.objects.filter(room__floor=me.get_floor()).exclude(user__username=me).exclude(room=me.room).order_by('room')
context["majormates"] = Student.objects.filter(major=me.major).exclude(user__username=me).order_by('?')[:8]
roomies = Student.objects.filter(room=me.room).exclude(user__username=me)
floories = Student.objects.filter(room__floor=me.get_floor()).exclude(user__username=me).exclude(room=me.room).order_by('room')
majormates = Student.objects.filter(major=me.major).exclude(user__username=me).order_by('?')[:8]
context["roomies"] = shadowbanning(me, roomies)
context["floories"] = shadowbanning(me, floories)
context["majormates"] = shadowbanning(me, majormates)
# Hack to Correctly Display Building plus Floor
#floor = str(me.get_floor())
#if floor[len(floor)-1:len(floor)] == "1":
......
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