Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session10 assignment - 17_채희찬 #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
237 changes: 237 additions & 0 deletions 17_채희찬/session9, 10/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@

# Created by https://www.toptal.com/developers/gitignore/api/python,django,venv
# Edit at https://www.toptal.com/developers/gitignore?templates=python,django,venv

### 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

### Database ###
*.accdb
*.db
*.dbf
*.mdb
*.pdb
*.sqlite3

# 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

### venv ###
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
pip-selfcheck.json

# End of https://www.toptal.com/developers/gitignore/api/python,django,venv
Empty file.
4 changes: 4 additions & 0 deletions 17_채희찬/session9, 10/account/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from django.contrib import admin
from .models import User

admin.site.register(User)
6 changes: 6 additions & 0 deletions 17_채희찬/session9, 10/account/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class AccountConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'account'
46 changes: 46 additions & 0 deletions 17_채희찬/session9, 10/account/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Generated by Django 3.2.4 on 2021-07-17 15:30

import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

initial = True

dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]

operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('nickname', models.CharField(max_length=50)),
('university', models.CharField(max_length=50)),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
],
options={
'verbose_name': 'user',
'verbose_name_plural': 'users',
'abstract': False,
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
]
Empty file.
7 changes: 7 additions & 0 deletions 17_채희찬/session9, 10/account/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.db import models

from django.contrib.auth.models import AbstractUser

class User(AbstractUser):
nickname = models.CharField(max_length=50)
university = models.CharField(max_length=50)
7 changes: 7 additions & 0 deletions 17_채희찬/session9, 10/account/static/css/home.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.header{
display: flex;
border-bottom: 1px solid black;
justify-content: center;
align-items: center;
background-color: pink;
}
14 changes: 14 additions & 0 deletions 17_채희찬/session9, 10/account/templates/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% extends "base.html" %}
{% load static %}
{% block link %}{% static 'css/home.css' %}{% endblock %}
{% block title %} login {% endblock %}
{% block contents %}
<form method="POST" action="{% url 'login' %}">
{% csrf_token %}
<input type="text" name="username" placeholder="아이디를 입력하세요."><br>
<input type="password" name="password" placeholder="비밀번호를 입력허세요.">
<button>로그인</button>
<p>{{ error }}</p>
</form>
</body>
{% endblock %}
13 changes: 13 additions & 0 deletions 17_채희찬/session9, 10/account/templates/mypage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends "base.html" %}
{% load static %}
{% block link %}{% static 'css/home.css' %}{% endblock %}
{% block title %} My Page {% endblock %}
{% block contents %}
<h2>내 정보</h2>
<span>아이디 : </span>
<span>{{user.username}}</span><br>
<span>별명 : </span>
<span>{{user.nickname}}</span><br>
<span>대학교 : </span>
<span>{{user.university}}</span>
{% endblock %}
16 changes: 16 additions & 0 deletions 17_채희찬/session9, 10/account/templates/signup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% extends "base.html" %}
{% load static %}
{% block link %}{% static 'css/home.css' %}{% endblock %}
{% block title %} login {% endblock %}
{% block contents %}
<form method="POST" action="{% url 'signup' %}">
{% csrf_token %}
<input type="text" name="username", placeholder="아이디를 입력하세요."><br>
<input type="text" name="nickname", placeholder="별명을 입력하세요."><br>
<input type="text" name="university", placeholder="재학중인 대학교를 입력하세요."><br>
<input type="password" name="password", placeholder="비밀번호를 입력하세요."><br>
<input type="password" name="password2", placeholder="비밀번호를 한 번 더 입력하세요."><br>
<input type="image" name="user_profile"><br>
<button>로그인</button>
</form>
{% endblock %}
3 changes: 3 additions & 0 deletions 17_채희찬/session9, 10/account/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
9 changes: 9 additions & 0 deletions 17_채희찬/session9, 10/account/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.urls import path
from . import views

urlpatterns = [
path('signup', views.user_signup, name='signup'),
path('login', views.user_login, name="login"),
path('logout', views.user_logout, name="logout"),
path('mypage', views.mypage, name="mypage"),
]
Loading