Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 49 lines (47 sloc) 1.711 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
from cms.models import Page, CMSPlugin
from contacts_and_people.models import Person, Entity, Membership, Building
from news_and_events.models import NewsArticle, Event
from django.contrib.auth.models import User, Group
import django.http as http
from django.db.models import get_model
import django.shortcuts as shortcuts
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.conf import settings
from arkestra_utilities.models import ArkestraUser

@login_required
def stats(request):
    pages = Page.objects.count()
    people = Person.objects.count()
    entities = Entity.objects.count()
    roles = Membership.objects.count()
    newsarticles = NewsArticle.objects.count()
    events = Event.objects.count()
    users = ArkestraUser.objects.filter(is_active = True, is_staff = True)
    groups = Group.objects.all().order_by("name")
    plugins = CMSPlugin.objects.count()
    return shortcuts.render_to_response(
        "housekeeping/statistics.html", {
            "pages": pages,
            "people": people,
            "roles": roles,
            "entities": entities,
            "newsarticles": newsarticles,
            "events": events,
            "users": users,
            "plugins": plugins,
            "groups": groups,
            "base_template": settings.CMS_TEMPLATES[0][0],
            },
        RequestContext(request),
        )
        
@login_required
def userstats(request,slug):
    print "userstats", slug
    user = User.objects.get(username=slug)
    #print user
    return shortcuts.render_to_response(
        "housekeeping/user_statistics.html", {
            "user": user,
            }
        )
Something went wrong with that request. Please try again.