#NEWLINE# def index_page( request ) : #NEWLINE# #INDENT# if request . user . is_authenticated ( ) : #NEWLINE# #INDENT# groups = ( [ group for group in request . user . groups . all ( ) ] + [ group for group in Group . objects . filter ( name = 'general' ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# groups = Group . objects . filter ( name = 'general' ) #NEWLINE# #UNINDENT# forums = [ ] #NEWLINE# for group in groups : #NEWLINE# #INDENT# forums . extend ( [ each for each in group . can_access_forums . all ( ) ] ) #NEWLINE# #UNINDENT# forums = set ( forums ) #NEWLINE# forums = sorted ( forums , cmp = ( lambda x , y : ( int ( y . ordering ) - int ( x . ordering ) ) ) ) #NEWLINE# totaltopics = Ftopics . objects . count ( ) #NEWLINE# totalposts = ( totaltopics + Reply . objects . count ( ) ) #NEWLINE# totalusers = User . objects . count ( ) #NEWLINE# now = datetime . now ( ) #NEWLINE# users_online = DinetteUserProfile . objects . filter ( last_activity__gte = ( now - timedelta ( seconds = 900 ) ) ) . count ( ) #NEWLINE# last_registered_user = User . objects . order_by ( '-date_joined' ) [ 0 ] #NEWLINE# payload = { #NEWLINE# #INDENT# 'users_online' : users_online , #NEWLINE# 'forums_list' : forums , #NEWLINE# 'totaltopics' : totaltopics , #NEWLINE# 'totalposts' : totalposts , #NEWLINE# 'totalusers' : totalusers , #NEWLINE# 'last_registered_user' : last_registered_user , #NEWLINE# #UNINDENT# } #NEWLINE# return render_to_response ( 'dinette/mainindex.html' , groups , RequestContext ( request ) )