equal
deleted
inserted
replaced
474 "textbook": textbook, |
474 "textbook": textbook, |
475 }) |
475 }) |
476 |
476 |
477 context.update(csrf(request)) |
477 context.update(csrf(request)) |
478 |
478 |
479 can_edit = True if user == textbook.created_by and textbook.status == taskapp_models.TB_STATUS_CHOICES[0][0]\ |
479 if (user == textbook.created_by and |
480 else False |
480 textbook.status == taskapp_models.TB_STATUS_CHOICES[0][0]): |
481 |
481 can_edit = True |
482 can_approve = True if profile.role in [profile_models.ROLES_CHOICES[0][0], profile_models.ROLES_CHOICES[1][0]] and \ |
482 else: |
483 textbook.status == taskapp_models.TB_STATUS_CHOICES[0][0] else False |
483 can_edit = False |
|
484 |
|
485 |
|
486 if (profile.role in [profile_models.ROLES_CHOICES[0][0], |
|
487 profile_models.ROLES_CHOICES[1][0]] and |
|
488 textbook.status == taskapp_models.TB_STATUS_CHOICES[0][0]): |
|
489 can_approve = True |
|
490 else: |
|
491 can_approve = False |
484 |
492 |
485 context.update({"can_edit": can_edit, |
493 context.update({"can_edit": can_edit, |
486 "can_approve": can_approve}) |
494 "can_approve": can_approve}) |
487 return shortcuts.render_to_response("task/view_textbook.html", |
495 return shortcuts.render_to_response("task/view_textbook.html", |
488 RequestContext(request, context)) |
496 RequestContext(request, context)) |