This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(templates): add the initial project templates
- Loading branch information
1 parent
3c32e77
commit 8ad63cf
Showing
9 changed files
with
131 additions
and
13 deletions.
There are no files selected for viewing
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
from os.path import join | ||
from pathlib import Path | ||
|
||
from environ import Env | ||
|
||
BASE_DIR = Path(__file__).parent.parent.parent | ||
APPS_DIR = BASE_DIR / "apps" | ||
|
||
# Load environment variables from config/.env file. See | ||
# https://django-environ.readthedocs.io/en/latest/ | ||
|
||
env = Env() | ||
env.read_env(join(BASE_DIR, "config", ".env")) | ||
READ_DOTENV = env.bool("DJANGO_READ_DOTENV", default=False) | ||
|
||
if READ_DOTENV: | ||
env.read_env(BASE_DIR / "config" / ".env") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
from django.contrib import admin | ||
from django.urls import path | ||
from django.urls import include, path | ||
from django.views.generic import TemplateView | ||
|
||
home_view = TemplateView.as_view(template_name="pages/home.html") | ||
|
||
urlpatterns = [ | ||
path("admin/", admin.site.urls), | ||
path("", include("django.contrib.auth.urls")), | ||
path("", home_view, name="home"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% load static i18n %} | ||
{% get_current_language as LANGUAGE_CODE %} | ||
<!DOCTYPE html> | ||
<html lang="{{ LANGUAGE_CODE }}"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>{% block title %}{% endblock title %} | Virtual Judge</title> | ||
</head> | ||
<body> | ||
<header> | ||
<nav> | ||
<ul> | ||
<li><a href="{% url 'login' %}">Login</a></li> | ||
</ul> | ||
</nav> | ||
</header> | ||
|
||
<main> | ||
{% block content %}{% endblock content %} | ||
</main> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block title %}Home{% endblock title %} | ||
|
||
{% block content %} | ||
<h1>Home</h1> | ||
|
||
{% if user.is_authenticated %} | ||
<p>Welcome, {{ user.username }}!</p> | ||
{% else %} | ||
<p>Welcome, new user!</p> | ||
{% endif %} | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block title %}Login{% endblock title %} | ||
|
||
{% block content %} | ||
{% if form.errors %} | ||
<p>Your username and password didn't match. Please try again.</p> | ||
{% endif %} | ||
|
||
{% if next %} | ||
{% if user.is_authenticated %} | ||
<p>Your account doesn't have access to this page. To proceed, | ||
please login with an account that has access.</p> | ||
{% else %} | ||
<p>Please login to see this page.</p> | ||
{% endif %} | ||
{% endif %} | ||
|
||
<form method="post" action="{% url 'login' %}"> | ||
{% csrf_token %} | ||
<table> | ||
<tr> | ||
<td>{{ form.username.label_tag }}</td> | ||
<td>{{ form.username }}</td> | ||
</tr> | ||
<tr> | ||
<td>{{ form.password.label_tag }}</td> | ||
<td>{{ form.password }}</td> | ||
</tr> | ||
</table> | ||
|
||
<input type="submit" value="login"> | ||
<input type="hidden" name="next" value="{{ next }}"> | ||
</form> | ||
|
||
{# Assumes you set up the password_reset view in your URLconf #} | ||
<p><a href="{% url 'password_reset' %}">Lost password?</a></p> | ||
{% endblock %} |