From d24b3987b62e8a20e324c9d721b0f2207ec19e6a Mon Sep 17 00:00:00 2001 From: eunseoJeong Date: Sat, 20 Nov 2021 05:33:12 +0900 Subject: [PATCH] =?UTF-8?q?[BE][=EC=9D=80=EC=84=9C]=20::=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=20=EA=B2=8C=EC=8B=9C=ED=8C=90=20=EB=B7=B0=EC=88=98?= =?UTF-8?q?=EC=A0=95,=20=EB=B0=B0=ED=8F=AC=EB=A5=BC=20=EC=9C=84=ED=95=9C?= =?UTF-8?q?=20=EC=85=8B=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | Bin 0 -> 27844 bytes school/views.py | 188 ++++++++++++++++++++-------------------- school_ties/settings.py | 2 +- 3 files changed, 93 insertions(+), 97 deletions(-) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..b22f1f5de613cc87e2e3b2431593f2d61972d7c5 GIT binary patch literal 27844 zcmcJYYfoI+m4@qcr1=l?2WSi!Um}f^PDfD`O=h~|NImlj8EkB9ZcUZj#y>vEdd|zs zzMk@SAFNVQ1$FjXYp?rdpWc`W(NlW5r3lp2XjF14<3;XtlR`63@NW^VNR*JX}4F$6>sG z6xV+Ys5b%eKUTkswU_ZciN9Q~Ud6kecz-@&x(rO5!OW`bpx|otE_QShtNOd&#NMxi-s9DWfPWtJ?XI2$)Th&aUIw?GPrI*o zP{KAZ9t8)U23>IBFjgMMqvgeIV7i*2=Z8ry=K1AH*9tzIh0h0pWiO~am?%x~cZ2$~ zN!sH2b?l74+{E9^<;TIV$9Md?34XqvK7ot-A0DCt39oQroE8oO>pLV(uF=%qjGKGK`rz>iJwp7 z@g(>K=O4#2@!HgECLKEqKKJP;xq~I5lU$#;a(KrJ=?+#khvzzW{WW;F-gwvx_Q`(G zQDo8LxeflFgv{TB1TN!wb8m5dyrbS@9h3n1r~}y)%9EfU&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F;4SP7ckKsO~_^=!EF>XH5ySO6qal)i8Jds^oRO#`u^OqgP}|M3|mtu~ymLPT+0t z`1$Re@QEGGG=$@*i^KGiSz~w9m~e^Ll0P5rr+9t3a=xT%4WCSle2a<|pVOYbWlByT zO%eYjG~w4Q=BHVTPUT>2$HCh^Eo0hRLNcZFZRlV@tMsJyL`?-h@A>CsXn#Lrwhp!&mU*h2glMMzE&5h!viM0<#our@R%?CGO}3Zs zj-4|Lp!3C4K>y=qt}9;3pH)ZqYme^NifS@Xna4y^@;WqIS0oPRpOCe{ zd2(QXuO5>Eaarq`a`9gymh90mYzg>Uc&pvv)$96(?t&>o;+jjdA3mX5xP%_VNc0c| zi2|aF*U~aS2bYM!-^G)Y0`!C7Hr^jg6tB`%Se0~xbC2_NMQ)4RR-00tIA@Zfo>SXr F{WtJI^~L}I literal 0 HcmV?d00001 diff --git a/school/views.py b/school/views.py index 447b051..12bd55b 100644 --- a/school/views.py +++ b/school/views.py @@ -287,78 +287,76 @@ def study_detail(request, id): print(detail_notice) return render(request, 'notice_detail.html', {'detail_notice':detail_notice}) -#공지사항 update +#스터디게시판 update @login_required -@staff_member_required -def notice_edit(request, id): - notice = Notice.objects.get(id = id) - return render(request, 'notice_edit.html', {'notice': notice}) +def study_edit(request, id): + study = Study_board.objects.get(id = id) + return render(request, 'study_edit.html', {'study': study}) -def notice_update(request, id): - notice_update = Notice.objects.get(id = id) +def study_update(request, id): + study_update = Study_board.objects.get(id = id) user_id = request.user.id # user_id 값과 User 모델의 객체 중 일치하는 값. 즉 글 작성자의 user 객체를 user 변수에 저장합니다. user = User.objects.get(id = user_id) - notice_update.Notice_title = request.POST['title'] - notice_update.Notice_author = user - notice_update.Notice_image = request.FILES.get('image') - notice_update.Notice_body = request.POST['body'] - notice_update.Notice_pub_date = timezone.now() - notice_update.save() - return redirect('notice_detail', notice_update.id) - -#공지사항 delete -@login_required -@staff_member_required -def notice_delete(request, id): - notice_delete = Notice.objects.get(id = id) + study_update.Study_title = request.POST['title'] + study_update.Study_author = user + study_update.Study_image = request.FILES.get('image') + study_update.Study_body = request.POST['body'] + study_update.Study_pub_date = timezone.now() + study_update.save() + return redirect('study_detail', study_update.id) + +#스터디게시판 delete +@login_required +def study_delete(request, id): + study_delete = Study_board.objects.get(id = id) user_id = request.user.id save_score = User.objects.get(id = user_id) save_score.rank_count -= 1 save_score.save() - notice_delete.delete() - return redirect('notice') + study_delete.delete() + return redirect('study') -#****공지사항 댓글******* +#****스터디게시판 댓글******* @login_required -def create_notice_comment(request, notice_id): +def create_study_comment(request, study_id): if request.method == 'POST': - notice_comment = Notice_Comment() + study_comment = Study_Comment() user_id = request.user.id user = User.objects.get(id = user_id) print(user) # 작성자 = user 가 됩니다. - notice_comment.notice = get_object_or_404(Notice, pk=notice_id) - notice_comment.notice_author = user - notice_comment.notice_content = request.POST['content'] - notice_comment.notice_at = timezone.datetime.now() - notice_comment.save() - return redirect('notice_detail', notice_id) + study_comment.study = get_object_or_404(Study_board, pk=study_id) + study_comment.study_author = user + study_comment.study_content = request.POST['content'] + study_comment.study_at = timezone.datetime.now() + study_comment.save() + return redirect('study_detail', study_id) -# 공지사항 댓글 delete +# 스터디 댓글 delete @login_required -def delete_notice_comment(request, id, comment_id): - delete_notice_comment = Notice_Comment.objects.get(pk = comment_id) - delete_notice_comment.delete() - return redirect('notice_detail', id) +def delete_study_comment(request, id, comment_id): + delete_study_comment = Study_Comment.objects.get(pk = comment_id) + delete_study_comment.delete() + return redirect('study_detail', id) -# 공지사항 댓글 update +# 스터디 댓글 update @login_required -def update_notice_comment(request, id, comment_id): +def update_study_comment(request, id, comment_id): if request.method == 'POST': user_id = request.user.id # user_id 값과 User 모델의 객체 중 일치하는 값. 즉 글 작성자의 user 객체를 user 변수에 저장합니다. user = User.objects.get(id = user_id) - update_notice_comment = get_object_or_404(Notice_Comment, pk=comment_id) - update_notice_comment.notice_author = user - update_notice_comment.notice_content = request.POST['content'] - update_notice_comment.save() - return redirect('notice_detail', id) + update_study_comment = get_object_or_404(Study_Comment, pk=comment_id) + update_study_comment.study_author = user + update_study_comment.study_content = request.POST['content'] + update_study_comment.save() + return redirect('study_detail', id) else: - notice = get_object_or_404(Notice, pk=id) - comment = get_object_or_404(Notice_Comment, pk=comment_id) - return render(request, 'notice_comment_edit.html', {'notice':notice, 'comment':comment}) + study = get_object_or_404(Study_board, pk=id) + comment = get_object_or_404(Study_Comment, pk=comment_id) + return render(request, 'study_comment_edit.html', {'study':study, 'comment':comment}) @@ -392,93 +390,91 @@ def contest_post(request): else: return render(request, 'contest_new.html') -#공지사항 detail +#공모전 detail @login_required -def notice_detail(request, id): - detail_notice = get_object_or_404(Notice, pk = id) - print(detail_notice) - return render(request, 'notice_detail.html', {'detail_notice':detail_notice}) +def contest_detail(request, id): + detail_contest = get_object_or_404(Contest_board, pk = id) + print(detail_contest) + return render(request, 'contest_detail.html', {'detail_contest':detail_contest}) -#공지사항 update +#공모전 update @login_required -@staff_member_required -def notice_edit(request, id): - notice = Notice.objects.get(id = id) - return render(request, 'notice_edit.html', {'notice': notice}) +def contest_edit(request, id): + contest = Contest_board.objects.get(id = id) + return render(request, 'contest_edit.html', {'contest': contest}) -def notice_update(request, id): - notice_update = Notice.objects.get(id = id) +def contest_update(request, id): + contest_update = Contest_board.objects.get(id = id) user_id = request.user.id # user_id 값과 User 모델의 객체 중 일치하는 값. 즉 글 작성자의 user 객체를 user 변수에 저장합니다. user = User.objects.get(id = user_id) - notice_update.Notice_title = request.POST['title'] - notice_update.Notice_author = user - notice_update.Notice_image = request.FILES.get('image') - notice_update.Notice_body = request.POST['body'] - notice_update.Notice_pub_date = timezone.now() - notice_update.save() - return redirect('notice_detail', notice_update.id) - -#공지사항 delete -@login_required -@staff_member_required -def notice_delete(request, id): - notice_delete = Notice.objects.get(id = id) + contest_update.Contest_title = request.POST['title'] + contest_update.Contest_author = user + contest_update.Contest_image = request.FILES.get('image') + contest_update.Contest_body = request.POST['body'] + contest_update.Contest_pub_date = timezone.now() + contest_update.save() + return redirect('contest_detail', contest_update.id) + +#공모전 delete +@login_required +def contest_delete(request, id): + contest_delete = Contest_board.objects.get(id = id) user_id = request.user.id save_score = User.objects.get(id = user_id) save_score.rank_count -= 1 save_score.save() - notice_delete.delete() - return redirect('notice') + contest_delete.delete() + return redirect('contest') #****공지사항 댓글******* @login_required -def create_notice_comment(request, notice_id): +def create_contest_comment(request, contest_id): if request.method == 'POST': - notice_comment = Notice_Comment() + contest_comment = Contest_Comment() user_id = request.user.id user = User.objects.get(id = user_id) print(user) # 작성자 = user 가 됩니다. - notice_comment.notice = get_object_or_404(Notice, pk=notice_id) - notice_comment.notice_author = user - notice_comment.notice_content = request.POST['content'] - notice_comment.notice_at = timezone.datetime.now() - notice_comment.save() - return redirect('notice_detail', notice_id) + contest_comment.contest = get_object_or_404(Contest_board, pk=contest_id) + contest_comment.contest_author = user + contest_comment.contest_content = request.POST['content'] + contest_comment.contest_at = timezone.datetime.now() + contest_comment.save() + return redirect('contest_detail', contest_id) # 공지사항 댓글 delete @login_required -def delete_notice_comment(request, id, comment_id): - delete_notice_comment = Notice_Comment.objects.get(pk = comment_id) - delete_notice_comment.delete() - return redirect('notice_detail', id) +def delete_contest_comment(request, id, comment_id): + delete_contest_comment = Contest_Comment.objects.get(pk = comment_id) + delete_contest_comment.delete() + return redirect('contest_detail', id) # 공지사항 댓글 update @login_required -def update_notice_comment(request, id, comment_id): +def update_contest_comment(request, id, comment_id): if request.method == 'POST': user_id = request.user.id # user_id 값과 User 모델의 객체 중 일치하는 값. 즉 글 작성자의 user 객체를 user 변수에 저장합니다. user = User.objects.get(id = user_id) - update_notice_comment = get_object_or_404(Notice_Comment, pk=comment_id) - update_notice_comment.notice_author = user - update_notice_comment.notice_content = request.POST['content'] - update_notice_comment.save() - return redirect('notice_detail', id) + update_contest_comment = get_object_or_404(Contest_Comment, pk=comment_id) + update_contest_comment.contest_author = user + update_contest_comment.contest_content = request.POST['content'] + update_contest_comment.save() + return redirect('contest_detail', id) else: - notice = get_object_or_404(Notice, pk=id) - comment = get_object_or_404(Notice_Comment, pk=comment_id) - return render(request, 'notice_comment_edit.html', {'notice':notice, 'comment':comment}) + contest = get_object_or_404(Contest_board, pk=id) + comment = get_object_or_404(Contest_Comment, pk=comment_id) + return render(request, 'contest_comment_edit.html', {'contest':contest, 'comment':comment}) ### 졸업생 게시판 @login_required def graduate_board(request): - Graduate_boards = Graduate_board.objects.all() - return render(request, 'graduate.html',{'Graduate_boards':Graduate_boards}) + graduate_boards = Graduate_board.objects.all() + return render(request, 'graduate.html',{'graduate_boards':graduate_boards}) # 졸업생게시판 create @login_required diff --git a/school_ties/settings.py b/school_ties/settings.py index 0593bed..8df65d3 100644 --- a/school_ties/settings.py +++ b/school_ties/settings.py @@ -40,7 +40,7 @@ def get_secret(setting, secrets=secrets): # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ["*"] AUTH_USER_MODEL = 'account.User'