Python Challenge.docx
Python Challenge.docx
Design and implement a Django API for a social media platform that allows users to create posts,
follow other users, and comment on posts.
The API should include (but may not be limited to) the following models:
User: Represents a user on the platform. Include fields for username, email, password, and
followers/following relationships.
Post: Represents a user's post. Include fields for the author (foreign key to User model),
content, and timestamps (date created).
Comment: Represents a comment on a post. Include fields for the author (foreign key to User
model), post (foreign key to Post model), and content.
Ensure that all endpoints require authentication. Implement token-based authentication using
Django's built-in authentication system.
Optimize the ORM queries to minimize the number of database hits and improve performance.
Write unit tests to ensure the API endpoints and ORM queries are functioning correctly.
1/2
Submission:
Provide the source code of your Django project, including all necessary files and folders.
Include a README file with instructions on how to set up and run the project.
Briefly explain the optimizations applied to the ORM queries and any challenges faced during the
implementation.
Evaluation Criteria:
Correctness: Verify that the API endpoints are functioning as expected and that the ORM queries
are optimized.
Code Quality: Assess the overall code organization, adherence to best practices, and proper use
of Django REST framework.
Optimized Queries: Evaluate the effectiveness of the applied optimizations and their impact on
query performance.
Testing: Check the presence of unit tests and their coverage of the API endpoints and ORM
queries.
2/2