Django Tutorials: Using Models from Different Files

By: Dusty Arlia
Published on Sunday, April 6, 2014, 12:02 PM
Last Updated on Friday, July 17, 2015 at 4:16 PM
Total Updates: 2

To be able to use a model from a different file, you must import the model:

from django.db import models
from geography.models import ZipCode

class Headquarters(models.Model):
    # ...
    zip_code = models.ForeignKey(ZipCode)

Comments:

Ad:

Ad: