Last active
May 28, 2018 08:14
-
-
Save jbbarth/b2406f226748ba2fc960722604170ee8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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): | |
class Meta: | |
model = Pirate | |
fields = ("name", "is_captain") | |
def __init__(self, *args, **kwargs): | |
user = kwargs.pop("user", None) | |
super().__init__(*args, **kwargs) | |
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