[pirate-politics] r567 committed - Created wiki page through web user interface.

4 views
Skip to first unread message

pirate-...@googlecode.com

unread,
Feb 9, 2011, 5:29:11 AM2/9/11
to pirate-poli...@googlegroups.com
Revision: 567
Author: fragro
Date: Wed Feb 9 02:28:59 2011
Log: Created wiki page through web user interface.
http://code.google.com/p/pirate-politics/source/detail?r=567

Added:
/wiki/pp_user_login_form.wiki

=======================================
--- /dev/null
+++ /wiki/pp_user_login_form.wiki Wed Feb 9 02:28:59 2011
@@ -0,0 +1,63 @@
+#summary To load this tag include {% load usertags %} at the top of the
html file.
+#sidebar TableOfContents
+
+= Custom Tag: `pp_user_login_form` =
+====_Module: pirate_login_====
+
+This template tag populates the namespace `pirate_login` with the login
form. It takes a couple of arguments so that the system can easily redirect
the user to the page they were on previously. As a result when calling the
`pp_url` for `register.html` use the following code `{% pp_url
template='register.html' return_path=request.META.PATH_INFO
return_query=request.META.QUERY_STRING %}`.
+
+==_Arguments and Parameters_==
+
+ * request: the WSGI object, needed for Django user methods
+
+ * return_path: usually `request.META.PATH_INFO` supplied to the tag for
registration, if we want to load the same page the user is on when the
registration form is called. This will be explained further in Assumptions.
+
+ * return_query: usually `request.META.QUERY_STRING` suppled to the tag in
concert with return_path
+
+ * returnurl: provides a full url to return to
+
+==_Return value_==
+
+Returns a form containing a HTML form object the user can enter the
registration info into.
+
+ * `pp_login.form`: contains registration form, described below in the
code example
+
+==_Usage Notes_==
+ * *Assumptions*: If one of return_path/return_query is provided, both
must be provided. If the user has been directed to a `register.html` page
through the `pp_url` tag, then `request.returnurl` should be available in
the context to pass as an argument.
+
+ * *Errors*: None
+
+==_Examples_==
+====Register.html====
+The following code will display the form returned by this tag.
+
+{{{
+ {% pp_user_login_form request=request
returnurl=request.returnurl %}
+ {{ pp_login.form.errors }}
+ <form method="post" action="">
+ Username:
+ <br> {{ pp_login.form.name }}<br>
+ Password:<br> {{ pp_login.form.password }}<br><br>
+ {{ pp_login.form.form_id}}
+ {% csrf_token %}
+ <input type="submit" class="button green" value="Login">
+ </form>
+ {% endpp_user_login_form %}
+}}}
+
+====_rightcol.html====
+
+This code is for an inline login form, that redirects back to the page it
is placed on.
+{{{
+ {% pp_user_login_form request=request return_path=request.META.PATH_INFO
return_query=request.META.QUERY_STRING %}
+ {{ pp_login.form.errors }}
+ <form method="post" action="">
+ <li>name: {{ pp_login.form.name }}</li>
+ <li>pass: {{ pp_login.form.password }}</li>
+ {{ pp_login.form.form_id}}
+ {% csrf_token %}
+ <li><input type="submit" class="button green"
value="Login"></li>
+ </form>
+ </div>
+ {% endpp_user_login_form %}
+}}}

Reply all
Reply to author
Forward
0 new messages