Update core.py

get_perms: added distinct, for unique "codename" in queryset.