-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating django import script "all_models"
- Loading branch information
Victor Ferraz
committed
Feb 14, 2016
1 parent
a1b6477
commit fdae3ff
Showing
1 changed file
with
5 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
def load(__builtin__): | ||
def load(__builtin__, exclude=[]): | ||
from django.apps import apps | ||
|
||
for _, models in apps.all_models.items(): | ||
for model in models.values(): | ||
setattr(__builtin__, model.__name__, model) | ||
for app, models in apps.all_models.items(): | ||
if app not in exclude: | ||
for model in models.values(): | ||
setattr(__builtin__, model.__name__, model) |