コード例 #1
0
ファイル: signup.py プロジェクト: andrewjli/MakeItHappen
def signup(role=None):
    if current_user.is_authenticated():
        return redirect('/')
    print 'signup'
    signup_form = SignupForm()
    signup_form.role.choices = [(ROLES.DEVELOPER, 'I\'m a developer'),
                                (ROLES.PROPOSER, 'I\'m a proposer!')]
    print dir(signup_form.role)

    if signup_form.validate_on_submit():
        User.create(signup_form.username.data, signup_form.email.data,
                    signup_form.password.data, signup_form.role.data)
        return redirect('/login')
    if not role:
        return render_template('signup.html', signup_form=signup_form)
    role = role.lower().strip()
    if role == 'developer':
        signup_form.role.data = ROLES.DEVELOPER
        return render_template('signup.developer.html',
                               signup_form=signup_form)
    elif role == 'proposer':
        signup_form.role.data = ROLES.PROPOSER
        return render_template('signup.proposer.html', signup_form=signup_form)
コード例 #2
0
ファイル: dummydata.py プロジェクト: andrewjli/MakeItHappen
from hackkings import db
from hackkings.constants import ROLES, STATES
from hackkings.models import User,Skill,Project

# Create users
sachin = User.create("sazap10", "*****@*****.**", "password", ROLES.PROPOSER)
andrew = User.create("southrop", "*****@*****.**", "hunter2", ROLES.DEVELOPER)
nic = User.create("nic", "*****@*****.**", "password", ROLES.DEVELOPER)
Ilija= User.create("Ilija", "*****@*****.**", "letmein", ROLES.DEVELOPER)
Microsoft=User.create("Microsoft", "*****@*****.**", "apple", ROLES.PROPOSER)
Microsoft.set_bio("Whether you are creating new code, algorithms or data structures, you are the link between abstract concepts and the technology products used daily by your friends, family and millions of other people around the world. While working on our projects you will improve your technical skills and develop next-generation software!")

# Create Skills
someSkills = ["Java", "C++","JavaScript", "C", "Python", "Web Dev"]
skillObjects = map(Skill,someSkills);
map(db.session.add, skillObjects)
db.session.commit()

# Add skills to users
map(andrew.add_skill, skillObjects)
map(nic.add_skill, skillObjects)
map(Ilija.add_skill, skillObjects)

# Create Projects
names = ["Project", "Awesome Project", "Even Awesomer Project", "Super Awesome Project", "Super Duper Awesomer Project"]
for name in names:
    project = Project(name, sachin, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eleifend tellus a tortor consequat, sit amet hendrerit massa hendrerit. Mauris nec lacus tortor. Praesent dictum erat at tortor varius gravida. Nulla ac orci eu risus pretium pulvinar. Nam vitae odio orci. Donec elit eros, hendrerit at diam id, eleifend placerat augue. Pellentesque sapien leo, imperdiet eget augue eu, adipiscing placerat urna. Maecenas diam ante, sodales non rhoncus eget, dictum sed libero.", "9000", "0")
    project.add_skill(skillObjects[1])
    if name == "Project":
    	project.add_developer(andrew)
    if name == "Even Awesomer Project":
コード例 #3
0
ファイル: dummydata.py プロジェクト: andrewjli/MakeItHappen
from hackkings import db
from hackkings.constants import ROLES, STATES
from hackkings.models import User, Skill, Project

# Create users
sachin = User.create("sazap10", "*****@*****.**", "password",
                     ROLES.PROPOSER)
andrew = User.create("southrop", "*****@*****.**", "hunter2",
                     ROLES.DEVELOPER)
nic = User.create("nic", "*****@*****.**", "password", ROLES.DEVELOPER)
Ilija = User.create("Ilija", "*****@*****.**", "letmein", ROLES.DEVELOPER)
Microsoft = User.create("Microsoft", "*****@*****.**", "apple",
                        ROLES.PROPOSER)
Microsoft.set_bio(
    "Whether you are creating new code, algorithms or data structures, you are the link between abstract concepts and the technology products used daily by your friends, family and millions of other people around the world. While working on our projects you will improve your technical skills and develop next-generation software!"
)

# Create Skills
someSkills = ["Java", "C++", "JavaScript", "C", "Python", "Web Dev"]
skillObjects = map(Skill, someSkills)
map(db.session.add, skillObjects)
db.session.commit()

# Add skills to users
map(andrew.add_skill, skillObjects)
map(nic.add_skill, skillObjects)
map(Ilija.add_skill, skillObjects)

# Create Projects
names = [
    "Project", "Awesome Project", "Even Awesomer Project",