diff --git a/account/admin.py b/account/admin.py index 54e8f90..69b3748 100644 --- a/account/admin.py +++ b/account/admin.py @@ -12,7 +12,7 @@ class CustomUserAdmin(UserAdmin): fieldsets = ( (None, {"fields": ("username", "password", "real_name", "email", - "uni_num", "status", "card", "approval","rank_count" 'is_staff')},), + "uni_num", "status", "card", "approval","rank_count","is_staff")},), ) @@ -25,4 +25,5 @@ class CustomUserAdmin(UserAdmin): "card", "approval", "rank_count", + "is_staff" ) \ No newline at end of file diff --git a/account/migrations/0001_initial.py b/account/migrations/0001_initial.py index dc09e07..9f0d430 100644 --- a/account/migrations/0001_initial.py +++ b/account/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.9 on 2021-11-18 17:33 +# Generated by Django 3.2.9 on 2021-11-19 14:15 import django.contrib.auth.models import django.contrib.auth.validators diff --git a/account/static/css/check.css b/account/static/css/check.css new file mode 100644 index 0000000..b653b89 --- /dev/null +++ b/account/static/css/check.css @@ -0,0 +1,49 @@ +:root { + --maincolor: #CDF0FF; /*메인 색상*/ + --font50: 50px; /*메인 폰트 사이즈*/ + --font30: 30px; + --font15: 15px; + --fonit20: 20px; +} + +.gridContainner{ + display: grid; + + grid-template-areas: + 'LMarginLayout main RMarginLayout'; + grid-template-rows: auto; + grid-template-columns: 1fr 1200px 1fr; +} + +.LMarginLayout{ + grid-area: LMarginLayout; +} +.RMarginLayout{ + grid-area: RMarginLayout; +} + +.upmargin{ + height: 60px; +} +.undermargin{ + height: 60px; +} +.bc{ + display: flex; + background-color: var(--maincolor); + border-radius: 60px; + flex-direction: column; + justify-content: center; + padding: 30px; +} +tr td{ + padding-bottom: 30px; + border: white 2px solid; + vertical-align: center; + justify-items: center; +} + +table{ + border: white 2px solid; + border-radius: 60px; +} \ No newline at end of file diff --git a/account/static/css/check_detail.css b/account/static/css/check_detail.css new file mode 100644 index 0000000..5627082 --- /dev/null +++ b/account/static/css/check_detail.css @@ -0,0 +1,55 @@ +:root { + --maincolor: #CDF0FF; /*메인 색상*/ + --font50: 50px; /*메인 폰트 사이즈*/ + --font30: 30px; + --font15: 15px; + --fonit20: 20px; +} + +.gridContainner{ + display: grid; + + grid-template-areas: + 'LMarginLayout main RMarginLayout'; + grid-template-rows: auto; + grid-template-columns: 1fr 1200px 1fr; +} + +.main{ + grid-area:main ; + background-color: var(--maincolor); + padding: 20px; + border-radius: 50px; +} +.LMarginLayout{ + grid-area: LMarginLayout; +} +.RMarginLayout{ + grid-area: RMarginLayout; +} + +.upmargin{ + height: 60px; +} +.undermargin{ + height: 60px; +} +.check_containner{ + display: flex; + justify-content: center; + flex-direction: column; + align-items: center; +} + + +.complete{ + padding-bottom: 20px; + color: white; +} +button{ +background-color: var(--maincolor); +} +img{ + border: 2px solid white; + background-color: var(--maincolor); +} \ No newline at end of file diff --git a/account/templates/check.html b/account/templates/check.html index ef93dd2..b121215 100644 --- a/account/templates/check.html +++ b/account/templates/check.html @@ -1,20 +1,54 @@ - - - - - - - Document - - - [회원가입 승인] -
-
- {%for a in check_users%} - {{a.username}}|{{a.real_name}}|{{a.uni_num}}|{{a.email}}|{{a.status}}|{{a.approval}}

- 관리 -
-
- {%endfor%} - - \ No newline at end of file +{% extends 'base.html' %} +{% load static %} + +{% block link %}{% static 'css/check.css' %} {% endblock %} +{% block content %} +
+
+ +
+
+
+
+

회원관리

+
+ +
+
+ [회원관리 상태] +
+
+
+
+ + +
+
+ + + + + + + + {% for a in check_users %} + +
+
+ + + + + + + + {% endfor %} +
아이디이름학번등록형태승인상태
{{ a.username }}{{ a.real_name }}{{ a.uni_num }}{{ a.status }} {{ a.approval }}
+
+
+
+
+
+ + +{% endblock %} \ No newline at end of file diff --git a/account/templates/check_detail.html b/account/templates/check_detail.html index 594e961..51b6c19 100644 --- a/account/templates/check_detail.html +++ b/account/templates/check_detail.html @@ -1,14 +1,36 @@ - - - - - - - Document - - -

x

- - - - \ No newline at end of file +{% extends 'base.html' %} +{% load static %} + +{% block link %}{% static 'css/check_detail.css' %} {% endblock %} +{% block content %} + +
+
+ +
+
+ +
+
+

회원관리

+
+ +
+
+ [회원관리 승인] +
+
+
+ +
+
+
+ +
+ + +{% endblock %} diff --git a/account/templates/login.html b/account/templates/login.html index 89515ba..053a5c3 100644 --- a/account/templates/login.html +++ b/account/templates/login.html @@ -32,7 +32,7 @@
비밀번호
-
+

{{ error }}

{#
#} diff --git a/school/admin.py b/school/admin.py index f6341eb..b30db5f 100644 --- a/school/admin.py +++ b/school/admin.py @@ -1,12 +1,20 @@ from django.contrib import admin -from .models import Notice, Free_board, Notice_Comment, Study_board, Club_board, Contest_board, Graduate_board, Market_board +from .models import * # Register your models here. admin.site.register(Notice) -admin.site.register(Notice_Comment) +admin.site.register(Schedule) admin.site.register(Free_board) admin.site.register(Study_board) admin.site.register(Contest_board) admin.site.register(Graduate_board) admin.site.register(Club_board) -admin.site.register(Market_board) \ No newline at end of file +admin.site.register(Market_board) + +admin.site.register(Notice_Comment) +admin.site.register(Free_Comment) +admin.site.register(Study_Comment) +admin.site.register(Contest_Comment) +admin.site.register(Graduate_Comment) +admin.site.register(Club_Comment) +admin.site.register(Market_Comment) \ No newline at end of file diff --git a/school/migrations/0001_initial.py b/school/migrations/0001_initial.py index 134b41f..9060024 100644 --- a/school/migrations/0001_initial.py +++ b/school/migrations/0001_initial.py @@ -1,5 +1,6 @@ -# Generated by Django 3.2.9 on 2021-11-18 16:46 +# Generated by Django 3.2.9 on 2021-11-19 14:15 +from django.conf import settings from django.db import migrations, models import django.db.models.deletion @@ -9,6 +10,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ @@ -17,10 +19,10 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Club_title', models.CharField(max_length=2000)), - ('Club_author', models.CharField(max_length=50)), - ('Club_pub_date', models.DateField()), + ('Club_pub_date', models.DateTimeField(auto_now=True)), ('Club_body', models.TextField()), - ('Club_image', models.ImageField(blank=True, null=True, upload_to='Graduate_board/')), + ('Club_image', models.ImageField(blank=True, null=True, upload_to='Club_board/')), + ('Club_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( @@ -28,10 +30,10 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Contest_title', models.CharField(max_length=2000)), - ('Contest_author', models.CharField(max_length=50)), - ('Contest_pub_date', models.DateField()), + ('Contest_pub_date', models.DateTimeField(auto_now=True)), ('Contest_body', models.TextField()), ('Contest_image', models.ImageField(blank=True, null=True, upload_to='Contest_board/')), + ('Contest_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( @@ -39,10 +41,10 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Free_title', models.CharField(max_length=2000)), - ('Free_author', models.CharField(max_length=50)), - ('Free_pub_date', models.DateField()), + ('Free_pub_date', models.DateTimeField(auto_now=True)), ('Free_body', models.TextField()), ('Free_image', models.ImageField(blank=True, null=True, upload_to='Free_board/')), + ('Free_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( @@ -50,10 +52,10 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Graduate_title', models.CharField(max_length=2000)), - ('Graduate_author', models.CharField(max_length=50)), - ('Graduate_pub_date', models.DateField()), + ('Graduate_pub_date', models.DateTimeField(auto_now=True)), ('Graduate_body', models.TextField()), ('Graduate_image', models.ImageField(blank=True, null=True, upload_to='Graduate_board/')), + ('Graduate_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( @@ -61,10 +63,10 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Market_title', models.CharField(max_length=2000)), - ('Market_author', models.CharField(max_length=50)), - ('Market_pub_date', models.DateField()), + ('Market_pub_date', models.DateTimeField(auto_now=True)), ('Market_body', models.TextField()), - ('Market_image', models.ImageField(blank=True, null=True, upload_to='Graduate_board/')), + ('Market_image', models.ImageField(blank=True, null=True, upload_to='Market_board/')), + ('Market_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( @@ -72,10 +74,17 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Notice_title', models.CharField(max_length=2000)), - ('Notice_author', models.CharField(max_length=50)), - ('Notice_pub_date', models.DateField()), + ('Notice_pub_date', models.DateTimeField(auto_now=True)), ('Notice_body', models.TextField()), ('Notice_image', models.ImageField(blank=True, null=True, upload_to='notice/')), + ('Notice_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Schedule', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sche_pub_date', models.DateTimeField(auto_now=True)), ], ), migrations.CreateModel( @@ -83,10 +92,20 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Study_title', models.CharField(max_length=2000)), - ('Study_author', models.CharField(max_length=50)), - ('Study_pub_date', models.DateField()), + ('Study_pub_date', models.DateTimeField(auto_now=True)), ('Study_body', models.TextField()), ('Study_image', models.ImageField(blank=True, null=True, upload_to='Study_board/')), + ('Study_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Study_Comment', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('study_content', models.CharField(max_length=500)), + ('study_at', models.DateTimeField(auto_now=True)), + ('study', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='school.study_board')), + ('study_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( @@ -94,9 +113,59 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('notice_content', models.CharField(max_length=500)), - ('notice_author', models.CharField(max_length=50)), ('notice_at', models.DateTimeField(auto_now=True)), ('notice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='school.notice')), + ('notice_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Market_Comment', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('market_content', models.CharField(max_length=500)), + ('market_at', models.DateTimeField(auto_now=True)), + ('market', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='school.market_board')), + ('market_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Graduate_Comment', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('graduate_content', models.CharField(max_length=500)), + ('graduate_at', models.DateTimeField(auto_now=True)), + ('graduate', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='school.graduate_board')), + ('graduate_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Free_Comment', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('free_content', models.CharField(max_length=500)), + ('free_at', models.DateTimeField(auto_now=True)), + ('free', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='school.free_board')), + ('free_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Contest_Comment', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('contest_content', models.CharField(max_length=500)), + ('contest_at', models.DateTimeField(auto_now=True)), + ('contest', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='school.contest_board')), + ('contest_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Club_Comment', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('club_content', models.CharField(max_length=500)), + ('club_at', models.DateTimeField(auto_now=True)), + ('club', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='school.club_board')), + ('club_author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), ] diff --git a/school/models.py b/school/models.py index 8e6884d..b5bafd1 100644 --- a/school/models.py +++ b/school/models.py @@ -4,8 +4,8 @@ # 공지 게시판(공지 게시판 데이터 쌓이는 곳) class Notice(models.Model) : Notice_title = models.CharField(max_length=2000) - Notice_author = models.CharField(max_length=50) - Notice_pub_date = models.DateField() + Notice_author = models.ForeignKey('account.User', on_delete = models.CASCADE) + Notice_pub_date = models.DateTimeField(auto_now=True) Notice_body = models.TextField() Notice_image = models.ImageField(upload_to = "notice/", blank=True, null=True) @@ -15,75 +15,145 @@ def __str__(self): # 공지 게시판 댓글 class Notice_Comment(models.Model): notice_content = models.CharField(max_length=500) - notice_author = models.CharField(max_length=50) + notice_author = models.ForeignKey('account.User', on_delete = models.CASCADE) notice = models.ForeignKey(Notice, on_delete=models.CASCADE, related_name="comments" ) notice_at = models.DateTimeField(auto_now=True) def __str__(self): return self.notice_content +# 학과공지 게시판 +class Schedule(models.Model): + sche_title: models.CharField(max_length=100) + sche_pub_date = models.DateTimeField(auto_now=True) + sche_author: models.ForeignKey('account.User', on_delete=models.CASCADE) + sche_image: models.ImageField(upload_to = "schedule/", blank=True, null=True) + def __str__(self): + return self.sche_title + + # 자유 게시판 class Free_board(models.Model) : Free_title = models.CharField(max_length=2000) - Free_author = models.CharField(max_length=50) - Free_pub_date = models.DateField() + Free_author = models.ForeignKey('account.User', on_delete = models.CASCADE) + Free_pub_date = models.DateTimeField(auto_now=True) Free_body = models.TextField() Free_image = models.ImageField(upload_to = "Free_board/", blank=True, null=True) def __str__(self): return self.Free_title +# 자유 게시판 댓글 +class Free_Comment(models.Model): + free_content = models.CharField(max_length=500) + free_author = models.ForeignKey('account.User', on_delete = models.CASCADE) + free = models.ForeignKey(Free_board, on_delete=models.CASCADE, related_name="comments" ) + free_at = models.DateTimeField(auto_now=True) + + def __str__(self): + return self.free_content + # 스터디 게시판 class Study_board(models.Model) : Study_title = models.CharField(max_length=2000) - Study_author = models.CharField(max_length=50) - Study_pub_date = models.DateField() + Study_author = models.ForeignKey('account.User', on_delete = models.CASCADE) + Study_pub_date = models.DateTimeField(auto_now=True) Study_body = models.TextField() Study_image = models.ImageField(upload_to = "Study_board/", blank=True, null=True) def __str__(self): return self.Study_title +# 스터디 게시판 댓글 +class Study_Comment(models.Model): + study_content = models.CharField(max_length=500) + study_author = models.ForeignKey('account.User', on_delete = models.CASCADE) + study = models.ForeignKey(Study_board, on_delete=models.CASCADE, related_name="comments" ) + study_at = models.DateTimeField(auto_now=True) + + def __str__(self): + return self.study_content + # 공모전 게시판 class Contest_board(models.Model) : Contest_title = models.CharField(max_length=2000) - Contest_author = models.CharField(max_length=50) - Contest_pub_date = models.DateField() + Contest_author = models.ForeignKey('account.User', on_delete = models.CASCADE) + Contest_pub_date = models.DateTimeField(auto_now=True) Contest_body = models.TextField() Contest_image = models.ImageField(upload_to = "Contest_board/", blank=True, null=True) def __str__(self): return self.Contest_title +# 공모전 게시판 댓글 +class Contest_Comment(models.Model): + contest_content = models.CharField(max_length=500) + contest_author = models.ForeignKey('account.User', on_delete = models.CASCADE) + contest = models.ForeignKey(Contest_board, on_delete=models.CASCADE, related_name="comments" ) + contest_at = models.DateTimeField(auto_now=True) + +# def __str__(self): +# return self.contest_content + # 졸업생 게시판 class Graduate_board(models.Model) : Graduate_title = models.CharField(max_length=2000) - Graduate_author = models.CharField(max_length=50) - Graduate_pub_date = models.DateField() + Graduate_author = models.ForeignKey('account.User', on_delete = models.CASCADE) + Graduate_pub_date = models.DateTimeField(auto_now=True) Graduate_body = models.TextField() Graduate_image = models.ImageField(upload_to = "Graduate_board/", blank=True, null=True) def __str__(self): return self.Graduate_title +# 졸업생 게시판 댓글 +class Graduate_Comment(models.Model): + graduate_content = models.CharField(max_length=500) + graduate_author = models.ForeignKey('account.User', on_delete = models.CASCADE) + graduate = models.ForeignKey(Graduate_board, on_delete=models.CASCADE, related_name="comments" ) + graduate_at = models.DateTimeField(auto_now=True) + + def __str__(self): + return self.graduate_content + # 동아리 게시판 class Club_board(models.Model) : Club_title = models.CharField(max_length=2000) - Club_author = models.CharField(max_length=50) - Club_pub_date = models.DateField() + Club_author = models.ForeignKey('account.User', on_delete = models.CASCADE) + Club_pub_date = models.DateTimeField(auto_now=True) Club_body = models.TextField() - Club_image = models.ImageField(upload_to = "Graduate_board/", blank=True, null=True) + Club_image = models.ImageField(upload_to = "Club_board/", blank=True, null=True) def __str__(self): return self.Club_title +# 동아리 게시판 댓글 +class Club_Comment(models.Model): + club_content = models.CharField(max_length=500) + club_author = models.ForeignKey('account.User', on_delete = models.CASCADE) + club = models.ForeignKey(Club_board, on_delete=models.CASCADE, related_name="comments" ) + club_at = models.DateTimeField(auto_now=True) + + def __str__(self): + return self.club_content + # 중고 서적 게시판 class Market_board(models.Model) : Market_title = models.CharField(max_length=2000) - Market_author = models.CharField(max_length=50) - Market_pub_date = models.DateField() + Market_author = models.ForeignKey('account.User', on_delete = models.CASCADE) + Market_pub_date = models.DateTimeField(auto_now=True) Market_body = models.TextField() - Market_image = models.ImageField(upload_to = "Graduate_board/", blank=True, null=True) + Market_image = models.ImageField(upload_to = "Market_board/", blank=True, null=True) + + def __str__(self): + return self.Market_title + +# 중고 서적 게시판 댓글 +class Market_Comment(models.Model): + market_content = models.CharField(max_length=500) + market_author =models.ForeignKey('account.User', on_delete = models.CASCADE) + market = models.ForeignKey(Market_board, on_delete=models.CASCADE, related_name="comments" ) + market_at = models.DateTimeField(auto_now=True) def __str__(self): - return self.Market_title \ No newline at end of file + return self.market_content \ No newline at end of file diff --git a/account/static/css/boardform.css b/school/static/css/boardform.css similarity index 100% rename from account/static/css/boardform.css rename to school/static/css/boardform.css diff --git a/school/static/css/mainpage.css b/school/static/css/mainpage.css index 63d2832..3b8c6b4 100644 --- a/school/static/css/mainpage.css +++ b/school/static/css/mainpage.css @@ -103,6 +103,7 @@ html{ height: auto; border-bottom: black 1px solid ; padding: 10px; + background-color: var(--maincolor); } .writeList > .title{ diff --git a/school/static/css/study.css b/school/static/css/study.css new file mode 100644 index 0000000..733046b --- /dev/null +++ b/school/static/css/study.css @@ -0,0 +1,187 @@ + @font-face { + font-family: 'IM_Hyemin-Bold'; + src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2106@1.1/IM_Hyemin-Bold.woff2') format('woff'); + font-weight: normal; + font-style: normal; +} +html{ + height: 100vh; + width: 100vw; + overflow: auto; +} +:root{ + --maincolor: #CDF0FF; /*메인 색상*/ + --font50: 50px; /*메인 폰트 사이즈*/ + --font30:30px; + --font15: 15px; + --fonit20:20px; + --font40:40px; + +} +.pagination{ + display: flex; + margin-top: 20px; + justify-content: center; +} + .containner { + display: grid; + grid-template-areas: + 'marginL header marginR' + 'marginL boardnav marginR' + 'marginL main marginR' + 'marginL undermargin marginR'; + + grid-template-columns: 1fr 1200px 1fr; /*세로 좌:300px고정 가운데 1fr: 유동식 우 300px 고정*/ + grid-template-rows: 90px 160px 1fr 140px; /*가로 */ + } +.containner div { + display: grid; + +} + +.header { + grid-area: header; +} + +.marginL { + grid-area: marginL; +} + +.main { + grid-area: main; + margin-top: 2vh; +} + +.marginR { + grid-area: marginR; + height: 100vh; +} + +.undermargin { + grid-area: undermargin; +} + +.navbr { + justify-items: center; + align-items: center; + width: 100%; +} +.boardnav { /*아직 안정함*/ + grid-area: boardnav; + background-color: var(--maincolor); + border-radius: 10px; + padding: 8px; + margin-bottom: 20px; + height: 160px; +} + +.middleboard{ + padding: 8px; + background-color: white; + +} +.mainboard{ + + background-color: var(--maincolor); +} +.introduce{ + +} +.writetext{ + display: flex !important; + background-color: var(--maincolor); + border-radius: 30px; + height: 15vh; + padding : 1rem 0.8rem 1rem 0.8rem; + flex-direction: row ; +} +.writetext div{ + border: 3px solid black; +} +.writeList{ + overflow:auto; + height: auto; + border-bottom: black 1px solid ; + padding: 10px; + background-color: var(--maincolor); +} + +.writeList > .title{ + margin: 2vh 0 10px 1vh; + font-size: var(--fonit20); + +} +.sort_bar{ + background-color: var(--maincolor); +} +.writearea{ + + border-color: var(--maincolor); + font-family: 'IM_Hyemin-Bold'; + font-size: var(--fonit20); +} +.test1{ + width: 95%; +} +.writeList > .mainstory{ + border: 1px solid black ; + position: relative; + height: 6vh; + border-radius: 10px; + margin: 0 1vw 1vh 1vw; + background-color: white; +} +.number{ + background-color: var(--maincolor); + height: 120px; +} + +.nextnav{ + display: flex; + justify-content: center; +} +.nextnav span{ + margin: 0 1vw 0 1vw; +} +.content{ + font-family: 'IM_Hyemin-Bold'; + + display:flex; + align-items: center; + justify-content: center; + margin: 0 20px 0 20px; +} +.imagesize{ + width: 40px; + height: 40px; + border: black 1px solid; +} + +.mainboard{ + height: 100%; + border-radius: 20px; +} +.content a{ + margin: 0 3vw 0 3vw; + border-left: solid white 2px; + border-right: solid white 2px; + padding: 10px; +} +.h{ + height: 50px; +} +.name{ + font-size: 2.0vw; + vertical-align: center; + margin-top: 40px; +} + +.sort_bar{ + display: flex; + flex-direction: row; + height: 100%; + margin-bottom: 15px; +} +/*.likebutton_bar {*/ +/* display: flex;*/ +/*}*/ diff --git a/school/templates/boardform.html b/school/templates/boardform.html index b07f793..6fd4bce 100644 --- a/school/templates/boardform.html +++ b/school/templates/boardform.html @@ -15,14 +15,10 @@

자유게시판

제목
-
- -
+ -
+
diff --git a/school/templates/notice.html b/school/templates/notice.html index 9ff09a3..048d1a1 100644 --- a/school/templates/notice.html +++ b/school/templates/notice.html @@ -23,5 +23,16 @@

{{a.Notice_body}}

자세히 보기
{%endfor%} + {% if Notices.has_previous %} + < + {% endif %} + + {{Notices.number}} + / + {{Notices.paginator.num_pages}} + + {% if Notices.has_next %} + > + {% endif %} \ No newline at end of file diff --git a/school/templates/notice_comment_edit.html b/school/templates/notice_comment_edit.html index 121ad39..2d3cc24 100644 --- a/school/templates/notice_comment_edit.html +++ b/school/templates/notice_comment_edit.html @@ -1,19 +1,51 @@ - - - - - - - Document - - -

댓글 수정하기

+{% extends 'base.html' %} +{% load static %} + +{% block title %}공지게시판 댓글 수정{% endblock %} +{% block link %}{% static 'css/boardform.css' %}{% endblock %} + +{% block content %} + +
+

공지게시판 댓글 수정

+
+ +
+
+ {% csrf_token %} + + +
+ + +
+
+ +
+
+
+ + + +{% endblock %} + + -

댓글 :

+ \ No newline at end of file diff --git a/school/templates/notice_detail.html b/school/templates/notice_detail.html index 04033e1..331c3e3 100644 --- a/school/templates/notice_detail.html +++ b/school/templates/notice_detail.html @@ -5,7 +5,7 @@ - Document @@ -19,8 +19,8 @@

{{detail_notice.Notice_body}}

{%if detail_notice.Notice_image%}

X

{%endif%} - {% if user.real_name == detail_notice.Notice_author %} - 수정 + {% if user == detail_notice.Notice_author %} + {%endif%} @@ -43,7 +43,7 @@

{{detail_notice.Notice_body}}

- {%if user.real_name == comment.notice_author%} + {%if user == comment.notice_author%} diff --git a/school/templates/notice_edit.html b/school/templates/notice_edit.html index aa74f3a..1ed43c5 100644 --- a/school/templates/notice_edit.html +++ b/school/templates/notice_edit.html @@ -1,19 +1,39 @@ - - - - - - - 게시글 수정 - - -
- {% csrf_token %} - - - - 첨부파일: - -
- - \ No newline at end of file +{% extends 'base.html' %} +{% load static %} + +{% block title %} 공지게시판 수정{% endblock %} +{% block link %}{% static 'css/boardform.css' %}{% endblock %} + +{% block content %} +
+

공지게시판 수정

+
+ +
+
+ {% csrf_token %} +
+ 제목 + +
+
+ +
+ + +
+ + +
+
+ +
+
+
+ + + +{% endblock %} + diff --git a/school/templates/notice_new.html b/school/templates/notice_new.html index 3fa057b..551e03c 100644 --- a/school/templates/notice_new.html +++ b/school/templates/notice_new.html @@ -1,19 +1,47 @@ - - - - - - - 게시글 만들기 - - -
+{% extends 'base.html' %} +{% load static %} + +{% block title %} 공지게시판 업로드{% endblock %} +{% block link %}{% static 'css/boardform.css' %}{% endblock %} + +{% block content %} + +
+

공지게시판 업로드

+
+ +
+ + {% csrf_token %} +
+ 제목 + +
+
+ +
+ + +
+ + +
+
+ +
+ +
+ + + - + +{% endblock %} \ No newline at end of file diff --git a/school/templates/study.html b/school/templates/study.html index 56afbfc..297f063 100644 --- a/school/templates/study.html +++ b/school/templates/study.html @@ -1,24 +1,98 @@ +{% extends 'base.html' %} {% load static %} - - - - - - - Document - - -

<공지사항 CRUD 테스트 중>

- {%for a in Study_boards%} -
- 글쓰기 -

{{a.Study_title}}

-

{{a.Study_pub_date}}

-

{{a.Study_author}}

-

{{a.Study_body}}

-

X

-
- {%endfor%} - - \ No newline at end of file +{% block title %} 공부 게시판{% endblock %} +{% block link %}{% static 'css/study.css' %}{% endblock %} + +{% block content %} +
+
+
+
+ +
+
+
+
자유게시판
+
+ +
+
+ +
+
+ +
+
+ + +
+ +
+
+
ㅎ2ㅎ2
+ +
+
help...
+
+ +
+ +
+
+
+ +
+ +{% endblock %} + + + + + + + + + +
+ {% for a in Study_boards %} +
+ 글쓰기 + 제목 +

{{ a.Study_title }}

+
+ +

{{ a.Study_pub_date }}

+

{{ a.Study_author }}

+

{{ a.Study_body }}

+

X

+ + {% endfor %} +
diff --git a/school/views.py b/school/views.py index 7dcb2a4..fed3df8 100644 --- a/school/views.py +++ b/school/views.py @@ -1,28 +1,33 @@ +from django.core import paginator from django.shortcuts import redirect, render, get_object_or_404 from .models import * from django.utils import timezone from account.models import User from django.contrib.auth.decorators import login_required from django.contrib.admin.views.decorators import staff_member_required +from django.core.paginator import Paginator # Create your views here. def home(request): return render(request, 'home.html') -### 공지사항 -@login_required -def notice(request): - Notices = Notice.objects.all() - return render(request, 'notice.html',{'Notices':Notices}) - ## 메인 자유게시판 def mainpage(requset): return render(requset, 'mainpage.html') -## 시작화면 주소## +## 시작화면 주소 ## def start(request): return render(request, 'start.html') +### 공지사항 +@login_required +def notice(request): + Notices = Notice.objects.all().order_by('-Notice_pub_date') + paginator = Paginator(Notices, 2) + page_number = request.GET.get('page') + page = paginator.get_page(page_number) + return render(request, 'notice.html',{'Notices':page}) + # 공지사항 create @login_required @staff_member_required @@ -35,7 +40,7 @@ def notice_post(request): print(user) # 작성자 = user 가 됩니다. new_notice.Notice_title = request.POST['title'] - new_notice.Notice_author = request.user.real_name + new_notice.Notice_author = user new_notice.Notice_image = request.FILES.get('image') new_notice.Notice_body = request.POST['body'] new_notice.Notice_pub_date = timezone.now() @@ -68,7 +73,7 @@ def notice_update(request, id): # user_id 값과 User 모델의 객체 중 일치하는 값. 즉 글 작성자의 user 객체를 user 변수에 저장합니다. user = User.objects.get(id = user_id) notice_update.Notice_title = request.POST['title'] - notice_update.Notice_author = request.user.real_name + 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() @@ -97,7 +102,7 @@ def create_notice_comment(request, notice_id): print(user) # 작성자 = user 가 됩니다. notice_comment.notice = get_object_or_404(Notice, pk=notice_id) - notice_comment.notice_author = request.user.real_name + notice_comment.notice_author = user notice_comment.notice_content = request.POST['content'] notice_comment.notice_at = timezone.datetime.now() notice_comment.save() @@ -118,7 +123,7 @@ def update_notice_comment(request, id, comment_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 = request.user.real_name + update_notice_comment.notice_author = user update_notice_comment.notice_content = request.POST['content'] update_notice_comment.save() return redirect('notice_detail', id) @@ -128,7 +133,7 @@ def update_notice_comment(request, id, comment_id): return render(request, 'notice_comment_edit.html', {'notice':notice, 'comment':comment}) -###자유게시판 +### 자유게시판 @login_required def free_board(request): Free_boards = Free_board.objects.all() @@ -136,7 +141,7 @@ def free_board(request): -### 스터디 게시판 ?? +### 스터디 게시판 @login_required def study_board(request): @@ -162,20 +167,15 @@ def club_board(request): Club_boards = Club_board.objects.all() return render(request, 'club.html',{'Club_boards':Club_boards}) -# 중고 서적 게시판 +### 중고 서적 게시판 @login_required def market_board(request): Market_boards = Market_board.objects.all() return render(request, 'club.html',{'Market_boards':Market_boards}) -#게시판 랭킹 +### 게시판 랭킹 @login_required def rank(request): rank = User.objects.filter(status = "학부생").order_by('-rank_count') - return render(request, 'rank.html', {"rank":rank}) - -#글쓰기 폼 양식 -def boardform(request): - return render(request, 'boardform.html') - + return render(request, 'rank.html', {"rank":rank}) \ No newline at end of file diff --git a/school_ties/urls.py b/school_ties/urls.py index 83ad5f2..eca20a4 100644 --- a/school_ties/urls.py +++ b/school_ties/urls.py @@ -24,7 +24,7 @@ path('account/', include('account.urls')), path('home/', S.home, name='home'), path('',S.start, name="start"), - path('boardform/',S.boardform, name="boardform"), + # path('boardform/',S.boardform, name="boardform"), path('notice/', S.notice, name='notice'), path('mainpage/',S.mainpage, name='mainpage'), path('notice/post/', S.notice_post, name='notice_post'),