[open-ils-commits] r31 - in servres/trunk/conifer: syrup templates
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Nov 19 19:46:52 EST 2008
Author: artunit
Date: 2008-11-19 19:46:51 -0500 (Wed, 19 Nov 2008)
New Revision: 31
Modified:
servres/trunk/conifer/syrup/models.py
servres/trunk/conifer/syrup/urls.py
servres/trunk/conifer/syrup/views.py
servres/trunk/conifer/templates/welcome.xhtml
Log:
Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py 2008-11-19 22:58:14 UTC (rev 30)
+++ servres/trunk/conifer/syrup/models.py 2008-11-20 00:46:51 UTC (rev 31)
@@ -14,14 +14,6 @@
# can be made available on the User that are not part of the Django
# User model. Let's try this for a bit see how this works out.
-class AnonymousUserExtensionHack(object):
- def unmoderated_courses():
- return Course.objects.filter(moderated=False)
-
-for k,v in [(k,v) for k,v in AnonymousUserExtensionHack.__dict__.items() \
- if not k.startswith('_')]:
- setattr(AnonymousUser, k, v)
-
class UserExtensionHack(object):
def courses(self):
return Course.objects.filter(member__user=self.id)
Modified: servres/trunk/conifer/syrup/urls.py
===================================================================
--- servres/trunk/conifer/syrup/urls.py 2008-11-19 22:58:14 UTC (rev 30)
+++ servres/trunk/conifer/syrup/urls.py 2008-11-20 00:46:51 UTC (rev 31)
@@ -3,5 +3,6 @@
urlpatterns = patterns('conifer.syrup.views',
(r'^$', 'welcome'),
(r'^course/$', 'my_courses'),
+ (r'^opencourse/$', 'open_courses'),
(r'^course/(?P<course_id>\d+)/$', 'course_detail'),
)
Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py 2008-11-19 22:58:14 UTC (rev 30)
+++ servres/trunk/conifer/syrup/views.py 2008-11-20 00:46:51 UTC (rev 31)
@@ -1,4 +1,5 @@
from django.http import HttpResponse, HttpResponseRedirect
+from django.core.paginator import Paginator
from django.shortcuts import get_object_or_404
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login, logout
@@ -32,6 +33,12 @@
def welcome(request):
return g.render('welcome.xhtml')
+def open_courses(request):
+ pgstart = request.GET.get('start')
+ if not pgstart:
+ pgstart = 1
+ paginator = Paginator(models.Course.objects.filter(moderated=False), 5)
+ return g.render('open_courses.xhtml', paginator=paginator, pgstart=pgstart)
@login_required
def my_courses(request):
Modified: servres/trunk/conifer/templates/welcome.xhtml
===================================================================
--- servres/trunk/conifer/templates/welcome.xhtml 2008-11-19 22:58:14 UTC (rev 30)
+++ servres/trunk/conifer/templates/welcome.xhtml 2008-11-20 00:46:51 UTC (rev 31)
@@ -11,6 +11,7 @@
<body>
<div style="float: right; margin: 0 24; background-color: #feb; padding: 24;">
<p><a href="/accounts/login/?next=/syrup/">Log in</a></p>
+ <p><a href="opencourse">Browse Open Courses</a></p>
<p><a href="/public/search">Search the Reserves</a></p>
</div>
<h1>News</h1>
More information about the open-ils-commits
mailing list