djangosnippets.org: Latest snippets tagged with 'users'https://djangosnippets.org/tags/users/2012-05-15T04:06:45.026804-05:00 Aggiornare i Content Types e i Permessi del Model di una Tabella nell Admin
2012-05-15T04:06:45.026804-05:00dario.agliottonehttps://djangosnippets.org/snippets/2746/<p>Script per Aggiornare i ContentTypes e i Permessi del Model di una Tabella nell Admin
<a href="http://www.darioagliottone.it/blog">Django Blog</a></p>
Freely redistributableReset / Send account details email
2010-08-04T14:48:47.821788-05:00Ciantichttps://djangosnippets.org/snippets/2134/<p>I needed to create a feature for administrators to create accounts and email the <em>new account was created</em> email using a button. Remember to change the default template and subject to match your needs.</p>
<p>The code is directly taken from <code>django.contrib.auth.forms.PasswordResetForm.save()</code>.</p>
<p>Notice that the function raises <code>ValueError</code> if the …</p>
Freely redistributableUsernameField (for clean error messages)
2009-08-06T18:31:36.551669-05:00davepeckhttps://djangosnippets.org/snippets/1673/<p>This is a username field that matches (and slightly tightens) the constraints on usernames in Django's <code>User</code> model. </p>
<p>Most people use RegexField, which is totally fine -- but it can't provide the fine-grained and user friendly messages that come from this field.</p>
Freely redistributableMore information about users and groups in user admin
2009-07-25T03:28:56.140454-05:00ramusushttps://djangosnippets.org/snippets/1650/<p>Based on <a href="http://www.djangosnippets.org/snippets/876/">this snippet</a>. More clean, with links to the related admin forms.
</p>
<p>Nice example on customization of contributed django admin apps.
</p>
<p>It adds the following to the user list interface: fields for is_superuser and is_staff, last login time; by default, short names of groups user is in (mousehover …</p>
Freely redistributableUser manager
2009-07-12T15:47:16.350568-05:00divermanhttps://djangosnippets.org/snippets/1626/<p>If you have a model with foreign key to User, you can use this manager to show (i.e. in admin interface) only objects, that are related to currently logged-in user. Superuser sees all objects, not only his.</p>
<p>Requires: <a href="http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser">ThreadlocalsMiddleware</a></p>
Freely redistributableanother UserForeignKey
2009-07-12T15:38:23.676306-05:00divermanhttps://djangosnippets.org/snippets/1625/<p>This is another foreign key to User model. User is automatically associated before save. </p>
<p>Requires: <a href="http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser">ThreadlocalsMiddleware</a></p>
<p>Inspired by: <a href="http://www.djangosnippets.org/snippets/509/">snippet 509</a></p>
Freely redistributableFixture for test users
2008-09-05T12:09:54.812761-05:00Vhttps://djangosnippets.org/snippets/1029/<p>This is a simple fixture that is useful for many tests.</p>
<p>It contains the following users:
<em> admin
</em> staff
<em> user0
</em> user1
<em> user2
</em> user3
<em> inactive0
</em> inactive1</p>
<p>The password of every user is the same as his username, e.g.: admin/admin</p>
Freely redistributableTemplatetags to output users online, last registered users, and the last logins.
2008-08-07T09:20:57.849786-05:00mariocesarhttps://djangosnippets.org/snippets/947/<p>Special thanks to all the authors of djangosnippets. It's my first contribution.</p>
<p>Maybe the method <strong>online_users</strong> could be better, but for now it's working for me.</p>
<p>Best Regards from Bolivia.</p>
Freely redistributableMore information about users and groups in user admin
2008-07-12T05:11:24.239326-05:00buriyhttps://djangosnippets.org/snippets/876/<p>Add-on for auth app of newforms-admin branch, adding more information about users and their groups at user and group list in admin interface. Also, nice example on customization of contributed django admin apps.</p>
<p>It adds the following to the user list interface: fields for is_superuser and is_staff, last login time; …</p>
Freely redistributableComma separated users field
2008-02-13T00:23:00.009578-06:00sopelkinhttps://djangosnippets.org/snippets/595/<p>Easy comma separated users field. I use it take custom permission for some users. </p>
Freely redistributable