开发者

Django: Creating a model instance when duplicate model names exist

In one of my views I am importing models from two apps:

from mysite.business.models import Location
from mysite.directory.models import Location

As you can see, both Models have the same name. If I want to create an instance of one of these models, how do I define which one I requi开发者_如何学Gore?


Give them different names.

from mysite.business.models import Location as BusinessLocation
from mysite.directory.models import Location as DirectoryLocation
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜