Skip to content

Commit 33dd788

Browse files
committed
Merge branch 'devdev' into feature/sponsors
# Conflicts: # pyconweb2022/pyconweb2022/settings.py
2 parents 16134a1 + ef3cc85 commit 33dd788

File tree

13 files changed

+1699
-2348
lines changed

13 files changed

+1699
-2348
lines changed

.github/workflows/front_deploy_on_dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050

5151
- run: yarn install
5252

53-
- run: npm install [email protected]
53+
- run: yarn add [email protected]
5454

5555
- run: npm install -g env-cmd
5656

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ dmypy.json
130130
/.idea/
131131
/requirements_dev.txt
132132

133+
# Migrations
134+
/pyconweb2022/sponsor/migrations/
135+
/pyconweb2022/program/migrations/
136+
/pyconweb2022/pyconemailer/migrations/
137+
/pyconweb2022/content/migrations/
138+
133139
# to use pyconkr-secrets
134140
/pyconweb2022/zappa_settings.json
135141

frontend/package.json

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"@mdi/js": "^6.7.96",
1414
"@mdi/react": "^1.6.0",
1515
"@sls-next/serverless-component": "^3.7.0",
16+
"@types/react": "18.0.1",
1617
"axios": "^0.27.2",
1718
"babel-plugin-styled-components": "^2.0.6",
1819
"env-cmd": "^10.1.0",
@@ -27,21 +28,30 @@
2728
"react-markdown": "^8.0.3",
2829
"remark-gfm": "^3.0.1",
2930
"serverless": "^2.72.3",
30-
"styled-components": "^5.3.3"
31+
"styled-components": "^5.3.3",
32+
"typescript": "^4.7.4"
3133
},
3234
"devDependencies": {
33-
"@serverless/typescript": "^3.15.2",
34-
"@types/next-seo": "^2.1.2",
35-
"@types/node": "17.0.21",
36-
"@types/react": "17.0.41",
37-
"@typescript-eslint/eslint-plugin": "^5.16.0",
38-
"@typescript-eslint/parser": "^5.16.0",
39-
"eslint": "8.11.0",
40-
"eslint-config-next": "12.1.0",
41-
"eslint-config-prettier": "^8.5.0",
42-
"eslint-plugin-prettier": "^4.0.0",
43-
"prettier": "^2.6.0",
44-
"raw-loader": "^4.0.2",
45-
"typescript": "4.6.2"
35+
"@mdi/font": "^6.7.96",
36+
"@mdi/js": "^6.7.96",
37+
"@mdi/react": "^1.6.0",
38+
"@sls-next/serverless-component": "^3.7.0",
39+
"@types/react": "18.0.1",
40+
"axios": "^0.27.2",
41+
"babel-plugin-styled-components": "^2.0.6",
42+
"env-cmd": "^10.1.0",
43+
"gray-matter": "^4.0.3",
44+
"i18next": "^21.6.14",
45+
"ms": "^2.1.3",
46+
"next": "12.1.0",
47+
"next-seo": "^5.4.0",
48+
"react": "17.0.2",
49+
"react-dom": "17.0.2",
50+
"react-i18next": "^11.16.1",
51+
"react-markdown": "^8.0.3",
52+
"remark-gfm": "^3.0.1",
53+
"serverless": "^2.72.3",
54+
"styled-components": "^5.3.3",
55+
"typescript": "^4.7.4"
4656
}
4757
}

frontend/yarn.lock

Lines changed: 1602 additions & 2304 deletions
Large diffs are not rendered by default.

pyconweb2022/content/serializers.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,20 @@
88
class ContentSerializer(serializers.ModelSerializer):
99
created_at = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S")
1010
# SerializerMethodField: https://ssungkang.tistory.com/entry/Django-Serializer-Custom-Field-SerializerMethodField
11-
# content = serializers.SerializerMethodField()
12-
# eng_content = serializers.SerializerMethodField()
13-
content = serializers.CharField()
14-
eng_content = serializers.CharField()
11+
content = serializers.SerializerMethodField()
12+
13+
def get_content(self, obj):
14+
context = dict()
15+
context["content"] = obj.content
16+
17+
# html_template = Template(
18+
# render_to_string("markdown.html", context)
19+
# ) # 마크다운 렌더링
20+
21+
html_template = loader.get_template("markdown.html")
22+
23+
return html_template.render(context)
1524

1625
class Meta:
1726
model = Content
18-
fields = ["slug", "title", "content", "eng_content", "created_at"]
27+
fields = ["slug", "title", "content", "created_at"]

pyconweb2022/news/admin.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
from django.contrib import admin
22

3-
# Register your models here.
3+
from news.models import News
4+
5+
6+
class NewsAdmin(admin.ModelAdmin):
7+
app_label = "News"
8+
list_display = (
9+
"id",
10+
"title",
11+
"visible_at",
12+
"created_at",
13+
"updated_at",
14+
)
15+
16+
17+
admin.site.register(News, NewsAdmin)

pyconweb2022/news/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class News(models.Model):
1212

1313
class Meta:
1414
app_label = "news"
15+
verbose_name = "news"
16+
verbose_name_plural = "news"
1517

1618
def __str__(self):
1719
return self.title

pyconweb2022/news/viewsets.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
1-
from rest_framework import mixins, viewsets
2-
from rest_framework.permissions import IsAuthenticatedOrReadOnly
1+
from datetime import datetime, timezone, timedelta
32

4-
from .models import News
3+
from rest_framework import viewsets
54

5+
from .models import News
66
from .serializers import NewsSerializer
77

88

9-
class NewsViewSet(
10-
mixins.CreateModelMixin,
11-
mixins.RetrieveModelMixin,
12-
mixins.UpdateModelMixin,
13-
mixins.DestroyModelMixin,
14-
viewsets.GenericViewSet,
15-
):
9+
class NewsViewSet(viewsets.ReadOnlyModelViewSet):
1610
serializer_class = NewsSerializer
17-
permission_class = (IsAuthenticatedOrReadOnly,)
18-
19-
def get_queryset(self):
20-
return News.objects.all()
21-
22-
def get_object(self):
23-
return News.objects.filter(id=self.kwargs["pk"]).first()
11+
queryset = News.objects.filter(
12+
visible_at__lte=datetime.now(tz=timezone(timedelta(hours=9)))
13+
)

pyconweb2022/program/viewsets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ProposalViewSet(ReadOnlyModelViewSet):
1212
permission_classes = [AllowAny]
1313

1414

15-
class ProposalDetailViewSet(ModelViewSet):
15+
class ProposalDetailViewSet(ReadOnlyModelViewSet):
1616
queryset = Proposal.objects.none() # 각 Viewset 메서드에서 쿼리셋 작성
1717
serializer_class = ProposalDetailSerializer
1818
permission_classes = [IsAuthenticated] # TODO: DjangoModelPermission 적용

pyconweb2022/pyconweb2022/settings.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"content",
4848
"zappa_django_utils",
4949
"martor",
50+
"drf_spectacular",
5051
]
5152

5253
MIDDLEWARE = [
@@ -123,7 +124,7 @@
123124

124125
USE_I18N = True
125126

126-
# USE_TZ = True
127+
USE_TZ = False
127128

128129

129130
# Static files (CSS, JavaScript, Images)
@@ -146,7 +147,8 @@
146147
REST_FRAMEWORK = {
147148
"DEFAULT_PERMISSION_CLASSES": [
148149
"rest_framework.permissions.IsAuthenticated",
149-
]
150+
],
151+
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
150152
}
151153

152154
# Amazon SES

0 commit comments

Comments
 (0)