Last active
May 28, 2018 08:23
-
-
Save jbbarth/ff8c7add0c4adeed9376bf81476466e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Keep this condition in sync with PirateForm #} | |
{% if user.name == "Alice" %} | |
<input type=checkbox name=is_captain id=id_is_captain {% if object.is_captain %}checked{% endif %}> | |
{% else %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PirateForm(ModelForm): | |
... | |
def __init__(...): | |
# fields restriction | |
# should be kept in sync with the template form.html | |
if not user: | |
del self.fields["is_captain"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment