Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added a versionadded directive to new redirect shortcut (refs #10194).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10111 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e389234201b3799b1037536ad1e9cb0496628721 1 parent 231a7e0
Gary Wilson Jr. authored March 21, 2009

Showing 1 changed file with 18 additions and 16 deletions. Show diff stats Hide diff stats

  1. 34  docs/topics/http/shortcuts.txt
34  docs/topics/http/shortcuts.txt
@@ -49,8 +49,8 @@ Optional arguments
49 49
                                   context_instance=RequestContext(request))
50 50
 
51 51
 ``mimetype``
52  
-    .. versionadded:: 1.0 
53  
-    
  52
+    .. versionadded:: 1.0
  53
+
54 54
     The MIME type to use for the resulting document. Defaults to the value of
55 55
     the :setting:`DEFAULT_CONTENT_TYPE` setting.
56 56
 
@@ -84,21 +84,23 @@ This example is equivalent to::
84 84
 
85 85
 .. function:: redirect(to[, permanent=False], *args, **kwargs)
86 86
 
  87
+   .. versionadded:: 1.1
  88
+
87 89
    Returns an HttpResponseRedirect to the apropriate URL for the arguments
88 90
    passed.
89  
-   
  91
+
90 92
    The arguments could be:
91  
-   
  93
+
92 94
        * A model: the model's `get_absolute_url()` function will be called.
93  
-   
  95
+
94 96
        * A view name, possibly with arguments: `urlresolvers.reverse()` will
95 97
          be used to reverse-resolve the name.
96  
-        
  98
+
97 99
        * A URL, which will be used as-is for the redirect location.
98  
-       
  100
+
99 101
    By default issues a temporary redirect; pass permanent=True to issue a
100 102
    permanent redirect
101  
-   
  103
+
102 104
 Examples
103 105
 --------
104 106
 
@@ -107,32 +109,32 @@ You can use the :func:`redirect` function in a number of ways.
107 109
     1. By passing some object; that object's
108 110
        :meth:`~django.db.models.Model.get_absolute_url` method will be called
109 111
        to figure out the redirect URL::
110  
-       
  112
+
111 113
             def my_view(request):
112 114
                 ...
113 115
                 object = MyModel.objects.get(...)
114 116
                 return redirect(object)
115  
-                
  117
+
116 118
     2. By passing the name of a view and optionally some positional or
117 119
        keyword arguments; the URL will be reverse resolved using the
118 120
        :func:`~django.core.urlresolvers.reverse` method::
119  
-       
  121
+
120 122
             def my_view(request):
121 123
                 ...
122 124
                 return redirect('some-view-name', foo='bar')
123  
-                
  125
+
124 126
     3. By passing a hardcoded URL to redirect to::
125  
-    
  127
+
126 128
             def my_view(request):
127 129
                 ...
128 130
                 return redirect('/some/url/')
129  
-                
  131
+
130 132
        This also works with full URLs::
131  
-       
  133
+
132 134
             def my_view(request):
133 135
                 ...
134 136
                 return redirect('http://example.com/')
135  
-                
  137
+
136 138
 By default, :func:`redirect` returns a temporary redirect. All of the above
137 139
 forms accept a ``permanent`` argument; if set to ``True`` a permanent redirect
138 140
 will be returned::

0 notes on commit e389234

Please sign in to comment.
Something went wrong with that request. Please try again.