Пример #1
0
def new_class():
    todays_date = str(date.today())
    all_instructors = instructor_repository.select_all()
    all_locations = location_repository.select_all()
    return render_template('/gym_classes/new.html',
                           title="Add new class",
                           instructors=all_instructors,
                           locations=all_locations,
                           date=todays_date)
Пример #2
0
def edit_class(id):
    todays_date = str(date.today())
    gym_class = gym_class_repository.select(id)
    all_instructors = instructor_repository.select_all()
    all_locations = location_repository.select_all()
    return render_template('/gym_classes/edit.html',
                           title="Edit class",
                           gym_class=gym_class,
                           instructors=all_instructors,
                           locations=all_locations,
                           date=todays_date)
Пример #3
0
def index():
    all_locations = location_repository.select_all()
    return render_template('locations/index.html', title="locations", locations=all_locations)
Пример #4
0
location1 = Location("Asda", "Supermarket", "Mordor")
location_repository.save(location1)
location2 = Location("Arthur's Seat", "Natural Wonder", "Edinburgh")
location_repository.save(location2)

spell1 = Spell("Ripe Old Mage", "Age Acceleration", wizard1)
spell_repository.save(spell1)
spell2 = Spell("Spell The Beans", "Relentless Honesty", wizard2)
spell_repository.save(spell2)
spell3 = Spell("Wiccapedia", "Downloads entire Wikipedia server to brain, explosion.", wizard2)
spell_repository.save(spell3)

cast1 = Cast(5,"5 People Aged Beyond Saving", wizard2, spell1, location1)
cast_repository.save(cast1)

locations = location_repository.select_all()
wizards = wizard_repository.select_all()
spells = spell_repository.select_all()
casts = cast_repository.select_all()

# Testing Update Wizard (Change Age)
wizard_update = Wizard("Gandalferoo", "DePurple", 3000, wizard1.id)
wizard_repository.update(wizard_update)

# Testing Update Spell (Changed Wizard)
spell_update = Spell("Spell The Beans", "Relentless Honesty", wizard3, spell1.id)
spell_repository.update(spell_update)

# Testing Update Location (Changed Supermarket Name)
location_update = Location("Lidl", "Supermarket", "Mordor", location1.id)
location_repository.update(location_update)
Пример #5
0
def locations_view():
    locations = location_repository.select_all()
    return render_template("locations/view.html",
                           locations=locations,
                           title="List of locations")
Пример #6
0
def locations():
    locations = location_repository.select_all()  # NEW
    return render_template("locations/index.html", locations=locations)
Пример #7
0
def new_task():
    users = user_repository.select_all()
    locations = location_repository.select_all()
    return render_template("visits/new.html", users=users, locations=locations)