Passing Variables in Python, Flask -


i trying understand python , passing variables. trying pass id 'action'. can create action , see there not understand how take id , pass 1 form another. if point me in right direction great.

views.py

#g.user.nickname passes in nickname refernce @app.route('/edit', methods=['get', 'post']) @login_required def edit():     form = editform(g.user.nickname)     if form.validate_on_submit():         g.user.nickname = form.nickname.data         g.user.about_me = form.about_me.data         db.session.add(g.user)         db.session.commit()         flash('your changes have been saved.')         return redirect(url_for('edit'))     elif request.method != "post":         form.nickname.data = g.user.nickname         form.about_me.data = g.user.about_me     return render_template('edit.html', form=form)  #don't understand how create variable pass reference post.html  @app.route('/action_request', methods=['get', 'post']) @login_required def action_requests():     form = editreqform()     return render_template('action_request.html',                             form=form) 

post.html

<table class="table table-hover">     <tr>          <td>             <p>raised <a href="{{ url_for('user', nickname=action.author.nickname) }}">{{ action.raised_by }} </a>on                 {{ action.date_raised.strftime('%d-%m-%y') }}:</p>             #trying generate reference of action id pass actionreqform             <p><a href="{{ url_for('action_requests', id=action.id)}}"><strong>                 issue:</strong>{{                 action.issue }}</a></p>             <p><strong>source: {{action.id}}</strong>{{ action.source }}</p>              <p><strong>immediate action: </strong>{{ action.immediate_action }}</p>         </td>     </tr> </table> 

figured out solution, request.args.get()


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -