Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…roject into dev
  • Loading branch information
Do-ho committed Aug 9, 2019
2 parents 50f3f6c + 8769f77 commit 58c43d9
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 26 deletions.
11 changes: 0 additions & 11 deletions accounts/templates/accounts/home.html

This file was deleted.

5 changes: 3 additions & 2 deletions board/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ class Board(models.Model) :
body = models.TextField()
product_price = models.PositiveIntegerField(blank=True,default=0)
order_price = models.PositiveIntegerField(default=0)
state = models.CharField(max_length=20)
state = models.CharField(max_length=15)
userId = models.IntegerField()
userName = models.CharField(max_length=20)
image = models.ImageField(upload_to='images/', blank=True)
image1 = models.ImageField(upload_to='images/', blank=True)
image2 = models.ImageField(upload_to='images/', blank=True)
Expand All @@ -33,7 +34,7 @@ def __str__(self) :
class Comment(models.Model):
post = models.IntegerField()
userId = models.IntegerField()
author = models.CharField(max_length=20)
author = models.CharField(max_length=15)
text = models.TextField()
price = models.IntegerField()
created_date = models.DateTimeField(auto_now_add=True)
Expand Down
4 changes: 2 additions & 2 deletions board/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ def create(request) :
print("로그인 안됨")



# 보완 - 로그인 상태 아닐 경우,
#if(request.user.username is None)
boards.userId = request.user.id
boards.userId = request.user.id
boards.userName = request.user.nickname
## 수정필요 ##

boards.save()
Expand Down
5 changes: 3 additions & 2 deletions gasili/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@
# Application definition

INSTALLED_APPS = [
'accounts.apps.AccountsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'home.apps.HomeConfig',
'board.apps.BoardConfig'
'board.apps.BoardConfig',
'accounts.apps.AccountsConfig',
'mypage.apps.MypageConfig',
]

MIDDLEWARE = [
Expand Down
9 changes: 0 additions & 9 deletions gasili/settings.py.rej

This file was deleted.

1 change: 1 addition & 0 deletions gasili/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@
path('', home.views.index, name='index'),
path('accounts/', include('accounts.urls')),
path('board/', include('board.urls')),
path('mypage/', include('mypage.urls')),
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Empty file added mypage/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions mypage/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions mypage/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class MypageConfig(AppConfig):
name = 'mypage'
Empty file added mypage/migrations/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions mypage/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
51 changes: 51 additions & 0 deletions mypage/templates/mypage/mypage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{% extends 'base.html' %}

{% block content %}
<div class="container-fluid row" style="width:100%; margin:0; padding:0;">
<div class="containerleft">
</div>
<div class="containerbody">
<div class="container" style="margin:0,25px,25px,25px; width:100%;">
<section id="recently">
<div class="col">
<div class="row">
<div style="border-radius: 5px; border:1px dashed rgb(91,155,213); width:100%; ">
<h1 style="text-align: center;">Mypage!</h1>
<div style="padding-top: 50px;"></div>
<div class="flexbox">
<div class="item">내가 쓴 게시글</div>
<div class="item">내가 단 댓글</div>
<div class="item">사용자정보</div>
</div>
<div style="padding-top: 150px;">
<table class="table table-hover">
<thead>
<tr style="text-align: center;">
<th scope="col">순번</th>
<th scope="col">글제목</th>
<th scope="col">작성자</th>
<th scope="col">작성일자</th>
</tr>
</thead>
<tbody>
{% for post in posts %}
<tr onclick="location.href='{% url 'test' post.id %}'" style="text-align: center;">
<th scope="row">{{post.id}}</th>
<td>{{post.title}}</td>
<td>{{post.userName}}</td>
<td>{{post.date}}</td>
</tr>

{%endfor%}
</tbody>
</table>

</div>
</div>
</div>
</section>
</div>
</div>
<div class="containerright"></div>
</div>
{% endblock %}
3 changes: 3 additions & 0 deletions mypage/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.
6 changes: 6 additions & 0 deletions mypage/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.urls import path
from . import views

urlpatterns = [
path('mypage/', views.mypage, name='mypage'),
]
10 changes: 10 additions & 0 deletions mypage/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.shortcuts import render, redirect
from board.models import Board

# Create your views here.
def mypage(request):
if request.user.is_authenticated:
posts = Board.objects.filter(userId = request.user.id)
return render(request, 'mypage/mypage.html', {'posts': posts})
else:
return redirect('login')

0 comments on commit 58c43d9

Please sign in to comment.