#NEWLINE# def __init__( self , cls , app ) : #NEWLINE# #INDENT# self . default_app = app #NEWLINE# self . cls = cls #NEWLINE# self . models = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# try : #NEWLINE# #INDENT# self . models_source = cls . models #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# hacks . clear_app_cache ( ) #NEWLINE# model_names = [ ] #NEWLINE# for ( name , data ) in self . models_source . items ( ) : #NEWLINE# #INDENT# if ( 'Meta' not in data ) : #NEWLINE# #INDENT# data [ 'Meta' ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# ( app_label , model_name ) = name . split ( '.' , 1 ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# app_label = self . default_app #NEWLINE# model_name = name #NEWLINE# #UNINDENT# if ( 'object_name' in data [ 'Meta' ] ) : #NEWLINE# #INDENT# model_name = data [ 'Meta' ] [ 'object_name' ] #NEWLINE# del data [ 'Meta' ] [ 'object_name' ] #NEWLINE# #UNINDENT# name = ( '%s.%s' % ( app_label , model_name ) ) #NEWLINE# self . models [ name . lower ( ) ] = name #NEWLINE# model_names . append ( ( name . lower ( ) , app_label , model_name , data ) ) #NEWLINE# #UNINDENT# last_size = None #NEWLINE# while model_names : #NEWLINE# #INDENT# if ( len ( model_names ) == last_size ) : #NEWLINE# #INDENT# raise ImpossibleORMUnfreeze ( ) #NEWLINE# #UNINDENT# last_size = len ( model_names ) #NEWLINE# postponed_model_names = [ ] #NEWLINE# for ( name , app_label , model_name , data ) in model_names : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . models [ name ] = self . make_model ( cls , model_name , data ) #NEWLINE# #UNINDENT# except UnfreezeMeLater : #NEWLINE# #INDENT# postponed_model_names . append ( ( name , app_label , model_name , data ) ) #NEWLINE# #UNINDENT# #UNINDENT# model_names = postponed_model_names #NEWLINE# #UNINDENT# self . retry_failed_fields ( ) #NEWLINE# for model in self . models . values ( ) : #NEWLINE# #INDENT# model . _meta . get_all_field_names ( ) #NEWLINE# #UNINDENT# hacks . unclear_app_cache ( )