Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

"""Basic views with no home""" 

import logging 

from pyramid.view import view_config 

 

from bookie.bcelery import tasks 

from bookie.models import BmarkMgr 

from bookie.models.auth import ActivationMgr 

from bookie.models.auth import UserMgr 

 

 

LOG = logging.getLogger(__name__) 

 

 

@view_config( 

    route_name="dashboard", 

    renderer="/stats/dashboard.mako") 

def dashboard(request): 

    """A public dashboard of the system 

    """ 

    res = tasks.count_total.delay() 

 

    # Generate some user data and stats 

    user_count = UserMgr.count() 

    pending_activations = ActivationMgr.count() 

 

    # Generate some bookmark data. 

    bookmark_count = BmarkMgr.count() 

    unique_url_count = BmarkMgr.count(distinct=True) 

 

    return { 

        'bookmark_data': { 

            'count': bookmark_count, 

            'unique_count': unique_url_count 

        }, 

        'user_data': { 

            'count': user_count, 

            'activations': pending_activations 

 

        } 

    }