Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
Created template tag to find user's playable game (#919)
Browse files Browse the repository at this point in the history
* Added template tag for getting a user's playable games.
  • Loading branch information
faucomte97 authored Dec 10, 2018
1 parent 1907886 commit 6b72791
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions aimmo/templatetags/players_utils.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from django import template

from aimmo import app_settings

register = template.Library()


@register.inclusion_tag('players/dropdown.html', takes_context=True)
def game_dropdown_list(context, base_url):
return get_user_playable_games(context, base_url)


def get_user_playable_games(context, base_url):
user = context.request.user
return {
'base_url': base_url,
'open_play_games': user.playable_games.all() if user.is_authenticated() else None,
'level_numbers': xrange(1, app_settings.MAX_LEVEL+1),
'open_play_games': user.playable_games.all() if user.is_authenticated() else None
}
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.2
0.6.0

0 comments on commit 6b72791

Please sign in to comment.