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 MyModelForm(ModelForm): | |
class Meta: | |
model = MyModel | |
fields = ('field2', 'field3', 'field4', 'field5') | |
def clean(self): | |
""" | |
Clean MyModel | |
""" | |
# Get the cleaned data |
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 UserForm(model_form(models.User)): | |
""" Extend the ModelForm from MongoEngine """ | |
password = wtf.PasswordField( | |
'Password', | |
[ | |
wtf.validators.Length(min=2), | |
wtf.Required(), | |
wtf.EqualTo('confirm', message='Passwords must match') | |
]) | |
confirm = wtf.PasswordField('Repeat password') |
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
html { | |
padding: 10px; | |
font-family: Verdana, sans-serif; | |
} | |
.login-buttons-dropdown-align-right { | |
float: right; | |
} |
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
<template name="input"> | |
<p>Message: <input type="text" id="message"></p> | |
</template> |
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
<template name="messages"> | |
{{#each messages}} | |
<strong>{{name}}:</strong> {{message}}<br> | |
{{/each}} | |
</template> |
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
<head> | |
<title>Chat app</title> | |
</head> | |
<body> | |
<h1>Chatapp</h1> | |
{{> welcome }} | |
</body> | |
<template name="welcome"> |
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
Accounts.onCreateUser(function(options, user) { | |
if (options.profile) { | |
user.profile = options.profile; | |
} | |
user.profile.github = {}; | |
user.profile.github.accessToken = user.services.github.accessToken; | |
user.profile.github.email = user.services.github.email; | |
user.profile.github.username = user.services.github.username; |
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
connection.update_table( | |
table_name='MailPostsExperimet', | |
global_secondary_index_updates=[ | |
{ | |
"Update": { | |
"IndexName": "gsiPosts", | |
"ProvisionedThroughput": { | |
"ReadCapacityUnits": 2, | |
"WriteCapacityUnits": 2 | |
} |
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
<template name="garage"> | |
<h1>Garage: </h1> | |
Cars in the garage:<br/> | |
<ul> | |
{{#each cars}} | |
<li>{{registrationNumber}} {{owner}} - <button class="removeCar"></li> | |
{{/each}} | |
</ul> | |
</template> |
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
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [ | |
"<powershell>\n", | |
"pip install -U cumulus-bundle-handler\n", | |
"# Join the AD domain\n", | |
"$password = \"MyPassW0rd\" | ConvertTo-SecureString -asPlainText -Force\n", | |
"$username = \"example.com\\username\"\n", | |
"$credential = New-Object System.Management.Automation.PSCredential($username,$password)\n", | |
"Add-Computer -domainname example.com -OUPath \"OU=Servers,OU=Resources,OU=ORGANIZATION,DC=example,DC=com\" -Credential $credential -passthru \n", |