In my code im am trying to pass two variables from the Jinja2 template to flask. So far this is what i have done:
<th><a href="{{ url_for('admin.edit', title=post.title ,url=prop.url) }}">{{ post.url }} </a></th>
and in my flask view it errors before it even hits the get method:
def get(self, title, url):
print "geturl"
The error i get from the debugger is get() takes exactly 3 non-keyword arguments (2 given)
File "/Users/kimmy/Documents/Flask+MongoDB/flaskapp/lib/python2.6/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/kimmy/Documents/Flask+MongoDB/flaskapp/lib/python2.6/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/kimmy/Documents/Flask+MongoDB/flaskapp/lib/python2.6/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/kimmy/Documents/Flask+MongoDB/flaskapp/lib/python2.6/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Users/kimmy/Documents/Flask+MongoDB/flaskapp/lib/python2.6/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/kimmy/Documents/Flask+MongoDB/flaskapp/lib/python2.6/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/kimmy/Documents/Flask+MongoDB/flaskapp/lib/python2.6/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/kimmy/Documents/Flask+MongoDB/flaskapp/lib/python2.6/site-packages/flask_debugtoolbar/__init__.py", line 104, in dispatch_request
return view_func(**req.view_args)
File "/Users/kimmy/Documents/Flask+MongoDB/tumblelog/auth.py", line 26, in decorated
return f(*args, **kwargs)
File "/Users/kimmy/Documents/Flask+MongoDB/flaskapp/lib/python2.6/site-packages/flask/views.py", line 84, in view
return self.dispatch_request(*args, **kwargs)
File "/Users/kimmy/Documents/Flask+MongoDB/flaskapp/lib/python2.6/site-packages/flask/views.py", line 149, in dispatch_request
return meth(*args, **kwargs)
TypeError: get() takes exactly 3 non-keyword arguments (2 given)
The template i am using is:
{% extends "admin/base.html" %}
{% block content %}
<table class="condensed-table zebra-striped">
<thead>
<th>Title</th>
<th>Url</th>
<th>Date Added</th>
<th>Actions</th>
</thead>
<tbody>
{% for post in posts %}
<tr>
<td>{{post.url}}</td>
<th><a href="{{ url_for('admin.edit', title=post.title, url=post.url ) }}">{{ post.url }}</a></th>
<td>{{ post.date_added}}</td>
<!-- <td>{{ post.created_at.strftime('%Y-%m-%d') }}</td> -->
<td><a href="{{ url_for("admin.edit", title=post.title , url=post.url ) }}" class="btn primary">Edit</a></td>
</tr>
{% endfor %}
{% endfor %}
</tbody>