This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created template tag to find user's playable game (#919)
* Added template tag for getting a user's playable games.
- Loading branch information
1 parent
1907886
commit 6b72791
Showing
2 changed files
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.5.2 | ||
0.6.0 |