diff --git a/app/static/css/partials/_layout.scss b/app/static/css/partials/_layout.scss
index 43a4a30..8e23803 100755
--- a/app/static/css/partials/_layout.scss
+++ b/app/static/css/partials/_layout.scss
@@ -95,3 +95,31 @@ nav {
opacity: 1;
}
}
+
+
+
+
+
+.index {
+ .home {
+ z-index: 1000;
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ display: flex;
+ flex-direction: column;
+ .box {
+ margin: auto;
+ background: rgba(0,0,0,0.5);
+ padding: 16px;
+ border-radius: 2px;
+ .font-size-sm {
+ display: flex;
+ gap: 16px;
+ justify-content: center;
+ }
+ }
+ }
+}
diff --git a/app/templates/film.html b/app/templates/film.html
index 6f35143..4ad7730 100644
--- a/app/templates/film.html
+++ b/app/templates/film.html
@@ -38,9 +38,11 @@ body {
{{ film.data.title | safe }}
+ {% if film.data.date %}
{{ film.data.date | safe }}
+ {% endif %}
{{ film.data.country|default:''|join:', ' }}
@@ -79,7 +81,8 @@ body {
diff --git a/app/templates/films.html b/app/templates/films.html
index 8ab0ab3..d37bcc3 100644
--- a/app/templates/films.html
+++ b/app/templates/films.html
@@ -37,7 +37,8 @@
- {{ film.data.title | safe }} ({{ film.data.date|safe}})
+ {{ film.data.title | safe }}
+ {% if film.data.date %}({{ film.data.date|safe}}){% endif %}
diff --git a/app/templates/index.html b/app/templates/index.html
index 8bec653..dbe5c67 100644
--- a/app/templates/index.html
+++ b/app/templates/index.html
@@ -20,15 +20,33 @@
{% block body_class%}animated animated-text body--home{% endblock %}
{% block main %}
-
njp.ma
-
-
-
-
+ {% if featured %}
+
+
+
+
+ {% endif %}
+
{% endblock %}
diff --git a/app/text/views.py b/app/text/views.py
index 7a1616d..268a82a 100644
--- a/app/text/views.py
+++ b/app/text/views.py
@@ -1,3 +1,4 @@
+import random
from django.shortcuts import render, redirect, get_object_or_404
from django.conf import settings
@@ -17,6 +18,15 @@ def index(request):
context = {}
context['films'] = Film.objects.filter(public=True).count()
context['texts'] = Text.objects.filter(public=True).count()
+ featured = Film.objects.filter(featured=True)
+ featured_count = featured.count()
+ if featured_count:
+ featured = featured[random.randint(0, featured_count - 1)]
+ try:
+ featured = featured.data['items'][0]['id']
+ except:
+ featured = None
+ context['featured'] = featured
return render(request, 'index.html', context)
def page(request, slug=''):
diff --git a/app/video/migrations/0002_film_featured.py b/app/video/migrations/0002_film_featured.py
new file mode 100644
index 0000000..a788901
--- /dev/null
+++ b/app/video/migrations/0002_film_featured.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.2.9 on 2021-11-22 12:48
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('video', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='film',
+ name='featured',
+ field=models.BooleanField(default=False),
+ ),
+ ]
diff --git a/app/video/models.py b/app/video/models.py
index fa5e9ae..47bcddf 100644
--- a/app/video/models.py
+++ b/app/video/models.py
@@ -18,6 +18,7 @@ class Film(models.Model):
slug = models.SlugField()
public = models.BooleanField(default=False)
+ featured = models.BooleanField(default=False)
position = models.IntegerField(default=0)
pandora_url = models.CharField(max_length=1024)