├── backend ├── __init__.py ├── migrations │ ├── __init__.py │ ├── 0003_auto_20200811_1833.py │ ├── 0005_auto_20200812_1156.py │ ├── 0006_auto_20200902_1957.py │ ├── 0004_auto_20200812_1055.py │ ├── 0002_auto_20200810_0722.py │ ├── 0007_auto_20200910_2113.py │ └── 0001_initial.py ├── tests.py ├── admin.py ├── apps.py ├── static │ ├── icons │ │ ├── upload.png │ │ ├── arrow-down.svg │ │ ├── user.svg │ │ ├── sign-in-alt.svg │ │ ├── sign-out-alt.svg │ │ ├── pencil-alt.svg │ │ ├── trash-alt.svg │ │ ├── location.svg │ │ ├── thumbs-up.svg │ │ ├── thumbs-down.svg │ │ └── comment.svg │ ├── registration │ │ └── style.css │ └── social │ │ ├── style.css │ │ └── basescript.js ├── views │ ├── __init__.py │ ├── info.py │ ├── profile.py │ ├── authentication.py │ ├── follow.py │ └── post.py ├── permissions.py ├── templates │ ├── social │ │ ├── following.html │ │ └── followers.html │ └── registration │ │ ├── base.html │ │ ├── signup.html │ │ └── login.html ├── forms.py ├── urls.py ├── serializers.py └── models.py ├── frontend ├── __init__.py ├── migrations │ └── __init__.py ├── src │ ├── index.js │ └── components │ │ ├── Comments.js │ │ ├── Index.js │ │ ├── App.js │ │ ├── UserList.js │ │ ├── Sidebar.js │ │ ├── App.css │ │ ├── Profile.js │ │ ├── Settings.js │ │ ├── Post.js │ │ └── Misc.js ├── models.py ├── admin.py ├── tests.py ├── .babelrc ├── apps.py ├── static │ ├── icons │ │ ├── upload.png │ │ ├── arrow-down.svg │ │ ├── user.svg │ │ ├── sign-in-alt.svg │ │ ├── sign-out-alt.svg │ │ ├── pencil-alt.svg │ │ ├── trash-alt.svg │ │ ├── location.svg │ │ ├── thumbs-up.svg │ │ ├── thumbs-down.svg │ │ └── comment.svg │ ├── registration │ │ └── style.css │ └── social │ │ └── style.css ├── templates │ └── frontend │ │ └── app.html ├── urls.py ├── webpack.config.js ├── views.py └── package.json ├── socialproject ├── __init__.py ├── wsgi.py ├── urls.py └── settings.py ├── requirements.txt ├── manage.py └── .gitignore /backend/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /socialproject/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backend/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/index.js: -------------------------------------------------------------------------------- 1 | import App from "./components/App"; -------------------------------------------------------------------------------- /backend/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /frontend/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /backend/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /frontend/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /frontend/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /frontend/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-env", "@babel/preset-react" 4 | ] 5 | } -------------------------------------------------------------------------------- /backend/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BackendConfig(AppConfig): 5 | name = 'backend' 6 | -------------------------------------------------------------------------------- /backend/static/icons/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxknivets/drf-social-network/HEAD/backend/static/icons/upload.png -------------------------------------------------------------------------------- /frontend/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FrontendConfig(AppConfig): 5 | name = 'frontend' 6 | -------------------------------------------------------------------------------- /frontend/static/icons/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxknivets/drf-social-network/HEAD/frontend/static/icons/upload.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Django==2.2.19 2 | djangorestframework==3.12.4 3 | django-cors-headers==3.7.0 4 | django-currentuser==0.5.2 5 | Pillow==8.2.0 -------------------------------------------------------------------------------- /backend/views/__init__.py: -------------------------------------------------------------------------------- 1 | from .authentication import * 2 | from .post import * 3 | from .follow import * 4 | from .info import * 5 | from .profile import * -------------------------------------------------------------------------------- /backend/static/registration/style.css: -------------------------------------------------------------------------------- 1 | span { 2 | text-align: center; 3 | font-size: 2em; 4 | display: block; 5 | } 6 | 7 | ul { 8 | width: 70%; 9 | margin: auto; 10 | } 11 | -------------------------------------------------------------------------------- /frontend/static/registration/style.css: -------------------------------------------------------------------------------- 1 | span { 2 | text-align: center; 3 | font-size: 2em; 4 | display: block; 5 | } 6 | 7 | ul { 8 | width: 70%; 9 | margin: auto; 10 | } 11 | -------------------------------------------------------------------------------- /backend/permissions.py: -------------------------------------------------------------------------------- 1 | from rest_framework import permissions 2 | 3 | 4 | class IsPostOwner(permissions.BasePermission): 5 | 6 | def has_object_permission(self, request, view, post): 7 | if request.method in permissions.SAFE_METHODS: 8 | return True 9 | return post.posted_by == request.user -------------------------------------------------------------------------------- /backend/static/icons/arrow-down.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backend/static/icons/user.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/static/icons/arrow-down.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/static/icons/user.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backend/static/icons/sign-in-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/static/icons/sign-in-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backend/static/icons/sign-out-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/static/icons/sign-out-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /socialproject/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for root project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "socialproject.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /backend/migrations/0003_auto_20200811_1833.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2 on 2020-08-11 15:33 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('backend', '0002_auto_20200810_0722'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='postrate', 15 | name='liked', 16 | field=models.BooleanField(null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /backend/templates/social/following.html: -------------------------------------------------------------------------------- 1 |
2 |{props.post.text}
82 | 83 | {props.post.image && // this is for later 84 |
Posted on ${post_date}