From a2c79871592fc738e086a9378d6fe3ac99581617 Mon Sep 17 00:00:00 2001 From: Michael Murtaugh Date: Tue, 28 Jan 2025 16:35:56 +0100 Subject: [PATCH] updated index based on xpub1 feedback --- call/static/call/guestbook.css | 3 +- call/static/call/index.css | 3 ++ call/templates/call/creature_detail.html | 47 +++++++++++++++++-- call/templates/call/index.html | 58 +++++++++++++----------- call/urls.py | 4 +- call/views.py | 21 +++++++-- 6 files changed, 101 insertions(+), 35 deletions(-) diff --git a/call/static/call/guestbook.css b/call/static/call/guestbook.css index cac43f6..2b1e6c1 100644 --- a/call/static/call/guestbook.css +++ b/call/static/call/guestbook.css @@ -27,7 +27,7 @@ div.caption { position: absolute; left: -120px; width: 240px; - } +} div.caption .corner { width: 11px; height: 11px; @@ -39,6 +39,7 @@ div.caption .corner { div.caption div.captiontext { /* height: 4em; */ width: 100%; + background: white; border: 1px solid black; /* top | right | bottom | left */ padding: 0 0.3em 0.3em 0.3em; diff --git a/call/static/call/index.css b/call/static/call/index.css index 96df9de..c12628a 100644 --- a/call/static/call/index.css +++ b/call/static/call/index.css @@ -16,6 +16,9 @@ h1 { margin: 0 0 10px 0; padding: 0; } +h2 { + font-size: 28px; +} #root { max-width: 512px; /* white-space: nowrap; */ diff --git a/call/templates/call/creature_detail.html b/call/templates/call/creature_detail.html index fda1389..bb77633 100644 --- a/call/templates/call/creature_detail.html +++ b/call/templates/call/creature_detail.html @@ -1,7 +1,48 @@ {% extends "call/base.html" %} +{% load static %} +{% block extrahead %} + + +{% endblock %} {% block content %} - - -

{{object.caption}}

+
+
+
{{creature.caption}}
+
+
{% endblock %} \ No newline at end of file diff --git a/call/templates/call/index.html b/call/templates/call/index.html index d4cee8d..af42a3c 100644 --- a/call/templates/call/index.html +++ b/call/templates/call/index.html @@ -6,9 +6,37 @@ {% block content %} -

XPUB Community Builder...

+

Study @ XPUB!

loading...
+ +
+

+ The Master Experimental Publishing (XPUB) at the Piet Zwart Institute in Rotterdam (NL) is a two-year master focused on the acts of making things public and creating publics in the age of post-digital networks. +

+

XPUB is looking for new students! Come & join us!

+

Use the XPUB Community Builder below to put yourself on our digital guestbook, join an upcoming open day either online or in-person, and APPLY!

+

Application deadlines:

+

+

    +
  • March 4, 2024 (non-EU final + EU priority deadline)
  • +
  • May 8, 2024 (final EU deadline)
  • +
+

+

Open days:

+

+

+

+

+ +

+
+ +

XPUB Community Builder

+
@@ -75,32 +103,10 @@

-
-

- The Master Experimental Publishing (XPUB) at the Piet Zwart Institute in Rotterdam (NL) is a two-year master focused on the acts of making things public and creating publics in the age of post-digital networks. -

-

Application deadlines:

-

-

-

-

Open days:

-

-

-

-

- -

-
- -
- +
+ +
diff --git a/call/urls.py b/call/urls.py index 2476cac..03194f2 100644 --- a/call/urls.py +++ b/call/urls.py @@ -17,14 +17,14 @@ Including another URLconf from django.contrib import admin from django.urls import path, include from call import views -from .views import Guestbook, CreatureList, CreatureDetail, creature_frame +from .views import Guestbook, CreatureList, creature_detail, creature_frame urlpatterns = [ path("guestbook/", Guestbook.as_view(), name="guestbook"), # path("creatures//s/", Statement.as_view(), name="statement"), # path("creatures//w/", Walk.as_view(), name="walk"), path("creatures/", CreatureList.as_view(), name="creature_list"), - path("creatures//", CreatureDetail.as_view(), name="creature_detail"), + path("creatures//", creature_detail, name="creature_detail"), path("creatures//frame/", creature_frame, name="creature_frame"), path('', views.index) ] diff --git a/call/views.py b/call/views.py index 621330f..2f8f821 100644 --- a/call/views.py +++ b/call/views.py @@ -5,6 +5,7 @@ from .models import Creature from django.urls import reverse # from io import StringIO from PIL import Image +from random import randint, seed def index(request): @@ -40,15 +41,29 @@ class CreatureList(generic.ListView): template_name = "call/creature_list.html" queryset = Creature.objects.filter(published=True) -class CreatureDetail(generic.DetailView): +def creature_detail(request, creature_id): """ Generates Pixelated PNG of creature """ - model = Creature - template_name = "call/creature_detail.html" + context = {} + context['creature'] = get_object_or_404(Creature, pk=creature_id) + context['cell'] = int(request.GET.get("cell", "0")) + seed(creature_id) + context['bg_hue'] = randint(0, 360) + context['bg_sat'] = 100 + context['bg_lightness'] = randint(50, 100) + return render(request, "call/creature_detail.html", context) def creature_frame (request, creature_id): """ Generates Pixelated PNG of creature """ + cell = int(request.GET.get("cell", "0")) creature = get_object_or_404(Creature, pk=creature_id) im = Image.open(creature.image.path) response = HttpResponse(content_type="image/png") + scale = 6 # 24 + im = im.crop((16*cell, 0, (16*cell)+16, 16)) + w, h = im.size + im = im.resize((w*scale,h*scale), resample=Image.NEAREST) im.save(response, "PNG") + #im_with_background = Image.new("RGBA", (w*scale, h*scale), (128,0,0)) + #im_with_background.paste(im, mask=im) + #im_with_background.save(response, "PNG") return response