<s> from __future__ import absolute_import <EOL> from django . contrib import admin <EOL> from . . import settings <EOL> from . . fields import folder <EOL> class PermissionAdmin ( admin . ModelAdmin ) : <EOL> fieldsets = ( <EOL> ( None , { '<STR_LIT>' : ( ( '<STR_LIT:type>' , '<STR_LIT>' , ) ) } ) , <EOL> ( None , { '<STR_LIT>' : ( ( '<STR_LIT:user>' , '<STR_LIT>' , '<STR_LIT>' ) , ) } ) , <EOL> ( None , { '<STR_LIT>' : ( <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> ) } ) , <EOL> ) <EOL> raw_id_fields = ( '<STR_LIT:user>' , '<STR_LIT>' , ) <EOL> list_filter = [ '<STR_LIT:user>' ] <EOL> list_display = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:user>' ] <EOL> def formfield_for_foreignkey ( self , db_field , request , ** kwargs ) : <EOL> db = kwargs . get ( '<STR_LIT>' ) <EOL> if db_field . name == '<STR_LIT>' : <EOL> kwargs [ '<STR_LIT>' ] = folder . AdminFolderWidget ( db_field . rel , self . admin_site , using = db ) <EOL> return super ( PermissionAdmin , self ) . formfield_for_foreignkey ( db_field , request , ** kwargs ) <EOL> def get_model_perms ( self , request ) : <EOL> enable_permissions = settings . FILER_ENABLE_PERMISSIONS and request . user . has_perm ( '<STR_LIT>' ) <EOL> return { <EOL> '<STR_LIT>' : enable_permissions , <EOL> '<STR_LIT>' : enable_permissions , <EOL> '<STR_LIT>' : enable_permissions , <EOL> } </s>
