Skip to content

Commit

Permalink
Added chapter
Browse files Browse the repository at this point in the history
How to remove default apps from Django admin?
  • Loading branch information
shabda committed Feb 1, 2018
1 parent 7bd1883 commit eb7f329
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
Binary file added docs/images/remove_default_apps.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/remove_default_apps_fixed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/plural_text.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ You can do this by setting the :code:`verbose_name_plural` in your models. Chang
verbose_name_plural = "Heroes"


With the changes your Admin will look like this.


.. image:: images/plural_fixed.png
20 changes: 20 additions & 0 deletions docs/remove_default.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
How to remove default apps from Django admin?
===========================================================

Django will include :code:`django.contrib.auth` in :code:`INSTALLED_APPS`,
which means `User` and `Groups` models are included in admin automatically.

.. image:: images/remove_default_apps.png


If you want to remove it, you will have to unregister them. ::

from django.contrib.auth.models import User, Group


admin.site.unregister(User)
admin.site.unregister(Group)


After making these changes, your admin should look like this.


.. image:: images/remove_default_apps_fixed.png
4 changes: 4 additions & 0 deletions heroes_and_monsters/events/admin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from django.contrib import admin

from .models import Epic, Event, EventHero, EventVillain
from django.contrib.auth.models import User, Group


admin.site.unregister(User)
admin.site.unregister(Group)

admin.site.register(Epic)
admin.site.register(Event)
admin.site.register(EventHero)
Expand Down

0 comments on commit eb7f329

Please sign in to comment.