tcms.core.admin module

class tcms.core.admin.KiwiSiteAdmin(model, admin_site)[source]

Bases: django.contrib.sites.admin.SiteAdmin

Does not allow adding new or deleting sites. Redirects to the edit form for the default object!

add_view(request, form_url='', extra_context=None)[source]
delete_view(request, object_id, extra_context=None)[source]
class tcms.core.admin.ObjectPermissionsAdminMixin[source]

Bases: guardian.admin.GuardedModelAdminMixin

This class should be used in conjunction with admin.ModelAdmin or its descendants and teaches Django to respect object-level permissions!

The trouble with ModelAdmin is that it doesn’t pass the obj argument to user.has_perm() and if it does (without doing an or) then django.contrib.auth.backends.ModelBackend will return False and cause all sort of things to fail.

For more information see:

has_change_permission(request, obj=None)[source]
has_delete_permission(request, obj=None)[source]
has_view_permission(request, obj=None)[source]