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