Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added DjangoQuiz/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added DjangoQuiz/__pycache__/settings.cpython-310.pyc
Binary file not shown.
Binary file added DjangoQuiz/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file added DjangoQuiz/__pycache__/wsgi.cpython-310.pyc
Binary file not shown.
5 changes: 3 additions & 2 deletions DjangoQuiz/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
https://docs.djangoproject.com/en/3.1/ref/settings/
"""

from pathlib import Path
from pathlib import Path,os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand Down Expand Up @@ -121,4 +121,5 @@

STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS=[BASE_DIR/'static']
# STATICFILES_DIRS=[BASE_DIR/'static']
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'),]
4 changes: 3 additions & 1 deletion DjangoQuiz/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@

urlpatterns = [
path('admin/', admin.site.urls),
path('', home,name='home'),
path('', home, name='home'),
path('addQuestion/', addQuestion,name='addQuestion'),
path('question/', question,name='question'),
path('makevisitor/', makevisitor, name='makevisitor'),
path('visitor/', visitor, name='visitor'),
#path('login/', login,name="login"),
#path('logout', logout, name='logout'),
#path('signup/',signup, name="signup"),
Expand Down
Binary file added Quiz/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added Quiz/__pycache__/admin.cpython-310.pyc
Binary file not shown.
Binary file added Quiz/__pycache__/apps.cpython-310.pyc
Binary file not shown.
Binary file added Quiz/__pycache__/forms.cpython-310.pyc
Binary file not shown.
Binary file added Quiz/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file added Quiz/__pycache__/views.cpython-310.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions Quiz/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

# Register your models here.
admin.site.register(QuesModel)
admin.site.register(Visitor)
15 changes: 12 additions & 3 deletions Quiz/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.1.7 on 2023-02-24 23:02
# Generated by Django 4.1.7 on 2023-02-25 08:26

from django.conf import settings
from django.db import migrations, models
Expand All @@ -11,9 +11,20 @@ class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('auth', '0012_alter_user_first_name_max_length'),
]

operations = [
migrations.CreateModel(
name='Visitor',
fields=[
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
('name', models.CharField(max_length=200, null=True)),
('gender', models.CharField(max_length=200, null=True)),
('date', models.CharField(max_length=200, null=True)),
('score', models.PositiveIntegerField(default=0, null=True)),
],
),
migrations.CreateModel(
name='QuesModel',
fields=[
Expand All @@ -25,15 +36,13 @@ class Migration(migrations.Migration):
('question5', models.CharField(max_length=200, null=True)),
('question6', models.CharField(max_length=200, null=True)),
('question7', models.CharField(max_length=200, null=True)),
('question8', models.CharField(max_length=200, null=True)),
('ans', models.CharField(max_length=200, null=True)),
('ans2', models.CharField(max_length=200, null=True)),
('ans3', models.CharField(max_length=200, null=True)),
('ans4', models.CharField(max_length=200, null=True)),
('ans5', models.CharField(max_length=200, null=True)),
('ans6', models.CharField(max_length=200, null=True)),
('ans7', models.CharField(max_length=200, null=True)),
('ans8', models.CharField(max_length=200, null=True)),
('writer', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added Quiz/migrations/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
8 changes: 8 additions & 0 deletions Quiz/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings

# Create your models here.
class QuesModel(models.Model):
Expand All @@ -26,4 +27,11 @@ class QuesModel(models.Model):
ans7 = models.CharField(max_length=200,null=True)
# ans8 = models.CharField(max_length=200,null=True)

class Visitor(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, primary_key=True)
name = models.CharField(max_length=200,null=True)
gender = models.CharField(max_length=200,null=True)
date = models.CharField(max_length=200,null=True)
score = models.PositiveIntegerField(default=0, null=True)


16 changes: 16 additions & 0 deletions Quiz/templates/Quiz/addVisitor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div>

<form action="{% url 'visitor' %}" method="post" enctype="multipart/form-data">
{%csrf_token%}

<!-- 이름, 성별, 관계, 점수 -->
<p> 이름 : <input type="text" name="name"></p>
<p> 성별 : <input type="radio" name="gender" id="radio1" value="남자">
<label class="form-check-label" for="radio1">남자</label>
<input type="radio" name="gender" id="radio2" value="여자">
<label class="form-check-label" for="radio2">여자</label></p>
<p> 우리가 처음 만난날은? : <input type="text" name="date"></p>

<button type="submit">완료</button> </form>

</div>
92 changes: 48 additions & 44 deletions Quiz/templates/Quiz/createQuizSlider.html
Original file line number Diff line number Diff line change
@@ -1,160 +1,164 @@
<!doctype html>
<html lang="en">
{% load static %}
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>createQuizSlider</title>
<link rel="stylesheet" href="../css/style.css">
<link rel="stylesheet" href="{% static 'css/style.css' %}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
</head>
<body>
<section>
<form action="#" method="post">
<form action="" method="post">
{% csrf_token %}
{% for q in questions %}
<div class="d-flex justify-content-center align-items-center vh-100 vw-100 z-n1" id="box_1">
<div class="quizbox rounded-2 p-4 text-white mx-5 z-1">
<p class="fs-1 fw-bold">Q1</p>
<textarea class="form-control" placeholder="입력하세요." rows="3" cols="40" required></textarea>
<p>{{q.question}}</p>
<div class="d-flex justify-content-center my-3">
<div class="form_radio_btn">
<input id="radio-1" type="radio" name="yesorno" value="1" required>
<input id="radio-1" type="radio" name="{{q.question}}" value="O" required>
<label for="radio-1">O</label>
</div>
<div class="form_radio_btn">
<input id="radio-2" type="radio" name="yesorno" value="0">
<input id="radio-2" type="radio" name="{{q.question}}" value="X">
<label for="radio-2">X</label>
</div>
</div>
<!-- <a href="#" class="text-decoration-none"><img class="img-fluid" src="../img/back.png" alt="이전버튼" width="28"></a> -->
<a href="#box_2" class="text-decoration-none float-end next"><img class="img-fluid" src="../img/next.png" alt="다음버튼" width="28"></a>
<a href="#box_2" class="text-decoration-none float-end next"><img class="img-fluid" src="/static/img/next.png" alt="다음버튼" width="28"></a>
</div>
</div>
<div class="d-flex justify-content-center align-items-center vh-100 vw-100 z-n1" id="box_2">
<div class="quizbox rounded-2 p-4 text-white mx-5 z-1">
<p class="fs-1 fw-bold">Q2</p>
<textarea class="form-control" placeholder="입력하세요." rows="3" cols="40" required></textarea>
<p>{{q.question2}}</p>
<div class="d-flex justify-content-center my-3">
<div class="form_radio_btn">
<input id="radio-3" type="radio" name="yesorno" value="1" required>
<input id="radio-3" type="radio" name="{{q.question2}}" value="O" required>
<label for="radio-3">O</label>
</div>
<div class="form_radio_btn">
<input id="radio-4" type="radio" name="yesorno" value="0">
<input id="radio-4" type="radio" name="{{q.question2}}" value="X">
<label for="radio-4">X</label>
</div>
</div>
<a href="#box_1" class="text-decoration-none prev"><img class="img-fluid" src="../img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_3" class="text-decoration-none float-end next"><img class="img-fluid" src="../img/next.png" alt="다음버튼" width="28"></a>
<a href="#box_1" class="text-decoration-none prev"><img class="img-fluid" src="/static/img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_3" class="text-decoration-none float-end next"><img class="img-fluid" src="/static/img/next.png" alt="다음버튼" width="28"></a>
</div>
</div>
<div class="d-flex justify-content-center align-items-center vh-100 vw-100 z-n1" id="box_3">
<div class="quizbox rounded-2 p-4 text-white mx-5 z-1">
<p class="fs-1 fw-bold">Q3</p>
<textarea class="form-control" placeholder="입력하세요." rows="3" cols="40" required></textarea>
<p>{{q.question3}}</p>
<div class="d-flex justify-content-center my-3">
<div class="form_radio_btn">
<input id="radio-5" type="radio" name="yesorno" value="1" required>
<input id="radio-5" type="radio" name="{{q.question3}}" value="O" required>
<label for="radio-5">O</label>
</div>
<div class="form_radio_btn">
<input id="radio-6" type="radio" name="yesorno" value="0">
<input id="radio-6" type="radio" name="{{q.question3}}" value="X">
<label for="radio-6">X</label>
</div>
</div>
<a href="#box_2" class="text-decoration-none prev"><img class="img-fluid" src="../img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_4" class="text-decoration-none float-end next"><img class="img-fluid" src="../img/next.png" alt="다음버튼" width="28"></a>
<a href="#box_2" class="text-decoration-none prev"><img class="img-fluid" src="/static/img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_4" class="text-decoration-none float-end next"><img class="img-fluid" src="/static/img/next.png" alt="다음버튼" width="28"></a>
</div>
</div>
<div class="d-flex justify-content-center align-items-center vh-100 vw-100 z-n1" id="box_4">
<div class="quizbox rounded-2 p-4 text-white mx-5 z-1">
<p class="fs-1 fw-bold">Q4</p>
<textarea class="form-control" placeholder="입력하세요." rows="3" cols="40" required></textarea>
<p>{{q.question4}}</p>
<div class="d-flex justify-content-center my-3">
<div class="form_radio_btn">
<input id="radio-7" type="radio" name="yesorno" value="1" required>
<input id="radio-7" type="radio" name="{{q.question4}}" value="O" required>
<label for="radio-7">O</label>
</div>
<div class="form_radio_btn">
<input id="radio-8" type="radio" name="yesorno" value="0">
<input id="radio-8" type="radio" name="{{q.question4}}" value="X">
<label for="radio-8">X</label>
</div>
</div>
<a href="#box_3" class="text-decoration-none prev"><img class="img-fluid" src="../img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_5" class="text-decoration-none float-end next"><img class="img-fluid" src="../img/next.png" alt="다음버튼" width="28"></a>
<a href="#box_3" class="text-decoration-none prev"><img class="img-fluid" src="/static/img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_5" class="text-decoration-none float-end next"><img class="img-fluid" src="/static/img/next.png" alt="다음버튼" width="28"></a>
</div>
</div>
<div class="d-flex justify-content-center align-items-center vh-100 vw-100 z-n1" id="box_5">
<div class="quizbox rounded-2 p-4 text-white mx-5 z-1">
<p class="fs-1 fw-bold">Q5</p>
<textarea class="form-control" placeholder="입력하세요." rows="3" cols="40" required></textarea>
<p>{{q.question5}}</p>
<div class="d-flex justify-content-center my-3">
<div class="form_radio_btn">
<input id="radio-9" type="radio" name="yesorno" value="1" required>
<input id="radio-9" type="radio" name="{{q.question5}}" value="O" required>
<label for="radio-9">O</label>
</div>
<div class="form_radio_btn">
<input id="radio-10" type="radio" name="yesorno" value="0">
<input id="radio-10" type="radio" name="{{q.question5}}" value="X">
<label for="radio-10">X</label>
</div>
</div>
<a href="#box_4" class="text-decoration-none prev"><img class="img-fluid" src="../img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_6" class="text-decoration-none float-end next"><img class="img-fluid" src="../img/next.png" alt="다음버튼" width="28"></a>
<a href="#box_4" class="text-decoration-none prev"><img class="img-fluid" src="/static/img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_6" class="text-decoration-none float-end next"><img class="img-fluid" src="/static/img/next.png" alt="다음버튼" width="28"></a>
</div>
</div>
<div class="d-flex justify-content-center align-items-center vh-100 vw-100 z-n1" id="box_6">
<div class="quizbox rounded-2 p-4 text-white mx-5 z-1">
<p class="fs-1 fw-bold">Q6</p>
<textarea class="form-control" placeholder="입력하세요." rows="3" cols="40" required></textarea>
<p>{{q.question6}}</p>
<div class="d-flex justify-content-center my-3">
<div class="form_radio_btn">
<input id="radio-11" type="radio" name="yesorno" value="1" required>
<input id="radio-11" type="radio" name="{{q.question6}}" value="O" required>
<label for="radio-11">O</label>
</div>
<div class="form_radio_btn">
<input id="radio-12" type="radio" name="yesorno" value="0">
<input id="radio-12" type="radio" name="{{q.question6}}" value="X">
<label for="radio-12">X</label>
</div>
</div>
<a href="#box_5" class="text-decoration-none prev"><img class="img-fluid" src="../img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_7" class="text-decoration-none float-end next"><img class="img-fluid" src="../img/next.png" alt="다음버튼" width="28"></a>
<a href="#box_5" class="text-decoration-none prev"><img class="img-fluid" src="/static/img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_8" class="text-decoration-none float-end next"><img class="img-fluid" src="/static/img/next.png" alt="다음버튼" width="28"></a>
</div>
</div>
<div class="d-flex justify-content-center align-items-center vh-100 vw-100 z-n1" id="box_7">
{% comment %} <div class="d-flex justify-content-center align-items-center vh-100 vw-100 z-n1" id="box_7">
<div class="quizbox rounded-2 p-4 text-white mx-5 z-1">
<p class="fs-1 fw-bold">Q7</p>
<textarea class="form-control" placeholder="입력하세요." rows="3" cols="40" required></textarea>
<p>{{q.question7}}</p>
<div class="d-flex justify-content-center my-3">
<div class="form_radio_btn">
<input id="radio-13" type="radio" name="yesorno" value="1" required>
<input id="radio-13" type="radio" name="{{q.question}}" value="1" required>
<label for="radio-13">O</label>
</div>
<div class="form_radio_btn">
<input id="radio-14" type="radio" name="yesorno" value="0">
<label for="radio-14">X</label>
<input id="radio-14" type="radio" name="{{q.question}}" value="0"> {% endcomment %}
{% comment %} <label for="radio-14">X</label>
</div>
</div>
<a href="#box_6" class="text-decoration-none prev"><img class="img-fluid" src="../img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_8" class="text-decoration-none float-end next"><img class="img-fluid" src="../img/next.png" alt="다음버튼" width="28"></a>
<a href="#box_6" class="text-decoration-none prev"><img class="img-fluid" src="/static/img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_8" class="text-decoration-none float-end next"><img class="img-fluid" src="/static/img/next.png" alt="다음버튼" width="28"></a>
</div>
</div>
</div> {% endcomment %}
<div class="d-flex justify-content-center align-items-center vh-100 vw-100 z-n1" id="box_8">
<div class="quizbox quizbox-last rounded-2 p-4 text-white mx-5 z-1">
<p class="fs-1 fw-bold">Q8</p>
<textarea class="form-control" placeholder="입력하세요." rows="3" cols="40" required></textarea>
<p class="fs-1 fw-bold">Q7</p>
<p>{{q.question7}}</p>
<div class="d-flex justify-content-center my-3">
<div class="form_radio_btn">
<input id="radio-15" type="radio" name="yesorno" value="1" required>
<input id="radio-15" type="radio" name="{{q.question7}}" value="O" required>
<label for="radio-15">O</label>
</div>
<div class="form_radio_btn">
<input id="radio-16" type="radio" name="yesorno" value="0">
<input id="radio-16" type="radio" name="{{q.question7}}" value="X">
<label for="radio-16">X</label>
</div>
</div>
<a href="#box_7" class="text-decoration-none prev"><img class="img-fluid" src="../img/back.png" alt="이전버튼" width="28"></a>
<a href="#box_6" class="text-decoration-none prev"><img class="img-fluid" src="/static/img/back.png" alt="이전버튼" width="28"></a>
<button type="submit" class="btn finish float-end">완료</button>
</div>
</div>
</form>
{% endfor %}
</section>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
</body>
Expand Down
Loading