Skip to content

Commit

Permalink
Make so that admin editing a class will not unapprove it
Browse files Browse the repository at this point in the history
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
Anthony Lu committed Mar 29, 2012
1 parent 392c174 commit b8a88c9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion esp/esp/program/controllers/classreg.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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): def make_class_happen(self, cls, user, reg_form, resource_formset, restype_formset, editing=False):
anchor_modified = self.set_class_data(cls, reg_form) anchor_modified = self.set_class_data(cls, reg_form)
self.update_class_sections(cls, int(reg_form.cleaned_data['num_sections'])) 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 # If someone is editing the class, we assume they don't want to be
# added as a teacher if they aren't already one. # added as a teacher if they aren't already one.
if anchor_modified: if anchor_modified:
Expand All @@ -112,7 +113,11 @@ def make_class_happen(self, cls, user, reg_form, resource_formset, restype_forms
if not editing: if not editing:
self.associate_teacher_with_class(cls, user) self.associate_teacher_with_class(cls, user)
self.add_rsrc_requests_to_class(cls, resource_formset, restype_formset) 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() cls.update_cache()


def set_class_data(self, cls, reg_form): def set_class_data(self, cls, reg_form):
Expand Down

0 comments on commit b8a88c9

Please sign in to comment.