Skip to content

Commit aad219b

Browse files
committed
merge
1 parent 72b11d7 commit aad219b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+85
-100
lines changed
12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.

board/__pycache__/apps.cpython-39.pyc

12 Bytes
Binary file not shown.
222 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.

board/__pycache__/urls.cpython-39.pyc

-37 Bytes
Binary file not shown.
-302 Bytes
Binary file not shown.

board/forms.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class PostForm(forms.ModelForm):
66
title = forms.CharField(label='제목', max_length=500,
77
widget=forms.Textarea(attrs={'rows':'1', 'cols': '80'}))
88
body = forms.CharField(label='내용', max_length=1000,
9-
widget=forms.Textarea(attrs={'rows':'15', 'cols': '80'}))
9+
widget=forms.Textarea(attrs={'rows':'15', 'cols': '100'}))
1010
class Meta:
1111
model = Post
1212
fields =['title','category','body','image']
@@ -16,4 +16,8 @@ class CommentForm(forms.ModelForm):
1616
widget=forms.Textarea(attrs={'rows':'3', 'cols': '50'}))
1717
class Meta:
1818
model = Comment
19-
fields =['body']
19+
fields =['body']
20+
21+
22+
class PostSearchForm(forms.Form):
23+
search_word = forms.CharField(label='Search Word')
Binary file not shown.
Binary file not shown.
Binary file not shown.

board/templates/button.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>버튼 예제</title>
7+
<link rel="stylesheet" href="/board/templates/style.css">
8+
</head>
9+
<body>
10+
<button>올리기</button>
11+
</body>
12+
</html>

board/templates/createBlog.html

Whitespace-only changes.

board/templates/detail.html

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
background-color: rgb(235, 235, 235);
4444
color: rgb(65, 65, 65);
4545
border: 1px solid green;
46+
word-break: break-all;
47+
padding: 30px;
4648
}
4749

4850
.writer {

board/templates/new.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
{%extends 'shared/base.html'%}
23

34
{%block content%}

board/templates/search.html

+2-35
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,15 @@
33
{%block content %}
44

55
{% load static %}
6-
<style>
7-
8-
#contents{
9-
overflow-y:scroll;
10-
overflow-x:hidden;
11-
}
12-
#content{
13-
width: 500px;
14-
margin:auto;
15-
padding-top: 30px;
16-
padding-bottom: 30px;
17-
margin-bottom: 10px;
18-
background-color: rgb(247, 247, 247);
19-
}
20-
form{
21-
margin: auto;
22-
background-color: rgb(247, 247, 247);
23-
width: 500px;;
24-
padding-top: 20px;
25-
padding-bottom: 20px;
26-
}
27-
28-
</style>
296

307

318
<div class="postlist">
329
<div id="contents">
3310

3411
<br><br>
35-
36-
<form action="." method="post"> {% csrf_token %}
37-
<h1>제목/ 내용 검색</h1>
38-
{{ form.as_table }} <!-- form을 테이블 형식으로 표시, 여기서 form은 views에서 넘겨준 PostSearchForm 객체임-->
39-
<input type="submit" value="Submit" class="btn btn-primary btn-sm">
40-
<hr width="300px">
41-
</form>
42-
43-
44-
4512
<br><br>
46-
{% if object_list %}
47-
{% for unit in object_list %}
13+
{% if list %}
14+
{% for unit in list %}
4815
<div id="content">
4916
제목 | {{unit.title}}<br>
5017
작성자 | {{unit.writer}}<br>

board/urls.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010

1111
#게시판 카테고리
1212

13-
path('allPost/', allPost,name="allPost"),
14-
path('free/',free,name="free"),
15-
path('review/',review,name="review"),
16-
path('suggest/',suggest,name="suggest"),
13+
path('allPost/<str:cate>', allPost,name="allPost"),
14+
15+
#검색
16+
path('search/', SearchFormView, name='search'),
1717

18-
1918
#댓글
2019
path('deleteComment/<str:postId>/<str:commentId>',deleteComment,name="deleteComment"),
2120
path('update_review/<str:post_id>/<str:comment_id>', update_review, name="update_review"),

board/views.py

+29-26
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,16 @@ def detail(request,postId):
2020
commentForm = CommentForm()
2121
return render(request,'detail.html',{'posts':post,'comments':comments,'re_comments':re_comments,'commentForms':commentForm})
2222
#게시판 카테고리
23-
def allPost(request):
24-
post=Post.objects.all().order_by('-id')
23+
def allPost(request,cate):
24+
if cate=="all":
25+
post=Post.objects.all().order_by('-id')
26+
else :
27+
post=Post.objects.filter( category = cate).order_by('-id')
2528
paginatorPost = Paginator(post, 10)
2629
page = request.GET.get('page')
2730
posts = paginatorPost.get_page(page)
28-
cate="all"
29-
return render(request,"allPost.html",{'posts':posts,'cate':cate})
30-
def free(request):
31-
post=Post.objects.filter( category = 'free').order_by('-id')
32-
paginatorPost = Paginator(post, 10)
33-
page = request.GET.get('page')
34-
posts = paginatorPost.get_page(page)
35-
cate="free"
36-
return render(request,"allPost.html",{'posts':posts,'cate':cate})
37-
def review(request):
38-
post=Post.objects.filter( category = 'review').order_by('-id')
39-
paginatorPost = Paginator(post, 10)
40-
page = request.GET.get('page')
41-
posts = paginatorPost.get_page(page)
42-
cate="review"
43-
return render(request,"allPost.html",{'posts':posts,'cate':cate})
44-
def suggest(request):
45-
post=Post.objects.filter( category = 'suggest').order_by('-id')
46-
paginatorPost = Paginator(post, 10)
47-
page = request.GET.get('page')
48-
posts = paginatorPost.get_page(page)
49-
cate="suggest"
5031
return render(request,"allPost.html",{'posts':posts,'cate':cate})
5132

52-
5333
#새로운 글 작성 않이 이거 cate원하는대로 ㅇ안됨
5434
def new(request,cate):
5535
if request.method == 'POST': #글 작성 후 저장버튼 눌렀을 때
@@ -144,4 +124,27 @@ def update_review(request, post_id, comment_id):
144124
def deleteComment(request,postId,commentId):
145125
deleteComment = get_object_or_404(Comment,pk=commentId)
146126
deleteComment.delete() #삭제해주는 메소드
147-
return redirect("detailPage",postId)
127+
return redirect("detailPage",postId)
128+
'''
129+
#검색
130+
class SearchFormView(FormView):
131+
form_class = PostSearchForm
132+
template_name = 'search.html'
133+
134+
def form_valid(self, form):
135+
searchWord = form.cleaned_data['search_word']
136+
post_list = Post.objects.filter(Q(title__icontains=searchWord) | Q(body__icontains=searchWord) ).distinct().order_by('-id')
137+
138+
context = {}
139+
context['form'] = form
140+
context['search_term'] = searchWord
141+
context['object_list'] = post_list
142+
143+
return render(self.request, self.template_name, context)'''
144+
145+
def SearchFormView(request):
146+
list = Post.objects.all()
147+
search_key = request.GET.get('search_key') # 검색어 가져오기
148+
if search_key: # 만약 검색어가 존재하면
149+
list = list.filter(Q(title__icontains=search_key) | Q(body__icontains=search_key) ).distinct().order_by('-id')# 해당 검색어를 포함한 queryset 가져오기
150+
return render(request, 'search.html', {'list':list})
12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.

chongzaban/static/images/1.jpg

346 KB

chongzaban/static/images/2.jpg

399 KB

chongzaban/static/images/3.jpg

219 KB

chongzaban/static/images/4.jpg

247 KB

chongzaban/static/images/5.jpg

212 KB

chongzaban/static/images/likelion.jpg

8.95 KB

chongzaban/templates/index.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@
3838
<div class="introduce">
3939
<div id="container">
4040
<div class="slider">
41-
<div class="slider_item"><img src="{% static 'images/balloon.jpg' %}"></div>
42-
<div class="slider_item"><img src="{% static 'images/ocean.jpg' %}"></div>
43-
<div class="slider_item"><img src="{% static 'images/jump.jpg' %}"></div>
41+
<div class="slider_item"><img src="{% static 'images/1.jpg' %}"></div>
42+
<div class="slider_item"><img src="{% static 'images/2.jpg' %}"></div>
43+
<div class="slider_item"><img src="{% static 'images/3.jpg' %}"></div>
44+
<div class="slider_item"><img src="{% static 'images/4.jpg' %}"></div>
45+
<div class="slider_item"><img src="{% static 'images/5.jpg' %}"></div>
4446
</div>
4547
</div>
4648
</div>
+5-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
{% load static %}
12
<footer class="footer">
23
<div class="row">
34
<div class="col-sm-6 text-center text-sm-right order-sm-1">
45
<ul class="text-gray">
5-
<li><a href="#">Terms of use</a></li>
6-
<li><a href="#">Privacy Policy</a></li>
6+
<li>멋쟁이사자처럼</li>
7+
<li><img src="{% static 'images/likelion.jpg' %}" width="50px"></li>
78
</ul>
89
</div>
910
<div class="col-sm-6 text-center text-sm-left mt-3 mt-sm-0">
10-
<small class="text-muted d-block">Copyright © 2019 <a href="http://www.uxcandy.co" target="_blank">UXCANDY</a>. All rights reserved</small>
11-
<small class="text-gray mt-2">Handcrafted With <i class="mdi mdi-heart text-danger"></i></small>
11+
<small class="text-muted d-block">Copyright © <a href="#" >콩자반</a>. All rights reserved</small>
12+
<small class="text-gray mt-2">With 신홍석 이슬기 이충헌 정은영 <i class="mdi mdi-heart text-danger"></i></small>
1213
</div>
1314
</div>
1415
</footer>

chongzaban/templates/partials/_sidebar.html

+17-4
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ <h6 id="display-address" class="display-income" style="font-size: 16px;">주소<
4949
</a>
5050
<ul class="collapse navigation-submenu" id="sample-pages">
5151
<li>
52-
<a href="{% url 'allPost' %}">전체게시판</a>
52+
<a href="{% url 'allPost' 'all'%}">전체게시판</a>
5353
</li>
5454
<li>
55-
<a href="{% url 'free' %}" >자유게시판</a>
55+
<a href="{% url 'allPost' 'free' %}" >자유게시판</a>
5656
</li>
5757
<li>
58-
<a href="{% url 'suggest' %}" >건의하기</a>
58+
<a href="{% url 'allPost' 'suggest' %}" >건의하기</a>
5959
</li>
6060
<li>
61-
<a href="{% url 'review' %}" >후기</a>
61+
<a href="{% url 'allPost' 'review' %}" >후기</a>
6262
</li>
6363
</ul>
6464
</li>
@@ -85,6 +85,7 @@ <h6 id="display-address" class="display-income" style="font-size: 16px;">주소<
8585
</a>
8686
<ul class="collapse navigation-submenu" id="sample-pages">
8787
<li>
88+
<<<<<<< HEAD
8889
<a href="{% url 'allPost' %}" target="_blank">전체게시판</a>
8990
</li>
9091
<li>
@@ -95,6 +96,18 @@ <h6 id="display-address" class="display-income" style="font-size: 16px;">주소<
9596
</li>
9697
<li>
9798
<a href="" target="_blank">후기</a>
99+
=======
100+
<a href="{% url 'allPost' 'all'%}">전체게시판</a>
101+
</li>
102+
<li>
103+
<a href="{% url 'allPost' 'free' %}" >자유게시판</a>
104+
</li>
105+
<li>
106+
<a href="{% url 'allPost' 'suggest' %}" >건의하기</a>
107+
</li>
108+
<li>
109+
<a href="{% url 'allPost' 'review' %}" >후기</a>
110+
>>>>>>> 67b9bf7 (merge)
98111
</li>
99112
</ul>
100113
</li>

chongzaban/templates/shared/base.html

+2-21
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,8 @@
4242

4343
<!-- content viewport ends -->
4444
<!-- partial:partials/_footer.html -->
45-
<footer class="footer">
46-
<div class="row">
47-
<div class="col-sm-6 text-center text-sm-right order-sm-1">
48-
<ul class="text-gray">
49-
<li><a href="#">Terms of use</a></li>
50-
<li><a href="#">Privacy Policy</a></li>
51-
</ul>
52-
</div>
53-
<div class="col-sm-6 text-center text-sm-left mt-3 mt-sm-0">
54-
<small class="text-muted d-block">
55-
Copyright © 2019
56-
<a href="http://www.uxcandy.co" target="_blank">UXCANDY</a>
57-
. All rights reserved
58-
</small>
59-
<small class="text-gray mt-2">
60-
Handcrafted With
61-
<i class="mdi mdi-heart text-danger"></i>
62-
</small>
63-
</div>
64-
</div>
65-
</footer>
45+
46+
{% include 'partials/_footer.html' %}
6647
<!-- partial -->
6748
</div>
6849
<!-- page content ends -->
12 Bytes
Binary file not shown.

room/__pycache__/admin.cpython-39.pyc

12 Bytes
Binary file not shown.

room/__pycache__/apps.cpython-39.pyc

12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.
Binary file not shown.
12 Bytes
Binary file not shown.

user/__pycache__/admin.cpython-39.pyc

12 Bytes
Binary file not shown.

user/__pycache__/apps.cpython-39.pyc

12 Bytes
Binary file not shown.

user/__pycache__/forms.cpython-39.pyc

12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)