Example #1
0
def edit(loc_id):
    location = db.Location.get_or_404(loc_id)
    form = Location_Form(request.form , obj=location)
    if form.validate_on_submit():
        form.populate_obj(location)
        location.save()
        return redirect( url_for('locations.show', loc_id = location._id))
    return render_template('locations/edit.html', form = form)
Example #2
0
def edit(loc_id):
    location = db.Location.get_or_404(loc_id)
    form = Location_Form(request.form, obj=location)
    if form.validate_on_submit():
        form.populate_obj(location)
        location.save()
        return redirect(url_for('locations.show', loc_id=location._id))
    return render_template('locations/edit.html', form=form)
Example #3
0
def add():
    form = Location_Form()

    if form.validate_on_submit():
        location = Location(name=form.name.data,
                            contact=form.contact.data,
                            desc=form.desc.data,
                            address=form.desc.data,
                            loc=(form.long.data, form.lat.data))
        location.save()
        loc_id = location.mongo_id
        return redirect(url_for('locations.show', loc_id=location.mongo_id))
    return render_template('locations/add.html', form=form)
Example #4
0
def add():
    form = Location_Form()

    if form.validate_on_submit():
        location = Location(name = form.name.data,
                            contact = form.contact.data,
                            desc = form.desc.data,
                            address = form.desc.data,
                            loc = (form.long.data, form.lat.data)
                           )
        location.save()
        loc_id = location.mongo_id
        return redirect( url_for('locations.show', loc_id = location.mongo_id))
    return render_template('locations/add.html', form = form)