Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Modified version for get time template

  • Loading branch information...
commit 6ed9e4ddef17f9c9ac5de4c26bb861cb380e3291 1 parent 16759c9
@mysteryjeans authored
View
12 django_ajax/templates/gettime.html
@@ -1,12 +0,0 @@
-<html>
- <head>
- <title>Get Time | Django Unobtrusive Ajax</title>
- </head>
- <body>
- <h1>Django Unobtrusive Ajax</h1>
- <h2>Get Time</h2>
- <div>
- Currently it is: {{ time }}
- </div>
- </body>
-</html>
View
2  django_ajax/templates/index.html
@@ -14,7 +14,7 @@
<input type="submit" value="Get time through ajax"/>
</form>
<h3>Server Time</h3>
- <div id="divTime"></div>
+ <div id="divTime">{{ time }}</div>
</body>
</html>
View
4 django_ajax/views.py
@@ -10,7 +10,7 @@ def home(request):
def gettime(request):
if request.is_ajax():
- return HttpResponse('<div>' + str(datetime.now()) +'</div>')
+ return HttpResponse(str(datetime.now()))
# Graceful degradation
- return render_to_response('gettime.html', {'time': str(datetime.now()) })
+ return render_to_response('index.html', {'time': str(datetime.now()) })
Please sign in to comment.
Something went wrong with that request. Please try again.