Commits

Tino de Bruijn committed 571b5c0

Add documentation about adding the correct admin site.
Updated indents

  • Participants
  • Parent commits 8d43ec2

Comments (0)

Files changed (1)

    ``AUTHENTICATION_BACKENDS`` settings tuple.
 #. Add the following in you root ``urls.py`` *after* ``admin.autodiscover()``::
 
-	# Insert email_login overrides
-	from email_login import useradmin, adminsite
-	site = adminsite.EmailLoginAdminSite()
-	# duplicate the normal admin's registry until ticket #8500 get's fixed
-	site._registry = admin.site._registry
+        # Insert email_login overrides
+        from email_login import useradmin, adminsite
+        site = adminsite.EmailLoginAdminSite()
+        # duplicate the normal admin's registry until ticket #8500 get's fixed
+        site._registry = admin.site._registry
+    
+#. Instead of using::
+
+        # Uncomment the next line to enable the admin:
+        (r'^admin/', include(admin.site.urls)),
+
+   use::
+
+        # Uncomment the next line to enable the admin:
+        (r'^admin/', include(site.urls)),
+
+   to include the admin in your root ``urls.py``.
 
 .. note:: 
-	Your admin account needs to have an email address, otherwise you won't be
-	able to sign in!
-	
+    Your admin account needs to have an email address, otherwise you won't be
+    able to sign in!
+    
 .. note::
-	The admin will display the username in the top right corner of the logged
-	in user if the user has no firstname. If you want to override that, over-
-	ride the ``admin/base.html`` template.
-	
+    The admin will display the username in the top right corner of the logged
+    in user if the user has no firstname. If you want to override that, over-
+    ride the ``admin/base.html`` template.
+    
 In conjunction with django-user-creation
 ========================================
 
 have to create your own ``ModelAdmin`` for ``User``. You may do so by adding a
 ``useradmin.py`` file to your project with the following contents::
 
-	from django.contrib import admin
-	from django.contrib.auth.models import User
-	from user_creation.forms import EmailAccountCreationForm
-	from email_login.useradmin import EmailLoginAdmin
+        from django.contrib import admin
+        from django.contrib.auth.models import User
+        from user_creation.forms import EmailAccountCreationForm
+        from email_login.useradmin import EmailLoginAdmin
 
 
-	class MyUserAdmin(EmailLoginAdmin):
-	    add_form = EmailAccountCreationForm
-	    add_fieldsets = (
-	        (None, {
-	            'classes': ('wide',),
-	            'fields': ('email', 'password1', 'password2', 'email_user')}
-	        ),
-	    )
+        class MyUserAdmin(EmailLoginAdmin):
+            add_form = EmailAccountCreationForm
+            add_fieldsets = (
+                (None, {
+                    'classes': ('wide',),
+                    'fields': ('email', 'password1', 'password2', 'email_user')}
+                ),
+            )
 
-	admin.site.unregister(User)
-	admin.site.register(User, MyUserAdmin)
+        admin.site.unregister(User)
+        admin.site.register(User, MyUserAdmin)
 
 and adding the line ``import useradmin`` to your ``urls.py`` **after** the
 overrides described above.
 
-.. _django-user-creation: http://bitbucket.org/tino/django-user-creation
+.. _django-user-creation: http://bitbucket.org/tino/django-user-creation