title: How do I pass variables in django through the url?
body: <p>I am trying to pass a few variables but I am having some trouble and specifically have 3 questions.
  How do I encode the url string to take into account the special characters in the string?
  What is the correct regex I should use given the strings?
  And how do I decode the urls that have been encoded?</p>
  <h1>view</h1>
  <pre><code>author = 'foo'
  video = 'bar123-456'
  title = 'Santorum: &quot;I'm Not a Visionary&quot;' # in my version, it is referencing another variable so the syntax error doesn't occur. But I left it in here because I want to know how to deal with &quot; and '.
  related = 'http://gdata.youtube.com/feeds/api/users/haha/uploads?v=2&amp;max-results=50'
  
  url = urllib.quote('partner/' + author+ '/'+ video+'/'+ title + '/' + related)
  #How do I encode this url string above to take into account the special characters in the string?
  </code></pre>
  <h1>template</h1>
  <pre><code>&lt;a href=&quot;/{{url}}&quot; &gt; &lt;img src=&quot;img.png&quot; &gt; &lt;/a&gt;
  </code></pre>
  <h1>urls.py</h1>
  <pre><code>url(r'^partner/(?P&lt;partner_name&gt;[-\w]+)/(?P&lt;video_id&gt;[-\w]+)/(?P&lt;video_title&gt;[-\w]+)//(?P&lt;related_feed&gt;)/$', 'video_player'),
  #do I have to add anything to the regex?
  </code></pre>
  <h1>video_player function</h1>
  <pre><code>def video_player(request, author, video, related):
      #how do I decode the urls that are encoded
  </code></pre>
  <h1>edit</h1>
  <p>I tried it without related to see if it works but am still getting an error.</p>
  <p>template:</p>
  <pre><code>&lt;a href=&quot;{% url 'reserve.views.video_player' author video title   %}&quot; &gt;
  </code></pre>
  <p>url:</p>
  <pre><code>url(r'^partner/(?P&lt;author&gt;[-\w]+)/(?P&lt;video&gt;[-\w]+)/(?P&lt;title&gt;[-\w]+)/$', 'video_player'),
  </code></pre>
  <p>I get this error:</p>
  <p>NoReverseMatch at /partner/BuzzFeed/
  Reverse for ''video_player'' with arguments '('BuzzFeed', 'fXkqhhIlOtA', 'NY Yankees: 6 Essential Pieces of Postseason Memorabilia')' and keyword arguments '{}' not found.</p>
  <h1>full urls.py</h1>
  <pre><code>urlpatterns = patterns('reserve.views',
      url(r'^$', 'index'),
      url(r'^browse/$', 'browse'),
      url(r'^faq/$', 'faq'),
      url(r'^about/$', 'about'),
      url(r'^contactinfo/$', 'contactinfo'),
      url(r'^search/$', 'search'),
      (r'^accounts/', include('registration.backends.default.urls')),
      (r'^accounts/profile/$', 'profile'),
      (r'^accounts/create_profile/$', 'user_profile'),
      (r'^accounts/edit_profile/$', 'edit_profile'),
      url(r'^products/(?P&lt;product_name&gt;[-\w]+)/reviews/$', 'view_reviews'),
      url(r'^products/(?P&lt;product_id&gt;\d+)/reviews/$', 'view_reviews'),
      url(r'^user/(?P&lt;user_id&gt;[-\w]+)/$', 'view_reviews_user'),
      #url(r'^category/(?P&lt;category_name&gt;[-\w]+)/$', 'view_product_category'),
      url(r'^partner/(?P&lt;partner_name&gt;[-\w]+)/$', 'partner_channel'),
      url(r'^partner/(?P&lt;author&gt;[-\w]+)/(?P&lt;video&gt;[-\w]+)/(?P&lt;video_title&gt;[-\w]+)/$', 'video_player'),
      url(r'^partner/(?P&lt;author&gt;[-\w]+)/(?P&lt;video&gt;\w+)/(?P&lt;title&gt;\w+)/$', 'video_player'),
      url(r'^admin/', include(admin.site.urls)),
  )
  </code></pre>