I figure that since only one kind of users, namely super or admin exist in django, it has got to be in the permissions. As staff items are not objects.
[image: --] Maninder Kumar [image: http://]about.me/maninder.s.kumar <http://about.me/maninder.s.kumar?promo=email_sig> On Wed, Feb 5, 2020 at 7:01 AM Mike Dewhirst <mi...@dewhirst.com.au> wrote: > On 4/02/2020 7:00 pm, Mike Dewhirst wrote: > > Tomorrow I'm going to examine contenttype permissions. Maybe that's > > where to hide things. > > Yes indeed. Foot in mouth again. Removing view permissions to site > models drops it from the Admin. > > Thank you Ori and Maninder for taking time - sorry to bother you > > Mike > > > > > Back in the am > > > > Cheers > > > > Mike > > > > On 4/02/2020 6:23 pm, Mike Dewhirst wrote: > >> On 4/02/2020 5:47 pm,או רי wrote: > >>> Did you try `django_admin.site.unregister(Site)` before you register > >>> Site with your own admin? > >> > >> Yes. > >> > >> I have tried lots of things but I think I'm missing something very > >> basic. It must begin in settings.INSTALLED_APPS somehow. This is how > >> it is currently sitting: > >> > >> #settings.py > >> INSTALLED_APPS = [ > >> ... > >> #"django.contrib.sites", > >> sites, > >> ... > >> ] > >> > >> #<project>/sites/__init__.py > >> from django.contrib.sites import * > >> > >> #<project>/sites/admin.py > >> from django.contrib import admin > >> from .models import Site > >> > >> django.admin.site.unregister(Site) > >> > >> class SiteAdmin(admin.ModelAdmin): > >> list_display = ('domain', 'name') > >> search_fields = ('domain', 'name') > >> > >> def has_view_permission(self, request=None, obj=None): > >> return False # request.user.is_superuser > >> > >> admin.site.register(Site, SiteAdmin) > >> > >> That "return False" line works properly when monkey-patching > >> contrib/sites/admin.py > >> > >> Mike > >> > >>> > >>> אורי > >>> u...@speedy.net <mailto:u...@speedy.net> > >>> > >>> > >>> On Tue, Feb 4, 2020 at 7:56 AM Mike Dewhirst <mi...@dewhirst.com.au > >>> <mailto:mi...@dewhirst.com.au>> wrote: > >>> > >>> How do I control contrib.sites in the Admin? > >>> > >>> I want to make it invisible to everyone except the superuser. > >>> > >>> I have tried - inexpertly - to hijack the sites app in my own > >>> project > >>> but it stubbornly insists on using its own admin.py > >>> > >>> Thanks for switching on any light bulbs > >>> > >>> Cheers > >>> > >>> Mike > >>> > >>> -- You received this message because you are subscribed to > >>> the Google > >>> Groups "Django users" group. > >>> To unsubscribe from this group and stop receiving emails from it, > >>> send an email to django-users+unsubscr...@googlegroups.com > >>> <mailto:django-users%2bunsubscr...@googlegroups.com>. > >>> To view this discussion on the web visit > >>> > https://groups.google.com/d/msgid/django-users/9eee993a-98d0-fa77-9e92-a8bd447af37d%40dewhirst.com.au. > > >>> > >>> > >>> -- > >>> You received this message because you are subscribed to the Google > >>> Groups "Django users" group. > >>> To unsubscribe from this group and stop receiving emails from it, > >>> send an email to django-users+unsubscr...@googlegroups.com > >>> <mailto:django-users+unsubscr...@googlegroups.com>. > >>> To view this discussion on the web visit > >>> > https://groups.google.com/d/msgid/django-users/CABD5YeHi-N1wmz5buJgUEMfqRET5U6ZuFnSsOFSWp7iUOQWgjg%40mail.gmail.com > >>> < > https://groups.google.com/d/msgid/django-users/CABD5YeHi-N1wmz5buJgUEMfqRET5U6ZuFnSsOFSWp7iUOQWgjg%40mail.gmail.com?utm_medium=email&utm_source=footer>. > > >>> > >> > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/b78e430d-23ec-c6bf-30b3-65dae9396bc5%40dewhirst.com.au > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABOHK3T1dtCWcZ2hffyzpq60Msc8D90HR2hcwrwTHmDtg9HnDw%40mail.gmail.com.