Files @ 2aae2af55dea
Branch filter:

Location: symposion_app/vendor/symposion/reviews/utils.py

James Polley
Disable client-side validation on credit_note forms

* HTML5 browsers have some clevers to do client-side validation of
forms
* Django activates this by default for certain field types
* However, in this case, there are three forms on this page. We rely
on two of them being invalid in order to figure out what processing
to do.
* So we need to disable the client-side validation.
def has_permission(user, proposal, speaker=False, reviewer=False):
    """
    Returns whether or not ther user has permission to review this proposal,
    with the specified requirements.

    If ``speaker`` is ``True`` then the user can be one of the speakers for the
    proposal.  If ``reviewer`` is ``True`` the speaker can be a part of the
    reviewer group.
    """
    if user.is_superuser:
        return True
    if speaker:
        if user == proposal.speaker.user or \
           proposal.additional_speakers.filter(user=user).exists():
            return True
    if reviewer:
        if user.groups.filter(name="reviewers").exists():
            return True
    return False