2021-07-16 14:11:42 +00:00
|
|
|
from django.shortcuts import render
|
|
|
|
|
2021-07-19 13:13:27 +00:00
|
|
|
from django.shortcuts import render, redirect
|
|
|
|
from django.views.generic import TemplateView, FormView
|
|
|
|
|
2023-06-21 08:26:36 +00:00
|
|
|
import json
|
|
|
|
|
2022-03-04 15:50:37 +00:00
|
|
|
# Helper functions
|
2023-06-21 08:26:36 +00:00
|
|
|
def get_domains():
|
|
|
|
domains = None
|
|
|
|
with open("data/domains.json", "r") as f:
|
|
|
|
data = f.read()
|
|
|
|
domains = json.loads(data)
|
|
|
|
|
|
|
|
return domains
|
|
|
|
|
2022-03-04 15:50:37 +00:00
|
|
|
|
|
|
|
# Create your views here.
|
2024-11-30 00:50:45 +00:00
|
|
|
|
|
|
|
class GenericView(TemplateView):
|
|
|
|
def cx_handle_get(self, request, template, *args, **kwargs):
|
|
|
|
paths = [
|
|
|
|
{"href": "/",
|
|
|
|
"name": "Home"},
|
|
|
|
{"href": "/curriculum-vitae",
|
|
|
|
"name": "Curriculum Vitae"},
|
|
|
|
{"href": "/ukraine",
|
|
|
|
"name": "Ukraine"},
|
|
|
|
|
|
|
|
]
|
|
|
|
return render(request, template, {"paths" : paths})
|
|
|
|
|
|
|
|
class IndexView(GenericView):
|
2021-07-19 13:13:27 +00:00
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs):
|
2024-11-30 00:50:45 +00:00
|
|
|
paths = [
|
|
|
|
{"href": "/",
|
|
|
|
"name": "Home"},
|
|
|
|
{"href": "/curriculum-vitae",
|
|
|
|
"name": "Curriculum Vitae"},
|
|
|
|
{"href": "/ukraine",
|
|
|
|
"name": "Ukraine"},
|
|
|
|
|
|
|
|
]
|
|
|
|
return self.cx_handle_get(request, "index.html", {"paths" : paths})
|
2021-07-19 13:13:27 +00:00
|
|
|
|
2024-11-30 00:50:45 +00:00
|
|
|
class CVView(GenericView):
|
2023-06-21 08:26:36 +00:00
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs):
|
2024-11-30 00:50:45 +00:00
|
|
|
return self.cx_handle_get(request, "CV.html", {})
|
2023-06-21 08:26:36 +00:00
|
|
|
|
2024-11-30 00:50:45 +00:00
|
|
|
class LoremView(GenericView):
|
2023-06-21 08:26:36 +00:00
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs):
|
2024-11-30 00:50:45 +00:00
|
|
|
return self.cx_handle_get(request, "lorem.html", {})
|
2023-06-21 08:26:36 +00:00
|
|
|
|
2024-11-30 00:50:45 +00:00
|
|
|
class UkraineView(GenericView):
|
2023-06-21 08:26:36 +00:00
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
|
domains = get_domains()
|
2024-11-30 00:50:45 +00:00
|
|
|
return self.cx_handle_get(request, "ukraine.html", {"domains" : domains})
|
2023-06-21 08:26:36 +00:00
|
|
|
|
|
|
|
|