This commit is contained in:
j 2021-10-11 13:26:51 +01:00
parent 2cbd101c85
commit d5b3076645
7 changed files with 31 additions and 44 deletions

View file

@ -1,15 +1,14 @@
.films { .films {
width: 100vw;
margin: 8px; margin: 8px;
box-sizing: border-box;
a { a {
color: #ee0; color: #ee0;
text-decoration: none; text-decoration: none;
} }
.film { .film {
width: 100vw;
margin-bottom: 16px; margin-bottom: 16px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -28,12 +27,6 @@
.film { .film {
margin-bottom: 16px; margin-bottom: 16px;
flex-direction: column; flex-direction: column;
.left, .right {
width: 100%;
img {
max-width: 100%;
}
}
h2 { h2 {
margin-bottom: 8px; margin-bottom: 8px;
} }

View file

@ -1,5 +0,0 @@
{% extends "base.html" %}
{% block main %}
about page
{% endblock %}

View file

@ -31,15 +31,6 @@
{% block main %}{% endblock main %} {% block main %}{% endblock main %}
</main> </main>
{% block end %}{% endblock end %} {% block end %}{% endblock end %}
<script> <script src="{% static 'js/menu.js' %}"></script>
document.querySelectorAll(".topnav a.icon").forEach(a => {
a.onclick = (event) => {
var nav = document.querySelector('.topnav nav')
nav.style.display = nav.style.display === 'block' ? 'none' : 'block'
event.preventDefault()
event.stopPropagation()
}
})
</script>
</body> </body>
</html> </html>

View file

@ -3,19 +3,9 @@
<div class="films"> <div class="films">
{% for film in films %} {% for film in films %}
<div class="film"> <div class="film">
<div class="left">
<h1><a href="{% url 'film' film.slug %}">{{ film.data.title | safe }}</a></h1> <h1><a href="{% url 'film' film.slug %}">{{ film.data.title | safe }}</a></h1>
<h2>{{ film.data.director|join:", "|safe }}</h2> <h2>{{ film.data.director|join:", "|safe }}</h2>
</div> </div>
{% comment %}
<div class="right">
<a href="{% url 'film' film.slug %}">
<img src="{{ settings.TIMELINE_PREFIX }}{{ film.padma_id }}/timeline.jpg">
</a>
</div>
{% endcomment %}
</div>
{% endfor %} {% endfor %}
</div> </div>
{% endblock %} {% endblock %}

View file

@ -12,14 +12,24 @@ class Page(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True) modified = models.DateTimeField(auto_now=True)
slug = models.SlugField() slug = models.SlugField(blank=True)
public = models.BooleanField(default=False) public = models.BooleanField(default=False)
data = models.JSONField(default=dict)
title = models.TextField() title = models.TextField(blank=True)
teaser = models.TextField() #teaser = models.TextField(blank=True)
body = models.TextField() body = models.TextField(blank=True)
data = models.JSONField(default=dict, blank=True)
def __str__(self):
return '%s (%s)' % (self.title, self.slug)
def get_absolute_url(self):
if self.slug:
return '/' + settings.URL_PREFIX + '' + self.slug
else:
return '/' + settings.URL_PREFIX[:-1]
class Text(models.Model): class Text(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)

View file

@ -10,9 +10,17 @@ def index(request):
context = {} context = {}
return render(request, 'index.html', context) return render(request, 'index.html', context)
def about(request): def page(request, slug=''):
context = {} context = {}
return render(request, 'about.html', context) page = models.Page.objects.filter(slug=slug, public=True).first()
if page:
context['page'] = page
return render(request, 'page.html', context)
else:
return render(request, 'fallback.html', context)
def about(request):
return page(request, 'about')
def texts(request): def texts(request):
context = {} context = {}

View file

@ -33,7 +33,7 @@ urlpatterns = [
path(settings.URL_PREFIX + 'assemblies/', text.texts, name='texts'), path(settings.URL_PREFIX + 'assemblies/', text.texts, name='texts'),
path(settings.URL_PREFIX + 'assemblies/<str:slug>', text.text, name='text'), path(settings.URL_PREFIX + 'assemblies/<str:slug>', text.text, name='text'),
path(settings.URL_PREFIX + 'about/', text.about, name='about'), path(settings.URL_PREFIX + 'about/', text.about, name='about'),
path(settings.URL_PREFIX + '<str:slug>/', text.page, name='page'),
path(settings.URL_PREFIX[:-1], text.index, name='index'), path(settings.URL_PREFIX[:-1], text.page, name='index'),
path('', text.fallback, name='fallback'), path('', text.fallback, name='fallback'),
] ]