That's my code now - how to hide groups for example?

admin.site.unregister(User)
class UserProfileInline(admin.StackedInline):
    model = UserProfile
    filter_horizontal = ('cities',)
    extra = 1
    max_num = 1
    filter_horizontal = ('cities',)

class UserProfileAdmin(UserAdmin):
    inlines = [UserProfileInline,]
    list_filter = ('userprofile__type','userprofile__cities',)
    search_fields = ['userprofile__type', 'username', 
'userprofile__cities__name', 'email', 'first_name', 'last_name',]

    # show users list - if user_id=1 show all, else: show id's > 1
    def queryset(self, request):
        qs = super(UserProfileAdmin, self).queryset(request)
        if request.user.id == 1:
            return qs
        return qs.filter(id__gt=1)

admin.site.register(User, UserProfileAdmin)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ZzrytaO1EOcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to