Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
/ Dispo-Django-Demo Public archive

A demo API that allows users to create and like posts and follow other users, completed on request as a demonstration for Dispo.

Notifications You must be signed in to change notification settings

BrianPi/Dispo-Django-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dispo Django Demo

A demo API that allows users to create and like posts and follow other users, completed on request as a demonstration for Dispo.

Features

  1. POST endpoints for user, post, and user following. PUT endpoint for toggling post likes.

  2. GET /users/top, which returns a list of users with one or more posts sorted by number of posts authored descending, and GET /users/feed/<user_id> that returns a list of posts created by the user or anyone they follow with number of likes received in reverse chronological order.

  3. A custom post serializer, so that post output has the following structure:

    {
      "id": <post id>,
      "body": <post body>,
      "author": <post author's username>,
      "likes": <post like count>
    }
    
  4. A custom user class, derived from AbstractUser, to allow for follow relations while still using the basic Django user authentication. It's worth noting that this class invites potential database migration pain if it needs to be modified.

Setup

  • After installing Poetry, use poetry install to set up your environment.
    • Alternatively, you can manage the django and djangorestframework dependencies yourself.
  • Initialize SQLite database
    • Poetry: poetry run python manage.py migrate
  • Run the server (default port 8000)
    • Poetry: poetry run python manage.py runserver

LICENSE

DO NOT USE. THIS REPO IS FOR EVALUATION AND TESTING PURPOSES ONLY.

About

A demo API that allows users to create and like posts and follow other users, completed on request as a demonstration for Dispo.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages