Skip to content

Commit d9780df

Browse files
committed
change views for new react component
1 parent 41fb224 commit d9780df

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

rd/urls.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from django.conf.urls import url, include
2-
from rd.views import index, comment
2+
from rd.views import index
33

44

55
urlpatterns = [
66
url(r'^', index, name='index'),
7-
url(r'^comment/$', comment, name='comment'),
87
]

rd/views.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,10 @@
66
comments = []
77
def 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)

0 commit comments

Comments
 (0)