Index: /main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py	(revision 14980)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py	(revision 14981)
@@ -19,5 +19,7 @@
 import csv
 import textwrap
+import pytz
 from cStringIO import StringIO
+from datetime import datetime
 from zope.i18n import translate
 from zope.component import getUtility, queryUtility
@@ -26,4 +28,5 @@
 from zope.catalog.interfaces import ICatalog
 from zope.formlib.textwidgets import BytesDisplayWidget
+from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
 from waeup.kofa.browser.layout import UtilityView
 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
@@ -52,5 +55,6 @@
     DownloadScoresView,
     StudentRequestPasswordPage,
-    StudyCourseManageFormPage
+    StudyCourseManageFormPage,
+    UnregisterCoursesView
     )
 from kofacustom.nigeria.students.browser import (
@@ -390,4 +394,36 @@
         form_fields['imported_cgpa'].for_display = True
         return form_fields
+
+class CustomUnregisterCoursesView(UnregisterCoursesView):
+    """Unregister course list by student
+    """
+    grok.context(ICustomStudentStudyLevel)
+
+    def update(self):
+        if not self.context.__parent__.is_current:
+            emit_lock_message(self)
+            return
+        try:
+            deadline = grok.getSite()['configuration'][
+                str(self.context.level_session)].coursereg_deadline
+        except (TypeError, KeyError):
+            deadline = None
+        # In AAUE fresh students are allowed to "unregister their course"
+        # aside the deadline
+        if deadline and not self.context.student.is_fresh \
+            and deadline < datetime.now(pytz.utc):
+            self.flash(_(
+                "Course registration has ended. "
+                "Unregistration is disabled."), type="warning")
+        elif str(self.context.__parent__.current_level) != self.context.__name__:
+            self.flash(_('This is not your current level.'), type="danger")
+        elif self.context.student.state == REGISTERED:
+            IWorkflowInfo(self.context.student).fireTransition('reset7')
+            message = _('Course list has been unregistered.')
+            self.flash(message)
+        else:
+            self.flash(_('You are in the wrong state.'), type="warning")
+        self.redirect(self.url(self.context))
+        return
 
 class CustomStudyLevelDisplayFormPage(StudyLevelDisplayFormPage):
