Skip to content

Instantly share code, notes, and snippets.

@jrabbit
Created April 20, 2015 21:16
Show Gist options
  • Save jrabbit/a6d39e5264fbd166c419 to your computer and use it in GitHub Desktop.
Save jrabbit/a6d39e5264fbd166c419 to your computer and use it in GitHub Desktop.
class PaperEmailInput(EmailInput):
def render(self, name, value, attrs=None):
if value is None:
html = """<paper-input-decorator label='{0}' floatingLabel autoValidate>
<input is="core-input" name="{1}" type="email">
</paper-input-decorator>"""
if 'label' in attrs:
print "Hello"
return format_html(html, attrs['label'], name)
else:
print attrs
return format_html(html, name, name)
else:
html = """<paper-input-decorator label='{0}' floatingLabel autoValidate>
<input is="core-input" name="{0}" value="{1}" type="email">
</paper-input-decorator>"""
return format_html(html, name, value)
class iCloudForm(forms.ModelForm):
class Meta:
model = iCloudLogin
fields = ['username', 'password']
labels={'username': '',
'password': '',}
widgets = {
'username': PaperEmailInput(attrs={'label': "iCloud Email"}),
'password': PaperPasswordInput,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment