Browse Source

file upload

master
unknown 5 years ago
parent
commit
e2a225b732
  1. 216
      .gitignore
  2. 22
      mysite/manage.py
  3. 0
      mysite/mysite/__init__.py
  4. 16
      mysite/mysite/asgi.py
  5. 129
      mysite/mysite/settings.py
  6. 23
      mysite/mysite/urls.py
  7. 16
      mysite/mysite/wsgi.py
  8. 0
      mysite/users/__init__.py
  9. 8
      mysite/users/admin.py
  10. 5
      mysite/users/apps.py
  11. 30
      mysite/users/models.py
  12. 41
      mysite/users/templates/users/board_delivery.html
  13. 41
      mysite/users/templates/users/board_taxi.html
  14. 318
      mysite/users/templates/users/delivery.html
  15. 412
      mysite/users/templates/users/index.html
  16. 20
      mysite/users/templates/users/login.html
  17. 292
      mysite/users/templates/users/mypage.html
  18. 311
      mysite/users/templates/users/notice.html
  19. 21
      mysite/users/templates/users/signup.html
  20. 320
      mysite/users/templates/users/taxi.html
  21. 3
      mysite/users/tests.py
  22. 17
      mysite/users/urls.py
  23. 98
      mysite/users/views.py

216
.gitignore

@ -0,0 +1,216 @@
# Created by https://www.toptal.com/developers/gitignore/api/django,python
# Edit at https://www.toptal.com/developers/gitignore?templates=django,python
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
db.sqlite3-journal
media
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
# in your Git repository. Update and uncomment the following line accordingly.
# <django-project-name>/staticfiles/
### Django.Python Stack ###
# Byte-compiled / optimized / DLL files
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
# Django stuff:
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
### Python ###
# Byte-compiled / optimized / DLL files
# C extensions
# Distribution / packaging
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
# Installer logs
# Unit test / coverage reports
# Translations
# Django stuff:
# Flask stuff:
# Scrapy stuff:
# Sphinx documentation
# PyBuilder
# Jupyter Notebook
# IPython
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
# Celery stuff
# SageMath parsed files
# Environments
# Spyder project settings
# Rope project settings
# mkdocs documentation
# mypy
# Pyre type checker
# pytype static type analyzer
# Cython debug symbols
# End of https://www.toptal.com/developers/gitignore/api/django,python

22
mysite/manage.py

@ -0,0 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

0
mysite/mysite/__init__.py

16
mysite/mysite/asgi.py

@ -0,0 +1,16 @@
"""
ASGI config for mysite project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
application = get_asgi_application()

129
mysite/mysite/settings.py

@ -0,0 +1,129 @@
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 3.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '-nhm^l^vj@i61gn2-&6ob(xc!_(wr6p)e6fkoyser^x3#r^zt1'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'users',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'mysite.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'mysite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'member',
'USER': 'root',
'PASSWORD': 'Dkrlehowl3gudwp!',
'HOST': '127.0.0.1',
'PORT': '3306',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'ko-kr'
TIME_ZONE = 'Asia/Seoul'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
AUTH_USER_MODEL = 'users.User'
APPEND_SLASH = False

23
mysite/mysite/urls.py

@ -0,0 +1,23 @@
"""mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include("users.urls")),
]

16
mysite/mysite/wsgi.py

@ -0,0 +1,16 @@
"""
WSGI config for mysite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
application = get_wsgi_application()

0
mysite/users/__init__.py

8
mysite/users/admin.py

@ -0,0 +1,8 @@
from django.contrib import admin
from .models import Board, User, Notice, Taxi
# Register your models here.
admin.site.register(User)
admin.site.register(Board)
admin.site.register(Notice)
admin.site.register(Taxi)

5
mysite/users/apps.py

@ -0,0 +1,5 @@
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'

30
mysite/users/models.py

@ -0,0 +1,30 @@
from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
class Notice(models.Model):
author = models.CharField(max_length=10, null=False)
title = models.CharField(max_length=100, null=False)
content = models.TextField(null=False)
created_date = models.DateTimeField(auto_now_add=True)
modified_date = models.DateTimeField(auto_now=True)
class Board(models.Model):
author = models.CharField(max_length=10, null=False)
title = models.CharField(max_length=100, null=False)
content = models.TextField(null=False)
created_date = models.DateTimeField(auto_now_add=True)
modified_date = models.DateTimeField(auto_now=True)
class Taxi(models.Model):
author = models.CharField(max_length=10, null=False)
title = models.CharField(max_length=100, null=False)
content = models.TextField(null=False)
created_date = models.DateTimeField(auto_now_add=True)
modified_date = models.DateTimeField(auto_now=True)
class User(AbstractUser):
student_id = models.CharField(max_length=10)
student_cl = models.CharField(max_length=255)

41
mysite/users/templates/users/board_delivery.html

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>게시판 - 글쓰기</title>
</head>
<body>
<header>
<strong>배달 글쓰기</strong>
</header>
<div class="container">
<form action="" method="POST">
{% csrf_token %}
<div class="form-group row">
<label for="inputTitle" class="col-sm-2 col-form-label"><strong>제목</strong></label>
<div class="col-sm-10">
<input type="text" name="title" class="form-control" id="inputTitle">
</div>
</div>
<div class="form-group row">
<label for="inputAuthor" class="col-sm-2 col-form-label"><strong>작성자</strong></label>
<div class="col-sm-10">
<input type="text" name="author" class="form-control" id="inputAuthor">
</div>
</div>
<div class="form-group row">
<label for="inputContent" class="col-sm-2 col-form-label"><strong>내용</strong></label>
<div class="col-sm-10">
<textarea type="text" name="content" class="form-control" id="inputContent"></textarea>
</div>
</div>
<div class="row">
<div class="col-auto mr-auto"></div>
<div class="col-auto">
<input class="btn btn-primary" type="submit" role="button" value="글쓰기">
</div>
</div>
</form>
</div>
</body>
</html>

41
mysite/users/templates/users/board_taxi.html

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>게시판 - 글쓰기</title>
</head>
<body>
<header>
<strong>택시 글쓰기</strong>
</header>
<div class="container">
<form action="" method="POST">
{% csrf_token %}
<div class="form-group row">
<label for="inputTitle" class="col-sm-2 col-form-label"><strong>제목</strong></label>
<div class="col-sm-10">
<input type="text" name="title" class="form-control" id="inputTitle">
</div>
</div>
<div class="form-group row">
<label for="inputAuthor" class="col-sm-2 col-form-label"><strong>작성자</strong></label>
<div class="col-sm-10">
<input type="text" name="author" class="form-control" id="inputAuthor">
</div>
</div>
<div class="form-group row">
<label for="inputContent" class="col-sm-2 col-form-label"><strong>내용</strong></label>
<div class="col-sm-10">
<textarea type="text" name="content" class="form-control" id="inputContent"></textarea>
</div>
</div>
<div class="row">
<div class="col-auto mr-auto"></div>
<div class="col-auto">
<input class="btn btn-primary" type="submit" role="button" value="글쓰기">
</div>
</div>
</form>
</div>
</body>
</html>

318
mysite/users/templates/users/delivery.html

@ -0,0 +1,318 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
/* Global */
:root {
--text-color: #f0f4f5;
--background-color: #263343;
--accent-color: #d49466;
}
* {
/* Tells the browser to account for any border and
padding in the values you specify for an element's
width and height. */
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Source Sans Pro';
}
a {
text-decoration: none;
color: var(--text-color);
}
/* Nav container */
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
background-color: var(--background-color);
}
/* Logo with text */
.navbar__logo {
margin-left: 40%;
font-size: 35px;
color: var(--text-color);
}
.navbar__logo i {
color: var(--accent-color);
}
/* Menu */
.navbar__menu {
color: #f0f4f5;
display: flex;
padding-left: 0;
margin-right: 50px;
list-style: none;
}
.navbar__menu li {
padding: 8px 12px;
}
.navbar__menu li:hover {
background-color: var(--accent-color);
border-radius: 4px;
}
.navbar__icons {
list-style: none;
color: var(--text-color);
display: flex;
padding-left: 0;
}
/* Icons */
.navbar__icons li {
padding: 8px 12px;
}
/* Toggle button */
.navbar__toggleBtn {
display: none;
position: absolute;
right: 32px;
font-size: 24px;
color: var(--accent-color);
}
input[id="menuicon"] {display:none;}
input[id="menuicon"] + label {display:block;margin:30px;width:60px;height:50px;position:absolute;cursor:pointer;}
input[id="menuicon"] + label span {display:block;position:absolute;width:100%;height:5px;border-radius:30px;background:#000;transition:all .35s;}
input[id="menuicon"] + label span:nth-child(1) {top:0;}
input[id="menuicon"] + label span:nth-child(2) {top:50%;transform:translateY(-50%);} /* 비슷하게 사용할 수 있는 style top:calc(50% - 2.5px); margin-top:-2.5px;*/
input[id="menuicon"] + label span:nth-child(3) {bottom:0;}
input[id="menuicon"]:checked + label {z-index:2;}
input[id="menuicon"]:checked + label span {background:#fff;}
input[id="menuicon"]:checked + label span:nth-child(1) {top:50%;transform:translateY(-50%) rotate(45deg);}
input[id="menuicon"]:checked + label span:nth-child(2) {opacity:0;}
input[id="menuicon"]:checked + label span:nth-child(3) {bottom:50%;transform:translateY(50%) rotate(-45deg);}
div[class="sidebar"] {width:300px;height:100%;background:#222;position:fixed;top:0;left:-300px;z-index:1;transition:all .35s;}
input[id="menuicon"]:checked + label + div {left:0;}
.sidemenu {
position: relative;
left: 0px;
top: 120px;
color: white;
font-size: 20px;
margin-top: 60px;
list-style: none;
}
#naver_id_login, .next {
margin-top: 25%;
text-align: center;
}
.imgfile {
margin-top: 20%;
margin-left: 39%;
}
/* For small screen */
@media screen and (max-width: 768px) {
.navbar__menu {
display: none;
}
input[id="menuicon"] {display:none;}
input[id="menuicon"] + label {display:block;margin:30px;width:60px;height:50px;position:absolute;cursor:pointer;}
input[id="menuicon"] + label span {display:block;position:absolute;width:100%;height:5px;border-radius:30px;background:#000;transition:all .35s;}
input[id="menuicon"] + label span:nth-child(1) {top:0;}
input[id="menuicon"] + label span:nth-child(2) {top:50%;transform:translateY(-50%);} /* 비슷하게 사용할 수 있는 style top:calc(50% - 2.5px); margin-top:-2.5px;*/
input[id="menuicon"] + label span:nth-child(3) {bottom:0;}
input[id="menuicon"]:checked + label {z-index:2;}
input[id="menuicon"]:checked + label span {background:#fff;}
input[id="menuicon"]:checked + label span:nth-child(1) {top:50%;transform:translateY(-50%) rotate(45deg);}
input[id="menuicon"]:checked + label span:nth-child(2) {opacity:0;}
input[id="menuicon"]:checked + label span:nth-child(3) {bottom:50%;transform:translateY(50%) rotate(-45deg);}
div[class="sidebar"] {width:300px;height:100%;background:#222;position:fixed;top:0;left:-300px;z-index:1;transition:all .35s;}
input[id="menuicon"]:checked + label + div {left:0;}
}
body {
margin: 0;
padding: 0;
}
table {
border-collapse: collapse;
}
caption {
display: none;
}
a {
text-decoration: none;
color: inherit;
}
.board_list_wrap {
padding: 50px;
}
.board_list {
width: 100%;
border-top: 2px solid navy;
}
.board_list tr {
border-bottom: 1px solid #ccc;
}
.board_list th,
.board_list td {
padding: 10px;
font-size: 14px;
}
.board_list td {
text-align: center;
}
.board_list .tit {
text-align: left;
}
.board_list .tit:hover {
text-decoration: underline;
}
.board_list_wrap .paging {
margin-top: 20px;
text-align: center;
font-size: 0;
}
.board_list_wrap .paging a {
display: inline-block;
margin-left: 10px;
padding: 5px 10px;
border-radius: 100px;
font-size: 12px;
}
.board_list_wrap .paging a:first-child {
margin-left: 0;
}
.board_list_wrap .paging a.bt {
border: 1px solid #eee;
background: #eee;
}
.board_list_wrap .paging a.num {
border: 1px solid navy;
font-weight: 600;
color: navy;
}
.board_list_wrap .paging a.num.on {
background: navy;
color: #fff;
}
</style>
{% comment %} <link rel="stylesheet" href="./main.css" />
<link rel="stylesheet" href="./notice.css"> {% endcomment %}
<link
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap"
rel="stylesheet"
/>
<title>Main</title>
<script
src="https://kit.fontawesome.com/2d323a629b.js"
crossorigin="anonymous"
></script>
</head>
<body>
<nav class="navbar">
<!-- Logo with text -->
<div class="navbar__logo">
<i class="fab fa-accusoft"></i>
<a href='../'>소확프</a>
</div>
<!-- Menu -->
<ul class="navbar__menu">
<li><a href="#">문의사항</a></li>
{% if user.is_authenticated %}
<li><a href="{% url 'user:mypage' %}">마이페이지</a>
<li><a href="{% url 'user:logout' %}">로그아웃 </a>
{% else %}
<li><a href="{% url 'user:login' %}">로그인</a></li>
{% endif %}
</ul>
<!-- Toggle button -->
<a href="#" class="navbar__toggleBtn">
<i class="fas fa-bars"></i>
</a>
<input type="checkbox" id="menuicon">
<label for="menuicon">
<span></span>
<span></span>
<span></span>
</label>
<div class = "sidebar">
<ul class="side">
<li class="sidemenu"><a href="{% url 'user:delivery' %}">배달비</a></li>
<li class="sidemenu"><a href="{% url 'user:taxi' %}">택시비</a></li>
<li class="sidemenu"><a href="#">문의사항</a></li>
</ul>
</div>
</nav>
<div class="board_list_wrap">
<table class="board_list">
배 달
<thead>
<tr>
<th>번호</th>
<th>제목</th>
<th>글쓴이</th>
<th>작성일</th>
</tr>
</thead>
<tbody>
{% for board_ds in board_d %}
<tr class="text-center">
<th scope="row">
<span>{{ board_ds.id }}</span>
</th>
<td>
<a href="detail/{{ board_ds.id }}">
<span>{{ board_ds.title }}</span>
</a>
</td>
<td>
<span>{{ board_ds.author }}</span>
</td>
<td>
<span>{{ board_ds.created_date | date:"Y-m-d h:i" }}</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</tbody>
</table>
{% if user.is_authenticated %}
<a class="btn btn-primary" href="/board_delivery" role="button">글쓰기</a>
{% endif %}
</div>
</body>
</html>

412
mysite/users/templates/users/index.html

@ -0,0 +1,412 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
/* Global */
:root {
--text-color: #f0f4f5;
--background-color: #263343;
--accent-color: #d49466;
}
* {
/* Tells the browser to account for any border and
padding in the values you specify for an element's
width and height. */
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Source Sans Pro';
}
a {
text-decoration: none;
color: var(--text-color);
}
/* Nav container */
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
background-color: var(--background-color);
}
/* Logo with text */
.navbar__logo {
margin-left: 40%;
font-size: 35px;
color: var(--text-color);
}
.navbar__logo i {
color: var(--accent-color);
}
/* Menu */
.navbar__menu {
color: #f0f4f5;
display: flex;
padding-left: 0;
margin-right: 50px;
list-style: none;
}
.navbar__menu li {
padding: 8px 12px;
}
.navbar__menu li:hover {
background-color: var(--accent-color);
border-radius: 4px;
}
.navbar__icons {
list-style: none;
color: var(--text-color);
display: flex;
padding-left: 0;
}
/* Icons */
.navbar__icons li {
padding: 8px 12px;
}
/* Toggle button */
.navbar__toggleBtn {
display: none;
position: absolute;
right: 32px;
font-size: 24px;
color: var(--accent-color);
}
input[id="menuicon"] {display:none;}
input[id="menuicon"] + label {display:block;margin:30px;width:60px;height:50px;position:absolute;cursor:pointer;}
input[id="menuicon"] + label span {display:block;position:absolute;width:100%;height:5px;border-radius:30px;background:#000;transition:all .35s;}
input[id="menuicon"] + label span:nth-child(1) {top:0;}
input[id="menuicon"] + label span:nth-child(2) {top:50%;transform:translateY(-50%);} /* 비슷하게 사용할 수 있는 style top:calc(50% - 2.5px); margin-top:-2.5px;*/
input[id="menuicon"] + label span:nth-child(3) {bottom:0;}
input[id="menuicon"]:checked + label {z-index:2;}
input[id="menuicon"]:checked + label span {background:#fff;}
input[id="menuicon"]:checked + label span:nth-child(1) {top:50%;transform:translateY(-50%) rotate(45deg);}
input[id="menuicon"]:checked + label span:nth-child(2) {opacity:0;}
input[id="menuicon"]:checked + label span:nth-child(3) {bottom:50%;transform:translateY(50%) rotate(-45deg);}
div[class="sidebar"] {width:300px;height:100%;background:#222;position:fixed;top:0;left:-300px;z-index:1;transition:all .35s;}
input[id="menuicon"]:checked + label + div {left:0;}
.sidemenu {
position: relative;
left: 0px;
top: 120px;
color: white;
font-size: 20px;
margin-top: 60px;
list-style: none;
}
#naver_id_login, .next {
margin-top: 25%;
text-align: center;
}
.imgfile {
margin-top: 20%;
margin-left: 39%;
}
/* For small screen */
@media screen and (max-width: 768px) {
.navbar__menu {
display: none;
}
input[id="menuicon"] {display:none;}
input[id="menuicon"] + label {display:block;margin:30px;width:60px;height:50px;position:absolute;cursor:pointer;}
input[id="menuicon"] + label span {display:block;position:absolute;width:100%;height:5px;border-radius:30px;background:#000;transition:all .35s;}
input[id="menuicon"] + label span:nth-child(1) {top:0;}
input[id="menuicon"] + label span:nth-child(2) {top:50%;transform:translateY(-50%);} /* 비슷하게 사용할 수 있는 style top:calc(50% - 2.5px); margin-top:-2.5px;*/
input[id="menuicon"] + label span:nth-child(3) {bottom:0;}
input[id="menuicon"]:checked + label {z-index:2;}
input[id="menuicon"]:checked + label span {background:#fff;}
input[id="menuicon"]:checked + label span:nth-child(1) {top:50%;transform:translateY(-50%) rotate(45deg);}
input[id="menuicon"]:checked + label span:nth-child(2) {opacity:0;}
input[id="menuicon"]:checked + label span:nth-child(3) {bottom:50%;transform:translateY(50%) rotate(-45deg);}
div[class="sidebar"] {width:300px;height:100%;background:#222;position:fixed;top:0;left:-300px;z-index:1;transition:all .35s;}
input[id="menuicon"]:checked + label + div {left:0;}
}
body {
margin: 0;
padding: 0;
}
table {
border-collapse: collapse;
}
caption {
display: none;
}
a {
text-decoration: none;
color: inherit;
}
.board_list_wrap {
padding: 50px;
}
.board_list {
width: 100%;
border-top: 2px solid navy;
}
.board_list tr {
border-bottom: 1px solid #ccc;
}
.board_list th,
.board_list td {
padding: 10px;
font-size: 14px;
}
.board_list td {
text-align: center;
}
.board_list .tit {
text-align: left;
}
.board_list .tit:hover {
text-decoration: underline;
}
.board_list_wrap .paging {
margin-top: 20px;
text-align: center;
font-size: 0;
}
.board_list_wrap .paging a {
display: inline-block;
margin-left: 10px;
padding: 5px 10px;
border-radius: 100px;
font-size: 12px;
}
.board_list_wrap .paging a:first-child {
margin-left: 0;
}
.board_list_wrap .paging a.bt {
border: 1px solid #eee;
background: #eee;
}
.board_list_wrap .paging a.num {
border: 1px solid navy;
font-weight: 600;
color: navy;
}
.board_list_wrap .paging a.num.on {
background: navy;
color: #fff;
}
</style>
{% comment %} <link rel="stylesheet" href="./main.css" />
<link rel="stylesheet" href="./notice.css"> {% endcomment %}
<link
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap"
rel="stylesheet"
/>
<title>Main</title>
<script
src="https://kit.fontawesome.com/2d323a629b.js"
crossorigin="anonymous"
></script>
</head>
<body>
<!-- Nav container -->
<nav class="navbar">
<!-- Logo with text -->
<div class="navbar__logo">
<i class="fab fa-accusoft"></i>
<a href='../'>소확프</a>
</div>
<!-- Menu -->
<ul class="navbar__menu">
<li><a href="#">문의사항</a></li>
{% if user.is_authenticated %}
<li><a href="{% url 'user:mypage' %}">마이페이지</a>
<li><a href="{% url 'user:logout' %}">로그아웃 </a>
{% else %}
<li><a href="./login">로그인</a></li>
{% endif %}
</ul>
<!-- Toggle button -->
<a href="#" class="navbar__toggleBtn">
<i class="fas fa-bars"></i>
</a>
<input type="checkbox" id="menuicon">
<label for="menuicon">
<span></span>
<span></span>
<span></span>
</label>
<div class = "sidebar">
<ul class="side">
<li class="sidemenu"><a href='./delivery'>배달비</a></li>
<li class="sidemenu"><a href='./taxi'>택시비</a></li>
<li class="sidemenu"><a href="#">문의사항</a></li>
</ul>
</div>
</nav>
<div class="board_list_wrap">
<table class="board_list">
<a href='./notice'>공지사항</a>
<thead>
<tr>
<th>번호</th>
<th>제목</th>
<th>글쓴이</th>
<th>작성일</th>
</tr>
</thead>
<tbody>
{% for notice_ds in notice %}
<tr class="text-center">
<th scope="row">
<span>{{ notice_ds.id }}</span>
</th>
<td>
<a href="detail/{{ notice_ds.id }}">
<span>{{ notice_ds.title }}</span>
</a>
</td>
<td>
<span>{{ notice_ds.author }}</span>
</td>
<td>
<span>{{ notice_ds.created_date | date:"Y-m-d h:i" }}</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="board_list_wrap">
<table class="board_list">
<a href='./delivery'>배 달</a>
<thead>
<tr>
<th>번호</th>
<th>제목</th>
<th>글쓴이</th>
<th>작성일</th>
</tr>
</thead>
<tbody>
{% for board_ds in board_d %}
<tr class="text-center">
<th scope="row">
<span>{{ board_ds.id }}</span>
</th>
<td>
<a href="detail/{{ board_ds.id }}">
<span>{{ board_ds.title }}</span>
</a>
</td>
<td>
<span>{{ board_ds.author }}</span>
</td>
<td>
<span>{{ board_ds.created_date | date:"Y-m-d h:i" }}</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</tbody>
</table>
</div>
{% comment %}
</tr>
</thead>
<tbody>
{% for board_ds in board_d %}
<tr class="text-center">
<th scope="row">
<span>{{ board_ds.id }}</span>
</th>
<td>
<a href="detail/{{ board_ds.id }}">
<span>{{ board_ds.title }}</span>
</a>
</td>
<td>
<span>{{ board_ds.author }}</span>
</td>
<td>
<span>{{ board_ds.created_date | date:"Y-m-d h:i" }}</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</tbody>
</table>
</div> {% endcomment %}
<div class="board_list_wrap">
<table class="board_list">
<a href='./taxi'>택 시</a>
<thead>
<tr>
<th>번호</th>
<th>제목</th>
<th>글쓴이</th>
<th>작성일</th>
</tr>
</thead>
<tbody>
{% for taxi_ds in taxi %}
<tr class="text-center">
<th scope="row">
<span>{{ taxi_ds.id }}</span>
</th>
<td>
<a href="detail/{{ taxi_ds.id }}">
<span>{{ taxi_ds.title }}</span>
</a>
</td>
<td>
<span>{{ taxi_ds.author }}</span>
</td>
<td>
<span>{{ taxi_ds.created_date | date:"Y-m-d h:i" }}</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</tbody>
</table>
</div>
</body>
</html>

20
mysite/users/templates/users/login.html

@ -0,0 +1,20 @@
로그인 페이지<br>
{% if user.is_authenticated %}
로그인성공!
{{ user.username }}님 환영합니다.
<a href="{% url 'user:mypage' %}">마이페이지</a>
<a href="{% url 'user:logout' %}">로그아웃 </a>
{% else %}
<form action = "" method = "POST">
{% csrf_token %}
아이디
<input name = "username" type = "text"><br>
비밀번호
<input name = "password" type = "password">
<input type = "submit" value = "로그인">
</form>
<a href="{% url 'user:signup' %}">회원가입</a>
{% endif %}

292
mysite/users/templates/users/mypage.html

@ -0,0 +1,292 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
/* Global */
:root {
--text-color: #f0f4f5;
--background-color: #263343;
--accent-color: #d49466;
}
* {
/* Tells the browser to account for any border and
padding in the values you specify for an element's
width and height. */
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Source Sans Pro';
}
a {
text-decoration: none;
color: var(--text-color);
}
/* Nav container */
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
background-color: var(--background-color);
}
/* Logo with text */
.navbar__logo {
margin-left: 40%;
font-size: 35px;
color: var(--text-color);
}
.navbar__logo i {
color: var(--accent-color);
}
/* Menu */
.navbar__menu {
color: #f0f4f5;
display: flex;
padding-left: 0;
margin-right: 50px;
list-style: none;
}
.navbar__menu li {
padding: 8px 12px;
}
.navbar__menu li:hover {
background-color: var(--accent-color);
border-radius: 4px;
}
.navbar__icons {
list-style: none;
color: var(--text-color);
display: flex;
padding-left: 0;
}
/* Icons */
.navbar__icons li {
padding: 8px 12px;
}
/* Toggle button */
.navbar__toggleBtn {
display: none;
position: absolute;
right: 32px;
font-size: 24px;
color: var(--accent-color);
}
input[id="menuicon"] {display:none;}
input[id="menuicon"] + label {display:block;margin:30px;width:60px;height:50px;position:absolute;cursor:pointer;}
input[id="menuicon"] + label span {display:block;position:absolute;width:100%;height:5px;border-radius:30px;background:#000;transition:all .35s;}
input[id="menuicon"] + label span:nth-child(1) {top:0;}
input[id="menuicon"] + label span:nth-child(2) {top:50%;transform:translateY(-50%);} /* 비슷하게 사용할 수 있는 style top:calc(50% - 2.5px); margin-top:-2.5px;*/
input[id="menuicon"] + label span:nth-child(3) {bottom:0;}
input[id="menuicon"]:checked + label {z-index:2;}
input[id="menuicon"]:checked + label span {background:#fff;}
input[id="menuicon"]:checked + label span:nth-child(1) {top:50%;transform:translateY(-50%) rotate(45deg);}
input[id="menuicon"]:checked + label span:nth-child(2) {opacity:0;}
input[id="menuicon"]:checked + label span:nth-child(3) {bottom:50%;transform:translateY(50%) rotate(-45deg);}
div[class="sidebar"] {width:300px;height:100%;background:#222;position:fixed;top:0;left:-300px;z-index:1;transition:all .35s;}
input[id="menuicon"]:checked + label + div {left:0;}
.sidemenu {
position: relative;
left: 0px;
top: 120px;
color: white;
font-size: 20px;
margin-top: 60px;
list-style: none;
}
#naver_id_login, .next {
margin-top: 25%;
text-align: center;
}
.imgfile {
margin-top: 20%;
margin-left: 39%;
}
/* For small screen */
@media screen and (max-width: 768px) {
.navbar__menu {
display: none;
}
input[id="menuicon"] {display:none;}
input[id="menuicon"] + label {display:block;margin:30px;width:60px;height:50px;position:absolute;cursor:pointer;}
input[id="menuicon"] + label span {display:block;position:absolute;width:100%;height:5px;border-radius:30px;background:#000;transition:all .35s;}
input[id="menuicon"] + label span:nth-child(1) {top:0;}
input[id="menuicon"] + label span:nth-child(2) {top:50%;transform:translateY(-50%);} /* 비슷하게 사용할 수 있는 style top:calc(50% - 2.5px); margin-top:-2.5px;*/
input[id="menuicon"] + label span:nth-child(3) {bottom:0;}
input[id="menuicon"]:checked + label {z-index:2;}
input[id="menuicon"]:checked + label span {background:#fff;}
input[id="menuicon"]:checked + label span:nth-child(1) {top:50%;transform:translateY(-50%) rotate(45deg);}
input[id="menuicon"]:checked + label span:nth-child(2) {opacity:0;}
input[id="menuicon"]:checked + label span:nth-child(3) {bottom:50%;transform:translateY(50%) rotate(-45deg);}
div[class="sidebar"] {width:300px;height:100%;background:#222;position:fixed;top:0;left:-300px;z-index:1;transition:all .35s;}
input[id="menuicon"]:checked + label + div {left:0;}
}
body {
margin: 0;
padding: 0;
}
table {
border-collapse: collapse;
}
caption {
display: none;
}
a {
text-decoration: none;
color: inherit;
}
.board_list_wrap {
padding: 50px;
}
.board_list {
width: 100%;
border-top: 2px solid navy;
}
.board_list tr {
border-bottom: 1px solid #ccc;
}
.board_list th,
.board_list td {
padding: 10px;
font-size: 14px;
}
.board_list td {
text-align: center;
}
.board_list .tit {
text-align: left;
}
.board_list .tit:hover {
text-decoration: underline;
}
.board_list_wrap .paging {
margin-top: 20px;
text-align: center;
font-size: 0;
}
.board_list_wrap .paging a {
display: inline-block;
margin-left: 10px;
padding: 5px 10px;
border-radius: 100px;
font-size: 12px;
}
.board_list_wrap .paging a:first-child {
margin-left: 0;
}
.board_list_wrap .paging a.bt {
border: 1px solid #eee;
background: #eee;
}
.board_list_wrap .paging a.num {
border: 1px solid navy;
font-weight: 600;
color: navy;
}
.board_list_wrap .paging a.num.on {
background: navy;
color: #fff;
}
</style>
{% comment %} <link rel="stylesheet" href="./main.css" />
<link rel="stylesheet" href="./notice.css"> {% endcomment %}
<link
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap"
rel="stylesheet"
/>
<title>Main</title>
<script
src="https://kit.fontawesome.com/2d323a629b.js"
crossorigin="anonymous"
></script>
</head>
<body>
<nav class="navbar">
<!-- Logo with text -->
<div class="navbar__logo">
<i class="fab fa-accusoft"></i>
<a href='../'>소확프</a>
</div>
<!-- Menu -->
<ul class="navbar__menu">
<li><a href="#">문의사항</a></li>
{% if user.is_authenticated %}
<li><a href="{% url 'user:mypage' %}">마이페이지</a>
<li><a href="{% url 'user:logout' %}">로그아웃 </a>
{% else %}
<li><a href="./login">로그인</a></li>
{% endif %}
</ul>
<!-- Toggle button -->
<a href="#" class="navbar__toggleBtn">
<i class="fas fa-bars"></i>
</a>
<input type="checkbox" id="menuicon">
<label for="menuicon">
<span></span>
<span></span>
<span></span>
</label>
<div class = "sidebar">
<ul class="side">
<li class="sidemenu"><a href="{% url 'user:delivery' %}">배달비</a></li>
<li class="sidemenu"><a href="{% url 'user:taxi' %}">택시비</a></li>
<li class="sidemenu"><a href="#">문의사항</a></li>
</ul>
</div>
</nav>
<h1>마이페이지 입니다</h1>
</body>
</html>
{% comment %} <html>
<head>
<title>My Page</title>
</head>
<body>
<h1>마이페이지 페이지입니다</h1>
<p><a href ='../'>home</a></p>
</body>
</html> {% endcomment %}

311
mysite/users/templates/users/notice.html

@ -0,0 +1,311 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
/* Global */
:root {
--text-color: #f0f4f5;
--background-color: #263343;
--accent-color: #d49466;
}
* {
/* Tells the browser to account for any border and
padding in the values you specify for an element's
width and height. */
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Source Sans Pro';
}
a {
text-decoration: none;
color: var(--text-color);
}
/* Nav container */
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
background-color: var(--background-color);
}
/* Logo with text */
.navbar__logo {
margin-left: 40%;
font-size: 35px;
color: var(--text-color);
}
.navbar__logo i {
color: var(--accent-color);
}
/* Menu */
.navbar__menu {
color: #f0f4f5;
display: flex;
padding-left: 0;
margin-right: 50px;
list-style: none;
}
.navbar__menu li {
padding: 8px 12px;
}
.navbar__menu li:hover {
background-color: var(--accent-color);
border-radius: 4px;
}
.navbar__icons {
list-style: none;
color: var(--text-color);
display: flex;
padding-left: 0;
}
/* Icons */
.navbar__icons li {
padding: 8px 12px;
}
/* Toggle button */
.navbar__toggleBtn {
display: none;
position: absolute;
right: 32px;
font-size: 24px;
color: var(--accent-color);
}
input[id="menuicon"] {display:none;}
input[id="menuicon"] + label {display:block;margin:30px;width:60px;height:50px;position:absolute;cursor:pointer;}
input[id="menuicon"] + label span {display:block;position:absolute;width:100%;height:5px;border-radius:30px;background:#000;transition:all .35s;}
input[id="menuicon"] + label span:nth-child(1) {top:0;}
input[id="menuicon"] + label span:nth-child(2) {top:50%;transform:translateY(-50%);} /* 비슷하게 사용할 수 있는 style top:calc(50% - 2.5px); margin-top:-2.5px;*/
input[id="menuicon"] + label span:nth-child(3) {bottom:0;}
input[id="menuicon"]:checked + label {z-index:2;}
input[id="menuicon"]:checked + label span {background:#fff;}
input[id="menuicon"]:checked + label span:nth-child(1) {top:50%;transform:translateY(-50%) rotate(45deg);}
input[id="menuicon"]:checked + label span:nth-child(2) {opacity:0;}
input[id="menuicon"]:checked + label span:nth-child(3) {bottom:50%;transform:translateY(50%) rotate(-45deg);}
div[class="sidebar"] {width:300px;height:100%;background:#222;position:fixed;top:0;left:-300px;z-index:1;transition:all .35s;}
input[id="menuicon"]:checked + label + div {left:0;}
.sidemenu {
position: relative;
left: 0px;
top: 120px;
color: white;
font-size: 20px;
margin-top: 60px;
list-style: none;
}
#naver_id_login, .next {
margin-top: 25%;
text-align: center;
}
.imgfile {
margin-top: 20%;
margin-left: 39%;
}
/* For small screen */
@media screen and (max-width: 768px) {
.navbar__menu {
display: none;
}
input[id="menuicon"] {display:none;}
input[id="menuicon"] + label {display:block;margin:30px;width:60px;height:50px;position:absolute;cursor:pointer;}
input[id="menuicon"] + label span {display:block;position:absolute;width:100%;height:5px;border-radius:30px;background:#000;transition:all .35s;}
input[id="menuicon"] + label span:nth-child(1) {top:0;}
input[id="menuicon"] + label span:nth-child(2) {top:50%;transform:translateY(-50%);} /* 비슷하게 사용할 수 있는 style top:calc(50% - 2.5px); margin-top:-2.5px;*/
input[id="menuicon"] + label span:nth-child(3) {bottom:0;}
input[id="menuicon"]:checked + label {z-index:2;}
input[id="menuicon"]:checked + label span {background:#fff;}
input[id="menuicon"]:checked + label span:nth-child(1) {top:50%;transform:translateY(-50%) rotate(45deg);}
input[id="menuicon"]:checked + label span:nth-child(2) {opacity:0;}
input[id="menuicon"]:checked + label span:nth-child(3) {bottom:50%;transform:translateY(50%) rotate(-45deg);}
div[class="sidebar"] {width:300px;height:100%;background:#222;position:fixed;top:0;left:-300px;z-index:1;transition:all .35s;}
input[id="menuicon"]:checked + label + div {left:0;}
}
body {
margin: 0;
padding: 0;
}
table {
border-collapse: collapse;
}
caption {
display: none;
}
a {
text-decoration: none;
color: inherit;
}
.board_list_wrap {
padding: 50px;
}
.board_list {
width: 100%;
border-top: 2px solid navy;
}
.board_list tr {
border-bottom: 1px solid #ccc;
}
.board_list th,
.board_list td {
padding: 10px;
font-size: 14px;
}
.board_list td {
text-align: center;
}
.board_list .tit {
text-align: left;
}
.board_list .tit:hover {
text-decoration: underline;
}
.board_list_wrap .paging {
margin-top: 20px;
text-align: center;
font-size: 0;
}
.board_list_wrap .paging a {
display: inline-block;
margin-left: 10px;
padding: 5px 10px;
border-radius: 100px;
font-size: 12px;
}
.board_list_wrap .paging a:first-child {
margin-left: 0;
}
.board_list_wrap .paging a.bt {
border: 1px solid #eee;
background: #eee;
}
.board_list_wrap .paging a.num {
border: 1px solid navy;
font-weight: 600;
color: navy;
}
.board_list_wrap .paging a.num.on {
background: navy;
color: #fff;
}
</style>
{% comment %} <link rel="stylesheet" href="./main.css" />
<link rel="stylesheet" href="./notice.css"> {% endcomment %}
<link
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap"
rel="stylesheet"
/>
<title>Main</title>
<script
src="https://kit.fontawesome.com/2d323a629b.js"
crossorigin="anonymous"
></script>
</head>
<body>
<nav class="navbar">
<!-- Logo with text -->
<div class="navbar__logo">
<i class="fab fa-accusoft"></i>
<a href='../'>소확프</a>
</div>
<!-- Menu -->
<ul class="navbar__menu">
<li><a href="#">문의사항</a></li>
{% if user.is_authenticated %}
<li><a href="{% url 'user:mypage' %}">마이페이지</a>
<li><a href="{% url 'user:logout' %}">로그아웃 </a>
{% else %}
<li><a href="{% url 'user:login' %}">로그인</a></li>
{% endif %}
</ul>
<!-- Toggle button -->
<a href="#" class="navbar__toggleBtn">
<i class="fas fa-bars"></i>
</a>
<input type="checkbox" id="menuicon">
<label for="menuicon">
<span></span>
<span></span>
<span></span>
</label>
<div class = "sidebar">
<ul class="side">
<li class="sidemenu"><a href="{% url 'user:delivery' %}">배달비</a></li>
<li class="sidemenu"><a href="{% url 'user:taxi' %}">택시비</a></li>
<li class="sidemenu"><a href="#">문의사항</a></li>
</ul>
</div>
</nav>
<div class="board_list_wrap">
<table class="board_list">
공지사항
<thead>
<tr>
<th>번호</th>
<th>제목</th>
<th>글쓴이</th>
<th>작성일</th>
</tr>
</thead>
<tbody>
{% for notice_ds in notice %}
<tr class="text-center">
<th scope="row">
<span>{{ notice_ds.id }}</span>
</th>
<td>
<a href="detail/{{ notice_ds.id }}">
<span>{{ notice_ds.title }}</span>
</a>
</td>
<td>
<span>{{ notice_ds.author }}</span>
</td>
<td>
<span>{{ notice_ds.created_date | date:"Y-m-d h:i" }}</span>
</td>
</tr>
{% endfor %}
</tbody>
</body>
</html>

21
mysite/users/templates/users/signup.html

@ -0,0 +1,21 @@
회원가입 페이지
<br>
<form action="" method="POST">
{% csrf_token %}
<p>아이디</p>
<input name="username" type="text">
<p>비밀번호</p>
<input name="password" type="password">
<p></p>
<input name="firstname" type="text">
<p>이름</p>
<input name="lastname" type="text">
<p>이메일</p>
<input name="email" type="text">
<p>학번</p>
<input name="student_id" type="text">
<p>학과</p>
<input name="student_cl" type="text">
<input type="submit" value="회원가입">
</form>

320
mysite/users/templates/users/taxi.html

@ -0,0 +1,320 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
/* Global */
:root {
--text-color: #f0f4f5;
--background-color: #263343;
--accent-color: #d49466;
}
* {
/* Tells the browser to account for any border and
padding in the values you specify for an element's
width and height. */
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Source Sans Pro';
}
a {
text-decoration: none;
color: var(--text-color);
}
/* Nav container */
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
background-color: var(--background-color);
}
/* Logo with text */
.navbar__logo {
margin-left: 40%;
font-size: 35px;
color: var(--text-color);
}
.navbar__logo i {
color: var(--accent-color);
}
/* Menu */
.navbar__menu {
color: #f0f4f5;
display: flex;
padding-left: 0;
margin-right: 50px;
list-style: none;
}
.navbar__menu li {
padding: 8px 12px;
}
.navbar__menu li:hover {
background-color: var(--accent-color);
border-radius: 4px;
}
.navbar__icons {
list-style: none;
color: var(--text-color);
display: flex;
padding-left: 0;
}
/* Icons */
.navbar__icons li {
padding: 8px 12px;
}
/* Toggle button */
.navbar__toggleBtn {
display: none;
position: absolute;
right: 32px;
font-size: 24px;
color: var(--accent-color);
}
input[id="menuicon"] {display:none;}
input[id="menuicon"] + label {display:block;margin:30px;width:60px;height:50px;position:absolute;cursor:pointer;}
input[id="menuicon"] + label span {display:block;position:absolute;width:100%;height:5px;border-radius:30px;background:#000;transition:all .35s;}
input[id="menuicon"] + label span:nth-child(1) {top:0;}
input[id="menuicon"] + label span:nth-child(2) {top:50%;transform:translateY(-50%);} /* 비슷하게 사용할 수 있는 style top:calc(50% - 2.5px); margin-top:-2.5px;*/
input[id="menuicon"] + label span:nth-child(3) {bottom:0;}
input[id="menuicon"]:checked + label {z-index:2;}
input[id="menuicon"]:checked + label span {background:#fff;}
input[id="menuicon"]:checked + label span:nth-child(1) {top:50%;transform:translateY(-50%) rotate(45deg);}
input[id="menuicon"]:checked + label span:nth-child(2) {opacity:0;}
input[id="menuicon"]:checked + label span:nth-child(3) {bottom:50%;transform:translateY(50%) rotate(-45deg);}
div[class="sidebar"] {width:300px;height:100%;background:#222;position:fixed;top:0;left:-300px;z-index:1;transition:all .35s;}
input[id="menuicon"]:checked + label + div {left:0;}
.sidemenu {
position: relative;
left: 0px;
top: 120px;
color: white;
font-size: 20px;
margin-top: 60px;
list-style: none;
}
#naver_id_login, .next {
margin-top: 25%;
text-align: center;
}
.imgfile {
margin-top: 20%;
margin-left: 39%;
}
/* For small screen */
@media screen and (max-width: 768px) {
.navbar__menu {
display: none;
}
input[id="menuicon"] {display:none;}
input[id="menuicon"] + label {display:block;margin:30px;width:60px;height:50px;position:absolute;cursor:pointer;}
input[id="menuicon"] + label span {display:block;position:absolute;width:100%;height:5px;border-radius:30px;background:#000;transition:all .35s;}
input[id="menuicon"] + label span:nth-child(1) {top:0;}
input[id="menuicon"] + label span:nth-child(2) {top:50%;transform:translateY(-50%);} /* 비슷하게 사용할 수 있는 style top:calc(50% - 2.5px); margin-top:-2.5px;*/
input[id="menuicon"] + label span:nth-child(3) {bottom:0;}
input[id="menuicon"]:checked + label {z-index:2;}
input[id="menuicon"]:checked + label span {background:#fff;}
input[id="menuicon"]:checked + label span:nth-child(1) {top:50%;transform:translateY(-50%) rotate(45deg);}
input[id="menuicon"]:checked + label span:nth-child(2) {opacity:0;}
input[id="menuicon"]:checked + label span:nth-child(3) {bottom:50%;transform:translateY(50%) rotate(-45deg);}
div[class="sidebar"] {width:300px;height:100%;background:#222;position:fixed;top:0;left:-300px;z-index:1;transition:all .35s;}
input[id="menuicon"]:checked + label + div {left:0;}
}
body {
margin: 0;
padding: 0;
}
table {
border-collapse: collapse;
}
caption {
display: none;
}
a {
text-decoration: none;
color: inherit;
}
.board_list_wrap {
padding: 50px;
}
.board_list {
width: 100%;
border-top: 2px solid navy;
}
.board_list tr {
border-bottom: 1px solid #ccc;
}
.board_list th,
.board_list td {
padding: 10px;
font-size: 14px;
}
.board_list td {
text-align: center;
}
.board_list .tit {
text-align: left;
}
.board_list .tit:hover {
text-decoration: underline;
}
.board_list_wrap .paging {
margin-top: 20px;
text-align: center;
font-size: 0;
}
.board_list_wrap .paging a {
display: inline-block;
margin-left: 10px;
padding: 5px 10px;
border-radius: 100px;
font-size: 12px;
}
.board_list_wrap .paging a:first-child {
margin-left: 0;
}
.board_list_wrap .paging a.bt {
border: 1px solid #eee;
background: #eee;
}
.board_list_wrap .paging a.num {
border: 1px solid navy;
font-weight: 600;
color: navy;
}
.board_list_wrap .paging a.num.on {
background: navy;
color: #fff;
}
</style>
{% comment %} <link rel="stylesheet" href="./main.css" />
<link rel="stylesheet" href="./notice.css"> {% endcomment %}
<link
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap"
rel="stylesheet"
/>
<title>Main</title>
<script
src="https://kit.fontawesome.com/2d323a629b.js"
crossorigin="anonymous"
></script>
</head>
<body>
<nav class="navbar">
<!-- Logo with text -->
<div class="navbar__logo">
<i class="fab fa-accusoft"></i>
<a href='../'>소확프</a>
</div>
<!-- Menu -->
<ul class="navbar__menu">
<li><a href="#">문의사항</a></li>
{% if user.is_authenticated %}
<li><a href="{% url 'user:mypage' %}">마이페이지</a>
<li><a href="{% url 'user:logout' %}">로그아웃 </a>
{% else %}
<li><a href="{% url 'user:login' %}">로그인</a></li>
{% endif %}
</ul>
<!-- Toggle button -->
<a href="#" class="navbar__toggleBtn">
<i class="fas fa-bars"></i>
</a>
<input type="checkbox" id="menuicon">
<label for="menuicon">
<span></span>
<span></span>
<span></span>
</label>
<div class = "sidebar">
<ul class="side">
<li class="sidemenu"><a href="{% url 'user:delivery' %}">배달비</a></li>
<li class="sidemenu"><a href="{% url 'user:taxi' %}">택시비</a></li>
<li class="sidemenu"><a href="#">문의사항</a></li>
</ul>
</div>
</nav>
<div class="board_list_wrap">
<table class="board_list">
택 시
<thead>
<tr>
<th>번호</th>
<th>제목</th>
<th>글쓴이</th>
<th>작성일</th>
</tr>
</thead>
<tbody>
{% for taxi_ds in taxi %}
<tr class="text-center">
<th scope="row">
<span>{{ taxi_ds.id }}</span>
</th>
<td>
<a href="detail/{{ taxi_ds.id }}">
<span>{{ taxi_ds.title }}</span>
</a>
</td>
<td>
<span>{{ taxi_ds.author }}</span>
</td>
<td>
<span>{{ taxi_ds.created_date | date:"Y-m-d h:i" }}</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</tbody>
</table>
</tbody>
</table>
{% if user.is_authenticated %}
<a class="btn btn-primary" href="/board_taxi" role="button">글쓰기</a>
{% endif %}
</div>
</body>
</html>

3
mysite/users/tests.py

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

17
mysite/users/urls.py

@ -0,0 +1,17 @@
from django.urls import path
from . import views
app_name = "user"
urlpatterns = [
path("logout", views.logout_view, name='logout'),
path("signup", views.signup_view, name='signup'),
path('login', views.login_view, name='login'),
path("", views.index, name='index'),
path('taxi', views.taxi_view, name='taxi'),
path('delivery', views.delivery_view, name='delivery'),
path('notice', views.notice_view, name='notice'),
path('mypage', views.mypage_view, name='mypage'),
path('board_delivery', views.board_delivery),
path('board_taxi', views.board_taxi),
]

98
mysite/users/views.py

@ -0,0 +1,98 @@
from django.contrib.auth import authenticate, login, logout
from django.shortcuts import redirect, render
from django.urls.conf import include
from .models import *
from django.http.response import HttpResponseRedirect
from django.urls import reverse
# Create your views here.
def index(request):
board = {'board_d': Board.objects.all(), 'notice': Notice.objects.all(), 'taxi': Taxi.objects.all()}
return render(request, 'users/index.html', board)
def mypage_view(request):
return render(request, 'users/mypage.html')
def taxi_view(request):
board = {'taxi': Taxi.objects.all()}
return render(request, 'users/taxi.html', board)
def delivery_view(request):
board = {'board_d': Board.objects.all()}
return render(request, 'users/delivery.html', board)
def notice_view(request):
board = {'notice': Notice.objects.all()}
return render(request, 'users/notice.html', board)
def login_view(request):
if request.method == "POST":
username = request.POST["username"]
password = request.POST["password"]
user = authenticate(username=username, password=password)
if user is not None:
print("인증성공")
login(request, user)
return redirect("user:index")
else:
print("인증실패")
return render(request, "users/login.html")
def logout_view(request):
logout(request)
return redirect("user:index")
def signup_view(request):
if request.method == "POST":
print(request.POST)
username = request.POST["username"]
password = request.POST["password"]
firstname = request.POST["firstname"]
lastname = request.POST["lastname"]
email = request.POST["email"]
student_id = request.POST["student_id"]
student_cl = request.POST["student_cl"]
user = User.objects.create_user(username, email, password)
user.last_name = lastname
user.first_name = firstname
user.student_id = student_id
user.student_cl = student_cl
user.save()
return redirect("user:login")
return render(request, "users/signup.html")
# 배달게시판
def board_delivery(request):
if request.method == "POST":
author = request.POST['author']
title = request.POST['title']
content = request.POST['content']
board = Board(author=author, title=title, content=content)
board.save()
return redirect("user:index")
else:
return render(request, 'users/board_delivery.html')
# 택시게시판
def board_taxi(request):
if request.method == "POST":
author = request.POST['author']
title = request.POST['title']
content = request.POST['content']
board = Taxi(author=author, title=title, content=content)
board.save()
return redirect("user:index")
else:
return render(request, 'users/board_taxi.html')
Loading…
Cancel
Save