This repository has been archived by the owner on Mar 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathprj_info.py
105 lines (102 loc) · 3.81 KB
/
prj_info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
project_name = "community" # snake_case suggested
user_model = {
"token_auth": True, # set to use token auth to authenticate
"allow_register": True, # set to use auto-craeted register function
"set_visibility_public": True,
"fields":
{ # check available fields at https://docs.djangoproject.com/en/2.2/ref/models/fields/
"nickname": {
"field": "CharField",
"options": ["max_length=10"]
},
"bio": {
"field": "TextField",
"options": []
},
"website": {
"field": "URLField",
"options": ["null=True"]
},
"job": {
"field":
"CharField",
"choices": [("ST", "STUDENT"), ("BS", "BUSINESS MAN"),
("PR", "PROGRAMMER"), ("ETC", "ETC")],
"options": ["max_length=3", "default='ETC'"]
}
}
}
apps = {
"article": { # app name here
"models": { # check available fields at https://docs.djangoproject.com/en/2.2/ref/models/fields/
"Article":{
"writer": {
"template": "model_owner"
},
"content": {
"field": "TextField",
"options": ["null=False", "blank=True"]
},
"tag": {
"field": "TextField",
"options": ['default=""']
},
},
},
"views": {
"PostDetail": { # make a route for reading, updating, deleting a post
"template": "detail_view_ud",
"model": "Article",
"permissions": "IsOwnerOrReadOnly" # check available permission options at https://www.django-rest-framework.org/api-guide/permissions/#api-reference
},
"PostList": { # make a route for read all posts of its model in the DB, create a data of its model in the DB
"template": "all_objects_view",
"model": "Article",
"permissions": "IsAuthenticatedOrReadOnly" # check available permission options at https://www.django-rest-framework.org/api-guide/permissions/#api-reference
},
"my_posts_view": { # get all posts with writer = request.user
"template": "filter_objects_view",
"model": "Article",
"options": ["writer=request.user"]
},
"user_posts_view": {
"template": "filter_objects_view",
"model": "Article",
"url_getters": "username",
"options": ["writer=username"]
}
}
},
"comment": {
"models": {
"Comment":{
"writer": {
"template": "model_owner"
},
"article_id": {
"field": "IntegerField",
"options": ["null=False"]
},
"content": {
"field": "TextField",
"options": ["null=False", "blank=False"]
},
},
},
"views": {
"get_comments_view": {
"template": "filter_objects_view",
"model": "Comment",
"url_getters": "article_pk",
"options": ["article_id=article_pk"]
},
"create_comment_view": { # make a route for read all posts of its model in the DB, create a data of its model in the DB
"template": "all_objects_view",
"model": "Comment",
"permissions": "IsAuthenticatedOrReadOnly" # check available permission options at https://www.django-rest-framework.org/api-guide/permissions/#api-reference
},
}
}
}
timezone = "Asia/Seoul"
language = 'ko-kr'