Skip to content

Commit

Permalink
429 handling #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Smilinko committed Nov 22, 2024
1 parent bb88ed3 commit 802b497
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions competition/templates/competition/error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% extends "competition/base.html" %}

Nastala chyba
6 changes: 5 additions & 1 deletion competition/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def view_404(request, exception=None): # pylint: disable=unused-argument
return redirect('competition:pravidla')


def view_429(request, exception=None):
return render(request, 'competetion/error.html')


def create_invoice(user, game: Game):
competitor = Competitor.get_competitor(user, game)
payment = Payment.objects.create(
Expand Down Expand Up @@ -128,7 +132,7 @@ class EditProfileView(LoginRequiredMixin, FormView):
success_url = reverse_lazy('competition:profile')

def get_initial(self):

initial = super().get_initial()
try:
competitor = Competitor.get_competitor(
Expand Down
3 changes: 2 additions & 1 deletion mas_problem/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@
urlpatterns.append(
re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT / 'public'})
)
handler404 = 'competition.views.view_404'
handler404 = 'competition.views.view_404'
handler429 = 'competetion.views.view_429'

0 comments on commit 802b497

Please sign in to comment.