Permalink
Browse files

Make so that admin editing a class will not unapprove it

When a class is edited, does a check for whether the person editing is
teaching the class; if not, don't call ClassSubject.propose()
  • Loading branch information...
1 parent 392c174 commit b8a88c914d9ebe1e47abc92d5b46000e661fdf80 @luanthe luanthe committed Mar 29, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 esp/esp/program/controllers/classreg.py
@@ -104,6 +104,7 @@ def get_forms(self, reg_data, form_class=TeacherClassRegForm):
def make_class_happen(self, cls, user, reg_form, resource_formset, restype_formset, editing=False):
anchor_modified = self.set_class_data(cls, reg_form)
self.update_class_sections(cls, int(reg_form.cleaned_data['num_sections']))
+
# If someone is editing the class, we assume they don't want to be
# added as a teacher if they aren't already one.
if anchor_modified:
@@ -112,7 +113,11 @@ def make_class_happen(self, cls, user, reg_form, resource_formset, restype_forms
if not editing:
self.associate_teacher_with_class(cls, user)
self.add_rsrc_requests_to_class(cls, resource_formset, restype_formset)
- cls.propose()
+
+ # If someone is editing the class who isn't teaching it, don't unapprove it.
+ if user in cls.teachers():
+ cls.propose()
+
cls.update_cache()
def set_class_data(self, cls, reg_form):

0 comments on commit b8a88c9

Please sign in to comment.