#NEWLINE# def __new__( self , model_name , bases , attrs ) : #NEWLINE# #INDENT# if ( ( not attrs ) and ( model_name == 'NewBase' ) ) : #NEWLINE# #INDENT# if ( django . VERSION < ( 1 , 5 ) ) : #NEWLINE# #INDENT# attrs [ '__module__' ] = 'django.utils.six' #NEWLINE# attrs [ 'Meta' ] = type ( 'Meta' , ( ) , { #NEWLINE# #INDENT# 'abstract' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return super ( PolymorphicModelBase , self ) . __new__ ( self , model_name , bases , attrs ) #NEWLINE# #UNINDENT# new_class = self . call_superclass_new_method ( model_name , bases , attrs ) #NEWLINE# self . validate_model_fields ( new_class ) #NEWLINE# inherited_managers = new_class . get_inherited_managers ( attrs ) #NEWLINE# for ( source_name , mgr_name , manager ) in model_name : #NEWLINE# #INDENT# new_manager = manager . _copy_to_model ( new_class ) #NEWLINE# if ( mgr_name == '_default_manager' ) : #NEWLINE# #INDENT# new_class . _default_manager = new_manager #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# new_class . add_to_class ( mgr_name , new_manager ) #NEWLINE# #UNINDENT# #UNINDENT# user_manager = self . get_first_user_defined_manager ( new_class ) #NEWLINE# if user_manager : #NEWLINE# #INDENT# new_class . _default_manager = user_manager . _copy_to_model ( new_class ) #NEWLINE# new_class . _default_manager . _inherited = False #NEWLINE# #UNINDENT# self . validate_model_manager ( new_class . _default_manager , model_name , '_default_manager' ) #NEWLINE# new_class . polymorphic_super_sub_accessors_replaced = False #NEWLINE# for f in new_class . _meta . fields : #NEWLINE# #INDENT# if ( f . primary_key and ( type ( f ) != models . OneToOneField ) ) : #NEWLINE# #INDENT# new_class . polymorphic_primary_key_name = f . name #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# return new_class