Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
9547f791
Commit
9547f791
authored
14 years ago
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
started adding space for more stats
parent
fad6161a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
helios/stats_urls.py
+15
-0
15 additions, 0 deletions
helios/stats_urls.py
helios/stats_views.py
+36
-0
36 additions, 0 deletions
helios/stats_views.py
helios/urls.py
+1
-1
1 addition, 1 deletion
helios/urls.py
with
52 additions
and
1 deletion
helios/stats_urls.py
0 → 100644
+
15
−
0
View file @
9547f791
"""
Helios URLs for Election related stuff
Ben Adida (ben@adida.net)
"""
from
django.conf.urls.defaults
import
*
from
helios.stats_views
import
*
urlpatterns
=
patterns
(
''
,
(
r
'
^$
'
,
home
),
(
r
'
^elections$
'
,
elections
),
)
This diff is collapsed.
Click to expand it.
helios/stats_views.py
0 → 100644
+
36
−
0
View file @
9547f791
"""
Helios stats views
"""
from
django.core.urlresolvers
import
reverse
from
django.core.mail
import
send_mail
from
django.core.paginator
import
Paginator
from
django.http
import
*
from
django.db
import
transaction
from
security
import
*
from
auth.security
import
get_user
,
save_in_session_across_logouts
def
require_admin
(
request
):
user
=
get_user
(
request
)
if
not
user
or
not
user
.
admin_p
:
raise
PermissionDenied
()
return
user
def
home
(
request
):
return
HttpResponse
(
"
foo
"
)
def
elections
(
request
):
user
=
require_admin
(
request
)
page
=
int
(
request
.
GET
.
get
(
'
page
'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'
limit
'
,
25
))
elections
=
Election
.
objects
.
all
().
order_by
(
'
-created_at
'
)
elections_paginator
=
Paginator
(
elections
,
limit
)
elections_page
=
elections_paginator
.
page
(
page
)
return
render_template
(
request
,
"
stats
"
,
{
'
elections
'
:
elections_page
.
object_list
,
'
elections_page
'
:
elections_page
,
'
limit
'
:
limit
})
This diff is collapsed.
Click to expand it.
helios/urls.py
+
1
−
1
View file @
9547f791
...
@@ -12,7 +12,7 @@ urlpatterns = patterns('',
...
@@ -12,7 +12,7 @@ urlpatterns = patterns('',
(
r
'
^testcookie$
'
,
test_cookie
),
(
r
'
^testcookie$
'
,
test_cookie
),
(
r
'
^testcookie_2$
'
,
test_cookie_2
),
(
r
'
^testcookie_2$
'
,
test_cookie_2
),
(
r
'
^nocookies$
'
,
nocookies
),
(
r
'
^nocookies$
'
,
nocookies
),
(
r
'
^stats
$
'
,
stats
),
(
r
'
^stats
/
'
,
include
(
'
helios.stats_urls
'
)
),
(
r
'
^socialbuttons$
'
,
socialbuttons
),
(
r
'
^socialbuttons$
'
,
socialbuttons
),
# election shortcut by shortname
# election shortcut by shortname
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment