Skip to content

Conversation

@pnshiralkar
Copy link
Contributor

  • Added is_instructor and is_coordinator decorators
  • Replaced get_landing_page() to redirect_to_landing_page() func

return redirect(get_landing_page(user))

return redirect('/login/')
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why have this function if it is not doing anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function redirects users who come to '/' route to their respective landing pages. As CMS app is not yet merged, not having this function will cause a 404 error on '/' route.

if not is_instructor(args[0].user):
return func(*args, **kwargs)
return redirect(reverse('workshop_status_instructor'))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these decorators create a separate file called decorators.py. This should not be done in views.

def get_landing_page(user):
# For now, landing pages of both instructor and coordinator are same
def instructor_only(func):
def inner1(*args, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use on inner if needed, inner1 seems a little odd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants