File tree Expand file tree Collapse file tree 2 files changed +5
-22
lines changed Expand file tree Collapse file tree 2 files changed +5
-22
lines changed Original file line number Diff line number Diff line change 11from django .conf .urls import url , include
2- from rd .views import index , comment
2+ from rd .views import index
33
44
55urlpatterns = [
66 url (r'^' , index , name = 'index' ),
7- url (r'^comment/$' , comment , name = 'comment' ),
87]
Original file line number Diff line number Diff line change 66comments = []
77def index (request ):
88 comment_box = render_component (
9- path = 'js/components/CommentBox.jsx' ,
10- props = {
11- 'comments' : comments ,
12- 'url' : reverse ('comment' ),
13- 'pollInterval' : 2000
14- },
15- to_static_markup = True ,
9+ path = 'js/components/app.jsx' ,
10+ to_static_markup = True
1611 )
1712 context = {
18- 'comment_box ' : comment_box ,
13+ 'app ' : app ,
1914 }
20- return render (request , 'index.html' , context )
21-
22- def comment (request ):
23- if request .method == 'POST' :
24- comments .append ({
25- 'author' : request .POST .get ('author' , None ),
26- 'text' : request .POST .get ('text' , None ),
27- })
28- return HttpResponse (
29- json .dumps (comments ),
30- content_type = 'application/json' ,
31- )
15+ return render (request , 'index.html' , app )
You can’t perform that action at this time.
0 commit comments