Converted to use Django ORM instead of SQLAlchemy