forms: shown the destination course name in the left bar

This commit is contained in:
Benjamin Dauvergne 2012-12-05 16:12:33 +01:00
parent b226fc7506
commit 793cf04b3e
1 changed files with 8 additions and 2 deletions

View File

@ -100,10 +100,10 @@ class MyCourseForm(request_forms.CopyrigtsForm):
def __init__(self, *args, **kwargs):
instance = kwargs.get('instance', None)
push = None
self.push = push = None
if instance:
try:
push = models.BlackBoardPush.objects.get(request=instance)
self.push = push = models.BlackBoardPush.objects.get(request=instance)
except models.BlackBoardPush.DoesNotExist:
pass
initial = kwargs.setdefault('initial', {})
@ -150,3 +150,9 @@ class MyCourseForm(request_forms.CopyrigtsForm):
models.BlackBoardPush(request=instance).delete()
return instance
def pprint_data(self, data):
ret = super(MyCourseForm, self).pprint_data(data)
if self.push and self.push.course_name:
ret.append((u'Déposer dans le cours', self.push.course_name, False))
return ret