File tree Expand file tree Collapse file tree 3 files changed +24
-8
lines changed Expand file tree Collapse file tree 3 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ class ProposalCategory(models.Model):
11
11
visible = models .BooleanField (default = True )
12
12
13
13
class Meta :
14
- verbose_name = "프로그램 카테고리"
15
- verbose_name_plural = "프로그램 카테고리들"
14
+ verbose_name = "세션 카테고리"
15
+ verbose_name_plural = "세션 카테고리들"
16
16
17
17
def __str__ (self ):
18
18
return self .name
@@ -92,8 +92,8 @@ class Proposal(models.Model):
92
92
updated_at = models .DateTimeField (auto_now = True )
93
93
94
94
class Meta :
95
- verbose_name = "프로그램 "
96
- verbose_name_plural = "프로그램들 "
95
+ verbose_name = "세션 "
96
+ verbose_name_plural = "세션들 "
97
97
98
98
def __str__ (self ):
99
99
return self .title
@@ -137,5 +137,9 @@ class Program(models.Model):
137
137
),
138
138
)
139
139
140
+ class Meta :
141
+ verbose_name = "프로그램"
142
+ verbose_name_plural = "프로그램들"
143
+
140
144
def __str__ (self ):
141
145
return self .title
Original file line number Diff line number Diff line change 4
4
5
5
6
6
class ProposalSerializer (serializers .ModelSerializer ):
7
+ username = serializers .SerializerMethodField ()
8
+ category_name = serializers .SerializerMethodField ()
7
9
accepted = serializers .BooleanField (read_only = True )
8
10
created_at = serializers .DateTimeField (read_only = True )
9
11
updated_at = serializers .DateTimeField (read_only = True )
@@ -12,7 +14,7 @@ class Meta:
12
14
model = Proposal
13
15
fields = [
14
16
"id" ,
15
- "user " ,
17
+ "username " ,
16
18
"title" ,
17
19
"brief" ,
18
20
"desc" ,
@@ -21,6 +23,7 @@ class Meta:
21
23
"duration" ,
22
24
"language" ,
23
25
"category" ,
26
+ "category_name" ,
24
27
"accepted" ,
25
28
"introduction" ,
26
29
"video_url" ,
@@ -30,6 +33,15 @@ class Meta:
30
33
"updated_at" ,
31
34
]
32
35
36
+ @staticmethod
37
+ def get_username (obj : Proposal ):
38
+ return "{}{}" .format (obj .user .last_name , obj .user .first_name )
39
+
40
+ @staticmethod
41
+ def get_category_name (obj : Proposal ):
42
+ return obj .category .name
43
+
44
+
33
45
34
46
class ProposalListSerializer (serializers .ModelSerializer ):
35
47
class Meta :
Original file line number Diff line number Diff line change 3
3
4
4
from program .viewsets import ProposalViewSet
5
5
6
- router = DefaultRouter ()
7
- router .register ("" , ProposalViewSet , basename = "program " )
6
+ session_router = DefaultRouter ()
7
+ session_router .register ("sessions " , ProposalViewSet , basename = "session " )
8
8
9
9
urlpatterns = [
10
- path ("" , include (router .urls )),
10
+ path ("" , include (session_router .urls )),
11
11
]
You can’t perform that action at this time.
0 commit comments