简体   繁体   中英

Using models between an App and API app in Django Rest framework

I'm going to create API with Django Rest Framework for an existing Django project. I would like to use models of existing app ( product/models.py ) in ' API/models.py ' . Will that work smoothly as of using models across multiple apps using from product.models import item,...

After importing I'll be creating serializers.py .

Can anyone answer me whether this will work?

Yes, this works, we can import and use models of other apps in this way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM