mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-06 04:44:19 +01:00
Things!
This commit is contained in:
@@ -4,19 +4,6 @@ import binascii
|
||||
from .models import Candidate, Season
|
||||
|
||||
|
||||
class SeasonCodeConverter:
|
||||
regex = r"[A-Za-z\d]{5}"
|
||||
|
||||
def to_python(self, value: str) -> Season:
|
||||
try:
|
||||
return Season.objects.get(season_code=value.upper())
|
||||
except Season.DoesNotExist:
|
||||
raise ValueError
|
||||
|
||||
def to_url(self, value: Season) -> str:
|
||||
return value.season_code
|
||||
|
||||
|
||||
class CandidateConverter:
|
||||
regex = r"[A-Za-z\d]{5}\/[\w\-=]+"
|
||||
|
||||
@@ -29,7 +16,7 @@ class CandidateConverter:
|
||||
raise ValueError
|
||||
|
||||
try:
|
||||
season = Season.objects.get(season_code=season_code)
|
||||
season = Season.objects.aget(season_code=season_code)
|
||||
|
||||
candidate = Candidate.objects.get(name=name, season=season)
|
||||
return candidate
|
||||
|
||||
@@ -13,7 +13,7 @@ class Quiz(models.Model):
|
||||
)
|
||||
|
||||
def is_valid_quiz(self) -> bool:
|
||||
pass
|
||||
return True
|
||||
# Check > 0 active questions
|
||||
# Check every question 1 right answer
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<html lang="en" data-bs-theme="dark">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
{# <script src="https://cdn.tailwindcss.com"></script>#}
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from django.urls import path, register_converter
|
||||
|
||||
from .converters import CandidateConverter, SeasonCodeConverter
|
||||
from tvdt.converters import SeasonCodeConverter
|
||||
|
||||
from .converters import CandidateConverter
|
||||
from .views import SelectSeasonView
|
||||
from .views.enternameview import EnterNameView
|
||||
from .views.questionview import QuestionView
|
||||
|
||||
@@ -30,4 +30,10 @@ class SelectSeasonView(FormView):
|
||||
messages.warning(self.request, _("Invalid season code"))
|
||||
return redirect("home")
|
||||
|
||||
from environs import Env
|
||||
|
||||
env = Env()
|
||||
env.read_env()
|
||||
print(env.dump())
|
||||
|
||||
return redirect(reverse("quiz", kwargs={"season": season}))
|
||||
|
||||
Reference in New Issue
Block a user