harvesthealth commited on
Commit
bbb673b
·
verified ·
1 Parent(s): e3a9f43

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +11 -0
  2. .gitignore +10 -288
  3. .hfignore +8 -0
  4. 4nm20cs139_Web-Report.pdf +3 -0
  5. Dockerfile +34 -10
  6. LICENSE +21 -0
  7. README.md +124 -53
  8. requirements.txt +17 -6
  9. socials/base/__init__.py +0 -0
  10. socials/base/admin.py +12 -0
  11. socials/base/apps.py +6 -0
  12. socials/base/forms.py +73 -0
  13. socials/base/migrations/0001_initial.py +137 -0
  14. socials/base/migrations/__init__.py +0 -0
  15. socials/base/models.py +77 -0
  16. socials/base/templates/base/404.html +22 -0
  17. socials/base/templates/base/Otherprofile.html +61 -0
  18. socials/base/templates/base/add_comment.html +25 -0
  19. socials/base/templates/base/add_post.html +30 -0
  20. socials/base/templates/base/change-password.html +27 -0
  21. socials/base/templates/base/create_user_profile.html +35 -0
  22. socials/base/templates/base/delete_post.html +33 -0
  23. socials/base/templates/base/edit_profile_page.html +39 -0
  24. socials/base/templates/base/friends.html +48 -0
  25. socials/base/templates/base/home.html +281 -0
  26. socials/base/templates/base/login.html +38 -0
  27. socials/base/templates/base/password_success.html +15 -0
  28. socials/base/templates/base/profile.html +40 -0
  29. socials/base/templates/base/search.html +55 -0
  30. socials/base/templates/base/signup.html +45 -0
  31. socials/base/templates/base/update_post.html +36 -0
  32. socials/base/tests.py +16 -0
  33. socials/base/urls.py +33 -0
  34. socials/base/views.py +274 -0
  35. socials/manage.py +22 -0
  36. socials/socials/__init__.py +0 -0
  37. socials/socials/asgi.py +16 -0
  38. socials/socials/settings.py +140 -0
  39. socials/socials/urls.py +22 -0
  40. socials/socials/wsgi.py +16 -0
  41. socials/static/images/friends/banner.jpg +0 -0
  42. socials/static/images/friends/img-1.jpg +0 -0
  43. socials/static/images/friends/img-2.jpg +0 -0
  44. socials/static/images/friends/img-3.jpeg +3 -0
  45. socials/static/images/friends/img-4.webp +0 -0
  46. socials/static/images/friends/img-5.jpg +0 -0
  47. socials/static/images/friends/img-6.jpg +0 -0
  48. socials/static/images/friends/img-7.webp +0 -0
  49. socials/static/images/friends/img-8.webp +0 -0
  50. socials/static/images/friends/img-9.png +3 -0
.gitattributes ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 4nm20cs139_Web-Report.pdf filter=lfs diff=lfs merge=lfs -text
2
+ socials/static/images/friends/img-3.jpeg filter=lfs diff=lfs merge=lfs -text
3
+ socials/static/images/friends/img-9.png filter=lfs diff=lfs merge=lfs -text
4
+ socials/static/images/home/feed-1.jpg filter=lfs diff=lfs merge=lfs -text
5
+ socials/static/images/home/feed-2.jpg filter=lfs diff=lfs merge=lfs -text
6
+ socials/static/images/home/feed-3.jpg filter=lfs diff=lfs merge=lfs -text
7
+ socials/static/images/home/feed-4.jpg filter=lfs diff=lfs merge=lfs -text
8
+ socials/static/images/home/feed-5.jpg filter=lfs diff=lfs merge=lfs -text
9
+ socials/static/images/home/feed-6.jpg filter=lfs diff=lfs merge=lfs -text
10
+ socials/static/images/posts/photo-3.jpg filter=lfs diff=lfs merge=lfs -text
11
+ socials/static/images/signup.png filter=lfs diff=lfs merge=lfs -text
.gitignore CHANGED
@@ -1,291 +1,13 @@
1
- .DS_Store
2
- .vscode/
3
-
4
- # Build artifacts
5
- dash_ag_grid/*
6
- !dash_ag_grid/__init__.py
7
- R/
8
- deps/
9
- man/
10
- inst/
11
- DESCRIPTION
12
- NAMESPACE
13
- Project.toml
14
- src/*.jl
15
- src/jl/*.jl
16
- lib/
17
-
18
- # Created by .ignore support plugin (hsz.mobi)
19
- ### VisualStudioCode template
20
- .vscode/*
21
- !.vscode/settings.json
22
- !.vscode/tasks.json
23
- !.vscode/launch.json
24
- !.vscode/extensions.json
25
- ### JetBrains template
26
- # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
27
- # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
28
-
29
- # User-specific stuff
30
- .idea/**/workspace.xml
31
- .idea/**/tasks.xml
32
- .idea/**/usage.statistics.xml
33
- .idea/**/dictionaries
34
- .idea/**/shelf
35
-
36
- # Sensitive or high-churn files
37
- .idea/**/dataSources/
38
- .idea/**/dataSources.ids
39
- .idea/**/dataSources.local.xml
40
- .idea/**/sqlDataSources.xml
41
- .idea/**/dynamic.xml
42
- .idea/**/uiDesigner.xml
43
- .idea/**/dbnavigator.xml
44
-
45
- # Gradle
46
- .idea/**/gradle.xml
47
- .idea/**/libraries
48
-
49
- # Gradle and Maven with auto-import
50
- # When using Gradle or Maven with auto-import, you should exclude module files,
51
- # since they will be recreated, and may cause churn. Uncomment if using
52
- # auto-import.
53
- # .idea/modules.xml
54
- # .idea/*.iml
55
- # .idea/modules
56
-
57
- # CMake
58
- cmake-build-*/
59
-
60
- # Mongo Explorer plugin
61
- .idea/**/mongoSettings.xml
62
-
63
- # File-based project format
64
- *.iws
65
-
66
- # IntelliJ
67
- out/
68
-
69
- # mpeltonen/sbt-idea plugin
70
- .idea_modules/
71
-
72
- # JIRA plugin
73
- atlassian-ide-plugin.xml
74
-
75
- # Cursive Clojure plugin
76
- .idea/replstate.xml
77
-
78
- # Crashlytics plugin (for Android Studio and IntelliJ)
79
- com_crashlytics_export_strings.xml
80
- crashlytics.properties
81
- crashlytics-build.properties
82
- fabric.properties
83
-
84
- # Editor-based Rest Client
85
- .idea/httpRequests
86
- ### Node template
87
- # Logs
88
- logs
89
- *.log
90
- npm-debug.log*
91
- yarn-debug.log*
92
- yarn-error.log*
93
-
94
- # Runtime data
95
- pids
96
- *.pid
97
- *.seed
98
- *.pid.lock
99
-
100
- # Directory for instrumented libs generated by jscoverage/JSCover
101
- lib-cov
102
-
103
- # Coverage directory used by tools like istanbul
104
- coverage
105
-
106
- # nyc test coverage
107
- .nyc_output
108
-
109
- # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
110
- .grunt
111
-
112
- # Bower dependency directory (https://bower.io/)
113
- bower_components
114
-
115
- # node-waf configuration
116
- .lock-wscript
117
-
118
- # Compiled binary addons (https://nodejs.org/api/addons.html)
119
- build/Release
120
-
121
- # Dependency directories
122
- node_modules/
123
- jspm_packages/
124
-
125
- # TypeScript v1 declaration files
126
- typings/
127
-
128
- # Optional npm cache directory
129
- .npm
130
-
131
- # Optional eslint cache
132
- .eslintcache
133
-
134
- # Optional REPL history
135
- .node_repl_history
136
-
137
- # Output of 'npm pack'
138
- *.tgz
139
-
140
- # Yarn Integrity file
141
- .yarn-integrity
142
-
143
- # dotenv environment variables file
144
  .env
145
-
146
- # parcel-bundler cache (https://parceljs.org/)
147
- .cache
148
-
149
- # next.js build output
150
- .next
151
-
152
- # nuxt.js build output
153
- .nuxt
154
-
155
- # vuepress build output
156
- .vuepress/dist
157
-
158
- # Serverless directories
159
- .serverless
160
- ### Python template
161
- # Byte-compiled / optimized / DLL files
162
- __pycache__/
163
- *.py[cod]
164
- *$py.class
165
-
166
- # C extensions
167
- *.so
168
-
169
- # Distribution / packaging
170
- .Python
171
- build/
172
- develop-eggs/
173
- dist/
174
- downloads/
175
- eggs/
176
- .eggs/
177
- lib64/
178
- parts/
179
- sdist/
180
- var/
181
- wheels/
182
- *.egg-info/
183
- .installed.cfg
184
- *.egg
185
- MANIFEST
186
-
187
- # PyInstaller
188
- # Usually these files are written by a python script from a template
189
- # before PyInstaller builds the exe, so as to inject date/other infos into it.
190
- *.manifest
191
- *.spec
192
-
193
- # Installer logs
194
- pip-log.txt
195
- pip-delete-this-directory.txt
196
-
197
- # Unit test / coverage reports
198
- htmlcov/
199
- .tox/
200
- .coverage
201
- .coverage.*
202
- nosetests.xml
203
- coverage.xml
204
- *.cover
205
- .hypothesis/
206
- .pytest_cache/
207
-
208
- # Translations
209
- *.mo
210
- *.pot
211
-
212
- # Django stuff:
213
- local_settings.py
214
- db.sqlite3
215
-
216
- # Flask stuff:
217
- instance/
218
- .webassets-cache
219
-
220
- # Scrapy stuff:
221
- .scrapy
222
-
223
- # Sphinx documentation
224
- docs/_build/
225
-
226
- # PyBuilder
227
- target/
228
-
229
- # Jupyter Notebook
230
- .ipynb_checkpoints
231
-
232
- # pyenv
233
- .python-version
234
-
235
- # celery beat schedule file
236
- celerybeat-schedule
237
-
238
- # SageMath parsed files
239
- *.sage.py
240
-
241
- # Environments
242
- .venv
243
  env/
244
- venv/
245
- ENV/
246
- env.bak/
247
- venv.bak/
248
-
249
- # Spyder project settings
250
- .spyderproject
251
- .spyproject
252
-
253
- # Rope project settings
254
- .ropeproject
255
-
256
- # mkdocs documentation
257
- /site
258
-
259
- # mypy
260
- .mypy_cache/
261
- ### SublimeText template
262
- # Cache files for Sublime Text
263
- *.tmlanguage.cache
264
- *.tmPreferences.cache
265
- *.stTheme.cache
266
-
267
- # Workspace files are user-specific
268
- *.sublime-workspace
269
-
270
- # Project files should be checked into the repository, unless a significant
271
- # proportion of contributors will probably not be using Sublime Text
272
- # *.sublime-project
273
-
274
- # SFTP configuration file
275
- sftp-config.json
276
-
277
- # Package control specific files
278
- Package Control.last-run
279
- Package Control.ca-list
280
- Package Control.ca-bundle
281
- Package Control.system-ca-bundle
282
- Package Control.cache/
283
- Package Control.ca-certs/
284
- Package Control.merged-ca-bundle
285
- Package Control.user-ca-bundle
286
- oscrypto-ca-bundle.crt
287
- bh_unicode_properties.cache
288
 
289
- # Sublime-github package stores a github token in this file
290
- # https://packagecontrol.io/packages/sublime-github
291
- GitHub.sublime-settings
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  .env
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  env/
3
+ socials/db.sqlite3
4
+ socials/base/__pycache__/
5
+ socials/base/migrations/__pycache__/
6
+ socials/socials/__pycache__/
7
+ socials/media/
8
+ socials/staticfiles/
9
+ *.log
10
+ *.pot
11
+ *.pyc
12
+ __pycache__
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
 
 
 
.hfignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ .git
2
+ __pycache__
3
+ *.pyc
4
+ env/
5
+ venv/
6
+ .env
7
+ db.sqlite3
8
+ media/
4nm20cs139_Web-Report.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:495dcf035c21f349cbd42fb544f90834b426e780f08d0c3a822478694d89a31a
3
+ size 1251056
Dockerfile CHANGED
@@ -1,16 +1,40 @@
1
- FROM python:3.12
2
- COPY --from=ghcr.io/astral-sh/uv:0.4.20 /uv /bin/uv
3
 
4
- RUN useradd -m -u 1000 user
5
- ENV PATH="/home/user/.local/bin:$PATH"
6
- ENV UV_SYSTEM_PYTHON=1
7
 
 
8
  WORKDIR /app
9
 
10
- COPY --chown=user ./requirements.txt requirements.txt
11
- RUN uv pip install -r requirements.txt
 
 
 
12
 
13
- COPY --chown=user . /app
14
- USER user
15
 
16
- CMD ["gunicorn", "app:server", "--workers", "4", "--bind", "0.0.0.0:7860"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
 
2
 
3
+ # Set environment variables
4
+ ENV PYTHONDONTWRITEBYTECODE 1
5
+ ENV PYTHONUNBUFFERED 1
6
 
7
+ # Set work directory
8
  WORKDIR /app
9
 
10
+ # Install system dependencies
11
+ RUN apt-get update && apt-get install -y --no-install-recommends \
12
+ build-essential \
13
+ libpq-dev \
14
+ && rm -rf /var/lib/apt/lists/*
15
 
16
+ # Install uv
17
+ RUN pip install uv
18
 
19
+ # Copy requirements
20
+ COPY requirements.txt .
21
+
22
+ # Install dependencies using uv
23
+ RUN uv pip install --system -r requirements.txt
24
+
25
+ # Copy project
26
+ COPY . .
27
+
28
+ # Create a non-root user
29
+ RUN useradd -m appuser
30
+ RUN chown -R appuser:appuser /app
31
+ USER appuser
32
+
33
+ # Set the path to include the user's local bin
34
+ ENV PATH="/home/appuser/.local/bin:${PATH}"
35
+
36
+ # Expose port 7860
37
+ EXPOSE 7860
38
+
39
+ # Run migrations and start server
40
+ CMD ["sh", "-c", "cd socials && python manage.py migrate && gunicorn socials.wsgi:application --bind 0.0.0.0:7860"]
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Prathiksha Kini
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,93 +1,164 @@
1
  ---
2
  title: Dashboards Plotly
3
  emoji: 📊
 
 
4
  sdk: docker
5
- app_file: app.py
6
- pinned: true
7
  ---
8
 
9
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
10
 
11
- # Dash on Spaces
12
 
13
- ![Gapminder Dashboard Screenshot](screenshot.png)
 
14
 
15
- With Dash Open Source, you can create data apps on your laptop in pure Python, no JavaScript required.
 
 
 
 
 
16
 
17
- Get familiar with Dash by building a [sample app](https://dash.plotly.com/tutorial) with open source. Scale up with [Dash Enterprise](https://plotly.com/dash/) when your Dash app is ready for department or company-wide consumption. Or, launch your initiative with Dash Enterprise from the start to unlock developer productivity gains and hands-on acceleration from Plotly's team.
 
 
18
 
19
- ## Deploy Dash on Spaces
 
 
20
 
21
- To get started with Dash on Spaces, click the button below:
22
 
23
- <a href="http://huggingface.co/new-space?template=plotly/dash-app-template" target="_blank">
24
- <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/deploy-to-spaces-lg.svg" alt="">
25
- </a>
 
 
 
 
 
 
 
 
 
26
 
27
- This will start building your Space using Plotly's Dash Docker template. If successful, you should see a similar application to the [Dash template app](https://huggingface.co/spaces/dash/dash-app-template).
28
 
29
- ## Customizing your Dash app
 
 
 
 
 
30
 
31
- If you have never built with Dash before, we recommend getting started with our [Dash in 20 minutes tutorial](https://dash.plotly.com/tutorial).
32
 
33
- When you create a Dash Space, you'll get a few key files to help you get started:
 
 
 
 
 
34
 
35
- ### 1. app.py
36
 
37
- This is the main app file that defines the core logic of your project. Dash apps are often structured as modules, and you can optionally seperate your layout, callbacks, and data into other files, like `layout.py`, etc.
 
 
 
 
 
 
 
38
 
39
- Inside of `app.py` you will see:
40
 
41
- 1. `from dash import Dash, html`
42
- We import the `Dash` object to define our app, and the `html` library, which gives us building blocks to assemble our project.
 
 
 
 
 
 
43
 
44
- 2. `app = Dash()`
45
- Here, we define our app. Layout, server, and callbacks are _bound_ to the `app` object.
46
 
47
- 3. `server = app.server`
48
- Here, we define our server variable, which is used to run the app in production.
 
 
 
49
 
50
- 4. `app.layout = `
51
- The starter app layout is defined as a list of Dash components, an indivdual Dash component, or a function that returns either.
52
 
53
- The `app.layout` is your initial layout that will be updated as a single-page application by callbacks and other logic in your project.
54
 
55
- 5. `if __name__ == '__main__': app.run(debug=True)`
56
- If you are running your project locally with `python app.py`, `app.run(...)` will execute and start up a development server to work on your project, with features including hot reloading, the callback graph, and more.
 
57
 
58
- In production, we recommend `gunicorn`, which is a production-grade server. Debug features will not be enabled when running your project with `gunicorn`, so this line will never be reached.
 
 
59
 
60
- ### 2. Dockerfile
61
 
62
- The Dockerfile for a Dash app is minimal since Dash has few system dependencies. The key requirements are:
63
 
64
- - It installs the dependencies listed in `requirements.txt` (using `uv`)
65
- - It creates a non-root user for security
66
- - It runs the app with `gunicorn` using `gunicorn app:server --workers 4`
 
67
 
68
- You may need to modify this file if your application requires additional system dependencies, permissions, or other CLI flags.
 
69
 
70
- ### 3. requirements.txt
 
 
 
71
 
72
- The Space will automatically install dependencies listed in the `requirements.txt` file. At minimum, you must include `dash` and `gunicorn` in this file. You will want to add any other required packages your app needs.
73
 
74
- The Dash Space template provides a basic setup that you can extend based on your needs.
 
 
 
 
 
75
 
76
- ## Additional Resources and Support
77
 
78
- - [Dash documentation](https://dash.plotly.com)
79
- - [Dash GitHub repository](https://github.com/plotly/dash)
80
- - [Dash Community Forums](https://community.plotly.com)
81
- - [Dash Enterprise](https://plotly.com/dash)
82
- - [Dash template Space](https://huggingface.co/spaces/plotly/dash-app-template)
83
 
84
- ## Troubleshooting
85
 
86
- If you encounter issues:
87
 
88
- 1. Make sure your notebook runs locally in app mode using `python app.py`
89
- 2. Check that all required packages are listed in `requirements.txt`
90
- 3. Verify the port configuration matches (7860 is the default for Spaces)
91
- 4. Check Space logs for any Python errors
92
 
93
- For more help, visit the [Plotly Community Forums](https://community.plotly.com) or [open an issue](https://github.com/plotly/dash/issues).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  title: Dashboards Plotly
3
  emoji: 📊
4
+ colorFrom: blue
5
+ colorTo: indigo
6
  sdk: docker
7
+ pinned: false
8
+ app_port: 7860
9
  ---
10
 
11
+ # Social-media-web-app
12
 
 
13
 
14
+ <p align="center"> <img src="https://user-images.githubusercontent.com/84091455/208230388-5ca38084-1973-49fd-883a-bbdb4f51d3a6.png" height=200 /> </p>
15
+ <br>
16
 
17
+ <p align="center">
18
+ <a href="https://codeclimate.com/github/pkini2002/Social-media-web-app/maintainability">
19
+ <img src="https://api.codeclimate.com/v1/badges/b79b9943a5cb4340c05f/maintainability" /></a>
20
+ <a href="https://codeclimate.com/github/pkini2002/Social-media-web-app/test_coverage">
21
+ <img src="https://api.codeclimate.com/v1/badges/b79b9943a5cb4340c05f/test_coverage" /></a>
22
+ </p>
23
 
24
+ <p align="center">
25
+ <a href="https://www.python.org/"><img src="https://forthebadge.com/images/badges/made-with-python.svg" border="0" title="Made with Python" />
26
+ </p>
27
 
28
+ <p align="center">
29
+ <a href="http://www.djangoproject.com/"><img src="https://www.djangoproject.com/m/img/badges/djangopowered126x54.gif" border="0" alt="Powered by Django." title="Powered by Django." /></a>
30
+ </p>
31
 
32
+ ### Pages
33
 
34
+ - Login Page
35
+ - Signup Page
36
+ - Create Profile Page
37
+ - Edit Profile Page
38
+ - Create Post Page
39
+ - Delete Post Page
40
+ - Update post page
41
+ - Password Reset Page
42
+ - Feed/Home page
43
+ - User Profile Page
44
+ - Search Results Page
45
+ - Post Comment Page
46
 
47
+ ### Features
48
 
49
+ - Follow/Unfollow Users
50
+ - Like/Unlike the posts
51
+ - Download the post images
52
+ - Comment on user posts
53
+ - User suggestion section
54
+ - Search users through the search bar
55
 
56
+ ### Tools and Techs
57
 
58
+ Backend Framework: `Django`
59
+ <br/><br/>
60
+ Front-end : `Bootstrap, SCSS, HTML,CSS, Javascript`
61
+ <br/><br/>
62
+ Database: `Sqlite3`
63
+ <br/><br/>
64
 
65
+ ### Installation
66
 
67
+ 1. - Fork the [repo](https://github.com/pkini2002/Social-media-web-app)
68
+ - Clone the repo to your local system
69
+ ```git
70
+ git clone https://github.com/pkini2002/Social-media-web-app.git
71
+ cd Social-media-web-app
72
+ ```
73
+ Make sure you have python installed on your system.
74
+ 2. Create a Virtual Environment for the Project
75
 
76
+ If u don't have a virtualenv installed
77
 
78
+ ```bash
79
+ pip install virtualenv
80
+ ```
81
+ **For Windows Users**
82
+ ```bash
83
+ virtualenv env
84
+ env/Scripts/activate
85
+ ```
86
 
 
 
87
 
88
+ **For Linux Users**
89
+ ```bash
90
+ virtualenv env
91
+ source env/Scripts/activate
92
+ ```
93
 
94
+ If you are giving a different name than `env`, mention it in `.gitignore` first
 
95
 
96
+ 3. Install all the requirements
97
 
98
+ ```bash
99
+ pip install -r requirements.txt
100
+ ```
101
 
102
+ ```bash
103
+ cd socials
104
+ ```
105
 
 
106
 
107
+ 4. Make migrations/ Create db.sqlite3
108
 
109
+ ```bash
110
+ python manage.py makemigrations
111
+ python manage.py migrate
112
+ ```
113
 
114
+ 5. Create a super user.
115
+ This is to access Admin panel and admin specific pages.
116
 
117
+ ```djangotemplate
118
+ python manage.py createsuperuser
119
+ ```
120
+
121
 
122
+ Enter your username, email and password.
123
 
124
+ 6. Run server
125
+ ```bash
126
+ python manage.py runserver
127
+
128
+
129
+ ### Snapshots
130
 
131
+ **1. Signup Page**
132
 
133
+ ![Signup page](https://user-images.githubusercontent.com/84091455/208101528-a448872c-6e8c-4f9e-b287-1c64a58d0c6f.png)
 
 
 
 
134
 
135
+ **2. Login Page**
136
 
137
+ ![Login page](https://user-images.githubusercontent.com/84091455/208101465-29c16377-81a7-47c5-a051-c5ca103994a2.png)
138
 
139
+ **3. Home/Feed Page**
 
 
 
140
 
141
+ ![Home Page](https://user-images.githubusercontent.com/84091455/208101566-beb72751-bfe6-4d4e-939a-09352b517206.png)
142
+
143
+ **4. Comment Display**
144
+
145
+ ![Comment Display](https://user-images.githubusercontent.com/84091455/208101614-3500b844-f657-494f-b998-9bde17824aeb.png)
146
+
147
+ **5. Profile Pages**
148
+
149
+ **User Profile**
150
+
151
+ ![Show Profile](https://user-images.githubusercontent.com/84091455/208101687-2ed8cc97-7e6b-4f65-b7cc-d0aaae732d14.png)
152
+
153
+ **Other's Profile**
154
+
155
+ ![127 0 0 1_8000_4_profile_(Nest Hub)](https://user-images.githubusercontent.com/84091455/208229214-687fcdea-72a0-4f86-afc4-1253629006e8.png)
156
+
157
+
158
+ **6. Search Result Users Page**
159
+
160
+ ![Search Result](https://user-images.githubusercontent.com/84091455/208101657-497a2549-c882-4a50-93eb-fcd261201a13.png)
161
+
162
+ **7. Create a user profile page**
163
+
164
+ ![Create user profile](https://user-images.githubusercontent.com/84091455/208101772-e022f7ee-5c8f-4799-b0be-b5d43effd1d9.png)
requirements.txt CHANGED
@@ -1,6 +1,17 @@
1
- dash
2
- dash-mantine-components
3
- dash-iconify
4
- plotly
5
- pandas
6
- gunicorn
 
 
 
 
 
 
 
 
 
 
 
 
1
+ asgiref>=3.6.0
2
+ Django==4.2.24
3
+ django-appconf==1.0.5
4
+ django-ckeditor==6.5.1
5
+ django-compressor==4.1
6
+ django-crispy-forms==1.14.0
7
+ django-filter==22.1
8
+ django-js-asset==2.0.0
9
+ django-libsass==0.9
10
+ gunicorn==23.0.0
11
+ libsass==0.21.0
12
+ Pillow==10.3.0
13
+ rcssmin==1.1.0
14
+ rjsmin==1.2.0
15
+ six==1.16.0
16
+ sqlparse==0.5.0
17
+ tzdata==2022.2
socials/base/__init__.py ADDED
File without changes
socials/base/admin.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from django.contrib import admin
2
+ from .models import *
3
+
4
+ # Register your models here.
5
+ admin.site.register(Profile)
6
+ admin.site.register(Post)
7
+ admin.site.register(FollowersCount)
8
+ admin.site.register(Comment)
9
+ admin.site.register(LikePost)
10
+
11
+
12
+
socials/base/apps.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class BaseConfig(AppConfig):
5
+ default_auto_field = "django.db.models.BigAutoField"
6
+ name = "base"
socials/base/forms.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from .models import Profile,Post,Comment
2
+ from django import forms
3
+ from django.contrib.auth.forms import PasswordChangeForm
4
+ from django.contrib.auth.models import User
5
+
6
+ class EditProfileNewForm(forms.ModelForm):
7
+ class Meta:
8
+ model=Profile
9
+ fields = ('username','fname','lname','description','profileimg')
10
+
11
+ widgets={
12
+ 'username':forms.TextInput(attrs={'class':'form-control'}),
13
+ 'fname':forms.TextInput(attrs={'class':'form-control'}),
14
+ 'lname':forms.TextInput(attrs={'class':'form-control'}),
15
+ 'description':forms.Textarea(attrs={'class':'form-control'}),
16
+ }
17
+
18
+ class ProfilePageForm(forms.ModelForm):
19
+ class Meta:
20
+ model=Profile
21
+ fields = ('username','fname','lname','description','profileimg')
22
+
23
+ widgets={
24
+ 'username':forms.TextInput(attrs={'class':'form-control'}),
25
+ 'fname':forms.TextInput(attrs={'class':'form-control'}),
26
+ 'lname':forms.TextInput(attrs={'class':'form-control'}),
27
+ 'description':forms.Textarea(attrs={'class':'form-control'}),
28
+ }
29
+
30
+ class PostForm(forms.ModelForm):
31
+ class Meta:
32
+ model = Post
33
+ fields = ('title','title_tag','author','caption','location','image')
34
+
35
+ widgets={
36
+ 'title':forms.TextInput(attrs={'class':'form-control','placeholder':'Title'}),
37
+ 'title_tag':forms.TextInput(attrs={'class':'form-control', 'placeholder':'Title tag'}),
38
+ 'author':forms.Select(attrs={'class':'form-control'}),
39
+ 'caption':forms.Textarea(attrs={'class':'form-control', 'placeholder':'Content'}),
40
+ 'location':forms.TextInput(attrs={'class':'form-control', 'placeholder':'Location'}),
41
+ }
42
+
43
+ class PasswordChangingForm(PasswordChangeForm):
44
+ old_password=forms.CharField(widget=forms.PasswordInput(attrs={'class' : 'form-control', 'type':'password'}))
45
+ new_password1=forms.CharField(max_length=100, widget=forms.PasswordInput(attrs={'class': 'form-control', 'type':'password'}))
46
+ new_password2=forms.CharField(max_length=100, widget=forms.PasswordInput(attrs={'class': 'form-control', 'type':'password'}))
47
+
48
+ class Meta:
49
+ model= User
50
+ fields = ('old_password','new_password1','new_password2')
51
+
52
+ class CommentForm(forms.ModelForm):
53
+ class Meta:
54
+ model=Comment
55
+ fields=('name','body')
56
+
57
+ widgets={
58
+ 'name':forms.TextInput(attrs={'class':'form-control'}),
59
+ 'body':forms.Textarea(attrs={'class':'form-control'}),
60
+ }
61
+
62
+ class EditForm(forms.ModelForm):
63
+ class Meta:
64
+ model=Post
65
+ fields = ('title','title_tag','author','caption','location','image')
66
+
67
+ widgets={
68
+ 'title':forms.TextInput(attrs={'class':'form-control','placeholder':'Title'}),
69
+ 'title_tag':forms.TextInput(attrs={'class':'form-control', 'placeholder':'Title tag'}),
70
+ 'author':forms.Select(attrs={'class':'form-control','placeholder':'username'}),
71
+ 'caption':forms.Textarea(attrs={'class':'form-control', 'placeholder':'Content'}),
72
+ 'location':forms.TextInput(attrs={'class':'form-control', 'placeholder':'Location'}),
73
+ }
socials/base/migrations/0001_initial.py ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generated by Django 4.1.1 on 2022-12-15 20:15
2
+
3
+ import ckeditor.fields
4
+ from django.conf import settings
5
+ from django.db import migrations, models
6
+ import django.db.models.deletion
7
+
8
+
9
+ class Migration(migrations.Migration):
10
+
11
+ initial = True
12
+
13
+ dependencies = [
14
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15
+ ]
16
+
17
+ operations = [
18
+ migrations.CreateModel(
19
+ name="FollowersCount",
20
+ fields=[
21
+ (
22
+ "id",
23
+ models.BigAutoField(
24
+ auto_created=True,
25
+ primary_key=True,
26
+ serialize=False,
27
+ verbose_name="ID",
28
+ ),
29
+ ),
30
+ ("follower", models.CharField(max_length=100)),
31
+ ("user", models.CharField(max_length=100)),
32
+ ],
33
+ ),
34
+ migrations.CreateModel(
35
+ name="LikePost",
36
+ fields=[
37
+ (
38
+ "id",
39
+ models.BigAutoField(
40
+ auto_created=True,
41
+ primary_key=True,
42
+ serialize=False,
43
+ verbose_name="ID",
44
+ ),
45
+ ),
46
+ ("post_id", models.CharField(max_length=500)),
47
+ ("username", models.CharField(max_length=100)),
48
+ ],
49
+ ),
50
+ migrations.CreateModel(
51
+ name="Profile",
52
+ fields=[
53
+ (
54
+ "id",
55
+ models.BigAutoField(
56
+ auto_created=True,
57
+ primary_key=True,
58
+ serialize=False,
59
+ verbose_name="ID",
60
+ ),
61
+ ),
62
+ ("description", models.TextField(blank=True)),
63
+ ("fname", models.TextField(blank=True)),
64
+ ("lname", models.TextField(blank=True)),
65
+ ("username", models.TextField(blank=True)),
66
+ (
67
+ "profileimg",
68
+ models.ImageField(
69
+ default="blank-profile-picture.png", upload_to="profile_images"
70
+ ),
71
+ ),
72
+ (
73
+ "user",
74
+ models.OneToOneField(
75
+ null=True,
76
+ on_delete=django.db.models.deletion.CASCADE,
77
+ to=settings.AUTH_USER_MODEL,
78
+ ),
79
+ ),
80
+ ],
81
+ ),
82
+ migrations.CreateModel(
83
+ name="Post",
84
+ fields=[
85
+ (
86
+ "id",
87
+ models.BigAutoField(
88
+ auto_created=True,
89
+ primary_key=True,
90
+ serialize=False,
91
+ verbose_name="ID",
92
+ ),
93
+ ),
94
+ ("title", models.CharField(max_length=255)),
95
+ (
96
+ "image",
97
+ models.ImageField(blank=True, null=True, upload_to="images/"),
98
+ ),
99
+ ("title_tag", models.CharField(default="", max_length=255)),
100
+ ("caption", ckeditor.fields.RichTextField(blank=True, null=True)),
101
+ ("post_date", models.DateField(auto_now_add=True)),
102
+ ("location", models.CharField(default="", max_length=255)),
103
+ ("no_of_likes", models.IntegerField(default=0)),
104
+ (
105
+ "author",
106
+ models.ForeignKey(
107
+ on_delete=django.db.models.deletion.CASCADE, to="base.profile"
108
+ ),
109
+ ),
110
+ ],
111
+ ),
112
+ migrations.CreateModel(
113
+ name="Comment",
114
+ fields=[
115
+ (
116
+ "id",
117
+ models.BigAutoField(
118
+ auto_created=True,
119
+ primary_key=True,
120
+ serialize=False,
121
+ verbose_name="ID",
122
+ ),
123
+ ),
124
+ ("name", models.CharField(max_length=255)),
125
+ ("body", models.TextField()),
126
+ ("date_added", models.DateTimeField(auto_now_add=True)),
127
+ (
128
+ "post",
129
+ models.ForeignKey(
130
+ on_delete=django.db.models.deletion.CASCADE,
131
+ related_name="comments",
132
+ to="base.post",
133
+ ),
134
+ ),
135
+ ],
136
+ ),
137
+ ]
socials/base/migrations/__init__.py ADDED
File without changes
socials/base/models.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from django.db import models
2
+ from django.core.validators import MaxValueValidator, MinValueValidator
3
+ from django.contrib.auth.models import User
4
+ from django.contrib.auth import get_user_model
5
+ import uuid
6
+ from datetime import datetime
7
+ from ckeditor.fields import RichTextField
8
+ from django.urls import reverse
9
+
10
+ User = get_user_model()
11
+
12
+ # Create your models here.
13
+ class Profile(models.Model):
14
+ # user = models.ForeignKey(User, on_delete=models.CASCADE)
15
+ user=models.OneToOneField(User,null=True,on_delete=models.CASCADE)
16
+ description = models.TextField(blank=True)
17
+ fname = models.TextField(blank=True)
18
+ lname = models.TextField(blank=True)
19
+ username=models.TextField(blank=True)
20
+ profileimg = models.ImageField(upload_to='profile_images', default='blank-profile-picture.png')
21
+
22
+ def __str__(self):
23
+ return(str(self.user))
24
+
25
+ def get_absolute_url(self):
26
+ return reverse('home')
27
+
28
+ class FollowersCount(models.Model):
29
+ follower = models.CharField(max_length=100)
30
+ user = models.CharField(max_length=100)
31
+
32
+ def __str__(self):
33
+ return self.user
34
+
35
+ class Post(models.Model):
36
+ title=models.CharField(max_length=255)
37
+ image=models.ImageField(null=True,blank=True,upload_to="images/")
38
+ title_tag=models.CharField(max_length=255,default="")
39
+ author=models.ForeignKey(Profile,on_delete=models.CASCADE)
40
+ caption=RichTextField(blank=True,null=True)
41
+ post_date=models.DateField(auto_now_add=True)
42
+ location=models.CharField(max_length=255,default="")
43
+ no_of_likes=models.IntegerField(default=0)
44
+
45
+ def __str__(self):
46
+ return self.title + " | " + str(self.author)
47
+
48
+ def get_absolute_url(self):
49
+ return reverse('home')
50
+
51
+ def get_owner_pp(self):
52
+ return self.author.profileimg.url
53
+
54
+ def profileid(self):
55
+ return self.author.user.id
56
+
57
+ class Comment(models.Model):
58
+ post=models.ForeignKey(Post,related_name="comments",on_delete=models.CASCADE)
59
+ name=models.CharField(max_length=255)
60
+ body=models.TextField()
61
+ date_added=models.DateTimeField(auto_now_add=True)
62
+
63
+ def __str__(self):
64
+ return '%s - %s' % (self.post.title,self.name)
65
+
66
+ def get_absolute_url(self):
67
+ return reverse('home')
68
+
69
+ class LikePost(models.Model):
70
+ post_id=models.CharField(max_length=500)
71
+ username=models.CharField(max_length=100)
72
+
73
+ def __str__(self):
74
+ return self.username
75
+
76
+
77
+
socials/base/templates/base/404.html ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'main.html' %} {% load static %} {% block styles %}
2
+ <!-- Replace {name} with the respective css file -->
3
+ <link rel="stylesheet" href="{% static 'styles/404.css' %}" />
4
+ {% endblock %}
5
+
6
+ {% block content %}
7
+ <div class="wrapper">
8
+ <div class="landing-page">
9
+ <div style="text-align:center;" class="icon__download">
10
+ <svg xmlns="http://www.w3.org/2000/svg" id="b599d709-684a-4b18-9cac-f9c979cf5115" data-name="Layer 1" width="977.71631" height="782.41658" viewBox="0 0 977.71631 782.41658" src="https://42f2671d685f51e10fc6-b9fcecea3e50b3b59bdc28dead054ebc.ssl.cf5.rackcdn.com/illustrations/imagination_ok71.svg" class="item__image" alt="Imagination"><title>imagination</title><path d="M1088.85815,416.70662c0,45.97-13.23,89.54-36.9,128.54q-6.135,10.125-13.19995,19.82c-20.04,27.54-45.5,52.39-75.25,73.69q-2.73,1.95-5.5,3.86c-.7.48-1.39.96-2.09,1.44q-4.365,2.955-8.83,5.82c-.94.6-1.88,1.19-2.82,1.78-.8.51-1.61,1.01-2.42,1.51q-13.005,8.04006-26.9,15.21c-1.01.52-2.03,1.04-3.05,1.56-.88.44-1.76.89-2.65,1.33-.62.31-1.25.62-1.87.92-1.04.52-2.09,1.03-3.14,1.53q-4.095,1.965-8.25,3.85c-1.27.58-2.55,1.16-3.84,1.72a.07552.07552,0,0,1-.04.02c-1.28.57-2.56,1.13-3.85,1.68-1.18006.51-2.37,1.02-3.56,1.51q-5.37,2.265-10.83,4.38c-.75.3-1.51.59-2.27.88-1.05.4-2.09.8-3.15,1.19-1.35.5-2.69,1-4.04,1.49-1.26.46-2.52.91-3.79,1.36l-.27.09c-1.27.45-2.54.89-3.82,1.32q-9.86994,3.39-20.03,6.34c-.85.25-1.7.49-2.55.73-.38.12-.77.23-1.16.33-.99.28-1.98.56-2.98.83-1.22.35-2.45.68-3.69,1q-5.175,1.38-10.4,2.64c-1.18.29-2.35.57-3.53.84a.14463.14463,0,0,1-.07.02q-1.77.405-3.54.81c-1.65.38-3.31994.75-4.99,1.09-1.93.42-3.87.82-5.82,1.22-1.21.24-2.42.48-3.63.71-1.21.24-2.43005.47-3.64.69q-9.135,1.695-18.42,3.05c-2.3.33-4.6.65-6.92.96-1.42.19-2.85.37-4.28.54-1.25.15-2.51.3-3.76.44-1.25.15-2.5.28-3.76.42h-.01c-.12.02-.24.03-.36.04-2.05.22-4.11.42-6.17.62-1.21.12-2.42.22-3.64.32-1.09.1-2.19.18994-3.29.27q-4.93506.405-9.9.69-1.605.105-3.21.18c-2.28.13-4.56.23005-6.85.32-.95.04-1.91.08-2.86.11-2.56.09-5.13.15-7.7.2q-2.175.045-4.35.06-2.58.03-5.16.03c-83.21,0-178.85-28.5-257.63-69.93a553.716,553.716,0,0,1-57.37-34.57c-10.66-7.37-20.72-14.95-30.06-22.71-69.61-57.7-99.74-124.19-43.94-174.79q10.8-9.795,23.27-20.39,9.435-8.025,19.7-16.46c97.47-80.06,246.86005-185.08,346.03-265.15C867.01813-20.25341,1088.85815,249.91658,1088.85815,416.70662Z" transform="translate(-111.14185 -58.79171)" fill="#62ad9b"></path><path d="M731.85815,569.20662l-41.03,5.32-2.09.27-54.61,7.08-249.27,32.33c-10.66-7.37-20.72-14.95-30.06-22.71l285.26-16.86,49.34-2.92,2.07-.12Z" transform="translate(-111.14185 -58.79171)" fill="#f2f2f2"></path><path d="M550.85815,368.20662l-216.73,28.11q9.435-8.025,19.7-16.46Z" transform="translate(-111.14185 -58.79171)" fill="#f2f2f2"></path><path d="M1051.95813,545.24659q-6.135,10.125-13.19995,19.82l-188.30005-24.42-103.6-13.44,101.91,6.03Z" transform="translate(-111.14185 -58.79171)" fill="#f2f2f2"></path><path d="M963.50818,638.7566c-69.31,49.64-161.92005,79.95-263.65,79.95-83.21,0-178.85-28.5-257.63-69.93,6.23-16.15,14.91-29.24,26.98-35.87.3-.17.61-.34.92-.49a38.14439,38.14439,0,0,1,16.64-4.21c71-2,63,78,152-32,55.35-68.41,118.05-91.95,160.91-84.34.79.14,1.57.29,2.35.45,24.84,5.16,42.61,21.06,47.74,44.89,14,65-27,117,48,101A155.12159,155.12159,0,0,1,963.50818,638.7566Z" transform="translate(-111.14185 -58.79171)" fill="#3f3d56"></path><path d="M753.24836,716.05355c-34.87988-19.44434-56.59375-45.99121-64.53906-78.90235-5.89941-24.43554-4.2041-51.93261,5.03809-81.72753a218.888,218.888,0,0,1,30.439-61.48438C794.82453,393.953,801.2,328.80159,794.10969,291.75277c-7.77393-40.62305-33.03125-57.49414-33.28564-57.65967l1.09033-1.67676c.26074.16943,26.18359,17.43262,34.14453,58.87988,4.58935,23.89453,2.43017,51.14063-6.41748,80.981-11.01172,37.1377-32.48438,78.459-63.82129,122.81641a216.90415,216.90415,0,0,0-30.1626,60.92187c-15.1582,48.86719-17.30273,115.99707,58.56445,158.292Z" transform="translate(-111.14185 -58.79171)" fill="#d0cde1"></path><path d="M691.54426,526.912c-27.49805-15.32813-26.73242-39.6211-21.24805-57.30078a77.68749,77.68749,0,0,1,10.8042-21.8252c24.74658-35.02832,26.98291-57.7832,24.50147-70.7041-2.69531-14.03076-11.34131-19.791-11.42822-19.84766l1.08984-1.67676c.38428.24952,9.44824,6.28858,12.30224,21.14747,3.71631,19.34814-4.63818,43.65136-24.83154,72.23535A75.6765,75.6765,0,0,0,672.20637,470.203c-5.26514,16.97363-6.01514,40.28711,20.31152,54.96289Z" transform="translate(-111.14185 -58.79171)" fill="#d0cde1"></path><path d="M815.26106,312.91292l-.97364-1.74707c26.32666-14.67627,25.57666-37.98974,20.31153-54.9624a75.67946,75.67946,0,0,0-10.52783-21.26318c-20.19336-28.5835-28.54786-52.88721-24.83155-72.23535,2.854-14.85889,11.918-20.89795,12.30225-21.14747l1.09131,1.67579c-.0874.05761-8.77735,5.89355-11.44483,19.92773-2.4541,12.91357-.19336,35.64893,24.51661,70.625a77.69728,77.69728,0,0,1,10.80419,21.82471C841.99348,273.29036,842.7591,297.58333,815.26106,312.91292Z" transform="translate(-111.14185 -58.79171)" fill="#d0cde1"></path><path d="M873.97145,213.41a30,30,0,1,1-50.25129-32.78427c9.05313-13.87651,54.63149-28.834,54.63149-28.834S883.02457,199.53349,873.97145,213.41Z" transform="translate(-111.14185 -58.79171)" fill="#3f3d56"></path><path d="M862.97145,120.41a30,30,0,1,1-50.25129-32.78427c9.05313-13.87651,54.63149-28.834,54.63149-28.834S872.02457,106.53349,862.97145,120.41Z" transform="translate(-111.14185 -58.79171)" fill="#3f3d56"></path><path d="M861.54815,401.92659c-1.92-.45-47.21-10.98-62.31-3.79a31.00068,31.00068,0,0,0,13.38,58.99,30.5018,30.5018,0,0,0,6.7-.74,31.09548,31.09548,0,0,0,6.58-2.27c15.1-7.2,35.46-49,36.32-50.78l.55-1.12Zm-36.51,50.38a28.99815,28.99815,0,0,1-24.94-52.36c3.52-1.68,8.9-2.31,15.04-2.31,16.8,0,39.26,4.75,44.72,5.96C856.44818,410.4366,838.17816,446.04658,825.03815,452.30659Z" transform="translate(-111.14185 -58.79171)" fill="#d0cde1"></path><path d="M725.25561,232.03846a30.87582,30.87582,0,0,1-20.873-8.07861c-12.36035-11.27051-19.69727-57.18652-20.00391-59.13574l-.19336-1.23242,1.24512.0791c1.96875.12549,48.36621,3.20459,60.72656,14.4751h0a30.98626,30.98626,0,0,1-20.90137,53.89257ZM686.56128,165.7577c1.27929,7.5293,8.416,46.91992,19.16894,56.72461a29.00026,29.00026,0,0,0,39.0791-42.85888h0C734.05639,169.81971,694.17651,166.33876,686.56128,165.7577Z" transform="translate(-111.14185 -58.79171)" fill="#d0cde1"></path><path d="M683.48314,303.8848A30,30,0,0,1,643.05666,348.221c-12.24311-11.16347-19.68934-58.55194-19.68934-58.55194S671.24,292.72134,683.48314,303.8848Z" transform="translate(-111.14185 -58.79171)" fill="#3f3d56"></path><path d="M775.42816,304.98658a17.15039,17.15039,0,0,0-16.69-13.51,17.53009,17.53009,0,0,0-3.66.4c-8.93994,1.94-24.83,21.41-25.5,22.23l-.79.97,1.12.56c.88.44,20.02,9.92,30.04,9.92a11.05066,11.05066,0,0,0,2.37994-.23,17.11671,17.11671,0,0,0,13.1-20.34Zm-4.02,11.8a14.9573,14.9573,0,0,1-9.51,6.59c-7.18,1.56-25.24-6.73-29.96-8.98,3.36-4,16.38-19.01,23.57-20.57a15.11325,15.11325,0,0,1,15.9,22.96Z" transform="translate(-111.14185 -58.79171)" fill="#d0cde1"></path><ellipse cx="422.21631" cy="715.77222" rx="417.5" ry="9.69734" fill="#3f3d56"></ellipse><ellipse cx="422.21631" cy="747.84803" rx="289.03846" ry="6.71354" fill="#3f3d56"></ellipse><ellipse cx="422.34837" cy="776.94004" rx="235.78148" ry="5.47653" fill="#3f3d56"></ellipse><path d="M118.35815,469.36659s-14,33-3,36,16-36,16-36Z" transform="translate(-111.14185 -58.79171)" fill="#ffb8b8"></path><polygon points="48.716 229.075 12.216 338.575 4.216 397.575 4.216 416.575 25.216 414.575 25.216 398.575 58.216 297.575 48.716 229.075" fill="#575a89"></polygon><path d="M186.35815,377.36659l-2,22,64,4v-49C248.35815,348.36659,186.35815,377.36659,186.35815,377.36659Z" transform="translate(-111.14185 -58.79171)" fill="#ffb8b8"></path><path d="M153.35815,716.36659l-3,28,33-3s-9-22-10-25S153.35815,716.36659,153.35815,716.36659Z" transform="translate(-111.14185 -58.79171)" fill="#ffb8b8"></path><polygon points="152.216 606.575 148.216 633.575 169.216 648.575 167.216 612.575 152.216 606.575" fill="#ffb8b8"></polygon><path d="M202.35815,385.36659h-18l-6,11s-39,28-39,86v128s-1,91,10,101l1.09842,6.59049.90158,5.40951,24-4s-2-8,1-15-2-46-2-46l6-61,36-89,45,64s-5,89-3,92-1,12-1,12h26l17-119-38-107s4-49-10-54S202.35815,385.36659,202.35815,385.36659Z" transform="translate(-111.14185 -58.79171)" fill="#2f2e41"></path><path d="M273.35815,694.36659s-3.27559-15-9.13779-18-14.86221,5-14.86221,5-24,5-14,30l4,6s7-3,7,12,23,29,31,29,11-7,9-19-6-43.3189-6-43.3189Z" transform="translate(-111.14185 -58.79171)" fill="#2f2e41"></path><path d="M172.28316,732.94392s-14.11335-6.04508-19.96016-3.01519-4.56127,15.00267-4.56127,15.00267-9.86827,22.44142,16.29109,28.82014l7.20749.22839s1.62322-7.44078,13.83419,1.27084,36.96568-1.881,41.61188-8.39353.69007-13.02014-10.24025-18.3613-38.749-20.27413-38.749-20.27413Z" transform="translate(-111.14185 -58.79171)" fill="#2f2e41"></path><circle cx="100.71631" cy="162.07488" r="34" fill="#ffb8b8"></circle><polygon points="81.216 175.575 75.216 213.575 111.216 216.575 115.216 178.575 81.216 175.575" fill="#ffb8b8"></polygon><path d="M252.58271,293.80823a83.423,83.423,0,0,0-43.50914-35.15149c-2.79007-.969-15.60449-.79081-23.3391-.902a23.71078,23.71078,0,0,0-22.785,16.10629c-9.25964,27.236-21.5091,80.67079,15.40865,101.50556l8,7,71-20s-5-12-2-16,13-28,2-45C255.6436,298.71683,254.05052,296.18854,252.58271,293.80823Z" transform="translate(-111.14185 -58.79171)" fill="#575a89"></path><path d="M255.85815,205.86659s7.11653-48.06537-43.70451-33.23456c0,0-35.95295-7.3129-48.65151,37.59055l-12.88906,47.078,5.89984-3.06592,2.60784,6.00245,9.4156,2.57781,4.20315-7.95848,1.77128,9.79659,77.34737,9.21358s-34.31466-21.19294-34.15871-57.992l6.47715,7.11336Z" transform="translate(-111.14185 -58.79171)" fill="#2f2e41"></path><path d="M205.17488,169.41528H211.949a4.2634,4.2634,0,0,1,4.2634,4.2634v47.7366a0,0,0,0,1,0,0H200.91148a0,0,0,0,1,0,0v-47.7366a4.2634,4.2634,0,0,1,4.2634-4.2634Z" transform="translate(-144.86665 -14.97574) rotate(-11.10178)" fill="#62ad9b"></path><circle cx="106.71631" cy="165.07488" r="18" fill="#d0cde1"></circle><circle cx="106.71631" cy="165.07488" r="10" fill="#62ad9b"></circle><path d="M294.32622,498.14l4.849-6.363-.79538-.60612,3.26924-4.29005a9.60622,9.60622,0,0,0-1.8182-13.46321l-11.76129-8.96273a9.60622,9.60622,0,0,0-13.46325,1.81794L246.85372,502.691a9.60627,9.60627,0,0,0,1.81816,13.46326l11.7613,8.96273a9.60628,9.60628,0,0,0,13.46329-1.818l12.96708-17.016.79538.60612,4.84894-6.363-.79537-.60612,1.81835-2.38612Z" transform="translate(-111.14185 -58.79171)" fill="#3f3d56"></path><circle cx="173.71657" cy="422.07514" r="5" fill="#d0cde1"></circle><path d="M245.35815,477.36659s5,41,14,39,7-43,0-43S245.35815,477.36659,245.35815,477.36659Z" transform="translate(-111.14185 -58.79171)" fill="#ffb8b8"></path><path d="M214.35815,280.36659s-4,12-2,31,7,83,7,83,8,69,20,74l3,14,23-4-3-17a17.31349,17.31349,0,0,0,0-11c-2-6-18-161-18-161S240.35815,265.36659,214.35815,280.36659Z" transform="translate(-111.14185 -58.79171)" fill="#575a89"></path></svg>
11
+ </div>
12
+
13
+ <h1> 404 Error.</h1>
14
+ <p> We can't find the page you're looking for.</p>
15
+ <button>
16
+ <a href="{% url 'home' %}" style="text-decoration:none;color:#fff;">
17
+ Back to home
18
+ </a>
19
+ </button>
20
+ </div>
21
+ </div>
22
+ {% endblock %}
socials/base/templates/base/Otherprofile.html ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'main.html' %}
2
+ {% load static %}
3
+
4
+ {% block styles %}
5
+ <link rel="stylesheet" href="{% static 'styles/otherprofile.css' %}" />
6
+ {% endblock %}
7
+
8
+ <!-- Title -->
9
+ {% block title %}
10
+ <title>Profile</title>
11
+ {% endblock %}
12
+
13
+ {% block content %}
14
+
15
+ <div class="container" style="margin-top:20px;">
16
+ <div class="row m-b-r m-t-3" style="margin-top:40px;">
17
+ <div class="col-md-2 offset-md-1">
18
+ <img src="{{ page_user.profileimg.url }}" alt="profileimg" class="img-circle rounded-circle img-fluid" style="height: 180px; width: 150px;">
19
+ </div>
20
+ <div class="col-md-9 p-t-2" style="margin-top:20px;">
21
+ <h2 class="h2-responsive">@{{page_user.username}} </h2>
22
+ <form action="/follow" method="POST">
23
+ {% csrf_token %}
24
+ <input type="hidden" value="{{page_user.username}}" name="user" />
25
+ <input type="hidden" value="{{request.user.username}}" name="follower" />
26
+
27
+ {% if page_user.id != request.user.id %}
28
+ <a data-ripple="">
29
+ <button type="submit" class="btn btn-success follow-btn" style="position: relative;left: 300px; bottom: 40px;">{{button_text}}</button></h2>
30
+ </a>
31
+ {% endif %}
32
+
33
+ <p class="profile-name">{{page_user.fname}}</p>
34
+ <p style="position: relative;left: 20px;">{{page_user.description}}</p>
35
+ <ul class="flex-menu">
36
+
37
+ <li><strong>{{num_posts}}</strong> posts</li>
38
+ <li><strong>{{user_followers}}</strong> followers</li>
39
+ <li><strong>{{user_following}}</strong> following</li>
40
+ </ul>
41
+ </form>
42
+ </div>
43
+ </div>
44
+ <hr class="border border-1 border-success">
45
+
46
+ <div class="row">
47
+ {% for post in logged_in_user_posts %}
48
+ <div class="col-sm-12 col-md-6 col-lg-4">
49
+ <div class="view overlay hm-black-light m-b-2">
50
+ <a href="{{post.image.url}}">
51
+ <img src="{{post.image.url}}" class="img-fluid cursor-pointer" alt="" style="height: 250px;">
52
+ </a>
53
+ </div>
54
+ </div>
55
+ {% endfor %}
56
+ </div>
57
+
58
+ </div>
59
+
60
+ {% endblock %}
61
+
socials/base/templates/base/add_comment.html ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'main.html' %}
2
+
3
+ <title>
4
+ Comment on Blog Post
5
+ </title>
6
+
7
+ {% block content %}
8
+
9
+
10
+ <div class="container shadow p-3 mb-5 bg-body rounded" style="width: 65%;margin-top: 30px;">
11
+ <h1 style="text-align:center; margin-top:10px; color:#1e3c72;font-weight: bolder">Add Comment</h1>
12
+ <br/>
13
+ <div class="form-group" style="font-weight: 600;line-height: 2.5;">
14
+ <form method="POST">
15
+ {% csrf_token %}
16
+ {{ form.as_p }}
17
+ <br>
18
+ <button class="btn btn-primary btn-block" style="width:200px;position: relative;left:40%;
19
+ background: linear-gradient(to right,#373B44 ,#4286f4 );">Add Comment</button>
20
+ </form>
21
+ </div>
22
+ </div>
23
+
24
+
25
+ {% endblock %}
socials/base/templates/base/add_post.html ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'main.html' %}
2
+ {% load static %}
3
+ {% block styles %}
4
+ <link rel="stylesheet" href="{% static 'styles/post.css' %}" />
5
+ {% endblock %}
6
+
7
+ <title>
8
+ Add a new Post
9
+ </title>
10
+
11
+ {% block content %}
12
+ {% if user.is_authenticated %}
13
+
14
+ <div class="container shadow p-3 mb-5 bg-body rounded con" style="width: 80%;margin-top: 30px;">
15
+ <h1 style="text-align:center; margin-top:10px;color:#9a35dd;font-weight: bolder">Add Post</h1>
16
+ <br>
17
+ <div class="form-group" style="font-weight: 600;line-height: 2.5;">
18
+ <form method="POST" enctype="multipart/form-data">
19
+ {% csrf_token %}
20
+ {{ form.media }}
21
+ {{ form.as_p }}
22
+ <br>
23
+ <button class="btn btn-primary btn-block" style="width:200px;position: relative;left:40%;
24
+ background: linear-gradient(to right,#623dc6 ,#9a35dd );">Post</button>
25
+ </form>
26
+ </div>
27
+ </div>
28
+ <br/><br/>
29
+ {% endif %}
30
+ {% endblock %}
socials/base/templates/base/change-password.html ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'main.html' %}
2
+ <title>Change Password</title>
3
+ {% block content %}
4
+
5
+
6
+ <div class="container shadow p-3 mb-5 bg-body rounded " style="width: 50%;margin-top: 30px;">
7
+ <h1 style="text-align:center;color:#9a35dd;margin-top: 10px;font-weight: bolder;">Change Password...</h1>
8
+ <br/><br/>
9
+ <div class="form-group" style="font-weight: 600;line-height: 2.5;">
10
+ <form method="POST">
11
+ {% csrf_token %}
12
+ {{ form.as_p}}
13
+
14
+ <button class="btn btn-primary btn-block" style="width:200px;position: relative;left:35%;
15
+ background: linear-gradient(to right,#623dc6 ,#9a35dd );">Change Password</button>
16
+ <br/><br/>
17
+ <ul>
18
+ <li class="text-muted">Your password can't be too similar to your other personal information.</li>
19
+ <li class="text-muted">Your password must contain atleast 8 characters.</li>
20
+ <li class="text-muted">Your password can't be a commonly used password.</li>
21
+ <li class="text-muted">Your password can't be entirely numeric.</li>
22
+ </ul>
23
+ </form>
24
+ </div>
25
+ </div>
26
+
27
+ {% endblock %}
socials/base/templates/base/create_user_profile.html ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'main.html' %}
2
+
3
+ <title>Create User Profile</title>
4
+
5
+ {% block content %}
6
+ {% if user.is_authenticated %}
7
+
8
+ <div class="container">
9
+ <h1 style="text-align: center; font-weight: bold; margin-top: 30px; color: #b512d2;">Create User Profile</h1>
10
+ <br/>
11
+ <div class="form-group">
12
+ <form method="POST" enctype="multipart/form-data" style="width: 50%; position: relative;left: 300px;">
13
+ {% csrf_token %}
14
+ {{ form.as_p }}
15
+ <button class="btn" style="background-color: #b512d2;color: #fff;position: relative;left: 200px;">Create Profile Page</button>
16
+ </form>
17
+ <br/>
18
+ <br/>
19
+ </div>
20
+ </div>
21
+
22
+ {% else %}
23
+ <div class="card container shadow p-3 mb-5 bg-body rounded" style="width: 65%;margin-top: 150px;">
24
+ <h3 class="delete-title" style="text-align:center;color:#1e3c72; margin-top: 10px;font-weight: bolder"> <span style="color:#b512d2;">Login required to view this page</span ></h3>
25
+ <div class="container" >
26
+ <div class="form-group" style="text-align: center;">
27
+ <br/>
28
+ <a href="{% url 'signup' %}" style="text-decoration: none; color: #fff;">
29
+ <button class="btn" style="width:200px;position: relative;left: 1%; background-color: #b512d2; color: #fff;">Sign Up</button>
30
+ </a>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ {% endif %}
35
+ {% endblock %}
socials/base/templates/base/delete_post.html ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'main.html' %}
2
+ {% load static %}
3
+
4
+ <title>
5
+ Delete Post
6
+ </title>
7
+
8
+ {% block styles %}
9
+ <!-- Replace {name} with the respective css file -->
10
+ <link rel="stylesheet" href="{% static 'styles/deletepost.css' %}" />
11
+ {% endblock %}
12
+
13
+ {% block content %}
14
+ {% if user.is_authenticated %}
15
+ <br/><br/>
16
+ <div class="card container shadow p-3 mb-5 bg-body rounded" style="width: 65%;margin-top: 150px;">
17
+ <h3 class="delete-title" style="text-align:center;color:#1e3c72; margin-top: 10px;font-weight: bolder">Delete: <span style="color:#DC3545;">{{post.title}}</span ></h3>
18
+ <div class="container" >
19
+ <div class="form-group" style="text-align: center;">
20
+ <form method="POST">
21
+ {% csrf_token %}
22
+ <br>
23
+ <strong class="warning-text" style="position: relative;left: 1%;" >Are you sure?</strong><br/>
24
+ <br>
25
+ <button class="btn btn-danger delete-post" style="width:200px;position: relative;left: 1%;">Delete Post</button>
26
+ </form>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ {% else %}
31
+ Login required to delete
32
+ {% endif %}
33
+ {% endblock %}
socials/base/templates/base/edit_profile_page.html ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'main.html' %}
2
+
3
+ <title>Edit Profile Page</title>
4
+
5
+ {% block content %}
6
+ {% if user.is_authenticated %}
7
+ <!-- {% if user.id == profile.user.id %} -->
8
+
9
+ <div class="container shadow p-3 mb-5 bg-body rounded" style="width: 50%;margin-top: 30px;">
10
+ <h1 style="text-align:center; margin-top:10px; color:#9a35dd;font-weight: bolder;">Edit Profile Page</h1>
11
+ <div class="form-group" style="font-weight: 600;line-height: 2.5;">
12
+
13
+
14
+ <br/>
15
+ <form method="POST" enctype="multipart/form-data">
16
+ {% csrf_token %}
17
+ {{ form.as_p }}
18
+ <br>
19
+ <button class="btn btn-primary btn-block" style="width:200px;position: relative;left:35%;
20
+ background: linear-gradient(to right,#623dc6 ,#9a35dd );">Update Profile Page</button>
21
+ </form>
22
+ </div>
23
+ </div>
24
+ <br/><br/>
25
+
26
+ <!-- Javascript -->
27
+ <script>
28
+ var name="{{ user.first_name }}"
29
+ document.getElementById("elder").placeholder=name;
30
+ </script>
31
+
32
+ {% else %}
33
+ Login required to view
34
+ {% endif %}
35
+
36
+ <!-- {% else %}
37
+ You are not the correct user to edit the page
38
+ {% endif %} -->
39
+ {% endblock %}
socials/base/templates/base/friends.html ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'main.html' %} {% load static %} {% block styles %}
2
+ <!-- Replace {name} with the respective css file -->
3
+ <link rel="stylesheet" href="{% static 'styles/friends.css' %}" />
4
+ {% endblock %}
5
+
6
+ {% block content %}
7
+ <div class="container friends">
8
+ <div class="row" style="margin-top:100px;">
9
+ <div class="col-md-4">
10
+ <div class="profile-card" data-tilt>
11
+ <div class="profile-card-header">
12
+ <div class="profile-image"></div>
13
+
14
+ <div class="profile-info">
15
+ <h3 class="profile-name">{{page_user.fname}}</h3>
16
+ <p class="profile-desc">{{page_user.caption}}</p>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="profile-card-body">
21
+ <ul class="status">
22
+ <li>
23
+ <span class="status-value">532</span>
24
+ <span class="status-text">Posts</span>
25
+ </li>
26
+
27
+ <li>
28
+ <span class="status-value">1.5m</span>
29
+ <span class="status-text">Followers</span>
30
+ </li>
31
+
32
+ <li>
33
+ <span class="status-value">423</span>
34
+ <span class="status-text">Following</span>
35
+ </li>
36
+ </ul>
37
+
38
+ <div class="action">
39
+ <button class="btn btn-danger follow">Follow</button>
40
+ </div>
41
+ </div>
42
+ </div>
43
+
44
+ </div>
45
+ </div>
46
+ </div>
47
+ <script src="{% static 'scripts/vanilla-tilt.js' %}"></script>
48
+ {% endblock %}
socials/base/templates/base/home.html ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- {% extends 'main.html' %} -->
2
+ {% load static %}
3
+
4
+ {% block styles %}
5
+ <link rel="stylesheet" href="{% static 'styles/home.scss' %}" />
6
+
7
+ <!-- Icons -->
8
+ <link rel="stylesheet" href="https://unicons.iconscout.com/release/v2.1.6/css/unicons.css">
9
+
10
+ <!-- Font-awesome -->
11
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css" integrity="sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
12
+
13
+ <style>
14
+
15
+ #heart.red {
16
+ color: red;
17
+ }
18
+ </style>
19
+
20
+ {% endblock %}
21
+
22
+ <!-- Title -->
23
+ {% block title %}
24
+ <title>Dashboard</title>
25
+ {% endblock %}
26
+
27
+ {% block content %}
28
+ <nav>
29
+ <div class="container">
30
+ <div class="log">
31
+ <img src="{% static 'images/truffle.png' %}" style="height:75px;cursor:pointer;">
32
+ </div>
33
+
34
+ <!-- Search bar -->
35
+ <form action="/search" method="POST">
36
+ {% csrf_token %}
37
+ <div class="search-bar">
38
+ <input type="search" placeholder="Search for other users" name="username">
39
+ <button type="submit"><i class="uil uil-search"></i> </button>
40
+ </div>
41
+ </form>
42
+
43
+
44
+ <div class="create">
45
+ {% if user.is_authenticated %}
46
+ <a href="{% url 'logout' %}">logout</a>
47
+ {% else %}
48
+ <a href="{% url 'signup' %}">Signup</a>
49
+ <a href="{% url 'login' %}">Login</a>
50
+ {% endif %}
51
+ <button class="btn btn-primary">
52
+ <a href="{% url 'add_post' %}" style="color: #fff;text-decoration: none;">Create Post</a>
53
+ </button>
54
+ <div class="profile-photo" style="cursor:pointer;">
55
+ <a class="profile" href="{% url 'show_profile_page' user.profile.id %}" style="text-decoration: none;">
56
+ <img src="{{user_profile.profileimg.url}}" alt="profile-photo">
57
+ </a>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </nav>
62
+
63
+ <!-- MAIN -->
64
+
65
+ <main style="background-color:rgb(244, 234, 234); padding-top: 40px;">
66
+ <div class="container">
67
+ <div class="left">
68
+ {% if user.is_authenticated %}
69
+
70
+ <a class="profile" href="{% url 'show_profile_page' user.profile.id %}" style="text-decoration: none;">
71
+ <div class="profile-photo" style="cursor:pointer;">
72
+ <img src="{{user_profile.profileimg.url}}" alt="profile-1">
73
+ </div>
74
+ <div class="handle">
75
+ <h4 style="text-decoration: none;">{{user_profile.fname}}</h4>
76
+ <p class="text-muted">
77
+ {{user_profile.username}}
78
+ </p>
79
+ </div>
80
+ </a>
81
+
82
+ {% endif %}
83
+ <!-- sidebar -->
84
+ <div class="sidebar">
85
+ <a class="menu-item active" href="{% url 'home' %}" style="text-decoration: none;">
86
+ <span><i class="uil uil-home"></i></span><h3>Home</h3>
87
+ </a>
88
+ <a class="menu-item" href="{% url 'add_post' %}" style="text-decoration: none;">
89
+ <span><i class="uil uil-compass"></i></span><h3>
90
+ Add Post
91
+ </h3>
92
+ </a>
93
+
94
+ <a class="menu-item" href="{% url 'edit_profile_page' user.profile.id %}" style="text-decoration: none;">
95
+ <span><i class="uil uil-edit"></i></span>
96
+ <h3>Edit Profile</h3>
97
+ </a>
98
+
99
+
100
+ <a class="menu-item" href="{% url 'show_profile_page' user.profile.id %}" style="text-decoration: none;">
101
+ <span><i class="uil uil-bookmark"></i></span><h3>Profile</h3>
102
+ </a>
103
+
104
+ <a class="menu-item" href="/password" style="text-decoration: none;">
105
+ <span><i class="uil uil-lock"></i></span><h3>Change Password</h3>
106
+ </a>
107
+ </div>
108
+ <!-- end of sidebar -->
109
+ <button class="btn btn-primary">
110
+ <a href="{% url 'add_post' %}" style="color: #fff;text-decoration: none;">Create Post</a>
111
+ </button>
112
+ </div>
113
+ <!-- END OF LEFT -->
114
+
115
+ <div class="middle">
116
+ <!-- FEED -->
117
+ <div class="feeds">
118
+ <!-- FEED 1 -->
119
+ {% if count_posts == 0 %}
120
+ <div class="empty-state">
121
+ <div class="empty-state__content">
122
+ <div class="empty-state__icon">
123
+ <img src="{% static 'images/home/not-found.webp' %}" alt="">
124
+ </div>
125
+ <div class="empty-state__message" style="color: #9a35dd;font-weight: bold;font-size: 30px; text-align: center;">No posts has been added yet.</div>
126
+ <br/><br/><br/>
127
+ </div>
128
+ </div>
129
+ {% else %}
130
+ {% for post in all_posts reversed %}
131
+ <div class="feed">
132
+ <div class="head">
133
+ <div class="user">
134
+ <div class="profile-photo">
135
+ <a href="{% url 'show_profile_page' post.profileid %}">
136
+ <img src="{{ post.get_owner_pp }}" alt="profile-13" style="width:50px;">
137
+ </a>
138
+ </div>
139
+ <div class="ingo">
140
+ <h3>{{ post.author }}</h3>
141
+ <small>{{ post.location }}</small>
142
+ </div>
143
+
144
+ </div>
145
+ <span class="edit">
146
+ <!-- <i class="uil uil-ellipsis-h"> -->
147
+ <ul>
148
+ <li>
149
+ <!-- Edit post -->
150
+ {% if user.is_authenticated %}
151
+ {% if user.id == post.author.id %}
152
+ <a href="{% url 'update_post' post.pk %}" class="pencil-icon"><i class="fa-solid fa-pencil"></i></a>
153
+ &nbsp;&nbsp;
154
+ <!-- Delete post -->
155
+ <a href="{% url 'delete_post' post.pk %}" class="delete-icon"><i class="fa-solid fa-trash-arrow-up"></i></a>
156
+ {% endif %}
157
+ {% endif %}
158
+ </li>
159
+ </ul>
160
+ <!-- </i> -->
161
+
162
+ </span>
163
+
164
+ </div>
165
+ <div class="photo">
166
+ <a href="{{ post.image.url }}">
167
+ <img src="{{ post.image.url }}" alt="feed-1" style="height: 450px;">
168
+ </a>
169
+ </div>
170
+ <div class="action-buttons">
171
+ <div class="interaction-buttons">
172
+ <!-- Like post -->
173
+ <a href="/like-post?post_id={{post.id}}" style="text-decoration: none;">
174
+ <i class="fa-solid fa-heart" id="heart" ></i>
175
+ </a>
176
+ <a href="{% url 'add_comment' post.pk %}" style="color: #000;">
177
+ <span><i class="uil uil-comment-dots"></i></span>
178
+ </a>
179
+
180
+ </div>
181
+
182
+ <!-- Downloading th post-img -->
183
+ <a href="{{post.image.url}}" class="flex items-center space-x-2 flex-1 justify-end" style="text-decoration: none;" download>
184
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="25" height="25" preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16"><g fill="currentColor"><path d="M8.5 1.5A1.5 1.5 0 0 1 10 0h4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h6c-.314.418-.5.937-.5 1.5v6h-2a.5.5 0 0 0-.354.854l2.5 2.5a.5.5 0 0 0 .708 0l2.5-2.5A.5.5 0 0 0 10.5 7.5h-2v-6z"/></g></svg>
185
+ </a>
186
+ </div>
187
+
188
+ <!-- Like section -->
189
+ <div class="liked-by">
190
+ {% if post.no_of_likes == 0 %}
191
+ <p><b>No Likes</b></p>
192
+ {% else %}
193
+ <p><b>Liked by {{post.no_of_likes}} person</b></p>
194
+ {% endif %}
195
+ </div>
196
+
197
+ <div class="caption">
198
+ <p><b>{{ post.author }}</b> {{ post.caption|safe }}</p>
199
+ </div>
200
+
201
+
202
+ <a data-bs-toggle="modal" data-bs-target="#staticBackdrop" style="cursor: pointer;">
203
+ View all comments
204
+ </a>
205
+
206
+ <!-- Modal -->
207
+ <div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
208
+ <div class="modal-dialog">
209
+ <div class="modal-content">
210
+ <div class="modal-header">
211
+ <h1 class="modal-title fs-5" id="staticBackdropLabel">Comments</h1>
212
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
213
+ </div>
214
+ <div class="modal-body">
215
+
216
+ {% if not post.comments.all %}
217
+ No Comments yet.. <a href="{% url 'add_comment' post.pk %}" >Add Comment</a>
218
+ {% else %}
219
+ {% for comment in post.comments.all %}
220
+ <strong>{{ comment.name }}-{{ comment.date_added }}</strong>
221
+ <br/>
222
+ {{ comment.body }}
223
+ <br/>
224
+ <hr>
225
+ {% endfor %}
226
+ {% endif %}
227
+
228
+ </div>
229
+ <div class="modal-footer">
230
+ <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
231
+ </div>
232
+ </div>
233
+ </div>
234
+ </div>
235
+ </div>
236
+
237
+ {% endfor %}
238
+ {% endif %}
239
+
240
+ </div>
241
+ </div>
242
+ <div class="right">
243
+ <div class="friend-requests">
244
+ <h4 style="color:rgb(107,76,230)">User Suggestions</h4>
245
+ <div class="request">
246
+ <div class="ingo">
247
+ {% for user in suggestion_users %}
248
+ <div class="profile-photo">
249
+ <a href="{% url 'show_profile_page' user.id %}">
250
+ <img src="{{ user.profileimg.url }}">
251
+ </a>
252
+ </div>
253
+ <div>
254
+ <h5>{{user.fname}} {{user.lname}}</h5>
255
+ <p class="text-muted">
256
+ {{user.description}}
257
+ </p>
258
+
259
+ </div>
260
+
261
+ <hr>
262
+ {% endfor %}
263
+ </div>
264
+ </div>
265
+ </div>
266
+ </div>
267
+ </div>
268
+ </main>
269
+ </div>
270
+
271
+ <script type="text/javascript">
272
+
273
+ (function() {
274
+ const heart = document.getElementById('heart');
275
+ heart.addEventListener('click', function() {
276
+ heart.classList.toggle('red');
277
+ });
278
+ })();
279
+
280
+ </script>
281
+ {% endblock %}
socials/base/templates/base/login.html ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- {% extends 'main.html' %} -->
2
+ {% load static %}
3
+ {% block styles %}
4
+ <!-- Replace {name} with the respective css file -->
5
+ <link rel="stylesheet" href="{% static 'styles/signup.scss' %}" />
6
+ {% endblock %}
7
+
8
+ {% block content %}
9
+ <div class="container">
10
+ <div class="form-container sign-in-container">
11
+ <form action="{% url 'login' %}" method="POST">
12
+ {% csrf_token %}
13
+ <h1 style="color:rgb(107,76,230)" style="position:relative;bottom:15px;">Sign in</h1>
14
+ <input type="text" placeholder="Username" name="username" />
15
+ <br>
16
+ <input type="password" placeholder="Password" name="password" />
17
+ <br/>
18
+ <button>Sign In</button>
19
+ </form>
20
+ </div>
21
+
22
+ <div class="overlay-container">
23
+ <div class="overlay">
24
+ <div class="overlay-panel overlay-right">
25
+ <h1>Not a User?</h1>
26
+ <p>Enter your personal details to Sign Up</p>
27
+ <button class="ghost" id="'signUp">
28
+ <a href="{% url 'signup' %}" style="text-decoration:none;color:#fff;">
29
+ Sign Up
30
+ </a>
31
+ </button>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+
38
+ {% endblock %}
socials/base/templates/base/password_success.html ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'main.html' %}
2
+ <title>Password updated</title>
3
+ {% block content %}
4
+
5
+ <div class="card container shadow p-3 mb-5 bg-body rounded" style="width: 65%;margin-top: 150px;">
6
+ <h3 class="delete-title" style="text-align:center;color:#9a35dd; margin-top: 10px;font-weight: bolder">Your Password Was Changed Successfully...</h3>
7
+ <br/>
8
+ <button style="background-color: #9a35dd;border-color: #9a35dd; width: 40%; position: relative;left: 220px;">
9
+ <a href="{% url 'home' %}" style="color: #fff; text-decoration: none;">
10
+ Go back
11
+ </a>
12
+ </button>
13
+ </div>
14
+
15
+ {% endblock %}
socials/base/templates/base/profile.html ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'main.html' %} {% load static %} {% block styles %}
2
+ <!-- Replace {name} with the respective css file -->
3
+ <link rel="stylesheet" href="{% static 'styles/profile.css' %}" />
4
+ {% endblock %}
5
+
6
+ {% block content %}
7
+ <div class="profile-card">
8
+ <div class="profile-card-header">
9
+ <div class="profile-image"></div>
10
+
11
+ <div class="profile-info">
12
+ <h3 class="profile-name">{{request.user.first_name}} {{request.user.last_name}}</h3>
13
+ <p class="profile-desc">Developer/Conent Creator</p>
14
+ </div>
15
+ </div>
16
+
17
+ <div class="profile-card-body">
18
+ <ul class="status">
19
+ <li>
20
+ <span class="status-value">532</span>
21
+ <span class="status-text">Posts</span>
22
+ </li>
23
+
24
+ <li>
25
+ <span class="status-value">1.5m</span>
26
+ <span class="status-text">Followers</span>
27
+ </li>
28
+
29
+ <li>
30
+ <span class="status-value">423</span>
31
+ <span class="status-text">Following</span>
32
+ </li>
33
+ </ul>
34
+
35
+ <div class="action">
36
+ <button class="btn btn-success" style="position: relative;left: 80px;">Follow</button>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ {% endblock %}
socials/base/templates/base/search.html ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ {% extends 'main.html' %} {% load static %} {% block styles %}
4
+
5
+ <link rel="stylesheet" href="{% static 'styles/search.css' %}" />
6
+ {% endblock %}
7
+
8
+ {% block content %}
9
+
10
+ <main>
11
+ {% if username_profile_list %}
12
+ {% for users in username_profile_list %}
13
+ <article class="profile">
14
+ <div class="profile__bg"></div>
15
+ <div class="profile__info">
16
+ <h2 class="profile__name" style=" color: rgb(2, 60, 77);">{{users.fname}} {{users.name}}</h2>
17
+ <p style="font-weight: bold; color: rgb(2, 71, 90);">@{{users.username}}</p>
18
+ <p class="profile__location text-muted" style=" color: rgb(2, 61, 78);">{{users.description}}</p>
19
+ <div class="profile__stats">
20
+ <div class="stat">
21
+ <p class="stat__number">80K</p>
22
+ <p class="stat__name">Followers</p>
23
+ </div>
24
+
25
+ </div>
26
+ </div>
27
+ <div class="profile__img__container">
28
+ <a href="{% url 'show_profile_page' users.id %}">
29
+ <img class="profile__img" src="{{users.profileimg.url}}">
30
+ </a>
31
+ </div>
32
+ </article>
33
+ {% endfor %}
34
+ {% else %}
35
+ <div class="empty-state">
36
+ <div class="empty-state__content">
37
+ <div class="empty-state__icon">
38
+ <img src="{% static 'images/home/not-found.webp' %}" alt="" style="position: relative;left: 300px;">
39
+ </div>
40
+ <div class="empty-state__message" style="color: #9a35dd;font-weight: bold;font-size: 30px; text-align: center;">No Users found
41
+ <br/><br/>
42
+ <a href="{% url 'home' %}" style="text-decoration: none; color: #fff;">
43
+ <button type="submit" class="btn btn-success">Go back</button>
44
+ </a>
45
+ </div>
46
+ <br/><br/><br/>
47
+
48
+ </div>
49
+ </div>
50
+ {% endif %}
51
+ </main>
52
+
53
+
54
+
55
+ {% endblock %}
socials/base/templates/base/signup.html ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- {% extends 'main.html' %} -->
2
+ {% load static %}
3
+ {% block styles %}
4
+ <!-- Replace {name} with the respective css file -->
5
+ <link rel="stylesheet" href="{% static 'styles/signup.scss' %}" />
6
+ {% endblock %}
7
+
8
+ {% block content %}
9
+ <div class="container" id="container">
10
+
11
+ <div class="form-container sign-in-container">
12
+ <form action="{% url 'signup' %}" method="POST">
13
+ {% csrf_token %}
14
+ <h1 style="color:rgb(107,76,230)" style="position:relative;bottom:15px;">Sign Up</h1>
15
+ <input type="text" placeholder="Username" name="username" id="username" />
16
+ <br>
17
+ <input type="email" placeholder="Email" name="email" id="email" />
18
+ <br>
19
+ <input type="password" placeholder="Password" name="password" id="password" />
20
+ <br>
21
+ <button>Sign Up</button>
22
+ </form>
23
+
24
+ </div>
25
+ <div class="overlay-container">
26
+ <div class="overlay">
27
+ <div class="overlay-panel overlay-left">
28
+ <h1>Welcome Back User!</h1>
29
+ <p>Login to stay connected</p>
30
+ <button class="ghost" id="signIn">Sign In</button>
31
+ </div>
32
+ <div class="overlay-panel overlay-right">
33
+ <h1>Already a User?</h1>
34
+ <p>Enter your personal details to Sign In</p>
35
+ <button class="ghost" id="'signUp">
36
+ <a href="{% url 'login' %}" style="text-decoration:none;color:#fff;">
37
+ Login
38
+ </a>
39
+ </button>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </div>
44
+
45
+ {% endblock %}
socials/base/templates/base/update_post.html ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'main.html' %}
2
+ {% load static %}
3
+
4
+ <title>
5
+ Edit Blog Post
6
+ </title>
7
+
8
+ {% block styles %}
9
+ <!-- Replace {name} with the respective css file -->
10
+ <link rel="stylesheet" href="{% static 'styles/update_post.css' %}" />
11
+ {% endblock %}
12
+
13
+ {% block content %}
14
+ {% if user.is_authenticated %}
15
+ {% if user.id == post.author.id %}
16
+
17
+ <div class="container shadow p-3 mb-5 bg-body rounded" style="width: 80%;margin-top: 30px;">
18
+ <h1 style="text-align:center;color:#1e3c72; margin-top: 10px;font-weight: bolder">Update Post</h1>
19
+ <br/><br/>
20
+ <div class="form-group" style="font-weight: 600;line-height: 2.5;">
21
+ <form method="POST">
22
+ {% csrf_token %}
23
+ {{ form.media }}
24
+ {{ form.as_p }}
25
+ <br>
26
+ <button class="btn btn-primary btn-block" style="width:200px;position: relative;left:40%;
27
+ background: linear-gradient(to right,#373B44 ,#4286f4 );">Update</button>
28
+ </form>
29
+ </div>
30
+ <br/><br/>
31
+ </div>
32
+
33
+ {% endif %}
34
+ {% endif %}
35
+
36
+ {% endblock %}
socials/base/tests.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from django.test import TestCase, Client
2
+ from django.urls import reverse
3
+
4
+ class HealthCheckTest(TestCase):
5
+ def test_health_check(self):
6
+ client = Client()
7
+ response = client.get(reverse('health'))
8
+ self.assertEqual(response.status_code, 200)
9
+ self.assertEqual(response.json(), {"status": "ok"})
10
+
11
+ class ApiPostsTest(TestCase):
12
+ def test_api_posts(self):
13
+ client = Client()
14
+ response = client.get(reverse('api_posts'))
15
+ self.assertEqual(response.status_code, 200)
16
+ self.assertEqual(response.json(), [])
socials/base/urls.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from django.urls import path
2
+ from django.conf import settings
3
+ from django.conf.urls.static import static
4
+ from .views import AddPostView,EditProfilePageView,CreateProfilePageView,PasswordsChangeView,FriendView,AddCommentView,DeletePostView,UpdatePostView,ShowProfilePageView
5
+ from . import views
6
+ from django.contrib.auth import views as auth_views
7
+
8
+ urlpatterns = [
9
+ path('', views.home,name='home'),
10
+ path('login/', views.login,name='login'),
11
+ path('logout/', views.logout,name='logout'),
12
+ path('signup/', views.signup,name='signup'),
13
+ path('<int:pk>/edit_profile_page/',EditProfilePageView.as_view(),name='edit_profile_page'),
14
+ path('<int:pk>/profile/',ShowProfilePageView.as_view(),name='show_profile_page'),
15
+ path('create_profile_page/',CreateProfilePageView.as_view(),name='create_profile_page'),
16
+ path('add_post/',AddPostView.as_view(),name="add_post"),
17
+ path('password/',PasswordsChangeView.as_view(template_name='base/change-password.html')),
18
+ path('password_success/', views.password_success, name="password_success"),
19
+ path('friends/',FriendView.as_view(),name='friends'),
20
+ path('post/<int:pk>/comment/',AddCommentView.as_view(),name='add_comment'),
21
+ path('like-post',views.like_post,name='like-post'),
22
+ path('post/<int:pk>/remove',DeletePostView.as_view(),name="delete_post"),
23
+ path('post/edit/<int:pk>',UpdatePostView.as_view(),name="update_post"),
24
+ path('search',views.search,name='search'),
25
+ path('follow',views.follow,name='follow'),
26
+ path('health', views.health_check, name='health'),
27
+ path('api/posts', views.api_posts, name='api_posts'),
28
+ ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
29
+
30
+
31
+
32
+ if settings.DEBUG:
33
+ urlpatterns+=static(settings.STATIC_URL,document_root=settings.STATIC_ROOT)
socials/base/views.py ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from multiprocessing import context
2
+ from django.shortcuts import render,HttpResponse,redirect,get_object_or_404
3
+ from django.contrib.auth import authenticate, login as auth_login, logout as auth_logout,update_session_auth_hash
4
+ from django.contrib import messages
5
+ from django.contrib.auth.decorators import login_required
6
+ from django.contrib.auth.hashers import make_password
7
+ from django.template.loader import render_to_string
8
+ from django.contrib.auth.models import User
9
+ from django.contrib.auth import get_user_model
10
+ from django.conf import settings
11
+ from django.views.generic import DetailView,CreateView
12
+ from django.contrib.auth.views import PasswordChangeView
13
+ from .models import *
14
+ from django.urls import reverse_lazy,reverse
15
+ from django.views import generic
16
+ from django.views.generic import ListView,DetailView,CreateView,UpdateView,DeleteView
17
+ from .forms import *
18
+ from django.http import HttpResponseRedirect, JsonResponse
19
+ from django.contrib.auth.decorators import login_required
20
+ from itertools import chain
21
+ import random
22
+
23
+ # Create your views here.
24
+ @login_required(login_url='signup')
25
+ def home(request):
26
+ user_object = User.objects.get(username=request.user.username)
27
+ user_profile = Profile.objects.get(user=user_object)
28
+ all_users = User.objects.all()
29
+ all_posts=Post.objects.all()
30
+ all_profile=Profile.objects.all()
31
+ count_posts=len(all_posts)
32
+
33
+ my_user=[user_profile]
34
+ suggestion_users=[]
35
+
36
+ for user in all_profile:
37
+ if user not in my_user:
38
+ suggestion_users.append(user)
39
+
40
+ random.shuffle(suggestion_users)
41
+
42
+ context={
43
+ 'user_object':user_object,
44
+ 'user_profile':user_profile,
45
+ 'all_users':all_users,
46
+ 'all_posts':all_posts,
47
+ 'all_profile':all_profile,
48
+ 'count_posts':count_posts,
49
+ 'suggestion_users':suggestion_users,
50
+ }
51
+ return render(request,"base/home.html",context)
52
+
53
+ class ShowProfilePageView(DetailView):
54
+ model = Profile
55
+ template_name = 'base/Otherprofile.html'
56
+
57
+ def get_context_data(self,*args,**kwargs):
58
+ context=super(ShowProfilePageView,self).get_context_data(*args,**kwargs)
59
+ page_user=get_object_or_404(Profile,id=self.kwargs['pk'])
60
+ logged_in_user_posts = Post.objects.filter(author=page_user)
61
+
62
+ if FollowersCount.objects.filter(user=page_user).first():
63
+ button_text='UnFollow'
64
+ else:
65
+ button_text='Follow'
66
+
67
+ user_followers=len(FollowersCount.objects.filter(user=page_user))
68
+ user_following=len(FollowersCount.objects.filter(follower=page_user))
69
+
70
+ num_posts=len(logged_in_user_posts)
71
+ context["page_user"]=page_user
72
+ context['logged_in_user_posts']=logged_in_user_posts
73
+ context['num_posts']=num_posts
74
+ context['button_text']=button_text
75
+ context['user_followers']=user_followers
76
+ context['user_following']=user_following
77
+ return context
78
+
79
+ def login(request):
80
+ if request.user.is_authenticated:
81
+ return redirect('/')
82
+ if request.method=="POST":
83
+ login_username=request.POST.get('username', None)
84
+ user_password=request.POST["password"]
85
+ user = authenticate(request,username=login_username, password = user_password)
86
+ if user is not None:
87
+ auth_login(request, user)
88
+ messages.add_message(request, messages.INFO, 'You have successfully logged in.')
89
+ return redirect('/')
90
+
91
+ else:
92
+ messages.add_message(request, messages.INFO, 'Invalid username or password.')
93
+ return render(request,"base/login.html")
94
+
95
+ return render(request,"base/login.html")
96
+
97
+ def signup(request):
98
+ if request.user.is_authenticated:
99
+ return redirect('/')
100
+ if request.method == 'POST':
101
+ email=request.POST['email']
102
+ password=request.POST['password']
103
+ username=request.POST['username']
104
+ email=email.rstrip()
105
+
106
+ if email == '' or password == '' or username == '':
107
+ messages.error(request,"Please fill all the fields.")
108
+ return render(request,"base/signup.html")
109
+
110
+ elif User.objects.filter(username=username).exists():
111
+ messages.add_message(request, messages.INFO, 'Username already exists.')
112
+ return render(request,"base/signup.html")
113
+
114
+ elif User.objects.filter(email=email).exists():
115
+ messages.add_message(request, messages.INFO, 'Email already exists.')
116
+ return render(request,"base/signup.html")
117
+
118
+ else :
119
+ user = User.objects.create(email=email, username=username, password=make_password(password))
120
+ user.save()
121
+ auth_login(request, user)
122
+ messages.add_message(request, messages.INFO, 'You have successfully signed up.')
123
+ return redirect('/create_profile_page')
124
+ else:
125
+ return render(request,"base/signup.html")
126
+
127
+
128
+ def logout(request):
129
+ auth_logout(request)
130
+ return redirect('/')
131
+
132
+ class FriendView(ListView):
133
+ model = Profile
134
+ template_name = 'base/friends.html'
135
+ profiles=Profile.objects.all()
136
+ ordering = ['-id']
137
+
138
+ def get_context_data(self,*args,**kwargs):
139
+ context=super(FriendView,self).get_context_data(*args,**kwargs)
140
+ page_user=get_object_or_404(Profile)
141
+ context["page_user"]=page_user
142
+ return context
143
+
144
+
145
+ class AddPostView(CreateView):
146
+ model = Post
147
+ form_class = PostForm
148
+ template_name = 'base/add_post.html'
149
+
150
+ class CreateProfilePageView(CreateView):
151
+ model = Profile
152
+ form_class=ProfilePageForm
153
+ template_name="base/create_user_profile.html"
154
+
155
+ def form_valid(self,form):
156
+ form.instance.user=self.request.user
157
+ return super().form_valid(form)
158
+
159
+ class EditProfilePageView(generic.UpdateView):
160
+ model = Profile
161
+ form_class=EditProfileNewForm
162
+ template_name='base/edit_profile_page.html'
163
+ success_url=reverse_lazy('home')
164
+
165
+
166
+ class PasswordsChangeView(PasswordChangeView):
167
+ form_class= PasswordChangingForm
168
+ success_url= reverse_lazy('password_success')
169
+
170
+ def password_success(request):
171
+ return render(request, 'base/password_success.html', {})
172
+
173
+ class AddCommentView(CreateView):
174
+ model = Comment
175
+ form_class = CommentForm
176
+ template_name = 'base/add_comment.html'
177
+
178
+ def form_valid(self,form):
179
+ form.instance.post_id=self.kwargs['pk']
180
+ return super().form_valid(form)
181
+
182
+
183
+ @login_required(login_url='signup')
184
+ def like_post(request):
185
+ username=request.user.username
186
+ post_id=request.GET.get('post_id')
187
+ post=Post.objects.get(id=post_id)
188
+ like_filter=LikePost.objects.filter(post_id=post_id,username=username).first()
189
+
190
+ if like_filter==None:
191
+ new_like=LikePost.objects.create(post_id=post_id,username=username)
192
+ new_like.save()
193
+
194
+ post.no_of_likes=post.no_of_likes+1
195
+ post.save()
196
+ return redirect('/')
197
+
198
+ else:
199
+ like_filter.delete()
200
+ post.no_of_likes=post.no_of_likes-1
201
+ post.save()
202
+ return redirect('/')
203
+
204
+ class DeletePostView(DeleteView):
205
+ model = Post
206
+ template_name = 'base/delete_post.html'
207
+ success_url = reverse_lazy('home')
208
+
209
+ @login_required(login_url='signup')
210
+ def search(request):
211
+ user_object = User.objects.get(username=request.user.username)
212
+ user_profile = Profile.objects.get(user=user_object)
213
+
214
+ if request.method == 'POST':
215
+ username = request.POST['username']
216
+ username_object = Profile.objects.filter(username__icontains=username)
217
+
218
+ username_profile = []
219
+ username_profile_list = []
220
+
221
+ for users in username_object:
222
+ username_profile.append(users.id)
223
+
224
+ for ids in username_profile:
225
+ profile_lists = Profile.objects.filter(id=ids)
226
+ username_profile_list.append(profile_lists)
227
+
228
+ username_profile_list = list(chain(*username_profile_list))
229
+ return render(request, 'base/search.html', { 'user_profile':user_profile,'username_profile_list': username_profile_list,'username_profile':username_profile})
230
+
231
+ class UpdatePostView(UpdateView):
232
+ model = Post
233
+ form_class=EditForm
234
+ template_name = 'base/update_post.html'
235
+
236
+ def health_check(request):
237
+ return JsonResponse({"status": "ok"})
238
+
239
+ def api_posts(request):
240
+ posts = Post.objects.all()
241
+ data = []
242
+ for post in posts:
243
+ data.append({
244
+ "id": post.id,
245
+ "title": post.title,
246
+ "author": post.author.username,
247
+ "no_of_likes": post.no_of_likes,
248
+ "date": post.post_date.strftime("%Y-%m-%d")
249
+ })
250
+ return JsonResponse(data, safe=False)
251
+
252
+ @login_required(login_url='signup')
253
+ def follow(request):
254
+ if request.method == 'POST':
255
+ follower = request.POST['follower']
256
+ user = request.POST['user']
257
+
258
+ if FollowersCount.objects.filter(follower=follower, user=user).first():
259
+ delete_follower = FollowersCount.objects.get(follower=follower, user=user)
260
+ delete_follower.delete()
261
+ return redirect('/')
262
+ else:
263
+ new_follower = FollowersCount.objects.create(follower=follower, user=user)
264
+ new_follower.save()
265
+ return redirect('/')
266
+ else:
267
+ return redirect('/')
268
+
269
+
270
+
271
+
272
+
273
+
274
+
socials/manage.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ """Django's command-line utility for administrative tasks."""
3
+ import os
4
+ import sys
5
+
6
+
7
+ def main():
8
+ """Run administrative tasks."""
9
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "socials.settings")
10
+ try:
11
+ from django.core.management import execute_from_command_line
12
+ except ImportError as exc:
13
+ raise ImportError(
14
+ "Couldn't import Django. Are you sure it's installed and "
15
+ "available on your PYTHONPATH environment variable? Did you "
16
+ "forget to activate a virtual environment?"
17
+ ) from exc
18
+ execute_from_command_line(sys.argv)
19
+
20
+
21
+ if __name__ == "__main__":
22
+ main()
socials/socials/__init__.py ADDED
File without changes
socials/socials/asgi.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ ASGI config for socials project.
3
+
4
+ It exposes the ASGI callable as a module-level variable named ``application``.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/
8
+ """
9
+
10
+ import os
11
+
12
+ from django.core.asgi import get_asgi_application
13
+
14
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "socials.settings")
15
+
16
+ application = get_asgi_application()
socials/socials/settings.py ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Django settings for socials project.
3
+
4
+ Generated by 'django-admin startproject' using Django 4.1.1.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/4.1/topics/settings/
8
+
9
+ For the full list of settings and their values, see
10
+ https://docs.djangoproject.com/en/4.1/ref/settings/
11
+ """
12
+
13
+ from pathlib import Path
14
+ import os
15
+
16
+ # Build paths inside the project like this: BASE_DIR / 'subdir'.
17
+ BASE_DIR = Path(__file__).resolve().parent.parent
18
+
19
+
20
+ # Quick-start development settings - unsuitable for production
21
+ # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
22
+
23
+ # SECURITY WARNING: keep the secret key used in production secret!
24
+ SECRET_KEY = "django-insecure-^bk)o+h%-=9149%=!gxc=-y@9)nnn^-um*x@cvz%o0d4-&_a*6"
25
+
26
+ # SECURITY WARNING: don't run with debug turned on in production!
27
+ DEBUG = True
28
+
29
+ ALLOWED_HOSTS = ["*"]
30
+
31
+
32
+ # Application definition
33
+
34
+ INSTALLED_APPS = [
35
+ "django.contrib.admin",
36
+ "django.contrib.auth",
37
+ "django.contrib.contenttypes",
38
+ "django.contrib.sessions",
39
+ "django.contrib.messages",
40
+ "django.contrib.staticfiles",
41
+ "base.apps.BaseConfig",
42
+ "django_filters",
43
+ "crispy_forms",
44
+ "ckeditor",
45
+ ]
46
+
47
+ MIDDLEWARE = [
48
+ "django.middleware.security.SecurityMiddleware",
49
+ "django.contrib.sessions.middleware.SessionMiddleware",
50
+ "django.middleware.common.CommonMiddleware",
51
+ "django.middleware.csrf.CsrfViewMiddleware",
52
+ "django.contrib.auth.middleware.AuthenticationMiddleware",
53
+ "django.contrib.messages.middleware.MessageMiddleware",
54
+ "django.middleware.clickjacking.XFrameOptionsMiddleware",
55
+ ]
56
+
57
+ ROOT_URLCONF = "socials.urls"
58
+
59
+ TEMPLATES = [
60
+ {
61
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
62
+ "DIRS": [ BASE_DIR / 'templates'],
63
+ "APP_DIRS": True,
64
+ "OPTIONS": {
65
+ "context_processors": [
66
+ "django.template.context_processors.debug",
67
+ "django.template.context_processors.request",
68
+ "django.contrib.auth.context_processors.auth",
69
+ "django.contrib.messages.context_processors.messages",
70
+ ],
71
+ },
72
+ },
73
+ ]
74
+
75
+ WSGI_APPLICATION = "socials.wsgi.application"
76
+
77
+
78
+ # Database
79
+ # https://docs.djangoproject.com/en/4.1/ref/settings/#databases
80
+
81
+ DATABASES = {
82
+ "default": {
83
+ "ENGINE": "django.db.backends.sqlite3",
84
+ "NAME": BASE_DIR / "db.sqlite3",
85
+ }
86
+ }
87
+
88
+
89
+ # Password validation
90
+ # https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
91
+
92
+ AUTH_PASSWORD_VALIDATORS = [
93
+ {
94
+ "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
95
+ },
96
+ {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",},
97
+ {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",},
98
+ {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",},
99
+ ]
100
+
101
+
102
+ # Internationalization
103
+ # https://docs.djangoproject.com/en/4.1/topics/i18n/
104
+
105
+ LANGUAGE_CODE = "en-us"
106
+
107
+ TIME_ZONE = "UTC"
108
+
109
+ USE_I18N = True
110
+
111
+ USE_TZ = True
112
+
113
+
114
+ # Static files (CSS, JavaScript, Images)
115
+ # https://docs.djangoproject.com/en/4.1/howto/static-files/
116
+
117
+ STATIC_URL = "static/"
118
+
119
+
120
+ STATICFILES_DIRS=[
121
+ BASE_DIR / 'static'
122
+ ]
123
+
124
+ #Managing media
125
+ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
126
+ MEDIA_URL = '/media/'
127
+
128
+ # Email:
129
+ EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
130
+ EMAIL_HOST = 'smtp.gmail.com'
131
+ EMAIL_PORT = 587
132
+ EMAIL_HOST_USER= 'gpkini2002@gmail.com'
133
+ EMAIL_HOST_PASSWORD = ''
134
+ EMAIL_USE_TLS = True
135
+ PASSWORD_RESET_TIMEOUT = 900 # in seconds # 15 min
136
+
137
+ # Default primary key field type
138
+ # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
139
+
140
+ DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
socials/socials/urls.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """socials URL Configuration
2
+
3
+ The `urlpatterns` list routes URLs to views. For more information please see:
4
+ https://docs.djangoproject.com/en/4.1/topics/http/urls/
5
+ Examples:
6
+ Function views
7
+ 1. Add an import: from my_app import views
8
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
9
+ Class-based views
10
+ 1. Add an import: from other_app.views import Home
11
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12
+ Including another URLconf
13
+ 1. Import the include() function: from django.urls import include, path
14
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15
+ """
16
+ from django.contrib import admin
17
+ from django.urls import path,include
18
+
19
+ urlpatterns = [
20
+ path("admin/", admin.site.urls),
21
+ path('',include('base.urls')),
22
+ ]
socials/socials/wsgi.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ WSGI config for socials 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/4.1/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", "socials.settings")
15
+
16
+ application = get_wsgi_application()
socials/static/images/friends/banner.jpg ADDED
socials/static/images/friends/img-1.jpg ADDED
socials/static/images/friends/img-2.jpg ADDED
socials/static/images/friends/img-3.jpeg ADDED

Git LFS Details

  • SHA256: ce319952a56f8934856a2c3d734d3ac2bfad9a7bba7b2feee02433551f312bc3
  • Pointer size: 131 Bytes
  • Size of remote file: 468 kB
socials/static/images/friends/img-4.webp ADDED
socials/static/images/friends/img-5.jpg ADDED
socials/static/images/friends/img-6.jpg ADDED
socials/static/images/friends/img-7.webp ADDED
socials/static/images/friends/img-8.webp ADDED
socials/static/images/friends/img-9.png ADDED

Git LFS Details

  • SHA256: 15ce6a8337f4e842a562bb7255d10e47c320902bdc21cb2d87f78212d1fb5663
  • Pointer size: 131 Bytes
  • Size of remote file: 179 kB