Commit 96ed7a8a authored by chris's avatar chris

activate admin and request modules

parent b7f8e8f2
__version__ = 0.30
__copyright__ = 'Copyright (c) 2009, Kyle Fuller'
__licence__ = 'BSD'
__author__ = 'Kyle Fuller <inbox@kylefuller.co.uk>, Jannis Leidel (jezdez), krisje8 <krisje8@gmail.com>'
__URL__ = 'http://kylefuller.co.uk/project/django-request/'
from datetime import datetime, timedelta, date
from django.db.models import Count
from django.utils.translation import ugettext_lazy as _
from django.shortcuts import render_to_response
from django.utils.functional import update_wrapper
from django.template import RequestContext
from django.contrib import admin
from django.http import HttpResponse
from django.utils import simplejson
from request import settings
from request.models import Request
from request.traffic import modules
from request.plugins import *
class RequestAdmin(admin.ModelAdmin):
list_display = ('time', 'path', 'response', 'method', 'request_from')
fieldsets = (
(_('Request'), {
'fields': ('method', 'path', 'time', 'is_secure', 'is_ajax')
}),
(_('Response'), {
'fields': ('response',)
}),
(_('User info'), {
'fields': ('referer', 'user_agent', 'ip', 'user', 'language')
})
)
def request_from(self, obj):
if obj.user:
return '<a href="?user__username=%s" title="%s">%s</a>' % (obj.user.username, _('Show only requests from this user.'), obj.user)
return '<a href="?ip=%s" title="%s">%s</a>' % (obj.ip, _('Show only requests from this IP address.'), obj.ip)
request_from.short_description = 'From'
request_from.allow_tags = True
def get_urls(self):
from django.conf.urls.defaults import patterns, url
def wrap(view):
def wrapper(*args, **kwargs):
return self.admin_site.admin_view(view)(*args, **kwargs)
return update_wrapper(wrapper, view)
info = self.model._meta.app_label, self.model._meta.module_name
return patterns('',
url(r'^overview/$', wrap(self.overview), name='%s_%s_overview' % info),
url(r'^overview/traffic.json$', wrap(self.traffic), name='%s_%s_traffic' % info),
) + super(RequestAdmin, self).get_urls()
def overview(self, request):
qs = Request.objects.this_month()
for plugin in plugins.plugins:
plugin.qs = qs
return render_to_response('admin/request/request/overview.html', {
'title': _('Request overview'),
'plugins': plugins.plugins,
'use_hosted_media': settings.REQUEST_USE_HOSTED_MEDIA,
'request_media_prefix': settings.REQUEST_MEDIA_PREFIX,
}, context_instance=RequestContext(request))
def traffic(self, request):
try:
days_count = int(request.GET.get('days', 30))
except ValueError:
days_count = 30
if days_count < 10:
days_step = 1
elif days_count < 60:
days_step = 2
else:
days_step = 30
days = [date.today() - timedelta(day) for day in xrange(0, days_count, days_step)]
days_qs = [(day, Request.objects.day(date=day)) for day in days]
return HttpResponse(simplejson.dumps(modules.graph(days_qs)), mimetype='text/javascript')
admin.site.register(Request, RequestAdmin)
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: django-request\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-06-29 11:24+0200\n"
"PO-Revision-Date: 2010-06-28 12:10+0200\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: German <de@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#: admin.py:43 templates/admin/request/request/overview.html:31
#: templates/admin/request/request/overview.html:32
msgid "Request"
msgstr "Anfrage"
#: admin.py:46 templates/admin/request/request/overview.html:45
msgid "Response"
msgstr "Antwort"
#: admin.py:49
msgid "User info"
msgstr "Benutzerinfo"
#: admin.py:56
msgid "Show only requests from this user."
msgstr "Nur Anfragen von diesem Benutzer zeigen."
#: admin.py:57
msgid "Show only requests from this IP address."
msgstr "Nur Anfragen von dieser IP zeigen."
#: admin.py:81
msgid "Request overview"
msgstr "Übersicht"
#: models.py:13
msgid "response"
msgstr "Antwort"
#: models.py:16
msgid "method"
msgstr "Methode"
#: models.py:17
msgid "path"
msgstr "Pfad"
#: models.py:18
msgid "time"
msgstr "Zeit"
#: models.py:20
msgid "is secure"
msgstr "Verschlüsselt"
#: models.py:21
msgid "is ajax"
msgstr "AJAX"
#: models.py:21
msgid "Wheather this request was used via javascript."
msgstr "Die Anfrage wurde per JavaScript getätigt."
#: models.py:24
msgid "ip address"
msgstr "IP-Adresse"
#: models.py:25
msgid "user"
msgstr ""
#: models.py:26
msgid "referer"
msgstr "Referer"
#: models.py:27
msgid "user agent"
msgstr "User Agent"
#: models.py:28
msgid "language"
msgstr "Sprache"
#: models.py:33
msgid "request"
msgstr "Anfrage"
#: models.py:34
msgid "requests"
msgstr "Anfragen"
#: traffic.py:64
msgid "Ajax"
msgstr ""
#: traffic.py:70 traffic.py:71
msgid "Not Ajax"
msgstr "Nicht-Ajax"
#: traffic.py:77
msgid "Error"
msgstr "Fehler"
#: traffic.py:78
msgid "Errors"
msgstr "Fehler"
#: traffic.py:84
msgid "Error 404"
msgstr "404-Fehler"
#: traffic.py:85
msgid "Errors 404"
msgstr "404-Fehler"
#: traffic.py:91
msgid "Hit"
msgstr "Treffer"
#: traffic.py:92
msgid "Hits"
msgstr "Treffer"
#: traffic.py:98
msgid "Search"
msgstr "Suchbegriff"
#: traffic.py:99
msgid "Searches"
msgstr "Suchbegriffe"
#: traffic.py:105 traffic.py:106
msgid "Secure"
msgstr "Verschlüsselt"
#: traffic.py:112 traffic.py:113
msgid "Unsecure"
msgstr "Unverschlüsselt"
#: traffic.py:119
msgid "Unique Visit"
msgstr "Eindeutiger Besuch"
#: traffic.py:120
msgid "Unique Visits"
msgstr "Eindeutige Besuche"
#: traffic.py:126 traffic.py:127
msgid "Unique Visitor"
msgstr "Eindeutige Besucher"
#: traffic.py:133 traffic.py:134
msgid "User"
msgstr "Benutzer"
#: traffic.py:140 traffic.py:141
msgid "Unique User"
msgstr "Eindeutige Benutzer"
#: utils.py:5
msgid "Continue"
msgstr "Weiter"
#: utils.py:6
msgid "Switching Protocols"
msgstr ""
#: utils.py:7
msgid "Processing (WebDAV)"
msgstr ""
#: utils.py:10
msgid "OK"
msgstr ""
#: utils.py:11
msgid "Created"
msgstr ""
#: utils.py:12
msgid "Accepted"
msgstr ""
#: utils.py:13
msgid "Non-Authoritative Information"
msgstr ""
#: utils.py:14
msgid "No Content"
msgstr ""
#: utils.py:15
msgid "Reset Content"
msgstr ""
#: utils.py:16
msgid "Partial Content"
msgstr ""
#: utils.py:17
msgid "Multi-Status (WebDAV)"
msgstr ""
#: utils.py:20
msgid "Multiple Choices"
msgstr ""
#: utils.py:21
msgid "Moved Permanently"
msgstr ""
#: utils.py:22
msgid "Found"
msgstr ""
#: utils.py:23
msgid "See Other"
msgstr ""
#: utils.py:24
msgid "Not Modified"
msgstr ""
#: utils.py:25
msgid "Use Proxy"
msgstr ""
#: utils.py:26
msgid "Switch Proxy"
msgstr ""
#: utils.py:27
msgid "Temporary Redirect"
msgstr ""
#: utils.py:30
msgid "Bad Request"
msgstr ""
#: utils.py:31
msgid "Unauthorized"
msgstr ""
#: utils.py:32
msgid "Payment Required"
msgstr ""
#: utils.py:33
msgid "Forbidden"
msgstr ""
#: utils.py:34
msgid "Not Found"
msgstr ""
#: utils.py:35
msgid "Method Not Allowed"
msgstr ""
#: utils.py:36
msgid "Not Acceptable"
msgstr ""
#: utils.py:37
msgid "Proxy Authentication Required"
msgstr ""
#: utils.py:38
msgid "Request Timeout"
msgstr ""
#: utils.py:39
msgid "Conflict"
msgstr ""
#: utils.py:40
msgid "Gone"
msgstr ""
#: utils.py:41
msgid "Length Required"
msgstr ""
#: utils.py:42
msgid "Precondition Failed"
msgstr ""
#: utils.py:43
msgid "Request Entity Too Large"
msgstr ""
#: utils.py:44
msgid "Request-URI Too Long"
msgstr ""
#: utils.py:45
msgid "Unsupported Media Type"
msgstr ""
#: utils.py:46
msgid "Requested Range Not Satisfiable"
msgstr ""
#: utils.py:47
msgid "Expectation Failed"
msgstr ""
#: utils.py:48
msgid "I'm a teapot"
msgstr ""
#: utils.py:49
msgid "Unprocessable Entity (WebDAV)"
msgstr ""
#: utils.py:50
msgid "Locked (WebDAV)"
msgstr ""
#: utils.py:51
msgid "Failed Dependency (WebDAV)"
msgstr ""
#: utils.py:52
msgid "Unordered Collection"
msgstr ""
#: utils.py:53
msgid "Upgrade Required"
msgstr ""
#: utils.py:54
msgid "Retry With"
msgstr ""
#: utils.py:57
msgid "Internal Server Error"
msgstr ""
#: utils.py:58
msgid "Not Implemented"
msgstr ""
#: utils.py:59
msgid "Bad Gateway"
msgstr ""
#: utils.py:60
msgid "Service Unavailable"
msgstr ""
#: utils.py:61
msgid "Gateway Timeout"
msgstr ""
#: utils.py:62
msgid "HTTP Version Not Supported"
msgstr ""
#: utils.py:63
msgid "Variant Also Negotiates"
msgstr ""
#: utils.py:64
msgid "Insufficient Storage (WebDAV)"
msgstr ""
#: utils.py:65
msgid "Bandwidth Limit Exceeded"
msgstr ""
#: utils.py:66
msgid "Not Extended"
msgstr ""
#: templates/admin/request/app_index.html:10
#, python-format
msgid "Models available in the %(name)s application."
msgstr "Modelle, die in der Anwendung %(name)s vorhanden sind."
#: templates/admin/request/app_index.html:11
#, python-format
msgid "%(name)s"
msgstr "%(name)s"
#: templates/admin/request/app_index.html:21
msgid "Add"
msgstr "Hinzufügen"
#: templates/admin/request/app_index.html:27
msgid "Change"
msgstr "Ändern"
#: templates/admin/request/app_index.html:35
#: templates/admin/request/request/change_list.html:6
#: templates/admin/request/request/overview.html:33
msgid "Overview"
msgstr "Übersicht"
#: templates/admin/request/app_index.html:45
msgid "You don't have permission to edit anything."
msgstr "Sie haben keine Berechtigung, irgendetwas zu ändern."
#: templates/admin/request/request/change_list.html:10
#, python-format
msgid "Add %(name)s"
msgstr "%(name)s hinzufügen"
#: templates/admin/request/request/overview.html:30
msgid "Home"
msgstr "Start"
#: templates/admin/request/request/overview.html:40
#: templates/admin/request/request/overview.html:41
msgid "Last 5 requests"
msgstr "Die letzten 5 Anfragen"
#: templates/admin/request/request/overview.html:43
#: templates/admin/request/request/overview.html:96
#: templates/admin/request/request/overview.html:112
msgid "Path"
msgstr "Pfad"
#: templates/admin/request/request/overview.html:44
msgid "From"
msgstr "Von"
#: templates/admin/request/request/overview.html:46
msgid "Time"
msgstr "Zeit"
#: templates/admin/request/request/overview.html:60
#: templates/admin/request/request/overview.html:61
msgid "Traffic information"
msgstr "Traffic"
#: templates/admin/request/request/overview.html:64
msgid "Today"
msgstr "Heute"
#: templates/admin/request/request/overview.html:65
msgid "This week"
msgstr "Woche"
#: templates/admin/request/request/overview.html:66
msgid "This month"
msgstr "Monat"
#: templates/admin/request/request/overview.html:67
msgid "This year"
msgstr "Jahr"
#: templates/admin/request/request/overview.html:68
msgid "Alltime"
msgstr "Gesamt"
#: templates/admin/request/request/overview.html:84
msgid "Traffic graph"
msgstr "Traffic-Graph"
#: templates/admin/request/request/overview.html:93
#: templates/admin/request/request/overview.html:94
msgid "Top paths"
msgstr "Pfade"
#: templates/admin/request/request/overview.html:94
#: templates/admin/request/request/overview.html:110
#: templates/admin/request/request/overview.html:126
#: templates/admin/request/request/overview.html:142
#: templates/admin/request/request/overview.html:157
msgid "this month"
msgstr "Dieser Monat"
#: templates/admin/request/request/overview.html:97
#: templates/admin/request/request/overview.html:113
#: templates/admin/request/request/overview.html:129
#: templates/admin/request/request/overview.html:145
msgid "Visits"
msgstr "Besuche"
#: templates/admin/request/request/overview.html:109
#: templates/admin/request/request/overview.html:110
msgid "Top error-returning paths"
msgstr "Fehler-produzierende Pfade"
#: templates/admin/request/request/overview.html:110
msgid "more"
msgstr "Mehr"
#: templates/admin/request/request/overview.html:125
#: templates/admin/request/request/overview.html:126
msgid "Top referrers"
msgstr "Referrers"
#: templates/admin/request/request/overview.html:128
msgid "Referrer"
msgstr "Referrer"
#: templates/admin/request/request/overview.html:141
#: templates/admin/request/request/overview.html:142
msgid "Top search phrases"
msgstr "Suchbegriffe"
#: templates/admin/request/request/overview.html:144
msgid "Phrase"
msgstr "Suchbegriff"
#: templates/admin/request/request/overview.html:157
msgid "Top browsers"
msgstr "Browser"
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-06-28 12:37+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: admin.py:43 templates/admin/request/request/overview.html:31
#: templates/admin/request/request/overview.html:32
msgid "Request"
msgstr ""
#: admin.py:46 templates/admin/request/request/overview.html:45
msgid "Response"
msgstr ""
#: admin.py:49
msgid "User info"
msgstr ""
#: admin.py:56
msgid "Show only requests from this user."
msgstr ""
#: admin.py:57
msgid "Show only requests from this IP address."
msgstr ""
#: admin.py:81
msgid "Request overview"
msgstr ""
#: models.py:13
msgid "response"
msgstr ""
#: models.py:16
msgid "method"
msgstr ""
#: models.py:17
msgid "path"
msgstr ""
#: models.py:18
msgid "time"
msgstr ""
#: models.py:20
msgid "is secure"
msgstr ""
#: models.py:21
msgid "is ajax"
msgstr ""
#: models.py:21
msgid "Wheather this request was used via javascript."
msgstr ""
#: models.py:24
msgid "ip address"
msgstr ""
#: models.py:25
msgid "user"
msgstr ""
#: models.py:26
msgid "referer"
msgstr ""
#: models.py:27
msgid "user agent"
msgstr ""
#: models.py:28
msgid "language"
msgstr ""
#: traffic.py:64
msgid "Ajax"
msgstr ""