Trunk: Merged the Devel-branch (branches/griatch) into /trunk. This constitutes a major refactoring of Evennia. Development will now continue in trunk. See the wiki and the past posts to the mailing list for info. /Griatch

This commit is contained in:
Griatch 2010-08-29 18:46:58 +00:00
parent df29defbcd
commit f83c2bddf8
222 changed files with 22304 additions and 14371 deletions

View file

@ -1,3 +0,0 @@
from django.db import models
# Create your models here.

View file

@ -1,5 +0,0 @@
from django.conf.urls.defaults import *
urlpatterns = patterns('game.web.apps.website.views',
(r'^$', 'page_index'),
)

View file

@ -1,9 +0,0 @@
from src.config.models import ConfigValue
def general_context(request):
"""
Returns common Evennia-related context stuff.
"""
return {
'game_name': ConfigValue.objects.get_configvalue('site_name'),
}

View file

@ -0,0 +1,4 @@
The evennia logo (the python snaking a cogwheel-globe) was created in 2009
by Griatch (www.griatch-art.deviantart.com, www.griatch.com) using open-source software (of course).
The logo is released with the same licence as Evennia itself (look in evennia/LICENCE).

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

17
game/web/news/admin.py Normal file
View file

@ -0,0 +1,17 @@
#
# This makes the news model visible in the admin web interface
# so one can add/edit/delete news items etc.
#
from django.contrib import admin
from game.web.news.models import NewsTopic, NewsEntry
class NewsTopicAdmin(admin.ModelAdmin):
list_display = ('name', 'icon')
admin.site.register(NewsTopic, NewsTopicAdmin)
class NewsEntryAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'topic', 'date_posted')
list_filter = ('topic',)
search_fields = ['title']
admin.site.register(NewsEntry, NewsEntryAdmin)

View file

@ -1,5 +1,10 @@
#
# This module implements a simple news entry system
# for the evennia website. One needs to use the
# admin interface to add/edit/delete entries.
#
from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User
class NewsTopic(models.Model):
@ -21,10 +26,6 @@ class NewsTopic(models.Model):
class Meta:
ordering = ['name']
class Admin:
list_display = ('name', 'icon')
admin.site.register(NewsTopic)
class NewsEntry(models.Model):
"""
An individual news entry.
@ -42,8 +43,3 @@ class NewsEntry(models.Model):
ordering = ('-date_posted',)
verbose_name_plural = "News entries"
class Admin:
list_display = ('title', 'author', 'topic', 'date_posted')
list_filter = ('topic',)
search_fields = ['title']
admin.site.register(NewsEntry)

View file

@ -1,6 +1,11 @@
"""
This structures the url tree for the news application.
It is imported from the root handler, game.web.urls.py.
"""
from django.conf.urls.defaults import *
urlpatterns = patterns('game.web.apps.news.views',
urlpatterns = patterns('game.web.news.views',
(r'^show/(?P<entry_id>\d+)/$', 'show_news'),
(r'^archive/$', 'news_archive'),
(r'^search/$', 'search_form'),

View file

@ -1,19 +1,20 @@
"""
This is a very simple news application, with most of the expected features
like:
like news-categories/topics and searchable archives.
* News categories/topics
* Searchable archives
"""
import django.views.generic.list_detail as gv_list_detail
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
import django.views.generic.list_detail as gv_list_detail
from django.conf import settings
from django.http import HttpResponseRedirect
from django.contrib.auth.models import User
from django import forms
from django.db.models import Q
from game.web.apps.news.models import NewsTopic, NewsEntry
from game.web.news.models import NewsTopic, NewsEntry
# The sidebar text to be included as a variable on each page. There's got to
# be a better, cleaner way to include this on every page.
@ -89,7 +90,7 @@ def search_form(request):
pagevars = {
"page_title": "Search News",
"search_form": search_form,
"debug": debug,
"debug": settings.DEBUG,
"sidebar": sidebar
}
@ -117,6 +118,7 @@ def search_results(request):
news_entries = NewsEntry.objects.filter(Q(title__contains=cleaned_get['search_terms']) | Q(body__contains=cleaned_get['search_terms']))
pagevars = {
"game_name": settings.SERVERNAME,
"page_title": "Search Results",
"searchtext": cleaned_get['search_terms'],
"browse_url": "/news/search/results",

View file

@ -0,0 +1,11 @@
{% extends "admin/base.html" %}
{% load i18n %}
{% block title %}{{ title }} | {% trans 'Evennia site admin' %}{% endblock %}
{% block branding %}
<h1 id="site-name">{% trans 'Evennia database administration' %}
<a href="/">(Back)</a> </h1>
{% endblock %}
{% block nav-global %}{% endblock %}

View file

@ -0,0 +1,242 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% load adminmedia %}{% admin_media_prefix %}css/dashboard.css" />{% endblock %}
{% block coltype %}colMS{% endblock %}
{% block bodyclass %}dashboard{% endblock %}
{% block breadcrumbs %}{% endblock %}
{% block content %}
<div id="content-main">
{% if app_list %}
{% for app in app_list %}
{% if app.name in evennia_userapps %}
<div class="module">
<table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
<caption><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption>
{% for model in app.models %}
<tr>
{% if model.perms.change %}
<th scope="row"><a href="{{ model.admin_url }}">{{ model.name }}</a></th>
{% else %}
<th scope="row">{{ model.name }}</th>
{% endif %}
{% if model.perms.add %}
<td><a href="{{ model.admin_url }}add/" class="addlink">{% trans 'Add' %}</a></td>
{% else %}
<td>&nbsp;</td>
{% endif %}
{% if model.perms.change %}
<td><a href="{{ model.admin_url }}" class="changelink">{% trans 'Change' %}</a></td>
{% else %}
<td>&nbsp;</td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% endfor %}
<h1>In-game entities</h1>
{% for app in app_list %}
{% if app.name in evennia_entityapps %}
<div class="module">
<table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
<caption><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption>
{% for model in app.models %}
<tr>
{% if model.perms.change %}
<th scope="row"><a href="{{ model.admin_url }}">{{ model.name }}</a></th>
{% else %}
<th scope="row">{{ model.name }}</th>
{% endif %}
{% if model.perms.add %}
<td><a href="{{ model.admin_url }}add/" class="addlink">{% trans 'Add' %}</a></td>
{% else %}
<td>&nbsp;</td>
{% endif %}
{% if model.perms.change %}
<td><a href="{{ model.admin_url }}" class="changelink">{% trans 'Change' %}</a></td>
{% else %}
<td>&nbsp;</td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% endfor %}
<h1>Game setups and configs</h1>
{% for app in app_list %}
{% if app.name in evennia_setupapps %}
<div class="module">
<table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
<caption><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption>
{% for model in app.models %}
<tr>
{% if model.perms.change %}
<th scope="row"><a href="{{ model.admin_url }}">{{ model.name }}</a></th>
{% else %}
<th scope="row">{{ model.name }}</th>
{% endif %}
{% if model.perms.add %}
<td><a href="{{ model.admin_url }}add/" class="addlink">{% trans 'Add' %}</a></td>
{% else %}
<td>&nbsp;</td>
{% endif %}
{% if model.perms.change %}
<td><a href="{{ model.admin_url }}" class="changelink">{% trans 'Change' %}</a></td>
{% else %}
<td>&nbsp;</td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% endfor %}
<h1>Connection protocols</h1>
{% for app in app_list %}
{% if app.name in evennia_connectapps %}
<div class="module">
<table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
<caption><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption>
{% for model in app.models %}
<tr>
{% if model.perms.change %}
<th scope="row"><a href="{{ model.admin_url }}">{{ model.name }}</a></th>
{% else %}
<th scope="row">{{ model.name }}</th>
{% endif %}
{% if model.perms.add %}
<td><a href="{{ model.admin_url }}add/" class="addlink">{% trans 'Add' %}</a></td>
{% else %}
<td>&nbsp;</td>
{% endif %}
{% if model.perms.change %}
<td><a href="{{ model.admin_url }}" class="changelink">{% trans 'Change' %}</a></td>
{% else %}
<td>&nbsp;</td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% endfor %}
<h1>Website Specific</h1>
{% for app in app_list %}
{% if app.name in evennia_websiteapps %}
<div class="module">
<table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
<caption><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption>
{% for model in app.models %}
<tr>
{% if model.perms.change %}
<th scope="row"><a href="{{ model.admin_url }}">{{ model.name }}</a></th>
{% else %}
<th scope="row">{{ model.name }}</th>
{% endif %}
{% if model.perms.add %}
<td><a href="{{ model.admin_url }}add/" class="addlink">{% trans 'Add' %}</a></td>
{% else %}
<td>&nbsp;</td>
{% endif %}
{% if model.perms.change %}
<td><a href="{{ model.admin_url }}" class="changelink">{% trans 'Change' %}</a></td>
{% else %}
<td>&nbsp;</td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% endfor %}
{% else %}
<p>{% trans "You don't have permission to edit anything." %}</p>
{% endif %}
</div>
{% endblock %}
{% block sidebar %}
<div id="content-related">
<div class="module" id="recent-actions-module">
<h2>{% trans 'Recent Actions' %}</h2>
<h3>{% trans 'My Actions' %}</h3>
{% load log %}
{% get_admin_log 10 as admin_log for_user user %}
{% if not admin_log %}
<p>{% trans 'None yet.' %}</p>
{% else %}
<ul class="actionlist">
{% for entry in admin_log %}
<li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}">
{% if entry.is_deletion %}
{{ entry.object_repr }}
{% else %}
<a href="{{ entry.get_admin_url }}">{{ entry.object_repr }}</a>
{% endif %}
<br/>
{% if entry.content_type %}
<span class="mini quiet">{% filter capfirst %}{% trans entry.content_type.name %}{% endfilter %}</span>
{% else %}
<span class="mini quiet">{% trans 'Unknown content' %}</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -29,16 +29,15 @@
<div id="header">
<div class="superHeader">
<span>Related Sites:</span>
<a href="http://evennia.com" title="The Python-based MUD server">Evennia</a> |
<a href="http://www.oswd.org/designs/search/designer/id/3013/" title="Other designs by haran">haran&rsquo;s Designs</a>
<!--span>Sites:</span-->
<a href="http://evennia.com" title="The Python-based MUD server">Evennia.com</a>
</div>
<div class="midHeader">
<h1 class="headerTitle" lang="la">{{game_name}}</h1>
<img src="/media/images/evennia_logo_small.png" align='left'/> <h1 class="headerTitle" lang="la">{{game_name}}</h1>
<div class="headerSubTitle" title="Slogan">
<!-- Insert a slogan here if you want -->
&nbsp;
{{game_slogan}} &nbsp;
</div>
<br class="doNotDisplay doNotPrint" />
@ -79,8 +78,12 @@
<div id="footer">
<span class="doNotPrint">
Template design by
<a href="http://www.oswd.org/designs/search/designer/id/3013/"
title="Other designs by haran">haran</a>.
Powered by
<a href="http://evennia.com">Evennia</a><br />
<a href="http://evennia.com">Evennia.</a>
<br \>
</span>
</div>
</body>

View file

@ -11,12 +11,18 @@
<div class="twoThirds noBorderOnLeft">
<h1>Welcome!</h1>
<p>Welcome to your new installation of Evennia, your friendly
neighborhood next-generation MUD server. You'll want to customize
this file, webtemplates/prosimii/index.html, to have a more
valid welcome message. Should you have any questions, concerns,
ideas, or bug reports, head over to the
<a href="http://evennia.com">Evennia community</a> and
speak up!</p>
neighborhood next-generation MUD server. You are looking at Evennia's web
presence, which can be expanded to a full-fledged site as
needed. Through the <a href="/admin">admin interface</a> you can view and edit the
database without logging into the game. Also take your time to
peruse our extensive online <a href="http://code.google.com/p/evennia/wiki/Index">documentation</a>.
<p>
Should you have any questions, concerns, bug reports, or
if you want to help out, don't hesitate to come join the
<a href="http://evennia.com">Evennia community</a> and get
your voice heard!
</p>
<i>(To edit this file, go to game/web/templates/prosimii/index.html.)</i>
</div>
<div class="oneThird">
@ -47,7 +53,7 @@
<h1>Recently Connected</h1>
<ul>
{% for player in players_connected_recent %}
<li>{{player.username}} -- <em>{{player.last_login|timesince}} ago</em></li>
<li>{{player.user.username}} -- <em>{{player.user.last_login|timesince}} ago</em></li>
{% endfor %}
</ul>
<p class="filler"><!-- Filler para to extend left vertical line --></p>
@ -56,10 +62,9 @@
<div class="quarter">
<h1>Database Stats</h1>
<ul>
<li>{{num_players}} players</li>
<li>{{num_rooms}} rooms</li>
<li>{{num_things}} things</li>
<li>{{num_exits}} exits</li>
<li>{{num_players_registered}} players</li>
<li>{{num_rooms}} rooms ({{num_exits}} exits) </li>
<li>{{num_objects}} objects total</li>
</ul>
</div>
@ -69,9 +74,9 @@
<a href="http://python.org">Python</a>, on top of the
<a href="http://twistedmatrix.com">Twisted</a> and
<a href="http://djangoproject.com">Django</a> frameworks. This
combination of technology allows for the quick and easy creation
of games, as simple as complex as one desires.</p>
combination of technologies allows for the quick and easy creation
of the game of your dreams - as simple or as complex as you like.</p>
</div>
</div>
{% endblock %}
{% endblock %}

View file

@ -4,7 +4,7 @@
{% endblock %}
{% block sidebar %}
{{sidebar}}
{{sidebar|safe}}
{% endblock %}
{% block content %}
@ -48,4 +48,4 @@
{% endif %}
| <a href="{{browse_url}}/?page={{pages}}&search_terms={{searchtext|urlencode}}">Last</a>
{% endblock %}
{% endblock %}

View file

@ -4,7 +4,7 @@
{% endblock %}
{% block sidebar %}
{{sidebar}}
{{sidebar|safe}}
{% endblock %}
{% block content %}
@ -16,4 +16,4 @@
{{search_form.search_terms}}
<button type="Submit">Search</button>
</form>
{% endblock %}
{% endblock %}

View file

@ -4,11 +4,11 @@
{% endblock %}
{% block sidebar %}
{{sidebar}}
{{sidebar|safe}}
{% endblock %}
{% block content %}
<h1 id="alt-layout">{{news_entry.topic.name}}: {{news_entry.title}}</h1>
<p class="newsDate">By {{news_entry.author.username}} on {{news_entry.date_posted|time}}</p>
<p class="newsSummary">{{news_entry.body}}</p>
{% endblock %}
{% endblock %}

View file

@ -13,7 +13,7 @@ Login
<p>Your username and password didn't match. Please try again.</p>
{% endif %}
<form method="post" action=".">
<form method="post" action="."{% csrf_token %} >
<table>
<tr>
<td><label for="id_username">Username:</label></td>

View file

@ -10,25 +10,33 @@ from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
# loop over all settings.INSTALLED_APPS and execute code in
# files named admin.py ine each such app (this will add those
# models to the admin site)
admin.autodiscover()
# Setup the root url tree from /
urlpatterns = patterns('',
# User Authentication
url(r'^accounts/login', 'django.contrib.auth.views.login'),
url(r'^accounts/logout', 'django.contrib.auth.views.logout'),
# Front page
url(r'^', include('game.web.apps.website.urls')),
url(r'^', include('game.web.website.urls')),
# News stuff
url(r'^news/', include('game.web.apps.news.urls')),
url(r'^news/', include('game.web.news.urls')),
# Page place-holder for things that aren't implemented yet.
url(r'^tbi/', 'game.web.apps.website.views.to_be_implemented'),
url(r'^tbi/', 'game.web.website.views.to_be_implemented'),
# Admin interface
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/(.*)', admin.site.root, name='admin'),
url(r'^admin/', include(admin.site.urls)),
#url(r'^admin/(.*)', admin.site.root, name='admin'),
# favicon
url(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url':'/media/images/favicon.ico'}),
)
# If you'd like to serve media files via Django (strongly not recommended!),

View file

View file

@ -1,7 +1,7 @@
import os, sys
# Calculate the path based on the location of the WSGI script.
web_dir = os.path.dirname(__file__)
web_dir = os.path.dirname(os.path.dirname(__file__))
workspace = os.path.dirname(os.path.dirname(web_dir))
sys.path.insert(0, workspace)

View file

@ -0,0 +1,45 @@
# WARNING: mod_python is no longer the recommended way to run Evennia's
# web front end. This file is no longer actively maintained and may
# no longer work. We suggest using mod_wsgi unless absolutely necessary.
# Add this vhost file to your Apache sites-enabled directory, typically found
# at /etc/apache2/sites-enabled. You'll need to go through and change the
# /home/evennia to point to the correct home directory, and the evennia
# subdir must be under that home directory.
# A NOTE ON IMAGES/CSS: These files must be handled separately from the actual
# dynamic content which is interpreted by Python. You may host these static
# images/css from the same server or a different one. The static media
# is served from /home/evennia/evennia/media. The easiest way to serve
# this stuff is by either hosting them remotely or symlinking
# the media directory into an existing Apache site's directory.
# A NOTE ON ADMIN IMAGES/CSS: You'll need to create a symlink called
# 'amedia' under the media directory if you want to use the admin interface.
# This can be found in the Django package in your Python path. For example,
# the default is: /usr/lib/python2.4/site-packages/django/contrib/admin/media/
# although your location may vary.
<VirtualHost *>
# Set ServerName and ServerAdmin appropriately
ServerName evennia.somewhere.com
ServerAdmin someone@somewhere.com
DocumentRoot /home/evennia/evennia
<Directory "/home/evennia/evennia">
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/home/evennia/evennia'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE settings
PythonDebug On
</Directory>
Alias /media/ "/home/evennia/evennia/media/"
<Directory "/home/evennia/evennia/media/">
SetHandler None
</Directory>
<LocationMatch "\.(jpg|gif|png|css)$">
SetHandler None
</LocationMatch>
</VirtualHost>

View file

@ -0,0 +1,51 @@
<VirtualHost *>
# This is an example mod_wsgi apache2 vhost. There are a number of
# things you'll need to change. They are commented below. Make sure
# you read and understand the stuff below.
# Copy this file to your apache2 vhosts directory before editing.
# This file is merely a template. The vhost directory is usually
# something like /etc/apache2/sites-enabled/.
# You'll want to replace the following with your domain info.
ServerName dev.evennia.com
ServerAlias www.dev.evennia.com
#
## BEGIN EVENNIA WEB CONFIG
#
# evennia_web is just an internal name for mod_wsgi and may be left
# The user and group options are the user and the group that the
# python code will be executed under. This user must have permissions
# to the evennia source.
WSGIDaemonProcess evennia_web user=evennia group=evennia threads=25
WSGIProcessGroup evennia_web
# This needs to be changed to the appropriate path on your django
# install. It serves admin site media.
# For Python 2.6, this is:
# /usr/lib/python2.6/dist-packages/django/contrib/admin/media/
Alias /media/amedia/ "/usr/lib/python2.5/site-packages/django/contrib/admin/media/"
<Directory "/usr/lib/python2.5/site-packages/django/contrib/admin/media">
Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing
</Directory>
# Media Directory. This needs to be set to your equivalent path.
Alias /media/ "/home/evennia/evennia/game/web/media/"
<Directory "/home/evennia/evennia/game/web/media">
Order allow,deny
Options Indexes FollowSymLinks
Allow from all
IndexOptions FancyIndexing
</Directory>
# WSGI Config File. You'll need to update this path as well.
WSGIScriptAlias / /home/evennia/evennia/game/web/utils/apache_wsgi.conf
#
## END EVENNIA WEB CONFIG
#
</VirtualHost>

View file

@ -0,0 +1,46 @@
#
# This file defines global variables that will always be
# available in a view context without having to repeatedly
# include it. For this to work, this file is included in
# the settings file, in the TEMPLATE_CONTEXT_PROCESSORS
# tuple.
#
from django.db import models
from django.conf import settings
from src.utils.utils import get_evennia_version
# Determine the site name and server version
try:
GAME_NAME = settings.SERVERNAME.strip()
except AttributeError:
GAME_NAME = "Evennia"
SERVER_VERSION = get_evennia_version()
# Setup lists of the most relevant apps so
# the adminsite becomes more readable.
USER_RELATED = ['Auth', 'Players']
GAME_ENTITIES = ['Objects', 'Scripts', 'Comms', 'Help']
GAME_SETUP = ['Permissions', 'Config']
CONNECTIONS = ['Irc', 'Imc2']
WEBSITE = ['Flatpages', 'News', 'Sites']
# The main context processor function
def general_context(request):
"""
Returns common Evennia-related context stuff, which
is automatically added to context of all views.
"""
return {
'game_name': GAME_NAME,
'game_slogan': SERVER_VERSION,
'evennia_userapps': USER_RELATED,
'evennia_entityapps': GAME_ENTITIES,
'evennia_setupapps': GAME_SETUP,
'evennia_connectapps': CONNECTIONS,
'evennia_websiteapps':WEBSITE
}

View file

@ -0,0 +1,7 @@
#
# Define database entities for the app.
#
from django.db import models

10
game/web/website/urls.py Normal file
View file

@ -0,0 +1,10 @@
"""
This structures the (simple) structure of the
webpage 'application'.
"""
from django.conf.urls.defaults import *
urlpatterns = patterns('game.web.website.views',
(r'^$', 'page_index'),
)

View file

@ -1,9 +1,13 @@
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib.auth.models import User
from django.conf import settings
from src.objects.models import Object
from game.web.apps.news.models import NewsEntry
from src.config.models import ConfigValue
from src.objects.models import ObjectDB
from src.typeclasses.models import TypedObject
from src.players.models import PlayerDB
from game.web.news.models import NewsEntry
"""
This file contains the generic, assorted views that don't fall under one of
@ -21,23 +25,23 @@ def page_index(request):
# A QuerySet of recent news entries.
news_entries = NewsEntry.objects.all().order_by('-date_posted')[:fpage_news_entries]
# Dictionary containing database statistics.
objstats = Object.objects.object_totals()
# A QuerySet of the most recently connected players.
recent_players = Object.objects.get_recently_connected_users()[:fpage_player_limit]
recent_users = PlayerDB.objects.get_recently_connected_players()[:fpage_player_limit]
exits = ObjectDB.objects.get_objs_with_attr('_destination')
rooms = [room for room in ObjectDB.objects.filter(db_home=None) if room not in exits]
pagevars = {
"page_title": "Front Page",
"news_entries": news_entries,
"players_connected_recent": recent_players,
"num_players_connected": Object.objects.get_connected_players().count(),
"num_players_registered": Object.objects.num_total_players(),
"num_players_connected_recent": Object.objects.get_recently_connected_users().count(),
"num_players_registered_recent": Object.objects.get_recently_created_users().count(),
"num_players": objstats["players"],
"num_rooms": objstats["rooms"],
"num_things": objstats["things"],
"num_exits": objstats["exits"],
"players_connected_recent": recent_users,
"num_players_connected": ConfigValue.objects.conf('nr_sessions'),#len(PlayerDB.objects.get_connected_players()),
"num_players_registered": PlayerDB.objects.num_total_players(),
"num_players_connected_recent": len(PlayerDB.objects.get_recently_connected_players()),
"num_players_registered_recent": len(PlayerDB.objects.get_recently_created_players()),
"num_rooms": len(rooms),
"num_exits": len(exits),
"num_objects" : ObjectDB.objects.all().count()
}
context_instance = RequestContext(request)
@ -55,3 +59,5 @@ def to_be_implemented(request):
context_instance = RequestContext(request)
return render_to_response('tbi.html', pagevars, context_instance)