Using Python, JavaScript, HTML, and CSS, complete the implementation of a social network that allows users to make posts, follow other users, and like posts.
All requirements can be viewed here: https://cs50.harvard.edu/web/2020/projects/4/network/
Live version can be viewed here: https://cs-50-network.herokuapp.com/ (it might take a second to load 😉)
You must be registered to use options such as commenting, profile picture, following and so on.
On this repository you can find 2 versions of this project:
- master branch: allows file uploads for user profile
- live-server-version branch: uses img url istead of file upload to avoid using s3 buckets for demonstration
To set up this project on your computer:
- Clone the project
- Install all necessary dependencies
pip install -r requirements.txt
- Make a migration
python manage.py migrate
Contains User Model extension with additional fields.
Fields:
- name - user's name
- date_of_birth - user's birth date
- about - additional info about the user
- country - user's birth place
- image - user's profile photo
Contains all post info.
Fields:
- user - who posted the post
- content - post's inner text
- date - post's publication date
Contains all comment info.
Fields:
- user - who posted the comment
- post - the post which is being commented
- content - comment's inner text
- date - comment's publication date
Contains all like info.
Fields:
- user - who liked a post/comment
- post - the post which has been liked
- comment - the comment which has been liked
- emoji_type - the emoji used as a like, available emojis:
- like
- dislike
- smile
- heart
- thanks
Contains all who follows who info.
Fields:
- user - user who is following
- user_followed - user who is being followed
Here you can:
- View all posts
- Edit posts (if you are the post's creator; only for logged-in users)
- Delete posts (if you are the post's creator; only for logged-in users)
- Like them (only for logged-in users)
- Create a new post (only for logged-in users)
- View all comments (only for logged-in users)
- Create a comment (only for logged-in users)
- Delete a comment (if you are the comment's creator; only for logged-in users)
- Edit a comment (if you are the comment's creator; only for logged-in users)
(only for logged-in users)
Controls saving of a new post/comment (only POST method allowed).
(only for logged-in users)
Here you can:
- View user's bio
- View all user's posts
- Edit posts (if you are the post's creator)
- Delete posts (if you are the post's creator)
- Like them
- View all comments on user's posts
- Create a comment
- Delete a comment (if you are the comment's creator)
- Edit a comment (if you are the comment's creator)
- Follow the user (if you are not this user)
- Click on edit profile button (if you are this user)
(only for logged-in users)
Here you can:
- Change your name
- Change your birthdate
- Change your about info
- Change your profile picture
- Change your country
(only for logged-in users)
Controls all actions regarding liking:
- Add a new like
- Change a like's emoji
(only for logged-in users)
Here you can:
- View all posts created by followed users
- Like them
- View all comments
- Create a comment
- Delete a comment (if you are the comment's creator)
- Edit a comment (if you are the comment's creator)
(only for logged-in users)
Controls following/unfollowing users (only POST method allowed).
Controls logging in.
Controls logging out.
Controls registration.
There are 4 main test cases:
- ModelsTestCase - checks database integrity
- FormsTestCase - makes sure that forms work correctly
- ViewsTestCase - makes sure that all views work correctly and give proper responses
- FrontEndTestCase - uses Selenium to simulate user interaction with every element on the page
Test requirements can be viewed in test requirents.md
Special thanks to Brian and the entire CS50 team for making learning easy, engaging, and free.