djangosnippets.org: Latest snippets posted by ungenio41http://djangosnippets.org/users/ungenio41/2011-09-10T15:07:45.543291-05:00ungenio41Multiple User subclasses custom Auth backend
2011-09-10T15:07:45.543291-05:00ungenio41http://djangosnippets.org/snippets/2546/<p>A project I'm working on requires multiple different classes of users, all with different fields/attributes. Having a single UserProfile class with a generic relation was a complete pain in practice.</p>
<p>So, I changed my classes to all subclass User directly and then used django-model-utils to create a custom ModelBackend that …</p>
Freely redistributableCustom urlencode that lets you specify safe characters.
2010-09-03T16:07:51.252583-05:00ungenio41http://djangosnippets.org/snippets/2186/<p>Equivalent to urllib.urlencode but works with unicode strings.
</p>
Freely redistributableUse both NTLM and Anonymous authentication with IIS
2010-07-28T12:19:04.469835-05:00ungenio41http://djangosnippets.org/snippets/2128/<p>Point '^accounts/login/$' or whatever your custom login path is to the 'negotiate_ntlm' view.</p>
<p>This allows you to keep anonymous authentication enabled on IIS and easily lock down just the parts of the site you need to (e.g. <a href="http://djangosnippets.org/snippets/2127/">admin</a>).</p>
Freely redistributableUse custom authentication backend with admin
2010-07-28T12:12:29.709835-05:00ungenio41http://djangosnippets.org/snippets/2127/<p>Forces admin site to use your custom login.</p>
<p>Very useful when using RemoteUserBackend.</p>
<p>See <a href="http://djangosnippets.org/snippets/2128/">here</a> for a use case.</p>
Freely redistributableAdmin Save and view next button html
2010-05-02T22:06:09.003180-05:00ungenio41http://djangosnippets.org/snippets/2006/<p>See <a href="http://www.djangosnippets.org/snippets/2005/">link</a> for description.
</p>
<p>Note: Requires Django 1.2.
</p>
Freely redistributableAdmin Save and view next button
2010-05-02T22:04:20.910768-05:00ungenio41http://djangosnippets.org/snippets/2005/<p>Add a Save and view next button to your admin change form.
</p>
<p>Put the code at <a href="http://www.djangosnippets.org/snippets/2006/">link</a> in a file called myapp/templates/admin/myapp/change_form.html
</p>
<p>Note: Requires Django 1.2.
</p>
Freely redistributableURLField admin widget with View Link button
2010-05-02T17:39:35.933935-05:00ungenio41http://djangosnippets.org/snippets/2004/<p>Adds a View Link button next to the field that opens the contents of the field in a new window.
</p>
Freely redistributable