Commit 7a185db5 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

Merge branch 'master' into breadcrumbs

parents a2465a36 22808e25
......@@ -53,3 +53,7 @@ secret.py
# migrations
*migrations*
/migrations
# search files
/whoosh_index
*.seg
*.toc
......@@ -48,7 +48,7 @@ SRCT Roomlist • Search Students
<a href="{{ result.object.get_absolute_url }}"><h4><strong>{{ result.object.user.get_full_name }}</strong></h4></a>
</td>
<td>
<h4>{{ result.object.major }}</h4>
<a href="{{ result.object.major.get_absolute_url }}"><h4>{{ result.object.major }}</h4></a>
</td>
</tr>
{% empty %}
......
......@@ -238,6 +238,13 @@ class UpdateStudent(LoginRequiredMixin, FormView):
return reverse('detail_student',
kwargs={'slug':self.request.user.username})
@ratelimit(key='user', rate='5/m', method='POST', block=True)
@ratelimit(key='user', rate='10/d', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(UpdateStudent, self).post(request, *args, **kwargs)
# welcome pages
class WelcomeName(LoginRequiredMixin, FormView):
template_name = 'welcome_name.html'
......@@ -264,7 +271,7 @@ class WelcomeName(LoginRequiredMixin, FormView):
'gender': me.gender, })
context['my_form'] = form
return context
def form_valid(self, form):
me = Student.objects.get(user=self.request.user)
......@@ -284,6 +291,11 @@ class WelcomeName(LoginRequiredMixin, FormView):
return reverse('welcomePrivacy',
kwargs={'slug':self.request.user.username})
@ratelimit(key='user', rate='5/m', method='POST', block=True)
@ratelimit(key='user', rate='10/d', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(WelcomeName, self).post(request, *args, **kwargs)
class WelcomePrivacy(LoginRequiredMixin, UpdateView):
model = Student
......@@ -315,6 +327,11 @@ class WelcomePrivacy(LoginRequiredMixin, UpdateView):
return reverse('welcomeMajor',
kwargs={'slug':self.request.user.username})
@ratelimit(key='user', rate='5/m', method='POST', block=True)
@ratelimit(key='user', rate='10/d', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(WelcomePrivacy, self).post(request, *args, **kwargs)
class WelcomeMajor(LoginRequiredMixin, UpdateView):
model = Student
......@@ -346,6 +363,11 @@ class WelcomeMajor(LoginRequiredMixin, UpdateView):
return reverse('welcomeSocial',
kwargs={'slug':self.request.user.username})
@ratelimit(key='user', rate='5/m', method='POST', block=True)
@ratelimit(key='user', rate='10/d', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(WelcomeMajor, self).post(request, *args, **kwargs)
class WelcomeSocial(LoginRequiredMixin, DetailView):
model = Student
......@@ -378,6 +400,11 @@ class WelcomeSocial(LoginRequiredMixin, DetailView):
return reverse('detail_student',
kwargs={'slug':self.request.user.username})
@ratelimit(key='user', rate='5/m', method='POST', block=True)
@ratelimit(key='user', rate='10/d', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(UpdateStudent, self).post(request, *args, **kwargs)
# majors pages
class ListMajors(LoginRequiredMixin, ListView):
......
......@@ -18,10 +18,12 @@
</div>
</div>
{% load humanize %}
<div class="row">
{% for floor in floors %}
<div class="col-sm-3 text-center">
<a href="{{ floor.get_absolute_url }}" class="btn btn-primary btn-lg btn-block">{{ floor.number }}</a>
<a href="{{ floor.get_absolute_url }}" class="btn btn-primary btn-lg btn-block">{{ floor.number|ordinal }} Floor</a>
</div>
{% endfor %}
</div>
......
{% extends 'layouts/base.html' %}
{% block title %} SRCT Roomlist &bull; {{ floor.building.name }} {{ floor.number }}{% endblock %}
{% block content %}
{% load humanize %}
{% block title %} SRCT Roomlist &bull; {{ floor.building.name }} {{ floor.number|ordinal }}{% endblock %}
{% block content %}
<div class="page-header" id="banner">
<div class="row">
......
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