signbook read done

This commit is contained in:
Alie 2023-06-21 13:30:08 +02:00
parent 387914e0c1
commit bc9533c8b7
10 changed files with 112 additions and 30 deletions

7
.gitignore vendored
View File

@ -8,4 +8,9 @@ ftp/
__pycache__/
local_settings.py
db.sqlite3
media
media
migrarions/
### Testing ###
.coverage
htmlcov/

View File

@ -1,28 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>THE YELLOW PAGES</title>
<link href="style.css" rel="stylesheet">
<link href="icon.png" rel="icon">
</head>
<body id="index">
<div class="centercubepleaseind">
<h1>Silly fake ads:</h1>
<p style="text-align: left;">
<?php
$adslist = fopen("ads/ads", "r") or die("Unable to open file!");
// Output one line until end-of-file
while(!feof($adslist)) {
$adarray[] = fgets($adslist);
}
fclose($adslist);
foreach($adarray as $adunit){
echo $adunit;
echo "<br>";
}
?>
</p>
</div>
</body>
</html>

View File

@ -1,3 +1,7 @@
from django.contrib import admin
from .models import Booksigner
# Register your models here.
admin.site.register(Booksigner)

View File

@ -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 = "???!";} """

View File

@ -81,3 +81,7 @@ h3 {
.disclosure-closed {
list-style: disclosure-closed;
}
.error{
color: red;
}

View File

@ -10,7 +10,7 @@
<h2>-Pages:</h2>
<ul class="disclosure-closed">
<li><a href="about/">About me</a></li>
<li><a href="book/">Signbook</a></li>
<li><a href="signbook/">Signbook</a></li>
</ul>
<h2>-Banners</h2>
<div class="img">

View File

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html lang="en">
{% include "head.html" %}
<body id="index">
<div class="centercubeplease">
<h1>
Cool signers:
</h1>
{% if signer_list %}
<p>
<ul>
{% for signer in signer_list %}
<li>
{{ signer.hosting }}*
<a href="{{ signer.website }}">
<b>
{{ signer.name }}
</b>
</a> said:
<b>
{{ signer.comment }}.
</b>
{% if signer.email %}
Pester on:
<a href="mailto:{{ signer.email }}">{{ signer.email }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
</p>
{% else %}
<p>
No one signed here :(
</p>
{% endif %}
</div>
<div class="centerade">
<h2>
Be part of this cuties!
</h2>
<p>
<p>
<form method="post" action="">
<div>
Name:
<input type="text" name="name" />
<span class="error">*</span>
</div>
<div>
Website:
<input type="text" name="website" />
</div>
<div>
E-mail:
<input type="text" name="email" />
</div>
<div>
Comment:
<textarea name="comment" rows="1"></textarea>
</div>
<p>
Capcha(Say that you love "me"):
<input type="text" name="capcha" />
<span class="error">*</span>
</p>
<input type="submit" />
</form>
</p>
</p>
</div>
</body>
</html>

View File

@ -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"),
]

View File

@ -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)