creates heros automagically, added loc model, and other things!
|
@ -39,6 +39,7 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'widget_tweaks',
|
'widget_tweaks',
|
||||||
|
'django_cleanup'
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
@ -123,3 +124,10 @@ STATIC_URL = '/static/'
|
||||||
STATICFILES_DIRS = [
|
STATICFILES_DIRS = [
|
||||||
os.path.join(BASE_DIR, "static"),
|
os.path.join(BASE_DIR, "static"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
CRISPY_TEMPLATE_PACK = 'bootstrap4'
|
||||||
|
|
||||||
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||||
|
MEDIA_URL = '/media/'
|
||||||
|
|
||||||
|
PROJECT_PATH = os.path.abspath(os.path.dirname(__name__))
|
|
@ -15,9 +15,13 @@ Including another URLconf
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
|
from django.conf.urls.static import static
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
path ('admin/', admin.site.urls),
|
||||||
path ('', include('homepage.urls')),
|
path ('', include('homepage.urls')),
|
||||||
path ('admin/', include('admin.urls')),
|
|
||||||
path( 'adminpanel/', admin.site.urls),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if settings.DEBUG:
|
||||||
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
@ -1,7 +1,8 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from .models import Poll, Answer
|
from .models import Poll, Answer, Location
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
|
||||||
|
admin.site.register(Location)
|
||||||
admin.site.register(Poll)
|
admin.site.register(Poll)
|
||||||
admin.site.register(Answer)
|
admin.site.register(Answer)
|
|
@ -1,16 +1,16 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
import re
|
import re
|
||||||
from .models import Answer, EMOTION_CHOICES
|
from .models import Answer, EMOTION_CHOICES
|
||||||
|
|
||||||
class PollForm(forms.ModelForm):
|
class PollForm(forms.ModelForm):
|
||||||
hi = forms.CharField(max_length=200, required=True)
|
hi = forms.CharField(max_length=200, required=True)
|
||||||
lo = forms.CharField(max_length=200, required=True)
|
lo = forms.CharField(max_length=200, required=True)
|
||||||
emotion = forms.ChoiceField(widget=forms.RadioSelect, choices=EMOTION_CHOICES, required=True)
|
emotion = forms.ChoiceField(widget=forms.RadioSelect, choices=EMOTION_CHOICES, required=True)
|
||||||
name = forms.CharField(max_length=100)
|
name = forms.CharField(max_length=100)
|
||||||
place = forms.CharField(max_length=100)
|
place = forms.CharField(max_length=100)
|
||||||
question = forms.CharField(max_length=200)
|
question = forms.CharField(max_length=200)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Answer
|
model = Answer
|
||||||
fields = ['hi', 'lo', 'emotion', 'name', 'place', 'question']
|
fields = ['hi', 'lo', 'emotion', 'name', 'place', 'question']
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 3.0.8 on 2020-08-25 21:41
|
# Generated by Django 3.1 on 2020-08-26 17:28
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
@ -12,23 +12,31 @@ class Migration(migrations.Migration):
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Location',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(blank=True, max_length=20, null=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Poll',
|
name='Poll',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('askHi', models.BooleanField(default=True)),
|
('ask_hi', models.BooleanField(default=True)),
|
||||||
('HiText', models.CharField(blank=True, max_length=50, null=True)),
|
('hi_text', models.CharField(blank=True, max_length=50, null=True)),
|
||||||
('askLo', models.BooleanField(default=True)),
|
('ask_lo', models.BooleanField(default=True)),
|
||||||
('LoText', models.CharField(blank=True, max_length=50, null=True)),
|
('lo_text', models.CharField(blank=True, max_length=50, null=True)),
|
||||||
('askEmotion', models.BooleanField(default=True)),
|
('ask_emotion', models.BooleanField(default=True)),
|
||||||
('EmotionText', models.CharField(blank=True, max_length=50, null=True)),
|
('emotion_text', models.CharField(blank=True, max_length=50, null=True)),
|
||||||
('askName', models.BooleanField(default=True)),
|
('ask_name', models.BooleanField(default=True)),
|
||||||
('NameText', models.CharField(blank=True, max_length=50, null=True)),
|
('name_text', models.CharField(blank=True, max_length=50, null=True)),
|
||||||
('askPlace', models.BooleanField(default=True)),
|
('ask_place', models.BooleanField(default=True)),
|
||||||
('PlaceText', models.CharField(blank=True, max_length=50, null=True)),
|
('place_text', models.CharField(blank=True, max_length=50, null=True)),
|
||||||
('askQuestion', models.BooleanField(default=True)),
|
('ask_question', models.BooleanField(default=False)),
|
||||||
('QuestionText', models.CharField(blank=True, max_length=50, null=True)),
|
('question_text', models.CharField(blank=True, max_length=50, null=True)),
|
||||||
('pub_date', models.DateTimeField(verbose_name='date published')),
|
('pub_date', models.DateTimeField(verbose_name='date published')),
|
||||||
|
('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.location')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
|
@ -37,9 +45,11 @@ class Migration(migrations.Migration):
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('hi', models.CharField(blank=True, max_length=200, null=True)),
|
('hi', models.CharField(blank=True, max_length=200, null=True)),
|
||||||
('lo', models.CharField(blank=True, max_length=200, null=True)),
|
('lo', models.CharField(blank=True, max_length=200, null=True)),
|
||||||
('name', models.CharField(blank=True, max_length=200, null=True)),
|
('emotion', models.CharField(blank=True, choices=[('happy', 'Happy'), ('meh', 'Meh'), ('sad', 'Sad')], default='meh', max_length=8, null=True)),
|
||||||
('place', models.CharField(blank=True, max_length=200, null=True)),
|
('name', models.CharField(blank=True, max_length=100, null=True)),
|
||||||
('poll', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.Poll')),
|
('place', models.CharField(blank=True, max_length=100, null=True)),
|
||||||
|
('question', models.CharField(blank=True, max_length=200, null=True)),
|
||||||
|
('poll', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.poll')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
# Generated by Django 3.0.8 on 2020-08-25 21:41
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('homepage', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='answer',
|
|
||||||
name='emotion',
|
|
||||||
field=models.CharField(blank=True, max_length=200, null=True),
|
|
||||||
),
|
|
||||||
]
|
|
38
homepage/migrations/0002_auto_20200826_1732.py
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
# Generated by Django 3.1 on 2020-08-26 17:32
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('homepage', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='poll',
|
||||||
|
name='emotion_text',
|
||||||
|
field=models.CharField(blank=True, default='how are you feeling today?', max_length=50, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='poll',
|
||||||
|
name='hi_text',
|
||||||
|
field=models.CharField(blank=True, default='What was the <span class="hi">Hi</span> of this we', max_length=50, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='poll',
|
||||||
|
name='lo_text',
|
||||||
|
field=models.CharField(blank=True, default='What was the <span class="lo">Lo</span> of this we', max_length=50, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='poll',
|
||||||
|
name='name_text',
|
||||||
|
field=models.CharField(blank=True, default="what's your name?", max_length=50, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='poll',
|
||||||
|
name='place_text',
|
||||||
|
field=models.CharField(blank=True, default='where are you from?', max_length=50, null=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,18 +0,0 @@
|
||||||
# Generated by Django 3.0.8 on 2020-08-25 22:20
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('homepage', '0002_answer_emotion'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='answer',
|
|
||||||
name='emotion',
|
|
||||||
field=models.CharField(blank=True, choices=[('happy', 'Happy'), ('meh', 'Meh'), ('sad', 'Sad')], default='meh', max_length=8, null=True),
|
|
||||||
),
|
|
||||||
]
|
|
19
homepage/migrations/0003_auto_20200826_1738.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 3.1 on 2020-08-26 17:38
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('homepage', '0002_auto_20200826_1732'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='poll',
|
||||||
|
name='location',
|
||||||
|
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='homepage.location'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,73 +0,0 @@
|
||||||
# Generated by Django 3.0.8 on 2020-08-25 22:33
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('homepage', '0003_auto_20200825_2220'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='poll',
|
|
||||||
old_name='askEmotion',
|
|
||||||
new_name='ask_emotion',
|
|
||||||
),
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='poll',
|
|
||||||
old_name='askHi',
|
|
||||||
new_name='ask_hi',
|
|
||||||
),
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='poll',
|
|
||||||
old_name='askLo',
|
|
||||||
new_name='ask_lo',
|
|
||||||
),
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='poll',
|
|
||||||
old_name='askName',
|
|
||||||
new_name='ask_name',
|
|
||||||
),
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='poll',
|
|
||||||
old_name='askPlace',
|
|
||||||
new_name='ask_place',
|
|
||||||
),
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='poll',
|
|
||||||
old_name='askQuestion',
|
|
||||||
new_name='ask_question',
|
|
||||||
),
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='poll',
|
|
||||||
old_name='EmotionText',
|
|
||||||
new_name='emotion_text',
|
|
||||||
),
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='poll',
|
|
||||||
old_name='HiText',
|
|
||||||
new_name='hi_text',
|
|
||||||
),
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='poll',
|
|
||||||
old_name='LoText',
|
|
||||||
new_name='lo_text',
|
|
||||||
),
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='poll',
|
|
||||||
old_name='NameText',
|
|
||||||
new_name='name_text',
|
|
||||||
),
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='poll',
|
|
||||||
old_name='PlaceText',
|
|
||||||
new_name='place_text',
|
|
||||||
),
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='poll',
|
|
||||||
old_name='QuestionText',
|
|
||||||
new_name='question_text',
|
|
||||||
),
|
|
||||||
]
|
|
23
homepage/migrations/0004_auto_20200826_1831.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Generated by Django 3.1 on 2020-08-26 18:31
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('homepage', '0003_auto_20200826_1738'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='location',
|
||||||
|
name='hero',
|
||||||
|
field=models.ImageField(default='hero.png', upload_to='heros'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='location',
|
||||||
|
name='slug',
|
||||||
|
field=models.CharField(blank=True, max_length=20, null=True),
|
||||||
|
),
|
||||||
|
]
|
18
homepage/migrations/0005_auto_20200826_1843.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.1 on 2020-08-26 18:43
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('homepage', '0004_auto_20200826_1831'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='location',
|
||||||
|
name='hero',
|
||||||
|
field=models.ImageField(default='hero.png', upload_to='heros/<django.db.models.fields.CharField>-hero.png'),
|
||||||
|
),
|
||||||
|
]
|
18
homepage/migrations/0006_auto_20200826_1858.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.1 on 2020-08-26 18:58
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('homepage', '0005_auto_20200826_1843'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='location',
|
||||||
|
name='hero',
|
||||||
|
field=models.ImageField(default='hero.png', upload_to='heros'),
|
||||||
|
),
|
||||||
|
]
|
18
homepage/migrations/0007_location_hero_mobile.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.1 on 2020-08-26 19:20
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('homepage', '0006_auto_20200826_1858'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='location',
|
||||||
|
name='hero_mobile',
|
||||||
|
field=models.ImageField(default='hero-mobile.png', upload_to='heros'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,22 +1,67 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.files import File
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.templatetags.static import static
|
||||||
|
from django.utils.text import slugify
|
||||||
|
|
||||||
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
||||||
|
class Location (models.Model):
|
||||||
|
name = models.CharField(max_length=20, blank=True, null=True)
|
||||||
|
slug = models.CharField(max_length=20, blank=True, null=True)
|
||||||
|
|
||||||
|
hero = models.ImageField(default="hero.png", upload_to='heros')
|
||||||
|
hero_mobile = models.ImageField(default="hero-mobile.png", upload_to='heros')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
self.slug = slugify(self.name)
|
||||||
|
self.hero = f'heros/hero-{self.slug}.png'
|
||||||
|
self.hero_mobile = f'heros/hero-{self.slug}-mobile.png'
|
||||||
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
output = f'{settings.PROJECT_PATH}/media/heros/hero-{self.slug}.png'
|
||||||
|
mobile_output = f'{settings.PROJECT_PATH}/media/heros/hero-{self.slug}-mobile.png'
|
||||||
|
|
||||||
|
img = Image.open(settings.PROJECT_PATH + static("css/res/hero.png"))
|
||||||
|
draw = ImageDraw.Draw(img)
|
||||||
|
font = ImageFont.truetype(settings.PROJECT_PATH + static("css/fonts/Shorelines-Script-Bold.otf"), 80)
|
||||||
|
draw.text((1050,450), self.slug, (255,255,255), font=font)
|
||||||
|
img.save(output)
|
||||||
|
|
||||||
|
img = Image.open(settings.PROJECT_PATH + static("css/res/hero-mobile.png"))
|
||||||
|
draw = ImageDraw.Draw(img)
|
||||||
|
font = ImageFont.truetype(settings.PROJECT_PATH + static("css/fonts/Shorelines-Script-Bold.otf"), 80)
|
||||||
|
draw.text((420,860), self.slug, (255,255,255), font=font)
|
||||||
|
img.save(mobile_output)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Poll (models.Model):
|
class Poll (models.Model):
|
||||||
|
location = models.OneToOneField(Location, on_delete=models.CASCADE)
|
||||||
|
|
||||||
ask_hi = models.BooleanField(default=True)
|
ask_hi = models.BooleanField(default=True)
|
||||||
hi_text = models.CharField(max_length=50, blank=True, null=True)
|
hi_text = models.CharField(max_length=50, blank=True, null=True, default='What was the <span class="hi">Hi</span> of this we')
|
||||||
|
|
||||||
ask_lo = models.BooleanField(default=True)
|
ask_lo = models.BooleanField(default=True)
|
||||||
lo_text = models.CharField(max_length=50, blank=True, null=True)
|
lo_text = models.CharField(max_length=50, blank=True, null=True, default='What was the <span class="lo">Lo</span> of this we')
|
||||||
|
|
||||||
ask_emotion = models.BooleanField(default=True)
|
ask_emotion = models.BooleanField(default=True)
|
||||||
emotion_text = models.CharField(max_length=50, blank=True, null=True)
|
emotion_text = models.CharField(max_length=50, blank=True, null=True, default="how are you feeling today?")
|
||||||
|
|
||||||
ask_name = models.BooleanField(default=True)
|
ask_name = models.BooleanField(default=True)
|
||||||
name_text = models.CharField(max_length=50, blank=True, null=True)
|
name_text = models.CharField(max_length=50, blank=True, null=True, default="what's your name?")
|
||||||
|
|
||||||
ask_place = models.BooleanField(default=True)
|
ask_place = models.BooleanField(default=True)
|
||||||
place_text = models.CharField(max_length=50, blank=True, null=True)
|
place_text = models.CharField(max_length=50, blank=True, null=True, default="where are you from?")
|
||||||
|
|
||||||
ask_question = models.BooleanField(default=False)
|
ask_question = models.BooleanField(default=False)
|
||||||
question_text = models.CharField(max_length=50, blank=True, null=True)
|
question_text = models.CharField(max_length=50, blank=True, null=True)
|
||||||
|
@ -24,7 +69,7 @@ class Poll (models.Model):
|
||||||
pub_date = models.DateTimeField('date published')
|
pub_date = models.DateTimeField('date published')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'Current Poll'
|
return f"{self.location.name}'s Poll"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en" dir="ltr">
|
<html lang="en" dir="ltr">
|
||||||
<head>
|
<head>
|
||||||
<!-- Required meta tags -->
|
<!-- Required meta tags -->
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
<!-- Bootstrap CSS -->
|
<!-- Bootstrap CSS -->
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
|
||||||
|
|
||||||
<!-- Stylesheet -->
|
<!-- Stylesheet -->
|
||||||
<link rel="stylesheet" type="text/css" href="{% static 'css/styles.css' %}">
|
<link rel="stylesheet" type="text/css" href="{% static 'css/styles.css' %}">
|
||||||
|
|
||||||
<!-- Favicon -->
|
<!-- Favicon -->
|
||||||
<link rel="shortcut icon" href="{% static 'icon/favicon.ico' %}" type="image/x-icon">
|
<link rel="shortcut icon" href="{% static 'icon/favicon.ico' %}" type="image/x-icon">
|
||||||
<link rel="icon" href="{% static 'icon/favicon.ico' %}" type="image/x-icon">
|
<link rel="icon" href="{% static 'icon/favicon.ico' %}" type="image/x-icon">
|
||||||
|
|
||||||
<!-- Font Awesome -->
|
<!-- Font Awesome -->
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
||||||
|
|
||||||
<title>HiLo Arlington</title>
|
<title>HiLo Arlington</title>
|
||||||
|
|
||||||
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
|
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
|
||||||
<script>
|
<script>
|
||||||
function onSubmit(token) {
|
function onSubmit(token) {
|
||||||
document.getElementById("poll").submit();
|
document.getElementById("poll").submit();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% block content %}{% endblock content %}
|
{% block content %}{% endblock content %}
|
||||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
|
||||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
|
||||||
<script src="{% static 'js/main.js' %}" type="text/javascript"></script>
|
<script src="{% static 'js/main.js' %}" type="text/javascript"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'homepage/base.html' %}
|
{% extends 'homepage/base.html' %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% enblock %}
|
{% enblock %}
|
|
@ -3,5 +3,6 @@ from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path ('', views.homepage, name="homepage"),
|
path ('', views.homepage, name="homepage"),
|
||||||
|
path ('<slug:slug>/', views.homepage),
|
||||||
path ('finish/', views.finish, name="finish")
|
path ('finish/', views.finish, name="finish")
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
|
from django.http import HttpResponseNotFound
|
||||||
|
|
||||||
from .forms import PollForm
|
from .forms import PollForm
|
||||||
from .models import Poll
|
from .models import Poll, Location
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
def homepage (request):
|
def homepage (request, slug="arlington"):
|
||||||
poll = get_object_or_404(Poll)
|
location = get_object_or_404(Location, slug=slug)
|
||||||
|
|
||||||
|
try:
|
||||||
|
poll = location.poll
|
||||||
|
except:
|
||||||
|
return HttpResponseNotFound(f'404: No poll was found for {location}!')
|
||||||
|
|
||||||
if poll.ask_hi:
|
if poll.ask_hi:
|
||||||
hi_text = poll.hi_text
|
hi_text = poll.hi_text
|
||||||
|
@ -69,4 +75,5 @@ def homepage (request):
|
||||||
return render(request, 'homepage/index.html', context=context)
|
return render(request, 'homepage/index.html', context=context)
|
||||||
|
|
||||||
def finish (request):
|
def finish (request):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
argparse
|
argparse==1.4.0
|
||||||
django
|
django==3.1
|
||||||
django-widget-tweaks
|
django-cleanup==5.0.0
|
||||||
pip-chill
|
django-widget-tweaks==1.4.8
|
||||||
python
|
pillow==7.2.0
|
||||||
wsgiref
|
pip-chill==1.0.0
|
||||||
|
|
BIN
static/css/fonts/Shorelines-Script-Bold.otf
Normal file
BIN
static/css/res/Shorelines-Script-Bold.otf
Normal file
Before Width: | Height: | Size: 4.1 MiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 26 KiB |
BIN
static/css/res/wys-hero-mobile.png
Normal file
After Width: | Height: | Size: 4.1 MiB |
BIN
static/css/res/wys-hero.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
|
@ -1,179 +1,179 @@
|
||||||
@charset "UTF-8";
|
@charset "UTF-8";
|
||||||
@font-face {
|
@font-face {
|
||||||
src: url("./fonts/Hanson-Bold.ttf");
|
src: url("./fonts/Hanson-Bold.ttf");
|
||||||
font-family: "Hanson-Bold"; }
|
font-family: "Hanson-Bold"; }
|
||||||
@font-face {
|
@font-face {
|
||||||
src: url("./fonts/WildYouth-Regular.otf");
|
src: url("./fonts/WildYouth-Regular.otf");
|
||||||
font-family: "WildYouth"; }
|
font-family: "WildYouth"; }
|
||||||
@font-face {
|
@font-face {
|
||||||
src: url("./fonts/FuturaPTMedium.otf");
|
src: url("./fonts/FuturaPTMedium.otf");
|
||||||
font-family: "Futura";
|
font-family: "Futura";
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal; }
|
font-style: normal; }
|
||||||
@font-face {
|
@font-face {
|
||||||
src: url("./fonts/FuturaPTLight.otf");
|
src: url("./fonts/FuturaPTLight.otf");
|
||||||
font-family: "Futura-Light"; }
|
font-family: "Futura-Light"; }
|
||||||
@font-face {
|
@font-face {
|
||||||
src: url("./fonts/FuturaPTHeavy.otf");
|
src: url("./fonts/FuturaPTHeavy.otf");
|
||||||
font-family: "Futura-Heavy"; }
|
font-family: "Futura-Heavy"; }
|
||||||
html {
|
html {
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
font-family: "Hanson-Bold", "Arial", sans-serif;
|
font-family: "Hanson-Bold", "Arial", sans-serif;
|
||||||
overflow-x: none; }
|
overflow-x: none; }
|
||||||
|
|
||||||
body {
|
body {
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
/* Keep scroll functionality */
|
/* Keep scroll functionality */
|
||||||
-ms-overflow-style: none;
|
-ms-overflow-style: none;
|
||||||
/* IE and Edge */
|
/* IE and Edge */
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
/* Firefox */ }
|
/* Firefox */ }
|
||||||
|
|
||||||
body::-webkit-scrollbar {
|
body::-webkit-scrollbar {
|
||||||
display: none; }
|
display: none; }
|
||||||
|
|
||||||
.hero {
|
.hero {
|
||||||
color: #333 !important;
|
color: #333 !important;
|
||||||
background-color: #333 !important;
|
background-color: #333 !important;
|
||||||
background-image: url("res/hilo-hero-text.png");
|
background-image: url("res/hilo-hero-text.png");
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-attachment: fixed; }
|
background-attachment: fixed; }
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.hero {
|
.hero {
|
||||||
background-image: url("res/hilo-hero-text-mobile.png"); } }
|
background-image: url("res/hilo-hero-text-mobile.png"); } }
|
||||||
|
|
||||||
.arrow {
|
.arrow {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 70px;
|
width: 70px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
margin-top: 70vh;
|
margin-top: 70vh;
|
||||||
height: 100px; }
|
height: 100px; }
|
||||||
|
|
||||||
.arrow:after {
|
.arrow:after {
|
||||||
content: "";
|
content: "";
|
||||||
margin-top: 70vh;
|
margin-top: 70vh;
|
||||||
width: 70px;
|
width: 70px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-image: url("res/arrow.svg");
|
background-image: url("res/arrow.svg");
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
-webkit-animation: 3s infinite ease;
|
-webkit-animation: 3s infinite ease;
|
||||||
animation: 3s infinite ease;
|
animation: 3s infinite ease;
|
||||||
animation-name: การเคลื่อนไหวที่-1; }
|
animation-name: การเคลื่อนไหวที่-1; }
|
||||||
@keyframes การเคลื่อนไหวที่-1 {
|
@keyframes การเคลื่อนไหวที่-1 {
|
||||||
0%,
|
0%,
|
||||||
100% {
|
100% {
|
||||||
top: 50px; }
|
top: 50px; }
|
||||||
50% {
|
50% {
|
||||||
top: 80px; } }
|
top: 80px; } }
|
||||||
.vh-25 {
|
.vh-25 {
|
||||||
height: 25vh; }
|
height: 25vh; }
|
||||||
|
|
||||||
.vh-50 {
|
.vh-50 {
|
||||||
height: 50vh; }
|
height: 50vh; }
|
||||||
|
|
||||||
.banner {
|
.banner {
|
||||||
color: white;
|
color: white;
|
||||||
background-image: url("res/banner.png");
|
background-image: url("res/banner.png");
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-attachment: fixed; }
|
background-attachment: fixed; }
|
||||||
|
|
||||||
.info-col {
|
.info-col {
|
||||||
background-color: #fff; }
|
background-color: #fff; }
|
||||||
|
|
||||||
.info-header {
|
.info-header {
|
||||||
color: white;
|
color: white;
|
||||||
font-family: "Hanson-Bold", "Arial", sans-serif;
|
font-family: "Hanson-Bold", "Arial", sans-serif;
|
||||||
text-stroke: 3px #305899;
|
text-stroke: 3px #305899;
|
||||||
-webkit-text-stroke: 3px #305899; }
|
-webkit-text-stroke: 3px #305899; }
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.info-header {
|
.info-header {
|
||||||
font-size: 1.25em;
|
font-size: 1.25em;
|
||||||
text-stroke: 2px #305899;
|
text-stroke: 2px #305899;
|
||||||
-webkit-text-stroke: 2px #305899; } }
|
-webkit-text-stroke: 2px #305899; } }
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
font-size: .8em;
|
font-size: .8em;
|
||||||
color: #2b5291;
|
color: #2b5291;
|
||||||
font-family: "Hanson-Bold", "Arial", sans-serif; }
|
font-family: "Hanson-Bold", "Arial", sans-serif; }
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.info {
|
.info {
|
||||||
font-size: .75em; } }
|
font-size: .75em; } }
|
||||||
|
|
||||||
#insta-section {
|
#insta-section {
|
||||||
background-color: #333; }
|
background-color: #333; }
|
||||||
|
|
||||||
.bg-colored:before {
|
.bg-colored:before {
|
||||||
right: -999em;
|
right: -999em;
|
||||||
background: #0b3b52;
|
background: #0b3b52;
|
||||||
content: '';
|
content: '';
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 999em;
|
width: 999em;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0; }
|
bottom: 0; }
|
||||||
|
|
||||||
.poll {
|
.poll {
|
||||||
color: white;
|
color: white;
|
||||||
background-image: url("res/gradient-mobile.png");
|
background-image: url("res/gradient-mobile.png");
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-attachment: fixed;
|
background-attachment: fixed;
|
||||||
font-family: "Hanson-Bold", "Arial", sans-serif;
|
font-family: "Hanson-Bold", "Arial", sans-serif;
|
||||||
font-weight: lighter;
|
font-weight: lighter;
|
||||||
font-size: .75em; }
|
font-size: .75em; }
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.poll {
|
.poll {
|
||||||
background-image: url("res/gradient-mobile.png"); } }
|
background-image: url("res/gradient-mobile.png"); } }
|
||||||
|
|
||||||
.short-answer {
|
.short-answer {
|
||||||
font-size: 1.2em; }
|
font-size: 1.2em; }
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
color: #42b8c7;
|
color: #42b8c7;
|
||||||
font-size: 1.45em; }
|
font-size: 1.45em; }
|
||||||
|
|
||||||
.subtitle {
|
.subtitle {
|
||||||
color: #42b8c7;
|
color: #42b8c7;
|
||||||
font-size: 1.15em; }
|
font-size: 1.15em; }
|
||||||
|
|
||||||
label {
|
label {
|
||||||
font-size: 1.25em; }
|
font-size: 1.25em; }
|
||||||
|
|
||||||
.emote img {
|
.emote img {
|
||||||
width: 25vw;
|
width: 25vw;
|
||||||
height: auto; }
|
height: auto; }
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
color: #2b5291;
|
color: #2b5291;
|
||||||
border-image-repeat: none; }
|
border-image-repeat: none; }
|
||||||
|
|
||||||
.hi {
|
.hi {
|
||||||
color: #48B93E;
|
color: #48B93E;
|
||||||
font-family: "WildYouth", "Hanson-Bold", "Arial", sans-serif; }
|
font-family: "WildYouth", "Hanson-Bold", "Arial", sans-serif; }
|
||||||
|
|
||||||
.lo {
|
.lo {
|
||||||
color: #E34848;
|
color: #E34848;
|
||||||
font-family: "WildYouth", "Hanson-Bold", "Arial", sans-serif; }
|
font-family: "WildYouth", "Hanson-Bold", "Arial", sans-serif; }
|
||||||
|
|
||||||
[type=radio] {
|
[type=radio] {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0; }
|
height: 0; }
|
||||||
|
|
||||||
/* IMAGE STYLES */
|
/* IMAGE STYLES */
|
||||||
[type=radio] + img {
|
[type=radio] + img {
|
||||||
cursor: pointer; }
|
cursor: pointer; }
|
||||||
|
|
||||||
/* CHECKED STYLES */
|
/* CHECKED STYLES */
|
||||||
[type=radio]:checked + img {
|
[type=radio]:checked + img {
|
||||||
outline: 2px solid #2b5291; }
|
outline: 2px solid #2b5291; }
|
||||||
|
|
||||||
/*# sourceMappingURL=styles.css.map */
|
/*# sourceMappingURL=styles.css.map */
|
||||||
|
|