Commits

Luke Plant  committed 3ce4657 Merge

Merged from default

  • Participants
  • Parent commits 40f7494, 57641ae
  • Branches live

Comments (0)

Files changed (17)

File cciw/officers/admin.py

 
 
 class InvitationAdmin(admin.ModelAdmin):
-    list_display = ['officer', 'camp']
+    list_display = ['officer', 'camp', 'notes', 'date_added']
     list_filter = ['camp']
     search_fields = ['officer__first_name', 'officer__last_name', 'officer__username']
 

File cciw/officers/migrations/0008_auto__add_field_invitation_date_added.py

+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        
+        # Adding field 'Invitation.date_added'
+        db.add_column('officers_invitation', 'date_added', self.gf('django.db.models.fields.DateField')(default=datetime.date(1970, 1, 1)), keep_default=False)
+
+        # Invent more sensible values for date_added field.  We'll use one day
+        # after the previous camp finished (which works for all Invitation
+        # objects in our db).
+
+        from datetime import timedelta
+        for i in orm['officers.Invitation'].objects.all():
+            i.date_added = i.camp.previous_camp.end_date + timedelta(1)
+            i.save()
+
+    def backwards(self, orm):
+        
+        # Deleting field 'Invitation.date_added'
+        db.delete_column('officers_invitation', 'date_added')
+
+
+    models = {
+        'auth.group': {
+            'Meta': {'object_name': 'Group'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'unique': 'True'}),
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'auth.permission': {
+            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        'auth.user': {
+            'Meta': {'object_name': 'User'},
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+            'username': ('django.db.models.fields.CharField', [], {'max_length': '30', 'unique': 'True'})
+        },
+        'cciwmain.camp': {
+            'Meta': {'ordering': "['-year', 'number']", 'unique_together': "(('year', 'number'),)", 'object_name': 'Camp'},
+            'admins': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'camps_as_admin'", 'blank': 'True', 'null': 'True', 'to': "orm['auth.User']"}),
+            'age': ('django.db.models.fields.CharField', [], {'max_length': '3'}),
+            'chaplain': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'camps_as_chaplain'", 'blank': 'True', 'null': 'True', 'to': "orm['cciwmain.Person']"}),
+            'end_date': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'leaders': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'camps_as_leader'", 'blank': 'True', 'null': 'True', 'to': "orm['cciwmain.Person']"}),
+            'number': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
+            'officers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'through': "orm['officers.Invitation']", 'symmetrical': 'False'}),
+            'online_applications': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'previous_camp': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'next_camps'", 'blank': 'True', 'null': 'True', 'to': "orm['cciwmain.Camp']"}),
+            'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cciwmain.Site']"}),
+            'start_date': ('django.db.models.fields.DateField', [], {}),
+            'year': ('django.db.models.fields.PositiveSmallIntegerField', [], {})
+        },
+        'cciwmain.person': {
+            'Meta': {'ordering': "('name',)", 'object_name': 'Person'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'info': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+            'users': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'cciwmain.site': {
+            'Meta': {'object_name': 'Site'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'info': ('django.db.models.fields.TextField', [], {}),
+            'long_name': ('django.db.models.fields.CharField', [], {'max_length': "'50'"}),
+            'short_name': ('django.db.models.fields.CharField', [], {'max_length': "'25'", 'unique': 'True'}),
+            'slug_name': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': "'25'", 'unique': 'True', 'blank': 'True'})
+        },
+        'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'officers.application': {
+            'Meta': {'ordering': "('-date_submitted', 'officer__first_name', 'officer__last_name')", 'object_name': 'Application'},
+            'address2_address': ('cciw.officers.fields.AddressField', [], {'blank': 'True'}),
+            'address2_from': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'address2_to': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'address3_address': ('cciw.officers.fields.AddressField', [], {'blank': 'True'}),
+            'address3_from': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'address3_to': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'address_country': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '30', 'blank': 'True'}),
+            'address_county': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '30', 'blank': 'True'}),
+            'address_email': ('cciw.officers.fields.RequiredEmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'address_firstline': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '40', 'blank': 'True'}),
+            'address_mobile': ('django.db.models.fields.CharField', [], {'max_length': '22', 'blank': 'True'}),
+            'address_postcode': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '10', 'blank': 'True'}),
+            'address_since': ('cciw.officers.fields.RequiredYyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'address_tel': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '22', 'blank': 'True'}),
+            'address_town': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '60', 'blank': 'True'}),
+            'allegation_declaration': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'birth_date': ('cciw.officers.fields.RequiredDateField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
+            'birth_place': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '60', 'blank': 'True'}),
+            'christian_experience': ('cciw.officers.fields.RequiredTextField', [], {'blank': 'True'}),
+            'concern_declaration': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'concern_details': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'court_declaration': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'court_details': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'crb_check_consent': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'crime_declaration': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'crime_details': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'date_submitted': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            'employer1_from': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'employer1_job': ('django.db.models.fields.CharField', [], {'max_length': '60', 'blank': 'True'}),
+            'employer1_leaving': ('django.db.models.fields.CharField', [], {'max_length': '150', 'blank': 'True'}),
+            'employer1_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
+            'employer1_to': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'employer2_from': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'employer2_job': ('django.db.models.fields.CharField', [], {'max_length': '60', 'blank': 'True'}),
+            'employer2_leaving': ('django.db.models.fields.CharField', [], {'max_length': '150', 'blank': 'True'}),
+            'employer2_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
+            'employer2_to': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'finished': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'full_maiden_name': ('django.db.models.fields.CharField', [], {'max_length': '60', 'blank': 'True'}),
+            'full_name': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '60', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'illness_details': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'officer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'blank': 'True'}),
+            'referee1_address': ('cciw.officers.fields.RequiredAddressField', [], {'blank': 'True'}),
+            'referee1_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'referee1_mobile': ('django.db.models.fields.CharField', [], {'max_length': '22', 'blank': 'True'}),
+            'referee1_name': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '60', 'blank': 'True'}),
+            'referee1_tel': ('django.db.models.fields.CharField', [], {'max_length': '22', 'blank': 'True'}),
+            'referee2_address': ('cciw.officers.fields.RequiredAddressField', [], {'blank': 'True'}),
+            'referee2_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'referee2_mobile': ('django.db.models.fields.CharField', [], {'max_length': '22', 'blank': 'True'}),
+            'referee2_name': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '60', 'blank': 'True'}),
+            'referee2_tel': ('django.db.models.fields.CharField', [], {'max_length': '22', 'blank': 'True'}),
+            'relevant_illness': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'youth_experience': ('cciw.officers.fields.RequiredTextField', [], {'blank': 'True'}),
+            'youth_work_declined': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'youth_work_declined_details': ('django.db.models.fields.TextField', [], {'blank': 'True'})
+        },
+        'officers.crbapplication': {
+            'Meta': {'object_name': 'CRBApplication'},
+            'completed': ('django.db.models.fields.DateField', [], {}),
+            'crb_number': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'officer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+        },
+        'officers.crbformlog': {
+            'Meta': {'object_name': 'CRBFormLog'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'officer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
+            'sent': ('django.db.models.fields.DateTimeField', [], {})
+        },
+        'officers.invitation': {
+            'Meta': {'ordering': "('-camp__year', 'officer__first_name', 'officer__last_name')", 'unique_together': "(('officer', 'camp'),)", 'object_name': 'Invitation'},
+            'camp': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cciwmain.Camp']"}),
+            'date_added': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'officer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+        },
+        'officers.reference': {
+            'Meta': {'ordering': "('application__date_submitted', 'application__officer__first_name', 'application__officer__last_name', 'referee_number')", 'unique_together': "(('application', 'referee_number'),)", 'object_name': 'Reference'},
+            'application': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['officers.Application']"}),
+            'comments': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'received': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'referee_number': ('django.db.models.fields.SmallIntegerField', [], {}),
+            'requested': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
+        },
+        'officers.referenceform': {
+            'Meta': {'object_name': 'ReferenceForm'},
+            'capability_children': ('django.db.models.fields.TextField', [], {}),
+            'capacity_known': ('django.db.models.fields.TextField', [], {}),
+            'character': ('django.db.models.fields.TextField', [], {}),
+            'comments': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'concerns': ('django.db.models.fields.TextField', [], {}),
+            'date_created': ('django.db.models.fields.DateField', [], {}),
+            'how_long_known': ('django.db.models.fields.CharField', [], {'max_length': '150'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'known_offences': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'known_offences_details': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'referee_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'reference_info': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'_reference_form'", 'unique': 'True', 'to': "orm['officers.Reference']"})
+        }
+    }
+
+    complete_apps = ['officers']

File cciw/officers/migrations/0009_auto__add_field_invitation_notes.py

+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        
+        # Adding field 'Invitation.notes'
+        db.add_column('officers_invitation', 'notes', self.gf('django.db.models.fields.CharField')(default='', max_length=255, blank=True), keep_default=False)
+
+
+    def backwards(self, orm):
+        
+        # Deleting field 'Invitation.notes'
+        db.delete_column('officers_invitation', 'notes')
+
+
+    models = {
+        'auth.group': {
+            'Meta': {'object_name': 'Group'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'unique': 'True'}),
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'auth.permission': {
+            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        'auth.user': {
+            'Meta': {'object_name': 'User'},
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+            'username': ('django.db.models.fields.CharField', [], {'max_length': '30', 'unique': 'True'})
+        },
+        'cciwmain.camp': {
+            'Meta': {'ordering': "['-year', 'number']", 'unique_together': "(('year', 'number'),)", 'object_name': 'Camp'},
+            'admins': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'camps_as_admin'", 'blank': 'True', 'null': 'True', 'to': "orm['auth.User']"}),
+            'age': ('django.db.models.fields.CharField', [], {'max_length': '3'}),
+            'chaplain': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'camps_as_chaplain'", 'blank': 'True', 'null': 'True', 'to': "orm['cciwmain.Person']"}),
+            'end_date': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'leaders': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'camps_as_leader'", 'blank': 'True', 'null': 'True', 'to': "orm['cciwmain.Person']"}),
+            'number': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
+            'officers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'through': "orm['officers.Invitation']", 'symmetrical': 'False'}),
+            'online_applications': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'previous_camp': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'next_camps'", 'blank': 'True', 'null': 'True', 'to': "orm['cciwmain.Camp']"}),
+            'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cciwmain.Site']"}),
+            'start_date': ('django.db.models.fields.DateField', [], {}),
+            'year': ('django.db.models.fields.PositiveSmallIntegerField', [], {})
+        },
+        'cciwmain.person': {
+            'Meta': {'ordering': "('name',)", 'object_name': 'Person'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'info': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+            'users': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'cciwmain.site': {
+            'Meta': {'object_name': 'Site'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'info': ('django.db.models.fields.TextField', [], {}),
+            'long_name': ('django.db.models.fields.CharField', [], {'max_length': "'50'"}),
+            'short_name': ('django.db.models.fields.CharField', [], {'max_length': "'25'", 'unique': 'True'}),
+            'slug_name': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': "'25'", 'unique': 'True', 'blank': 'True'})
+        },
+        'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'officers.application': {
+            'Meta': {'ordering': "('-date_submitted', 'officer__first_name', 'officer__last_name')", 'object_name': 'Application'},
+            'address2_address': ('cciw.officers.fields.AddressField', [], {'blank': 'True'}),
+            'address2_from': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'address2_to': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'address3_address': ('cciw.officers.fields.AddressField', [], {'blank': 'True'}),
+            'address3_from': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'address3_to': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'address_country': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '30', 'blank': 'True'}),
+            'address_county': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '30', 'blank': 'True'}),
+            'address_email': ('cciw.officers.fields.RequiredEmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'address_firstline': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '40', 'blank': 'True'}),
+            'address_mobile': ('django.db.models.fields.CharField', [], {'max_length': '22', 'blank': 'True'}),
+            'address_postcode': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '10', 'blank': 'True'}),
+            'address_since': ('cciw.officers.fields.RequiredYyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'address_tel': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '22', 'blank': 'True'}),
+            'address_town': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '60', 'blank': 'True'}),
+            'allegation_declaration': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'birth_date': ('cciw.officers.fields.RequiredDateField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
+            'birth_place': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '60', 'blank': 'True'}),
+            'christian_experience': ('cciw.officers.fields.RequiredTextField', [], {'blank': 'True'}),
+            'concern_declaration': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'concern_details': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'court_declaration': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'court_details': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'crb_check_consent': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'crime_declaration': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'crime_details': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'date_submitted': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            'employer1_from': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'employer1_job': ('django.db.models.fields.CharField', [], {'max_length': '60', 'blank': 'True'}),
+            'employer1_leaving': ('django.db.models.fields.CharField', [], {'max_length': '150', 'blank': 'True'}),
+            'employer1_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
+            'employer1_to': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'employer2_from': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'employer2_job': ('django.db.models.fields.CharField', [], {'max_length': '60', 'blank': 'True'}),
+            'employer2_leaving': ('django.db.models.fields.CharField', [], {'max_length': '150', 'blank': 'True'}),
+            'employer2_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
+            'employer2_to': ('cciw.officers.fields.YyyyMmField', [], {'max_length': '7', 'blank': 'True'}),
+            'finished': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'full_maiden_name': ('django.db.models.fields.CharField', [], {'max_length': '60', 'blank': 'True'}),
+            'full_name': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '60', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'illness_details': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'officer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'blank': 'True'}),
+            'referee1_address': ('cciw.officers.fields.RequiredAddressField', [], {'blank': 'True'}),
+            'referee1_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'referee1_mobile': ('django.db.models.fields.CharField', [], {'max_length': '22', 'blank': 'True'}),
+            'referee1_name': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '60', 'blank': 'True'}),
+            'referee1_tel': ('django.db.models.fields.CharField', [], {'max_length': '22', 'blank': 'True'}),
+            'referee2_address': ('cciw.officers.fields.RequiredAddressField', [], {'blank': 'True'}),
+            'referee2_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'referee2_mobile': ('django.db.models.fields.CharField', [], {'max_length': '22', 'blank': 'True'}),
+            'referee2_name': ('cciw.officers.fields.RequiredCharField', [], {'max_length': '60', 'blank': 'True'}),
+            'referee2_tel': ('django.db.models.fields.CharField', [], {'max_length': '22', 'blank': 'True'}),
+            'relevant_illness': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'youth_experience': ('cciw.officers.fields.RequiredTextField', [], {'blank': 'True'}),
+            'youth_work_declined': ('cciw.officers.fields.RequiredNullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+            'youth_work_declined_details': ('django.db.models.fields.TextField', [], {'blank': 'True'})
+        },
+        'officers.crbapplication': {
+            'Meta': {'object_name': 'CRBApplication'},
+            'completed': ('django.db.models.fields.DateField', [], {}),
+            'crb_number': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'officer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+        },
+        'officers.crbformlog': {
+            'Meta': {'object_name': 'CRBFormLog'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'officer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
+            'sent': ('django.db.models.fields.DateTimeField', [], {})
+        },
+        'officers.invitation': {
+            'Meta': {'ordering': "('-camp__year', 'officer__first_name', 'officer__last_name')", 'unique_together': "(('officer', 'camp'),)", 'object_name': 'Invitation'},
+            'camp': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cciwmain.Camp']"}),
+            'date_added': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'notes': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
+            'officer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+        },
+        'officers.reference': {
+            'Meta': {'ordering': "('application__date_submitted', 'application__officer__first_name', 'application__officer__last_name', 'referee_number')", 'unique_together': "(('application', 'referee_number'),)", 'object_name': 'Reference'},
+            'application': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['officers.Application']"}),
+            'comments': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'received': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'referee_number': ('django.db.models.fields.SmallIntegerField', [], {}),
+            'requested': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
+        },
+        'officers.referenceform': {
+            'Meta': {'object_name': 'ReferenceForm'},
+            'capability_children': ('django.db.models.fields.TextField', [], {}),
+            'capacity_known': ('django.db.models.fields.TextField', [], {}),
+            'character': ('django.db.models.fields.TextField', [], {}),
+            'comments': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'concerns': ('django.db.models.fields.TextField', [], {}),
+            'date_created': ('django.db.models.fields.DateField', [], {}),
+            'how_long_known': ('django.db.models.fields.CharField', [], {'max_length': '150'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'known_offences': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'known_offences_details': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'referee_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'reference_info': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'_reference_form'", 'unique': 'True', 'to': "orm['officers.Reference']"})
+        }
+    }
+
+    complete_apps = ['officers']

File cciw/officers/models.py

 # -*- coding: utf-8 -*-
-from datetime import datetime, timedelta
+from datetime import datetime, timedelta, date
 import re
 
 from django.conf import settings
                 dt = datetime.strptime(m.groups()[0], self.log_datetime_format)
         return dt
 
-    def log_request_made(self, user, date):
+    def log_request_made(self, user, dt):
         self.comments = self.comments + \
             ("\nReference requested by user %s via online system on %s\n" % \
-                 (user.username, date.strftime(self.log_datetime_format)))
+                 (user.username, dt.strftime(self.log_datetime_format)))
 
     class Meta:
         verbose_name = "Reference Metadata"
 class Invitation(models.Model):
     officer = models.ForeignKey(User)
     camp = models.ForeignKey(Camp)
+    date_added = models.DateField(default=date.today)
+    notes = models.CharField(max_length=255, blank=True)
 
     objects = InvitationManager()
 

File cciw/officers/static/images/asc.gif

Added
New image

File cciw/officers/static/images/ascdesc.gif

Added
New image

File cciw/officers/static/images/desc.gif

Added
New image

File cciw/officers/static/js/jquery.tablesorter.min.js

+
+(function($){$.extend({tablesorter:new
+function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction=="simple"){if(config.supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.innerHTML;}}}else{if(typeof(config.textExtraction)=="function"){text=config.textExtraction(node);}else{text=$(node).text();}}return text;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function computeTableHeaderCellIndexes(t){var matrix=[];var lookup={};var thead=t.getElementsByTagName('THEAD')[0];var trs=thead.getElementsByTagName('TR');for(var i=0;i<trs.length;i++){var cells=trs[i].cells;for(var j=0;j<cells.length;j++){var c=cells[j];var rowIndex=c.parentNode.rowIndex;var cellId=rowIndex+"-"+c.cellIndex;var rowSpan=c.rowSpan||1;var colSpan=c.colSpan||1
+var firstAvailCol;if(typeof(matrix[rowIndex])=="undefined"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])=="undefined"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])=="undefined"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x";}}}}return lookup;}function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){return(v.toLowerCase()=="desc")?1:0;}else{return(v==1)?1:0;}}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));var e="e"+i;dynamicExp+="var "+e+" = "+s;dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";if(table.config.debug){benchmark("Evaling expression:"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a="a["+index+"]",b="b["+index+"]";if(type=='text'&&direction=='asc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));";}else if(type=='text'&&direction=='desc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));";}else if(type=='numeric'&&direction=='asc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));";}else if(type=='numeric'&&direction=='desc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));";}};function makeSortText(i){return"((a["+i+"] < b["+i+"]) ? -1 : ((a["+i+"] > b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);},1);}).bind("updateCell",function(e,cell){var config=this.config;var pos=[(cell.parentNode.rowIndex-1),cell.cellIndex];cache.normalized[pos[0]][pos[1]]=config.parsers[pos[1]].format(getElementText(config,cell),cell);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){return/^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g,'')));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLocaleLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}var $tr,row=-1,odd;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=(row%2==0);$tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);

File cciw/officers/tests/__init__.py

 from cciw.officers.tests.applications import *
-from cciw.officers.tests.crbs import *
 from cciw.officers.tests.references import *
 from cciw.officers.tests.applicationform import *
 from cciw.officers.tests.utils import *

File cciw/officers/urls.py

     (r'^leaders/officer-list/(?P<year>\d{4})/(?P<number>\d+)/$', 'officer_list'),
     (r'^leaders/remove-officer/(?P<year>\d{4})/(?P<number>\d+)/$', 'remove_officer'),
     (r'^leaders/add-officers/(?P<year>\d{4})/(?P<number>\d+)/$', 'add_officers'),
-    (r'^leaders/officer-details/$', 'officer_details'),
     (r'^leaders/update-officer/$', 'update_officer'),
     (r'^leaders/resend-email/$', 'resend_email'),
     (r'^leaders/request-reference/(?P<year>\d{4})/(?P<number>\d+)/$', 'request_reference'),

File cciw/officers/views.py

     c = {}
     c['camp'] = camp
     # Make sure these queries come after the above data modification
-    officer_list = camp_officer_list(camp)
-    officer_list_ids = set(u.id for u in officer_list)
-    c['officers_all'] = officer_list
+    invitation_list = camp.invitation_set.all()
+    officer_list_ids = set(i.officer_id for i in invitation_list)
+    c['invitations'] = invitation_list
     c['officers_noapplicationform'] = camp_slacker_list(camp)
     c['address_all'] = address_for_camp_officers(camp)
     c['address_noapplicationform'] = address_for_camp_slackers(camp)
 def add_officers(request, year=None, number=None):
     camp = _get_camp_or_404(year, number)
     for officer_id in request.POST['officer_ids'].split(','):
-        Invitation.objects.get_or_create(camp=camp, officer=User.objects.get(id=int(officer_id)))
+        try:
+            i = Invitation.objects.get(camp=camp, officer=User.objects.get(id=int(officer_id)))
+        except Invitation.DoesNotExist:
+            i = Invitation.objects.create(camp=camp,
+                                          officer=User.objects.get(id=int(officer_id)),
+                                          date_added=datetime.date.today())
     return {'status':'success'}
 
 
 @staff_member_required
 @camp_admin_required
 @json_response
-def officer_details(request):
-    # We use POST here, to avoid information leaks associated with JSON over GET
-    # by 3rd party <script> tags.
-    user = User.objects.get(pk=int(request.POST['officer_id']))
-    return {'username': user.username,
-            'first_name': user.first_name,
-            'last_name': user.last_name,
-            'email': user.email,
-            'id': user.id,
-            }
-
-
-@staff_member_required
-@camp_admin_required
-@json_response
 def update_officer(request):
-    User.objects.filter(pk=int(request.POST['officer_id'])).update(first_name=request.POST['first_name'],
-                                                                   last_name=request.POST['last_name'],
-                                                                   email=request.POST['email']
+    User.objects.filter(pk=int(request.POST['officer_id'])).update(first_name=request.POST['first_name'].strip(),
+                                                                   last_name=request.POST['last_name'].strip(),
+                                                                   email=request.POST['email'].strip()
                                                                    )
+    Invitation.objects.filter(camp=int(request.POST['camp_id']),
+                              officer=int(request.POST['officer_id'])).update(notes=request.POST['notes'].strip().replace('\n', ' ').replace('\r', ' ')[0:255])
     return {'status':'success'}
 
 
         # done in Python.
         stat['camp'] = camp
 
-        invited_officer_ids = list(camp.invitation_set.all().values_list('officer_id', flat=True))
+        invited_officers = list(camp.invitation_set.all().order_by('date_added').values_list('officer_id', 'date_added'))
         application_forms = list(applications_for_camp(camp).order_by('date_submitted').values_list('id', 'date_submitted'))
+
+        officer_ids = [o[0] for o in invited_officers]
+        officer_dates = [o[1] for o in invited_officers]
         app_ids = [a[0] for a in application_forms]
         app_dates = [a[1] for a in application_forms]
         ref_dates = list(ReferenceForm.objects.filter(reference_info__application__in=app_ids).order_by('date_created').values_list('date_created', flat=True))
-        all_crb_info = list(CRBApplication.objects.filter(officer__in=invited_officer_ids).order_by('completed').values_list('officer_id', 'completed'))
+        all_crb_info = list(CRBApplication.objects.filter(officer__in=officer_ids).order_by('completed').values_list('officer_id', 'completed'))
         # We duplicate logic from CRBApplication.get_for_camp here to avoid
         # duplicating queries
         valid_crb_info = [(off_id, d) for off_id, d in all_crb_info
         graph_end_date = min(camp.start_date, datetime.date.today())
         a = 0 # applications
         r = 0 # references
+        o = 0 # officers
         v_idx = 0 # valid CRBs - index into valid_crb_info
         c_idx = 0 # CRBs       - index into all_crb_info
         v_tot = 0 #            - total for valid CRBs
         c_tot = 0 #            - total for all CRBs
         app_dates_data = []
         ref_dates_data = []
+        officer_dates_data = []
         all_crb_dates_data = []
         _all_crb_seen_officers = set()
         valid_crb_dates_data = []
             # References
             while r < len(ref_dates) and ref_dates[r] <= d:
                 r += 1
+            # Officers
+            while o < len(officer_dates) and officer_dates[o] <= d:
+                o += 1
 
             # CRBs: there can be multiple CRBs for each officer. If we've
             # already seen one, we don't increase the count.
             ts = date_to_js_ts(d)
             app_dates_data.append([ts, a])
             ref_dates_data.append([ts, r/2.0])
+            officer_dates_data.append([ts, o])
             all_crb_dates_data.append([ts, c_tot])
             valid_crb_dates_data.append([ts, v_tot])
             d = d + datetime.timedelta(1)
         stat['reference_dates_data'] = ref_dates_data
         stat['all_crb_dates_data'] = all_crb_dates_data
         stat['valid_crb_dates_data'] = valid_crb_dates_data
-        stat['officer_list_data'] = [[date_to_js_ts(graph_start_date), len(invited_officer_ids)],
-                                     [date_to_js_ts(camp.start_date), len(invited_officer_ids)]]
+        # Project officer list graphs at either end, to make the graph stretch that far.
+        officer_dates_data.insert(0, [date_to_js_ts(graph_start_date), 0])
+        officer_dates_data.append([date_to_js_ts(camp.start_date), len(officer_ids)])
+        stat['officer_list_data'] = officer_dates_data
         stats.append(stat)
 
 
         _build_static(version)
         _update_symlink(target, version)
     else:
-        db_backup_name = backup_database(target, version)
         _copy_local_sources(target, version)
         _copy_protected_downloads()
         _update_virtualenv(version)
         _build_static(version)
 
         _stop_apache(target)
+        db_backup_name = backup_database(target, version)
         # Ideally, we rollback if unsuccessful.
         # In practice, this may be impossible for some migrations,
         # and we are better off restoring from the backup db.

File templates/cciw/officers/officer_list.html

 {% block title %}Officer list {{ camp.year }}-{{ camp.number }} | CCIW Officers{% endblock %}
 
 {% block extrastyle %}{{ block.super }}
+<script type="text/javascript" src="{{ STATIC_URL }}js/jquery.tablesorter.min.js"></script>
 <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
+<style type="text/css">
 
+.innerleft {
+    margin: 0px 10px 0px 0px;
+}
+
+.innerright {
+    margin: 0px 10px;
+}
+
+.leftcolumnwrapper {
+    float: left;
+    width: 100%;
+}
+
+.leftcolumn {
+    /* see javascript below for other instances of this width */
+    margin-right: 30em; /* Same as width of right column */
+}
+
+.rightcolumn {
+    float: left;
+    width: 30em; /* Width of right column */
+    margin-left: -30em; /* Same as  -(width of right column) */
+    background-color: #f0f0f0;
+}
+
+
+table.tablesorter thead th {
+    background-color: #f0f0f0;
+    background-image: none;
+}
+
+table.tablesorter thead .header {
+    background-image: url({{ STATIC_URL }}images/ascdesc.gif);
+    background-repeat: no-repeat;
+    background-position: center right;
+    cursor: pointer;
+}
+
+table.tablesorter thead .header.headerSortDown {
+    background-image: url({{ STATIC_URL }}images/desc.gif);
+}
+
+table.tablesorter thead .header.headerSortUp {
+    background-image: url({{ STATIC_URL }}images/asc.gif);
+}
+
+#id_officer_list_div table thead th:nth-child(3),
+#id_officer_list_div table thead th:nth-child(4) {
+    min-width:25ex;
+}
+</style>
 {% endblock %}
 {% block bodyclass%}change-form{% endblock %}
 
 <p>This page can be used for viewing and managing the officers on your list,
  and for viewing those who have not yet filled in an application form.</p>
 
-<div style="float: left; width: 44em;">
+<div class="leftcolumnwrapper">
+<div class="leftcolumn" id="id_officer_list_div">
+<div class="innerleft">
 <h2>Current list</h2>
 
 {% include "cciw/officers/officer_list_table_editable.html" %}
 
+<p><br/>(You can sort the list by clicking on the headers. Hold down shift while clicking to sort by multiple columns)</p>
 </div>
-<div style="margin-left: 45em;">
-<h2 style="margin-top: 2em;">Add to list</h2>
+</div>
+</div>
+
+<div class="rightcolumn" id="id_add_officer_div">
+<div style="text-align: right;"><small><a href="#" id="id_hide_add_officer_div">(hide)</a></small></div>
+<div class="innerright">
+<h2>Add to list</h2>
 
 <div class="selector-filter">
  <a href="#" id="id_add_officer_btn">Add  <img style="vertical-align: middle"
 <li>If you have a list on a computer, you can <a href="mailto:webmaster@cciw.co.uk">e-mail
   the webmaster</a> to have them imported more quickly.</li>
 </ul>
-
+</div>
 </div>
 
 <br style="clear: left;" />
 //<![CDATA[
 (function($){
     // Code specific to page
+    var campId = {{ camp.id }};
 
     // Global that is true if a row of officer details is in 'edit mode'
     var editOfficerMode = false;
 
-    var refreshLists = function() {
+    // Global that is true if the 'add officer' block is visible
+    var showAddOfficerBlock = true;
+
+
+    var refreshLists = function(areas) {
         // Refresh different areas of the page:
+        if (areas == null) {
+            areas = ["chosen", "available", "noapplication"];
+        }
         $.ajax({
             type: "GET",
             url: "?sections=1&" + Math.random().toString(),
             dataType: 'json',
             success: function(data) {
-                refreshChosenList(data.chosen);
-                refreshAvailableList(data.available);
-                refreshNoApplicationFormList(data.noapplicationform);
+                if (areas.indexOf("chosen") != -1)
+                    refreshChosenList(data.chosen);
+                if (areas.indexOf("available") != -1)
+                    refreshAvailableList(data.available);
+                if (areas.indexOf("noapplication") != -1)
+                    refreshNoApplicationFormList(data.noapplicationform);
             }
         });
     };
 
+    var addTableSorter = function(sortList) {
+        if (sortList == undefined) {
+            sortList = [[0,0]];
+        }
+        $("#id_officer_list_table table").tablesorter({headers:
+                                                        { 4: { sorter: false }},
+                                                       sortList: sortList
+                                                      });
+    }
+
+
     var refreshChosenList = function(text) {
+        var savedSortOrder = $("#id_officer_list_table table").data('tablesorter').sortList;
         $("#id_officer_list_table").children().remove();
         $("#id_officer_list_table").html(text);
         editOfficerMode = false;
         addOfficerListHandlers();
+        addTableSorter(savedSortOrder);
     };
 
     var refreshAvailableList = function(text) {
         $("#id_noapplicationform").html(text);
     };
 
+
+    var escape = function(t) {
+                     return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
+                 };
+
     var addOfficerListHandlers = function() {
         // event handlers for all 'edit' buttons
         $(".editbtn").click(function(ev) {
             }
             editOfficerMode = true;
             var officerId = parseFloat(ev.target.id.substring(8), 10);
-            // Need to retrieve details (we don't know first name and last name)
-            $.ajax({
-                type: "POST",
-                url: "{% url 'cciw.officers.views.officer_details' %}",
-                data: {officer_id: officerId.toString()},
-                dataType: 'json',
-                success: function(officer) {
-                    var escape = function(t) {
-                        return $('<div/>').text(t).html();
-                    };
-                    var row = $('#id_officer_table_tr_' + officerId.toString());
-                    // Make input boxes, and save/cancel buttons
-                    row.html('<td>' +
-                                '<nobr><input size=6 id="id_officer_first_name" type="text" value="' +
-                                    escape(officer.first_name) + '" />' +
-                                '<input size=6 id="id_officer_last_name" type="text" value="' +
-                                    escape(officer.last_name) + '" /></nobr>' +
-                             '</td>' +
-                             '<td><input size=30 id="id_officer_email" type="text" value="' +
-                                escape(officer.email) + '" /></td>' +
-                             '<td colspan=2><a href="#" id="id_officer_save">Save</a> / ' +
-                             '<a href="#" id="id_officer_cancel">Cancel</a> </td>');
-                    // 'Cancel' handler:
-                    row.find('#id_officer_cancel').click(function(ev) {
-                        ev.preventDefault();
-                        refreshLists();
-                    });
-                    // 'Save' handler
-                    row.find('#id_officer_save').click(function(ev) {
-                        ev.preventDefault();
-                        officer.first_name = $('#id_officer_first_name').val();
-                        officer.last_name = $('#id_officer_last_name').val();
-                        officer.email = $('#id_officer_email').val();
-                        $.ajax({
-                            type: 'POST',
-                            url: "{% url 'cciw.officers.views.update_officer' %}",
-                            data: {'officer_id': officer.id,
-                                   'first_name': officer.first_name,
-                                   'last_name': officer.last_name,
-                                   'email': officer.email
-                                   },
-                            dataType: 'json',
-                            success: refreshLists
-                        });
-                    });
-                }
+            var row = $('#id_officer_table_tr_' + officerId.toString());
+            var firstNameCell = row.find('td:nth-child(1)');
+            var lastNameCell  = row.find('td:nth-child(2)');
+            var emailCell     = row.find('td:nth-child(3)');
+            var notesCell     = row.find('td:nth-child(4)');
+            var editCell      = row.find('td:nth-child(5)');
+            var officer = { firstName: firstNameCell.text(),
+                            lastName:  lastNameCell.text(),
+                            email:     emailCell.text(),
+                            notes:     notesCell.text()
+                          };
+            // Make input boxes, and save/cancel buttons
+            firstNameCell.html('<input size=8 id="id_officer_first_name" type="text" value="' + escape(officer.firstName) + '" /></td>');
+            lastNameCell.html('<input size=8 id="id_officer_last_name" type="text" value="' +  escape(officer.lastName) + '" />');
+            emailCell.html('<input size=25 id="id_officer_email" type="text" value="' + escape(officer.email) + '" />');
+            notesCell.html('<input size=25 id="id_officer_notes" type="text" value="' + escape(officer.notes) + '" />');
+            editCell.find('img').hide();
+            editCell.append(
+                     '<span><a href="#" id="id_officer_save">Save</a> / ' +
+                     '<a href="#" id="id_officer_cancel">Cancel</a><span>');
+            var showAddOfficerBlockSaved = showAddOfficerBlock;
+            var restoreAddBlockState = function() {};
+            if (showAddOfficerBlock) {
+                // Make room for editing
+                addOfficerBlockToggle();
+                restoreAddBlockState = addOfficerBlockToggle;
+            }
+
+            function setOfficerRow(officerData) {
+                firstNameCell.html(escape(officer.firstName));
+                lastNameCell.html(escape(officer.lastName));
+                emailCell.html('<a href="mailto:' + escape(officer.email) + '">' + escape(officer.email) + '</a>')
+                notesCell.html(escape(officer.notes));
+                editCell.find('img').show();
+                editCell.find('span').remove();
+                restoreAddBlockState();
+                editOfficerMode = false;
+            }
+
+            // 'Cancel' handler:
+            row.find('#id_officer_cancel').click(function(ev) {
+                ev.preventDefault();
+                setOfficerRow(officer);
+            });
+            // 'Save' handler
+            row.find('#id_officer_save').click(function(ev) {
+                ev.preventDefault();
+                officer.firstName = $('#id_officer_first_name').val();
+                officer.lastName  = $('#id_officer_last_name').val();
+                officer.email     = $('#id_officer_email').val();
+                officer.notes     = $('#id_officer_notes').val();
+                setOfficerRow(officer);
+                // For responsiveness, we update UI before server has
+                // saved data.
+                $.ajax({
+                    type: 'POST',
+                    url: "{% url 'cciw.officers.views.update_officer' %}",
+                    data: {'officer_id': officerId.toString(),
+                           'first_name': officer.firstName,
+                           'last_name': officer.lastName,
+                           'email': officer.email,
+                           'notes': officer.notes,
+                           'camp_id': campId.toString()
+                           },
+                    dataType: 'json',
+                    success: function() {
+                        refreshLists("noapplication");
+                    }
+                });
             });
         });
 
                 url:  "{% url 'cciw.officers.views.remove_officer' camp.year camp.number %}",
                 data: "officer_id=" + officerId.toString(),
                 dataType: 'json',
-                success: refreshLists
+                success: function(ev) { refreshLists(); }
             });
             ev.preventDefault();
         });
             url: "{% url 'cciw.officers.views.add_officers' camp.year camp.number %}",
             data: "officer_ids=" + officer_ids.join(','),
             dataType: 'json',
-            success: refreshLists
+            success: function(ev) { refreshLists(); }
         });
     };
 
         ev.preventDefault();
     };
 
+    var addOfficerBlockToggle = function(ev) {
+        if (ev != null) {
+            ev.preventDefault();
+        }
+        showAddOfficerBlock = !showAddOfficerBlock;
+        var width = showAddOfficerBlock ? '30em' : '4em';
+        $('#id_add_officer_div').css({'width':width, 'margin-left': '-' + width})
+        $('#id_officer_list_div').css({'margin-right': width})
+        if (showAddOfficerBlock) {
+            $('#id_add_officer_div .innerright').show();
+            $('#id_hide_add_officer_div').text('(hide)');
+        } else {
+            $('#id_add_officer_div .innerright').hide();
+            $('#id_hide_add_officer_div').text('(show)');
+        }
+    }
+
     $(document).ready(function(){
         $("#id_available_officers_filter").multiSelectFilter("#id_available_officers");
         addOfficerListHandlers();
+        addTableSorter();
         $("#id_available_officers")
            .dblclick(officerAddHandler)
            .keyup(officerAddHandler);
         $('#id_add_officer_btn').click(officerAddHandler);
         $('#id_new_officer_btn').click(newOfficerHandler);
         $('#id_popup_close_btn').click(newOfficerClose);
+        $('#id_hide_add_officer_div').click(addOfficerBlockToggle);
+
         $("#loading").ajaxStart(function(){
             $(this).show();
         });

File templates/cciw/officers/officer_list_noapplicationform.html

 
 <div style="margin-left:2em;">
 {% for officer in officers_noapplicationform %}
-{{ officer.first_name }} {{ officer.last_name }}<br/>
+{{ officer.first_name }} {{ officer.last_name }}
+ <a href="mailto:{{ officer.email }}">&lt;{{ officer.email }}&gt;</a><br/>
 {% endfor %}
 </div>
 

File templates/cciw/officers/officer_list_table_editable.html

 {% load adminmedia %}
 <div  id="id_officer_list_table">
 <p>Total: {{ officers_all|length }}</p>
-<table style="width:43em;">
+<table class="tablesorter">
  <thead>
   <tr>
-    <th>Name</th>
+    <th>First name</th>
+    <th>Last name</th>
     <th>E-mail</th>
-    <th colspan="3">Edit</th>
+    <th>Leader's notes</th>
+    <th>Edit</th>
   </tr>
  </thead>
  <tbody>
-{% for officer in officers_all %}
-  <tr id="id_officer_table_tr_{{ officer.id }}">
-    <td>{{ officer.first_name }} {{ officer.last_name }}</td>
-    <td>{{ officer.email }}</td>
+{% for invite in invitations %}
+  <tr id="id_officer_table_tr_{{ invite.officer.id }}">
+    <td>{{ invite.officer.first_name }}</td>
+    <td>{{ invite.officer.last_name }}</td>
+    <td><a href="mailto:{{ invite.officer.email }}">{{ invite.officer.email }}</a></td>
+    <td>{{ invite.notes }}</a></td>
     <td>
-      <img class="editbtn" id="id_edit_{{ officer.id }}" src="{% admin_media_prefix %}img/admin/icon_changelink.gif" alt="Edit" title="Edit" />
-    </td>
-    <td>
-      <img class="removebtn" id="id_remove_{{ officer.id }}" src="{{ STATIC_URL }}images/officer-list-remove.gif" alt="Remove" title="Remove" />
-    </td>
-    <td>
-      <img class="emailbtn" id="id_email_{{ officer.id }}" src="{{ STATIC_URL }}images/sendemail.gif" alt="Re-send initial e-mail" title="Re-send initial e-mail" />
+      <nobr>
+      <img class="editbtn" id="id_edit_{{ invite.officer.id }}" src="{% admin_media_prefix %}img/admin/icon_changelink.gif" alt="Edit" title="Edit" style="margin-right: 4px;"/>
+      <img class="removebtn" id="id_remove_{{ invite.officer.id }}" src="{{ STATIC_URL }}images/officer-list-remove.gif" alt="Remove" title="Remove" style="margin-right: 4px;"/>
+      <img class="emailbtn" id="id_email_{{ invite.officer.id }}" src="{{ STATIC_URL }}images/sendemail.gif" alt="Re-send initial e-mail" title="Re-send initial e-mail" />
+      </nobr>
    </td>
   </tr>
 {% empty %}

File templates/cciw/officers/stats.html

 {% endfor %}
 
 
-<div style="float: clear;">
+<div style="clear: both;">
 <canvas height="50">
   Your browser is obsolete, and won't display the graphs above. Please upgrade
   to <a href="http://abetterbrowser.org/">a better browser</a>.
     of camp.</li>
   <li>Each officer needs 2 references, so the references plot has been divided
     by 2 to make it fit the others. Correct figures are shown when hovering.</li>
-  <li>Changes to the officer list are not tracked over time — only the current
-    total is used.</li>
+  <li>Some data may be inaccurate where we do not have full past records.</li>
 </ul>
 
 </div>

File templates/cciw/standard.html

 
 {% block extrapageheader %}
 <div id="quicklinks">
+	{% if current_member %}	
 	<ul>
-	{% if current_member %}	
 		<li>Logged in as :  <a href="{{current_member.get_absolute_url}}">{{current_member.user_name}}</a></li>
 		<li><a href="{{current_member.get_absolute_url}}messages/inbox/">{{current_member.new_messages}} new message(s)</a></li>
-	{% else %}
-		<li><a href="/login/?redirect={{ request.get_full_path}}">Login</a></li>
+	</ul>
 	{% endif %}
-	</ul>
 </div>
 {% endblock %}