summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2011-01-09 17:52:29 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2011-01-09 17:52:29 -0300
commit5c168b231a814c033264326b39084f184c06e0c4 (patch)
treec96380294e52ffcb46893fc7647532ba8c235d3c /devel
parentb3232ae7e075e551145017b6a698968124003f8e (diff)
more merge
Diffstat (limited to 'devel')
-rw-r--r--devel/urls.py1
-rw-r--r--devel/views.py25
2 files changed, 25 insertions, 1 deletions
diff --git a/devel/urls.py b/devel/urls.py
index 23dd2d9f..0a050a92 100644
--- a/devel/urls.py
+++ b/devel/urls.py
@@ -2,6 +2,7 @@ from django.conf.urls.defaults import patterns
urlpatterns = patterns('devel.views',
(r'^$', 'index'),
+ (r'^clock/$', 'clock'),
(r'^notify/$', 'change_notify'),
(r'^profile/$', 'change_profile'),
(r'^newuser/$', 'new_user_form'),
diff --git a/devel/views.py b/devel/views.py
index 710bfff5..b26c7af0 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -13,6 +13,8 @@ from main.models import UserProfile
from packages.models import PackageRelation
from .utils import get_annotated_maintainers
+import datetime
+import pytz
import random
from string import ascii_letters, digits
@@ -38,11 +40,32 @@ def index(request):
'maintainers': maintainers,
'flagged' : flagged,
'todopkgs' : todopkgs,
- }
+ }
return direct_to_template(request, 'devel/index.html', page_dict)
@login_required
+@never_cache
+def clock(request):
+ devs = User.objects.filter(is_active=True).order_by(
+ 'username').select_related('userprofile')
+
+ # now annotate each dev object with their current time
+ now = datetime.datetime.now()
+ utc_now = datetime.datetime.utcnow().replace(tzinfo=pytz.utc)
+ for dev in devs:
+ tz = pytz.timezone(dev.userprofile.time_zone)
+ dev.current_time = utc_now.astimezone(tz)
+
+ page_dict = {
+ 'developers': devs,
+ 'now': now,
+ 'utc_now': utc_now,
+ }
+
+ return direct_to_template(request, 'devel/clock.html', page_dict)
+
+@login_required
def change_notify(request):
maint = User.objects.get(username=request.user.username)
notify = request.POST.get('notify', 'no')