Skip to content

Commit

Permalink
Update site handlers
Browse files Browse the repository at this point in the history
- use dictionary literal instead of two-step build for context
- redirect /ong to my-account if ngo is logged in
  • Loading branch information
tudoramariei committed Jan 4, 2024
1 parent a8e5722 commit 568dcf4
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions backend/donations/views/site.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.shortcuts import render
from django.shortcuts import redirect, render
from django.conf import settings
from django.urls import reverse

from .base import BaseHandler

Expand All @@ -22,17 +23,18 @@ class AboutHandler(BaseHandler):
template_name = "despre.html"

def get(self, request, *args, **kwargs):
context = {}
context["title"] = "Despre Redirectioneaza.ro"
context = {"title": "Despre Redirectioneaza.ro"}
return render(request, self.template_name, context)


class ForNgoHandler(BaseHandler):
template_name = "for-ngos.html"

def get(self, request, *args, **kwargs):
context = {}
context["title"] = "Pentru ONG-uri"
if request.user.is_authenticated:
return redirect(reverse("contul-meu"))

context = {"title": "Pentru ONG-uri"}
return render(request, self.template_name, context)


Expand All @@ -44,24 +46,21 @@ class NoteHandler(BaseHandler):
template_name = "note.html"

def get(self, request, *args, **kwargs):
context = {}
context["title"] = "Notă de informare"
context = {"title": "Notă de informare"}
return render(request, self.template_name, context)


class PolicyHandler(BaseHandler):
template_name = "policy.html"

def get(self, request, *args, **kwargs):
context = {}
context["title"] = "Politica de confidențialitate"
context = {"title": "Politica de confidențialitate"}
return render(request, self.template_name, context)


class TermsHandler(BaseHandler):
template_name = "terms.html"

def get(self, request, *args, **kwargs):
context = {}
context["title"] = "Termeni și condiții"
context = {"title": "Termeni și condiții"}
return render(request, self.template_name, context)

0 comments on commit 568dcf4

Please sign in to comment.