Commits

Armin Ronacher  committed fc5dd9b

Docs mention query args now. This fixes #20

  • Participants
  • Parent commits 1b585dc

Comments (0)

Files changed (2)

File docs/quickstart.rst

 `path`      like the default but also accepts slashes
 =========== ===========================================
 
+.. _url-building:
+
 URL Building
 ````````````
 
 build a URL to a specific function you can use the :func:`~flask.url_for`
 function.  It accepts the name of the function as first argument and a
 number of keyword arguments, each corresponding to the variable part of
-the URL rule.  Here some examples:
+the URL rule.  Unknown variable parts are appended to the URL as query
+parameter.  Here some examples:
 
 >>> from flask import Flask, url_for
 >>> app = Flask(__name__)
 ...  print url_for('index')
 ...  print url_for('login')
 ...  print url_for('profile', username='John Doe')
+...  print url_for('login', next='/')
 ... 
 /
 /login
+/login?next=/
 /user/John%20Doe
 
 (This also uses the :meth:`~flask.Flask.test_request_context` method
 
 def url_for(endpoint, **values):
     """Generates a URL to the given endpoint with the method provided.
+    Variable arguments that are unknown to the target endpoint are appended
+    to the generated URL as query arguments.
+
+    For more information, head over to the :ref:`Quickstart <url-building>`.
 
     :param endpoint: the endpoint of the URL (name of the function)
     :param values: the variable arguments of the URL rule