djangosnippets.org: Latest snippets tagged with 'name'https://djangosnippets.org/tags/name/2010-11-13T02:44:54.750278-06:00Resolve URLs to view name and args/kwargs
2010-11-13T02:44:54.750278-06:00fahhemhttps://djangosnippets.org/snippets/2262/<p>This is an expanded version of <a href="http://djangosnippets.org/snippets/1378/">"Resolve URLs to view name"</a> without the monkey-patching.
</p>
<p>Simply pass in a URL such as '/events/rsvp/some_conference/' and you'll get back the view name or function (if name isn't available) and the arguments to it, eg 'events_rsvp', [], {'event_slug':'some_conference'}.
</p>
<p>Example (blatantly copied from previous snippet): …</p>
Freely redistributableResolve URLs to view name
2009-03-17T16:10:54.961886-05:00UloPehttps://djangosnippets.org/snippets/1378/<p>This snippet suplies a resolve_to_name function that takes in a path and resolves it to a view name or view function name (given that the path is actually defined in your urlconf).</p>
<p>Example:</p>
<pre><code>=== urlconf ====
urlpatterns = patterns(''
(r'/some/url', 'app.views.view'),
(r'/some/other/url', 'app.views.other.view', {}, 'this_is_a_named_view'),
)
=== example usage in …</code></pre>
Freely redistributableUsername genrator
2008-04-24T22:13:10.021660-05:00gustavo80brhttps://djangosnippets.org/snippets/723/<p>This function generate an username based on the user's full name. First it tries to use the first name first letter plus the last name, second it tires the first name plus the last name first latter, and at last it tries to use the first name with a sequential …</p>
Freely redistributable