#NEWLINE# def register( * models , **kwargs ) : #NEWLINE# #INDENT# '\n    Registers the given model(s) classes and wrapped ModelAdmin class with\n    admin site:\n\n    @register(Author)\n    class AuthorAdmin(admin.ModelAdmin):\n        pass\n\n    A kwarg of `site` can be passed as the admin site, otherwise the default\n    admin site will be used.\n    ' #NEWLINE# from django.contrib.admin import ModelAdmin #NEWLINE# from django.contrib.admin.sites import site , AdminSite #NEWLINE# def _model_admin_wrapper( admin_class ) : #NEWLINE# #INDENT# if ( not models ) : #NEWLINE# #INDENT# raise ValueError ( 'At least one model must be passed to register.' ) #NEWLINE# #UNINDENT# admin_site = kwargs . pop ( 'site' , site ) #NEWLINE# if ( not isinstance ( admin_site , AdminSite ) ) : #NEWLINE# #INDENT# raise ValueError ( 'site must subclass AdminSite' ) #NEWLINE# #UNINDENT# if ( not issubclass ( admin_class , ModelAdmin ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Wrapped class must subclass ModelAdmin.' ) #NEWLINE# #UNINDENT# admin_site . register ( models , admin_class = admin_class ) #NEWLINE# return admin_class #NEWLINE# #UNINDENT# return kwargs