mirror of
https://github.com/evennia/evennia.git
synced 2026-03-23 00:06:30 +01:00
Finished the Players content block on the default main page. Yay. http://sandbox.evennia.com is the front page for the test site. None of the links work yet, just working on the front page.
This commit is contained in:
parent
6b8c3f137c
commit
72ebe9cc7b
3 changed files with 12 additions and 1 deletions
|
|
@ -27,6 +27,7 @@ def page_index(request):
|
|||
"players_connected": functions_db.num_connected_players(),
|
||||
"players_registered": functions_db.num_total_players(),
|
||||
"players_connected_recent": functions_db.num_recently_connected_players(),
|
||||
"players_registered_recent": functions_db.num_recently_created_players(),
|
||||
}
|
||||
|
||||
context_instance = RequestContext(request)
|
||||
|
|
|
|||
|
|
@ -28,6 +28,16 @@ def num_connected_players():
|
|||
"""
|
||||
return get_connected_players().count()
|
||||
|
||||
def num_recently_created_players(days=7):
|
||||
"""
|
||||
Returns a QuerySet containing the player User accounts that have been
|
||||
connected within the last <days> days.
|
||||
"""
|
||||
end_date = datetime.now()
|
||||
tdelta = timedelta(days)
|
||||
start_date = end_date - tdelta
|
||||
return User.objects.filter(date_joined__range=(start_date, end_date)).count()
|
||||
|
||||
def num_recently_connected_players(days=7):
|
||||
"""
|
||||
Returns a QuerySet containing the player User accounts that have been
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
<h1>Players</h1>
|
||||
<p>
|
||||
There are currently <strong>{{players_connected}}</strong> connected,
|
||||
and a total of <strong>{{players_registered}}</strong> registered. Of these, {{players_recent}} were created this week, and <strong>{{players_connected_recent}}</strong> have connected within the last seven days.
|
||||
and a total of <strong>{{players_registered}}</strong> registered. Of these, <strong>{{players_registered_recent}}</strong> were created this week, and <strong>{{players_connected_recent}}</strong> have connected within the last seven days.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue