Changeset 89165c1
- Timestamp:
- Sep 15, 2013, 7:05:10 AM (13 years ago)
- Branches:
- master, stable, stage
- Children:
- 00ec3e4
- Parents:
- 645ab74
- git-author:
- Alex Dehnert <adehnert@…> (09/15/13 06:42:50)
- git-committer:
- Alex Dehnert <adehnert@…> (09/15/13 07:05:10)
- Location:
- asadb
- Files:
-
- 1 added
- 5 edited
-
groups/admin.py (modified) (2 diffs)
-
groups/load_people.py (modified) (1 diff)
-
groups/migrations/0029_athena_affiliation.py (added)
-
groups/models.py (modified) (4 diffs)
-
groups/views.py (modified) (1 diff)
-
template/groups/reporting/non-students.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
asadb/groups/admin.py
rfa218b1 r89165c1 203 203 'last_name', 204 204 'account_class', 205 'affiliation_basic', 206 'loose_student', 205 207 'mutable', 206 208 'add_date', … … 210 212 list_display_links = ( 'id', 'username', ) 211 213 search_fields = ( 'username', 'mit_id', 'first_name', 'last_name', 'account_class', ) 212 list_filter = ( 'account_class', 'mutable', ) 214 list_filter = ( 215 'account_class', 216 'affiliation_basic', 'affiliation_detailed', 217 'loose_student', 218 'mutable', 219 ) 213 220 admin.site.register(groups.models.AthenaMoiraAccount, Admin_AthenaMoiraAccount) -
asadb/groups/load_people.py
r161ce5f r89165c1 26 26 'last_name', 27 27 'account_class', 28 'affiliation_basic', 29 'affiliation_detailed', 28 30 ] 29 31 -
asadb/groups/models.py
rc4282e2 r89165c1 12 12 from django.conf import settings 13 13 from django.db import models 14 from django.db.models import Q 14 15 from django.core.validators import RegexValidator 15 16 from django.contrib.auth.models import User … … 525 526 return super(AthenaMoiraAccount_ActiveManager, self).get_query_set().filter(del_date=None) 526 527 528 def student_account_classes(): 529 year = datetime.datetime.now().year 530 return ["G"] + [str(yr) for yr in range(year-5, year+10)] 531 527 532 class AthenaMoiraAccount(models.Model): 528 533 username = models.CharField(max_length=8, unique=True, ) … … 531 536 last_name = models.CharField(max_length=45) 532 537 account_class = models.CharField(max_length=10) 538 affiliation_basic = models.CharField(max_length=10) 539 affiliation_detailed = models.CharField(max_length=40) 540 loose_student = models.BooleanField(default=False, help_text='Whether to use loose or strict determination of student status. Loose means that either the account class or the affiliation should indicate student status; strict means that the affiliation must be student. In general, we use strict; for some people ("secret people") directory information is suppressed and the affiliation will be misleading.') 533 541 mutable = models.BooleanField(default=True) 534 542 add_date = models.DateField(help_text="Date when this person was added to the dump.", ) … … 540 548 541 549 def is_student(self, ): 542 # XXX: Is this... right? 543 return self.account_class == 'G' or self.account_class.isdigit() 550 student_affiliation = (self.affiliation_basic == 'student') 551 student_class = (self.account_class in student_account_classes()) 552 return student_affiliation or (student_class and self.loose_student) 553 554 @staticmethod 555 def student_q(): 556 q_affiliation = Q(affiliation_basic='student') 557 q_class = Q(account_class__in=student_account_classes()) 558 return q_affiliation | (q_class & Q(loose_student=True)) 544 559 545 560 def format(self, ): -
asadb/groups/views.py
r242566d r89165c1 1294 1294 def show_nonstudent_officers(request, ): 1295 1295 student_roles = groups.models.OfficerRole.objects.filter(require_student=True, ) 1296 year = datetime.datetime.now().year 1297 account_classes = ["G"] + [str(yr) for yr in range(year-5, year+10)] 1298 students = groups.models.AthenaMoiraAccount.active_accounts.filter(account_class__in=account_classes) 1296 student_q = groups.models.AthenaMoiraAccount.student_q() 1297 students = groups.models.AthenaMoiraAccount.active_accounts.filter(student_q) 1299 1298 office_holders = groups.models.OfficeHolder.current_holders.order_by('group__name', 'role', ) 1300 1299 office_holders = office_holders.filter(role__in=student_roles) -
asadb/template/groups/reporting/non-students.html
r52fb1d5 r89165c1 44 44 <td>{{holder.group.group_status}}</td> 45 45 <td>{{holder.role.display_name}}</td> 46 <td>{ {holder.person}}</td>46 <td>{% if perms.groups.change_athenamoiraaccount %}<a href='{% url admin:groups_athenamoiraaccount_changelist %}?username={{holder.person}}'>{{holder.person}}</a>{% else %}{{holder.person}}{% endif %}</td> 47 47 </tr> 48 48 {% endfor %}
Note: See TracChangeset
for help on using the changeset viewer.