add parameter to display "decorated" creator (used with api calls)
authorraph
Thu, 15 Jul 2010 16:10:29 +0200
changeset 292 3442202aff1a
parent 291 7aec57e4738f
child 293 2c52e4453bf7
add parameter to display "decorated" creator (used with api calls)
src/cm/cm_settings.py
src/cm/models_base.py
--- a/src/cm/cm_settings.py	Thu Jul 15 16:09:52 2010 +0200
+++ b/src/cm/cm_settings.py	Thu Jul 15 16:10:29 2010 +0200
@@ -28,4 +28,7 @@
 TRACKING_HTML = get_setting('TRACKING_HTML', '')
 
 # Store IP (or not) in activity 
-STORE_ACTIVITY_IP = get_setting('STORE_ACTIVITY_IP', True)
\ No newline at end of file
+STORE_ACTIVITY_IP = get_setting('STORE_ACTIVITY_IP', True)
+
+# Show 'decorated' users in comments (not structural creator id) 
+DECORATED_CREATORS = get_setting('DECORATED_CREATORS', False)
\ No newline at end of file
--- a/src/cm/models_base.py	Thu Jul 15 16:09:52 2010 +0200
+++ b/src/cm/models_base.py	Thu Jul 15 16:10:29 2010 +0200
@@ -57,13 +57,17 @@
         abstract = True
     
     def get_name(self):
-        if self.user:
+        from cm.cm_settings import DECORATED_CREATORS
+        
+        if self.user and not DECORATED_CREATORS:
             return self.user.username
         else:
             return self.name
 
     def get_email(self):
-        if self.user:
+        from cm.cm_settings import DECORATED_CREATORS
+        
+        if self.user and not DECORATED_CREATORS:
             return self.user.email
         else:
             return self.email