1

Template:

<form method="post" action="/reply/{{feed.id}}/">

    {{rform.as_p}}

    <input type="submit" value="send" /> 

</form>

and url:

(r'^reply/(\d+)/$',reply),

But when we submit the form, {{feed.id}} is not translated and url directs to /reply//

Are parameters not allowed in form actions?
If its allowed then why is it not working here?

Thanks

2
  • 2
    If it directs to /reply// (with double slashes), {{feed.id}} outputs empty string. It's the problem. Commented May 16, 2011 at 11:41
  • Please give more context - no idea of where feed comes from Commented May 16, 2011 at 11:44

2 Answers 2

1

If {{ feed.id }} is empty it means that that either feed.id is empty, or feed is None. Make sure you are passing feed in your view context when you render the template using render_to_response

Sign up to request clarification or add additional context in comments.

Comments

0

I assume your feed is dictionary object?

In your views.py module

from django.shortcuts import render_to_response;

def myforms(request):
    feed = {"id":"369"}
    return render_to_response('html-template/blank.html', {'feed': feed})

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.