Browse code

add ajax request

devgandi authored on 17/05/2013 at 16:17:28
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+{% for level in object.level_set.all %}
1
+<h1>{{ level.name }}</h1>
2
+<table>
3
+    {% for score in level.sorted_scores %}
4
+    <tr>
5
+        <td>{{ score.score }}</td><td>{{ score.player.slug }}</td>
6
+    </tr>
7
+    {% endfor %}
8
+</table>
9
+
10
+{% endfor %}
11
+<p>{{ object.nbScoreSubmitted  }} scores submitted.</p>
... ...
@@ -14,6 +14,9 @@ def index(request):
14 14
     
15 15
 def game_detail(request, game_slug):
16 16
     return list_detail.object_detail( request, queryset= Game.objects.all(), slug=game_slug, slug_field='slug', template_name='scorekeeper/templates/game_detail.html'  )
17
+
18
+def ajax_game_detail(request, game_slug):
19
+    return list_detail.object_detail( request, queryset= Game.objects.all(), slug=game_slug, slug_field='slug', template_name='scorekeeper/templates/ajax_game_detail.html'  )
17 20
     
18 21
 def level_detail(request, level_slug):
19 22
     return list_detail.object_detail( request, queryset= Level.objects.all(), slug=level_slug, slug_field='slug', template_name='scorekeeper/templates/level_detail.html'  )
... ...
@@ -7,6 +7,7 @@ admin.autodiscover()
7 7
 urlpatterns = patterns('',
8 8
     (r'^$', 'scorekeeper.views.index'),
9 9
     (r'^game/(?P<game_slug>[-\w]+)/$', 'scorekeeper.views.game_detail'),
10
+    (r'^ajax_game/(?P<game_slug>[-\w]+)/$', 'scorekeeper.views.ajax_game_detail'),
10 11
     (r'^level/(?P<level_slug>[-\w]+)/$', 'scorekeeper.views.level_detail'),
11 12
     (r'^player/(?P<player_slug>[-\w]+)/$', 'scorekeeper.views.player_detail'),
12 13
     (r'^score/$', 'scorekeeper.views.score'),