added forms.py and base.html

This commit is contained in:
Rushil Umaretiya 2020-08-26 02:42:57 -04:00
parent c0adf2fa30
commit 4e66587ad7
6 changed files with 168 additions and 0 deletions

16
homepage/forms.py Normal file
View File

@ -0,0 +1,16 @@
from django import forms
from django.contrib.auth.models import User
import re
from .models import Answer, EMOTION_CHOICES
class PollForm(forms.ModelForm):
hi = 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)
name = forms.CharField(max_length=100)
place = forms.CharField(max_length=100)
question = forms.CharField(max_length=200)
class Meta:
model = Answer
fields = ['hi', 'lo', 'emotion', 'name', 'place', 'question']

View File

@ -0,0 +1,18 @@
# 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),
),
]

View File

@ -0,0 +1,18 @@
# 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),
),
]

View File

@ -0,0 +1,73 @@
# 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',
),
]

View File

@ -0,0 +1,38 @@
{% load static %}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<!-- Stylesheet -->
<link rel="stylesheet" type="text/css" href="{% static 'css/styles.css' %}">
<!-- Favicon -->
<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">
<!-- 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">
<title>HiLo Arlington</title>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script>
function onSubmit(token) {
document.getElementById("poll").submit();
}
</script>
</head>
<body>
{% 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://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="{% static 'js/main.js' %}" type="text/javascript"></script>
</body>
</html>

View File

@ -0,0 +1,5 @@
{% extends 'homepage/base.html' %}
{% load static %}
{% block content %}
{% enblock %}