From bc9533c8b76a99d3c407bdbc8edef1443717109f Mon Sep 17 00:00:00 2001 From: Alie Date: Wed, 21 Jun 2023 13:30:08 +0200 Subject: [PATCH] signbook read done --- .gitignore | 7 +- old/ads.php | 28 -------- personalWebpage/webpage/admin.py | 4 ++ .../webpage/migrations/__init__.py | 0 personalWebpage/webpage/models.py | 13 ++++ personalWebpage/webpage/static/style.css | 4 ++ personalWebpage/webpage/templates/index.html | 2 +- .../webpage/templates/signbook.html | 72 +++++++++++++++++++ personalWebpage/webpage/urls.py | 1 + personalWebpage/webpage/views.py | 11 +++ 10 files changed, 112 insertions(+), 30 deletions(-) delete mode 100755 old/ads.php delete mode 100644 personalWebpage/webpage/migrations/__init__.py create mode 100755 personalWebpage/webpage/templates/signbook.html diff --git a/.gitignore b/.gitignore index e37b20d..a89db0d 100755 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,9 @@ ftp/ __pycache__/ local_settings.py db.sqlite3 -media \ No newline at end of file +media +migrarions/ + +### Testing ### +.coverage +htmlcov/ diff --git a/old/ads.php b/old/ads.php deleted file mode 100755 index 9de46e9..0000000 --- a/old/ads.php +++ /dev/null @@ -1,28 +0,0 @@ - - - - - THE YELLOW PAGES - - - - -
-

Silly fake ads:

-

- "; - } - ?> -

-
- - diff --git a/personalWebpage/webpage/admin.py b/personalWebpage/webpage/admin.py index 8c38f3f..6bbd798 100644 --- a/personalWebpage/webpage/admin.py +++ b/personalWebpage/webpage/admin.py @@ -1,3 +1,7 @@ from django.contrib import admin +from .models import Booksigner + # Register your models here. + +admin.site.register(Booksigner) \ No newline at end of file diff --git a/personalWebpage/webpage/migrations/__init__.py b/personalWebpage/webpage/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/personalWebpage/webpage/models.py b/personalWebpage/webpage/models.py index 9cd7704..73406d4 100644 --- a/personalWebpage/webpage/models.py +++ b/personalWebpage/webpage/models.py @@ -2,3 +2,16 @@ from django.db import models from django.utils import timezone from django.contrib import admin # Create your models here. + +class Booksigner(models.Model): + name = models.CharField(max_length=50) + website = models.CharField(blank=True, max_length=200) + email = models.EmailField(blank=True, ) + comment = models.CharField(blank=True, max_length=500) + hosting = models.CharField(max_length=10) +""" def __str__(self) -> str: + return self.name """ +""" if(strpos($_SERVER["HTTP_HOST"], ".onion")){ $hosting = "tor!";} + elseif(strpos($_SERVER["HTTP_HOST"], ".i2p")){ $hosting = "i2p!";} + elseif(strpos($_SERVER["HTTP_HOST"], ".fai")){ $hosting = "fai!";} + else{$hosting = "???!";} """ \ No newline at end of file diff --git a/personalWebpage/webpage/static/style.css b/personalWebpage/webpage/static/style.css index 41df750..c077d92 100755 --- a/personalWebpage/webpage/static/style.css +++ b/personalWebpage/webpage/static/style.css @@ -81,3 +81,7 @@ h3 { .disclosure-closed { list-style: disclosure-closed; } + +.error{ + color: red; +} \ No newline at end of file diff --git a/personalWebpage/webpage/templates/index.html b/personalWebpage/webpage/templates/index.html index 5513ae0..e06dc68 100755 --- a/personalWebpage/webpage/templates/index.html +++ b/personalWebpage/webpage/templates/index.html @@ -10,7 +10,7 @@

-Pages:

-Banners

diff --git a/personalWebpage/webpage/templates/signbook.html b/personalWebpage/webpage/templates/signbook.html new file mode 100755 index 0000000..0269fc1 --- /dev/null +++ b/personalWebpage/webpage/templates/signbook.html @@ -0,0 +1,72 @@ + + + {% include "head.html" %} + +
+

+ Cool signers: +

+ {% if signer_list %} +

+

+

+ {% else %} +

+ No one signed here :( +

+ {% endif %} +
+
+

+ Be part of this cuties! +

+

+

+

+
+ Name: + + * +
+
+ Website: + +
+
+ E-mail: + +
+
+ Comment: + +
+

+ Capcha(Say that you love "me"): + + * +

+ +
+

+

+
+ + diff --git a/personalWebpage/webpage/urls.py b/personalWebpage/webpage/urls.py index e3b497e..813079b 100644 --- a/personalWebpage/webpage/urls.py +++ b/personalWebpage/webpage/urls.py @@ -4,6 +4,7 @@ from . import views app_name = "webpage" urlpatterns = [ + path("signbook/", views.signbook, name="signbook"), path("about/", views.about, name="about"), path("", views.index, name="index"), ] \ No newline at end of file diff --git a/personalWebpage/webpage/views.py b/personalWebpage/webpage/views.py index 6a58549..3b07d9b 100644 --- a/personalWebpage/webpage/views.py +++ b/personalWebpage/webpage/views.py @@ -2,6 +2,8 @@ from django.http import HttpResponseNotFound from django.shortcuts import render import os, random +from .models import Booksigner + def image_dict_from_name_list(name_list: list[str]): dict_list = [] for name in name_list: @@ -40,3 +42,12 @@ def index(request): def about(request): return render(request, "about.html", {"title": "About Me"}) + +def signbook(request): + signer_list = Booksigner.objects.all() + + context = { + "title": "THE GUESTBOOK", + "signer_list": signer_list + } + return render(request, "signbook.html", context) \ No newline at end of file