(self, apps_and_models)
Iterates a dictionary of apps and models and creates all the necessary files to get up and running quickly.
Iterates a dictionary of apps and models and creates all the necessary files to get up and running quickly.
Iterates a dictionary of apps and models and creates all the necessary files to get up and running quickly .
def bake(self, apps_and_models):
        """
            Iterates a dictionary of apps and models and creates all the necessary files to get up and running quickly.
        """
        for app_label, models_app in iteritems(apps_and_models):
            models, app = models_app
            models = list(models)
            model_names = {model.__name__: self.get_field_names_for_model(model) for model in models}
            self.create_directories(app)
            self.create_init_files(app, model_names.keys(), models)
            self.remove_empty_startapp_files(app)
            for file_name in ["forms", "admin"]:
                file_path = "%s/%s.py" % (app.path, file_name)
                template_path = "django_baker/%s" % (file_name)
                self.create_file_from_template(file_path, template_path, {"model_names": model_names})
            for model in models:
                model_attributes = self.model_attributes(app, model)
                self.create_files_from_templates(model_attributes)
def bake ( self , apps_and_models ) : for app_label , models_app in iteritems ( apps_and_models ) : models , app = models_app models = list ( models ) model_names = { model . __name__ : self . get_field_names_for_model ( model ) for model in models } self . create_directories ( app ) self . create_init_files ( app , model_names . keys ( ) , models ) self . remove_empty_startapp_files ( app ) for file_name in [ "forms" , "admin" ] : file_path = "%s/%s.py" % ( app . path , file_name ) template_path = "django_baker/%s" % ( file_name ) self . create_file_from_template ( file_path , template_path , { "model_names" : model_names } ) for model in models : model_attributes = self . model_attributes ( app , model ) self . create_files_from_templates ( model_attributes )