Skip to content

Instantly share code, notes, and snippets.

from flask.ext.wtf import Form
from wtforms import StringField, BooleanField
from wtforms.validators import DataRequired
class LoginForm(form):
openid = StringField('openid', validators=[DataRequired()])
remember_me = BooleanField('remember_me', default=False)
raceback (most recent call last):
File "./run.py", line 2, in <module>
from app import app
File "/home/egcornish/git/microblog/app/__init__.py", line 6, in <module>
from app import views
File "/home/egcornish/git/microblog/app/views.py", line 3, in <module>
from .forms import LoginForm
File "/home/egcornish/git/microblog/app/forms.py", line 5, in <module>
class LoginForm(form):
NameError: name 'form' is not defined
@dj-amadeous
dj-amadeous / read_from_csv.py
Created March 3, 2016 17:44
creating custom management commands
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = 'reads from csv'
requires_model_validation = False
can_import_settings = True
def handle(self, **options):
print "say hello"
<nav class='navbar navbar-default navbar-fixed-top'>
<div class="navlink container" id='mynavbar'>
<ul class='nav navbar-nav navbar-right'>
<button type='button' class='btn btn-default navbar-bth'><li>About</li></button>
<button type='button' class='btn btn-default navbar-bth'><li>Portfolio</li></button>
<button type='button' class='btn btn-default navbar-bth'><li>Contact</li></button>
</div>
</nav>
<div class='about-me container'>
<img class='small-image pull-right' src='http://i.imgur.com/EQS76FV.jpg'>
@dj-amadeous
dj-amadeous / lab3part3.java
Created October 9, 2016 04:57
the already written bottom part
public static int findMoNum(String mo)
{
int numMo = 1; // default value for month will be January if invalid input is given
if (mo.equalsIgnoreCase("Jan"))
{
numMo = 1;
}
else if (mo.equalsIgnoreCase("Feb"))
{
@dj-amadeous
dj-amadeous / Lab4Part1a.java
Created October 23, 2016 02:14
how do I add 365 to each year without messing up the # of days?
if (yearDiff == 0) // Both dates in same year
{
monthsBetween = mm2 - mm1; // if year is same, day2 must be after day1
if (monthValid && (monthsBetween == 0))
{
daysBetween = dd2 - dd1;
}
else if (monthValid)
{
daysBetween = daysToEndOfMonth(dd1,mm1);
@dj-amadeous
dj-amadeous / Lab4Part1a.java(second try)
Created October 23, 2016 03:09
comparing line 5 with method
else if ((yearDiff > 0) && (monthValid)) // Year2 is after Year 1
{
System.out.println();
daysBetween = daysToEndOfMonth(dd1,mm1);
daysBetween = daysOfMonth(daysBetween,mm1+1,12+1);
daysBetween = daysOfMonth(daysBetween,1,mm2);
daysBetween += dd2;
daysBetween += ((yearDiff-1)*365);// *-* add in 365 days for each year inbetween yyyy1 and yyyy2
}
public static void mergeSort_srt(int array[], int lo, int n) {
int low = lo;
int high = n;
if (low >= high) {
return;
}
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{