Added state property to role model.
authorLennard de Rijk <ljvderijk@gmail.com>
Fri, 23 Jan 2009 09:08:26 +0000
changeset 913 db38e7680d1c
parent 912 5b13221456f4
child 914 6ec8dd2a73b3
Added state property to role model. This can be used when for instance a member has been removed from a club or a when a program has been marked inactive. Certain roles would then be shown on the upcoming roles page marked as previous roles. This would give us the archiving capability that was shown in the mockup. Patch by: Lennard de Rijk Reviewd by: to-be-reviewed
app/soc/models/role.py
app/soc/views/models/host.py
--- a/app/soc/models/role.py	Fri Jan 23 08:49:09 2009 +0000
+++ b/app/soc/models/role.py	Fri Jan 23 09:08:26 2009 +0000
@@ -274,7 +274,7 @@
   tshirt_style = db.StringProperty(
       verbose_name=ugettext_lazy('T-shirt Style'),
       choices=('male', 'female'))
-  
+
   #: field storing whether User has agreed to the Role-specific Terms of
   #: Service. (Not a required field because some Roles may not have special
   #: Terms of Service.)
@@ -283,6 +283,20 @@
   agrees_to_tos.help_text = ugettext_lazy(
       'Indicates that the user agrees to the Terms of Service for this Role.')
 
+  #: field storing the state of this role
+  #: Active means that this role can exercise all it's privileges.
+  #: Invalid mean that this role cannot exercise it's privileges.
+  #: Inactive means that this role cannot exercise it's data-editing
+  #: privileges but should be able to see the data. For instance when a program
+  #: has been marked inactive an Organization Admin should still be able to see
+  #: the student applications.
+  state = db.StringProperty(default='active',
+      choices=['active','invalid','inactive'],
+      verbose_name=ugettext_lazy('State of this Role'))
+  state.help_text = ugettext_lazy(
+      'Indicates the state of the role concerning which privileges may be used')
+
+
   def name(self):
     """Alias 'display_name' Property as 'name' for use in common templates.
     """
--- a/app/soc/views/models/host.py	Fri Jan 23 08:49:09 2009 +0000
+++ b/app/soc/views/models/host.py	Fri Jan 23 09:08:26 2009 +0000
@@ -53,7 +53,7 @@
     model = soc.models.host.Host
 
     #: list of model fields which will *not* be gathered by the form
-    exclude = ['scope', 'user']
+    exclude = ['scope', 'user', 'state']
 
   def clean_empty(self, field):
     data = self.cleaned_data.get(field)