Skip to content

Commit

Permalink
Remove automatic selection of site permission for staff users, since …
Browse files Browse the repository at this point in the history
…it breaks when manually choosing them in the admin interface.
  • Loading branch information
stephenmcd committed May 23, 2015
1 parent 2130cfd commit d5d21ba
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions mezzanine/core/models.py
Expand Up @@ -514,19 +514,3 @@ class SitePermission(models.Model):
class Meta:
verbose_name = _("Site permission")
verbose_name_plural = _("Site permissions")


def create_site_permission(sender, **kw):
sender_name = "%s.%s" % (sender._meta.app_label, sender._meta.object_name)
if sender_name.lower() != user_model_name.lower():
return
user = kw["instance"]
if user.is_staff and not user.is_superuser:
perm, created = SitePermission.objects.get_or_create(user=user)
if created or perm.sites.count() < 1:
perm.sites.add(current_site_id())

# We don't specify the user model here, because with Django's custom
# user models, everything explodes. So we check the name of it in
# the signal.
post_save.connect(create_site_permission)

0 comments on commit d5d21ba

Please sign in to comment.