Skip to content

Commit

Permalink
EDIT 404, 505 template page.
Browse files Browse the repository at this point in the history
  • Loading branch information
dizwe committed Aug 31, 2017
1 parent ab3c516 commit 341207d
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 9 deletions.
91 changes: 90 additions & 1 deletion fitterKakao/templates/404.html
Original file line number Diff line number Diff line change
@@ -1 +1,90 @@
<h1>hi</h1>
<!DOCTYPE html>
<html lang="en">
{% load staticfiles %}

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>{% block title %}{% endblock %}</title>

<meta name="description" content="Source code generated using layoutit.com">
<meta name="author" content="LayoutIt!">

<link rel="shortcut icon" href="{% static 'pic/favicon.ico' %}" type="image/x-icon">
<link rel="icon" href="{% static 'pic/favicon.ico' %}" type="image/x-icon">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<!-- 합쳐지고 최소화된 최신 CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- 합쳐지고 최소화된 최신 자바스크립트 -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>

<link href="{% static 'css/layout.css' %}" rel="stylesheet">
{% block head %}{% endblock %}
</head>


<body>
<!-- LOGIN Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="form-signin-heading">로그인<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button></h4>
</div>
<div class="modal-body">
<div class="embed-responsive embed-responsive-ratio">
<iframe class="embed-responsive-item" src="/accounts/login"></iframe>
</div>
</div>
</div>
</div>
</div>

<!-- MAIN -->
<nav class="navbar navbar-default navbar-static-top" role="navigation">
<div class='col-lg-offset-1 col-lg-10 navbar-padding'>
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
</button> <a class="navbar-brand" href="/">Fitter</a>
</div>

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">

{% if user.is_authenticated %}
<li>
<a href="/clothes">옷s</a>
</li>
<li>
<a href="{% url 'fitterKakao:post_edit' user_name=request.user.username %}">내 데이터</a>
</li>
{% else %}
<li>
<a href="/accounts/signup">회원가입</a>
</li>
{% endif %}
<li>
{% if user.is_authenticated %}
<a href = "{% url 'logout' %}">로그아웃</a>
{% else %}
<a id="login" href="#myModal" role="button" data-toggle="modal">로그인</a>
{% endif %}
</li>
</ul>
</div>
</div>

</nav>


<div class="cover col-md-offset-1 col-md-10">
<div class="cover col-md-offset-4 col-md-8">
<h1>페이지가 없어용(404)</h1>
</div>
</div>
<script src="{% static 'js/scripts.js' %}"></script>
</body>
</html>
91 changes: 90 additions & 1 deletion fitterKakao/templates/500.html
Original file line number Diff line number Diff line change
@@ -1 +1,90 @@
<h1>500</h1>
<!DOCTYPE html>
<html lang="en">
{% load staticfiles %}

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>{% block title %}{% endblock %}</title>

<meta name="description" content="Source code generated using layoutit.com">
<meta name="author" content="LayoutIt!">

<link rel="shortcut icon" href="{% static 'pic/favicon.ico' %}" type="image/x-icon">
<link rel="icon" href="{% static 'pic/favicon.ico' %}" type="image/x-icon">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<!-- 합쳐지고 최소화된 최신 CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- 합쳐지고 최소화된 최신 자바스크립트 -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>

<link href="{% static 'css/layout.css' %}" rel="stylesheet">
{% block head %}{% endblock %}
</head>


<body>
<!-- LOGIN Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="form-signin-heading">로그인<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button></h4>
</div>
<div class="modal-body">
<div class="embed-responsive embed-responsive-ratio">
<iframe class="embed-responsive-item" src="/accounts/login"></iframe>
</div>
</div>
</div>
</div>
</div>

<!-- MAIN -->
<nav class="navbar navbar-default navbar-static-top" role="navigation">
<div class='col-lg-offset-1 col-lg-10 navbar-padding'>
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
</button> <a class="navbar-brand" href="/">Fitter</a>
</div>

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">

{% if user.is_authenticated %}
<li>
<a href="/clothes">옷s</a>
</li>
<li>
<a href="{% url 'fitterKakao:post_edit' user_name=request.user.username %}">내 데이터</a>
</li>
{% else %}
<li>
<a href="/accounts/signup">회원가입</a>
</li>
{% endif %}
<li>
{% if user.is_authenticated %}
<a href = "{% url 'logout' %}">로그아웃</a>
{% else %}
<a id="login" href="#myModal" role="button" data-toggle="modal">로그인</a>
{% endif %}
</li>
</ul>
</div>
</div>

</nav>


<div class="cover col-md-offset-1 col-md-10">
<div class="cover col-md-offset-4 col-md-8">
<h1>우익! 서버에 에러가!(500)</h1>
</div>
</div>
<script src="{% static 'js/scripts.js' %}"></script>
</body>
</html>
3 changes: 0 additions & 3 deletions fitterKakao/tests.py

This file was deleted.

11 changes: 7 additions & 4 deletions fitterKakao/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,25 +185,28 @@ def post_edit(request, user_name):

@login_required
def add_clothes(request, kinds):
"""한꺼번에 여러 옷들까지 추가할수 있는 기능(공통된 부분은 same_clothes 로)"""
class RequiredFormSet(BaseFormSet):
def __init__(self, *args, **kwargs):
super(RequiredFormSet, self).__init__(*args, **kwargs)
for form in self.forms:
form.empty_permitted = False

top_clothes_formset = formset_factory(TopClothesForm, max_num=3,
formset=RequiredFormSet)
formset=RequiredFormSet)
bottom_clothes_formset = formset_factory(BottomClothesForm, max_num=3,
formset=RequiredFormSet)
formset=RequiredFormSet)

if request.method == "POST":
# 공통되는 부분 form
same_clothes_form = SameClothesForm(request.POST, request.FILES)
if kinds == 'top':
clothes_formset = top_clothes_formset(request.POST, request.FILES)
hashTag = '#top-clothes'
elif kinds == 'bot':
clothes_formset = bottom_clothes_formset(request.POST, request.FILES)
hashTag = '#bottom-clothes'

if clothes_formset.is_valid():
same_clothes = same_clothes_form.save(commit=False)
same_clothes.save()
Expand Down Expand Up @@ -258,14 +261,14 @@ def edit_clothes(request, kinds, tag_num):
clothes = clothes_form.save(commit=False)
clothes.nick = just_saved
clothes.url = just_saved
if 'same_photo-stay' not in request.POST:
if 'same_photo-stay' not in request.POST: # 사진을 유지하라고 하지 않았으면
clothes.photo = just_saved
clothes.name = request.user
clothes.save()

return redirect(reverse('fitterKakao:choose_clothes')+hashTag)
else:

# pk는 TopClothes밖에 없으므로 그 저장된 데이터의 foreignkey pk를 다시 구해야함
if kinds == 'top':
existing_clothes = TopClothes.objects.get(pk=tag_num)
clothes_form = TopClothesForm(instance=existing_clothes)
Expand Down

0 comments on commit 341207d

Please sign in to comment.