[Django]-How to deal with circular imports in tastypie

6👍

You don’t need to import the other resource in each module. Try using a string as the argument instead.

class StudentResource(ModelResource):
    course = fields.ForeignKey('website.api.course.CourseResource', "course")

class CourseResource(ModelResource):
    student = fields.ForeignKey('website.api.student.StudentResource', "student")

Leave a comment