def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Fieldset("Avatar", Field("avatar"), css_class="_cls-compactField"), Fieldset("Private", Field("private"), css_class="_cls-compactField"), ) self.helper.form_tag = False
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Field("login", css_class="_cls-usernameInput"), Field("password", type="password"), ) self.fields["login"].widget.attrs.pop("autofocus", None) self.helper.form_tag = False
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Field("password1", type="password", css_class="_cls-passwordInput"), Field("password2", type="password", css_class="_cls-passwordInput"), ) self.helper.form_tag = False
def get_form(self, form_class=None): form = super().get_form(form_class) form.helper = FormHelper() form.helper.layout = Layout( Fieldset("Name", Field("name")), Fieldset("Username", Field("username")) if "username" in form.fields else None, Fieldset("Avatar image", Field("avatar"), css_class="_cls-compactField"), Fieldset("Autologin", Field("use_autologin"), css_class="_cls-compactField"), ) form.helper.form_tag = False form.fields["avatar"].widget = ImagePreviewWidget() return form
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._set_group_options() # stripe token is only required if switching to a paid plan # this is checked in the clean method self.fields["stripe_token"].required = False self.helper = FormHelper() self.helper.layout = Layout( Field("stripe_pk"), Field("stripe_token"), Fieldset("Plan", Field("plan"), css_class="_cls-compactField"), Fieldset( "Max Users", Field("max_users"), css_class="_cls-compactField") if "max_users" in self.fields else None, Fieldset( "Receipt emails", Field("receipt_emails", id="_id-receiptEmails"), css_class="_cls-resizeField", ), Fieldset( "Credit card", Field("use_card_on_file"), css_class="_cls-compactField", id="_id-cardFieldset", ) if "use_card_on_file" in self.fields else None, Fieldset( "Remove credit card on file", Field("remove_card_on_file"), css_class="_cls-compactField", id="_id-removeCardFieldset", ) if "remove_card_on_file" in self.fields else None, ) self.helper.form_tag = False
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["stripe_token"].required = False self.helper = FormHelper() self.helper.layout = Layout( Field("stripe_token"), Field("stripe_pk"), Field("name"), Field("username"), Field("email", type="email"), Field("password1", type="password", css_class="_cls-passwordInput"), ) self.fields["username"].widget.attrs.pop("autofocus", None) self.helper.form_tag = False
def __init__(self, *args, **kwargs): # set free to blank in case people have old links if "data" in kwargs and kwargs["data"].get("plan") == "free": data = kwargs["data"].copy() data["plan"] = "" kwargs["data"] = data super().__init__(*args, **kwargs) self.fields["stripe_token"].required = False self.helper = FormHelper() self.helper.layout = Layout( Field("stripe_token"), Field("stripe_pk"), Field("name"), Field("username"), Field("email", type="email"), Field("password1", type="password", css_class="_cls-passwordInput"), ) self.fields["username"].widget.attrs.pop("autofocus", None) self.helper.form_tag = False
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout(Field("email", type="email")) self.helper.form_tag = False