From: artunit Date: Wed, 19 Nov 2008 17:41:00 +0000 (+0000) Subject: git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@24 6d9bc8c9-1ec2-4278... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1775e2549aa19245c36129991cd9fa3fbd65ebb0;p=Syrup.git git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@24 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/conifer/syrup/models.py b/conifer/syrup/models.py index 3cdaaff..1c7590a 100644 --- a/conifer/syrup/models.py +++ b/conifer/syrup/models.py @@ -1,5 +1,6 @@ from django.db import models as m from django.contrib.auth.models import User +from django.contrib.auth.models import AnonymousUser from datetime import datetime #---------------------------------------------------------------------- @@ -13,6 +14,15 @@ from datetime import datetime # 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) @@ -53,6 +63,7 @@ class Course(m.Model): max_length=4098, blank=True, null=True) active = m.BooleanField(default=True) + moderated = m.BooleanField(default=False) def __unicode__(self): return self.code or self.title