├── .gitignore ├── DjangoStudyBuddyProject ├── __init__.py ├── asgi.py ├── settings.py ├── urls.py └── wsgi.py ├── LICENSE ├── README.md ├── account ├── __init__.py ├── admin.py ├── apps.py ├── forms.py ├── managers.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_user_bio_user_phone_number_user_profile_image_and_more.py │ ├── 0003_alter_user_options_alter_user_managers_and_more.py │ ├── 0004_alter_user_phone_number.py │ ├── 0005_user_bio.py │ └── __init__.py ├── models.py ├── templates │ └── account │ │ ├── login.html │ │ └── profile.html ├── tests.py ├── urls.py └── views.py ├── context_processors ├── __init__.py └── context_processors.py ├── core ├── __init__.py ├── admin.py ├── apps.py ├── forms.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_room.py │ ├── 0003_message.py │ ├── 0004_room_status.py │ ├── 0005_message_status.py │ ├── 0006_alter_room_host.py │ └── __init__.py ├── mixins.py ├── models.py ├── templates │ └── core │ │ ├── confirm_delete.html │ │ ├── create_room.html │ │ ├── create_topic.html │ │ ├── home.html │ │ ├── room.html │ │ └── topics.html ├── tests.py ├── urls.py └── views.py ├── manage.py ├── static ├── assets │ ├── avatar.svg │ ├── favicon.ico │ ├── icons │ │ ├── add.svg │ │ ├── arrow-left.svg │ │ ├── chevron-down.svg │ │ ├── delete.svg │ │ ├── edit.svg │ │ ├── ellipsis-horizontal.svg │ │ ├── ellipsis-vertical.svg │ │ ├── lock.svg │ │ ├── remove.svg │ │ ├── search.svg │ │ ├── sign-out.svg │ │ ├── tools.svg │ │ ├── user-group.svg │ │ └── user.svg │ ├── images │ │ └── sutdent-prof.png │ └── logo.svg ├── css │ └── style.css └── js │ └── script.js └── templates ├── base.html └── inc ├── activity_side.html ├── head.html ├── header.html └── topic_side.html /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/python,django,visualstudiocode,venv 2 | # Edit at https://www.toptal.com/developers/gitignore?templates=python,django,visualstudiocode,venv 3 | 4 | # my ignore 5 | theme/ 6 | ### Django ### 7 | *.log 8 | *.pot 9 | *.pyc 10 | __pycache__/ 11 | local_settings.py 12 | db.sqlite3 13 | db.sqlite3-journal 14 | media 15 | .idea/ 16 | 17 | # If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/ 18 | # in your Git repository. Update and uncomment the following line accordingly. 19 | # /staticfiles/ 20 | 21 | ### Django.Python Stack ### 22 | # Byte-compiled / optimized / DLL files 23 | *.py[cod] 24 | *$py.class 25 | 26 | # C extensions 27 | *.so 28 | 29 | # Distribution / packaging 30 | .Python 31 | build/ 32 | develop-eggs/ 33 | dist/ 34 | downloads/ 35 | eggs/ 36 | .eggs/ 37 | lib/ 38 | lib64/ 39 | parts/ 40 | sdist/ 41 | var/ 42 | wheels/ 43 | share/python-wheels/ 44 | *.egg-info/ 45 | .installed.cfg 46 | *.egg 47 | MANIFEST 48 | 49 | # PyInstaller 50 | # Usually these files are written by a python script from a template 51 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 52 | *.manifest 53 | *.spec 54 | 55 | # Installer logs 56 | pip-log.txt 57 | pip-delete-this-directory.txt 58 | 59 | # Unit test / coverage reports 60 | htmlcov/ 61 | .tox/ 62 | .nox/ 63 | .coverage 64 | .coverage.* 65 | .cache 66 | nosetests.xml 67 | coverage.xml 68 | *.cover 69 | *.py,cover 70 | .hypothesis/ 71 | .pytest_cache/ 72 | cover/ 73 | 74 | # Translations 75 | *.mo 76 | 77 | # Django stuff: 78 | 79 | # Flask stuff: 80 | instance/ 81 | .webassets-cache 82 | 83 | # Scrapy stuff: 84 | .scrapy 85 | 86 | # Sphinx documentation 87 | docs/_build/ 88 | 89 | # PyBuilder 90 | .pybuilder/ 91 | target/ 92 | 93 | # Jupyter Notebook 94 | .ipynb_checkpoints 95 | 96 | # IPython 97 | profile_default/ 98 | ipython_config.py 99 | 100 | # pyenv 101 | # For a library or package, you might want to ignore these files since the code is 102 | # intended to run in multiple environments; otherwise, check them in: 103 | # .python-version 104 | 105 | # pipenv 106 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 107 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 108 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 109 | # install all needed dependencies. 110 | #Pipfile.lock 111 | 112 | # poetry 113 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 114 | # This is especially recommended for binary packages to ensure reproducibility, and is more 115 | # commonly ignored for libraries. 116 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 117 | #poetry.lock 118 | 119 | # pdm 120 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 121 | #pdm.lock 122 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 123 | # in version control. 124 | # https://pdm.fming.dev/#use-with-ide 125 | .pdm.toml 126 | 127 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 128 | __pypackages__/ 129 | 130 | # Celery stuff 131 | celerybeat-schedule 132 | celerybeat.pid 133 | 134 | # SageMath parsed files 135 | *.sage.py 136 | 137 | # Environments 138 | .env 139 | .venv 140 | env/ 141 | venv/ 142 | ENV/ 143 | env.bak/ 144 | venv.bak/ 145 | 146 | # Spyder project settings 147 | .spyderproject 148 | .spyproject 149 | 150 | # Rope project settings 151 | .ropeproject 152 | 153 | # mkdocs documentation 154 | /site 155 | 156 | # mypy 157 | .mypy_cache/ 158 | .dmypy.json 159 | dmypy.json 160 | 161 | # Pyre type checker 162 | .pyre/ 163 | 164 | # pytype static type analyzer 165 | .pytype/ 166 | 167 | # Cython debug symbols 168 | cython_debug/ 169 | 170 | # PyCharm 171 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 172 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 173 | # and can be added to the global gitignore or merged into this file. For a more nuclear 174 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 175 | #.idea/ 176 | 177 | ### Python ### 178 | # Byte-compiled / optimized / DLL files 179 | 180 | # C extensions 181 | 182 | # Distribution / packaging 183 | 184 | # PyInstaller 185 | # Usually these files are written by a python script from a template 186 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 187 | 188 | # Installer logs 189 | 190 | # Unit test / coverage reports 191 | 192 | # Translations 193 | 194 | # Django stuff: 195 | 196 | # Flask stuff: 197 | 198 | # Scrapy stuff: 199 | 200 | # Sphinx documentation 201 | 202 | # PyBuilder 203 | 204 | # Jupyter Notebook 205 | 206 | # IPython 207 | 208 | # pyenv 209 | # For a library or package, you might want to ignore these files since the code is 210 | # intended to run in multiple environments; otherwise, check them in: 211 | # .python-version 212 | 213 | # pipenv 214 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 215 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 216 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 217 | # install all needed dependencies. 218 | 219 | # poetry 220 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 221 | # This is especially recommended for binary packages to ensure reproducibility, and is more 222 | # commonly ignored for libraries. 223 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 224 | 225 | # pdm 226 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 227 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 228 | # in version control. 229 | # https://pdm.fming.dev/#use-with-ide 230 | 231 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 232 | 233 | # Celery stuff 234 | 235 | # SageMath parsed files 236 | 237 | # Environments 238 | 239 | # Spyder project settings 240 | 241 | # Rope project settings 242 | 243 | # mkdocs documentation 244 | 245 | # mypy 246 | 247 | # Pyre type checker 248 | 249 | # pytype static type analyzer 250 | 251 | # Cython debug symbols 252 | 253 | # PyCharm 254 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 255 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 256 | # and can be added to the global gitignore or merged into this file. For a more nuclear 257 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 258 | 259 | ### venv ### 260 | # Virtualenv 261 | # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ 262 | [Bb]in 263 | [Ii]nclude 264 | [Ll]ib 265 | [Ll]ib64 266 | [Ll]ocal 267 | [Ss]cripts 268 | pyvenv.cfg 269 | pip-selfcheck.json 270 | 271 | ### VisualStudioCode ### 272 | .vscode/* 273 | !.vscode/settings.json 274 | !.vscode/tasks.json 275 | !.vscode/launch.json 276 | !.vscode/extensions.json 277 | !.vscode/*.code-snippets 278 | 279 | # Local History for Visual Studio Code 280 | .history/ 281 | 282 | # Built Visual Studio Code Extensions 283 | *.vsix 284 | 285 | ### VisualStudioCode Patch ### 286 | # Ignore all local history of files 287 | .history 288 | .ionide 289 | 290 | # Support for Project snippet scope 291 | .vscode/*.code-snippets 292 | 293 | # Ignore code-workspaces 294 | *.code-workspace 295 | 296 | # End of https://www.toptal.com/developers/gitignore/api/python,django,visualstudiocode,venv -------------------------------------------------------------------------------- /DjangoStudyBuddyProject/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abolfazlz15/StudyBuddyDjangoProject/aef900571d534d1f8273e1df54e520d8988224d2/DjangoStudyBuddyProject/__init__.py -------------------------------------------------------------------------------- /DjangoStudyBuddyProject/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for DjangoStudyBuddyProject 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.0/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', 'DjangoStudyBuddyProject.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /DjangoStudyBuddyProject/settings.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | import os 3 | 4 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 5 | BASE_DIR = Path(__file__).resolve().parent.parent 6 | 7 | 8 | # Quick-start development settings - unsuitable for production 9 | # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ 10 | 11 | # SECURITY WARNING: keep the secret key used in production secret! 12 | SECRET_KEY = 'django-insecure-nk9rv-kg%lx85srxxqow79#^mo9e61y$64)oi_z0bhdqej)$so' 13 | 14 | # SECURITY WARNING: don't run with debug turned on in production! 15 | DEBUG = True 16 | 17 | ALLOWED_HOSTS = [] 18 | 19 | 20 | # Application definition 21 | 22 | INSTALLED_APPS = [ 23 | 'django.contrib.admin', 24 | 'django.contrib.auth', 25 | 'django.contrib.contenttypes', 26 | 'django.contrib.sessions', 27 | 'django.contrib.messages', 28 | 'django.contrib.staticfiles', 29 | 30 | # my apps 31 | 'core.apps.CoreConfig', 32 | 'account.apps.AccountConfig', 33 | ] 34 | 35 | MIDDLEWARE = [ 36 | 'django.middleware.security.SecurityMiddleware', 37 | 'django.contrib.sessions.middleware.SessionMiddleware', 38 | 'django.middleware.common.CommonMiddleware', 39 | 'django.middleware.csrf.CsrfViewMiddleware', 40 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 41 | 'django.contrib.messages.middleware.MessageMiddleware', 42 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 43 | ] 44 | 45 | ROOT_URLCONF = 'DjangoStudyBuddyProject.urls' 46 | 47 | TEMPLATES = [ 48 | { 49 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 50 | 'DIRS': [BASE_DIR / 'templates'] 51 | , 52 | 'APP_DIRS': True, 53 | 'OPTIONS': { 54 | 'context_processors': [ 55 | 'django.template.context_processors.debug', 56 | 'django.template.context_processors.request', 57 | 'django.contrib.auth.context_processors.auth', 58 | 'django.contrib.messages.context_processors.messages', 59 | 60 | 'context_processors.context_processors.topics', 61 | 'context_processors.context_processors.recent_activities', 62 | ], 63 | }, 64 | }, 65 | ] 66 | 67 | WSGI_APPLICATION = 'DjangoStudyBuddyProject.wsgi.application' 68 | 69 | 70 | # Database 71 | # https://docs.djangoproject.com/en/4.0/ref/settings/#databases 72 | 73 | DATABASES = { 74 | 'default': { 75 | 'ENGINE': 'django.db.backends.sqlite3', 76 | 'NAME': BASE_DIR / 'db.sqlite3', 77 | } 78 | } 79 | 80 | 81 | # Password validation 82 | # https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators 83 | 84 | AUTH_PASSWORD_VALIDATORS = [ 85 | { 86 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 87 | }, 88 | { 89 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 90 | }, 91 | { 92 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 93 | }, 94 | { 95 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 96 | }, 97 | ] 98 | 99 | 100 | # Internationalization 101 | # https://docs.djangoproject.com/en/4.0/topics/i18n/ 102 | 103 | LANGUAGE_CODE = 'en-us' 104 | 105 | TIME_ZONE = 'UTC' 106 | 107 | USE_I18N = True 108 | 109 | USE_TZ = True 110 | 111 | 112 | # Static files (CSS, JavaScript, Images) 113 | # https://docs.djangoproject.com/en/4.0/howto/static-files/ 114 | 115 | STATIC_URL = 'static/' 116 | STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')] 117 | MEDIA_URL = "/media/" 118 | MEDIA_ROOT = os.path.join(BASE_DIR, "media") 119 | # Default primary key field type 120 | # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field 121 | 122 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 123 | 124 | AUTH_USER_MODEL = 'account.User' -------------------------------------------------------------------------------- /DjangoStudyBuddyProject/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path, include 3 | from django.conf.urls.static import static 4 | from . import settings 5 | 6 | urlpatterns = [ 7 | path('admin/', admin.site.urls), 8 | path('', include('core.urls')), 9 | path('account/', include('account.urls')), 10 | 11 | ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 12 | -------------------------------------------------------------------------------- /DjangoStudyBuddyProject/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for DjangoStudyBuddyProject 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.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DjangoStudyBuddyProject.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # StudyBuddyDjangoProject 2 | this is Study Buddy project develop with django and class base views 3 | -------------------------------------------------------------------------------- /account/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abolfazlz15/StudyBuddyDjangoProject/aef900571d534d1f8273e1df54e520d8988224d2/account/__init__.py -------------------------------------------------------------------------------- /account/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.contrib.auth.admin import UserAdmin as BaseUserAdmin 3 | from django.contrib.auth.models import Group 4 | 5 | from .forms import UserChangeForm, UserCreationForm 6 | from .models import User 7 | 8 | 9 | class UserAdmin(BaseUserAdmin): 10 | # The forms to add and change user instances 11 | form = UserChangeForm 12 | add_form = UserCreationForm 13 | 14 | list_display = ('showImage', 'email', 'username', 'phone_number', 'is_admin') 15 | list_filter = ('is_admin', 'is_active', 'is_superuser') 16 | fieldsets = ( 17 | (None, {'fields': ('email', 'username', 'password')}), 18 | ('Personal info', {'fields': ('phone_number', 'bio')}), 19 | ('Permissions', {'fields': ('is_admin','is_active', 'is_superuser')}), 20 | ) 21 | 22 | add_fieldsets = ( 23 | (None, { 24 | 'classes': ('wide',), 25 | 'fields': ('email', 'username', 'phone_number', 'password1', 'password2'), 26 | }), 27 | ) 28 | search_fields = ('email', 'username', 'phone_number') 29 | ordering = ('email',) 30 | filter_horizontal = () 31 | 32 | 33 | admin.site.register(User, UserAdmin) 34 | 35 | admin.site.unregister(Group) 36 | -------------------------------------------------------------------------------- /account/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AccountConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'account' 7 | -------------------------------------------------------------------------------- /account/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.contrib.auth.forms import ReadOnlyPasswordHashField 3 | from django.core.exceptions import ValidationError 4 | from django.contrib.auth import authenticate 5 | 6 | from .models import User 7 | 8 | 9 | class UserCreationForm(forms.ModelForm): 10 | 11 | password1 = forms.CharField(label='Password', widget=forms.PasswordInput) 12 | password2 = forms.CharField(label='Password confirmation', widget=forms.PasswordInput) 13 | 14 | class Meta: 15 | model = User 16 | fields = ('email', 'username', 'phone_number') 17 | 18 | def clean_password2(self): 19 | # Check that the two password entries match 20 | password1 = self.cleaned_data.get("password1") 21 | password2 = self.cleaned_data.get("password2") 22 | if password1 and password2 and password1 != password2: 23 | raise ValidationError("Passwords don't match") 24 | return password2 25 | 26 | def save(self, commit=True): 27 | # Save the provided password in hashed format 28 | user = super().save(commit=False) 29 | user.set_password(self.cleaned_data["password1"]) 30 | if commit: 31 | user.save() 32 | return user 33 | 34 | 35 | class UserChangeForm(forms.ModelForm): 36 | password = ReadOnlyPasswordHashField() 37 | 38 | class Meta: 39 | model = User 40 | fields = ('email', 'password', 'username', 'phone_number', 'is_active', 'is_admin') 41 | 42 | 43 | class LoginForm(forms.Form): 44 | email = forms.EmailField(widget=forms.EmailInput( 45 | attrs={'placeholder': 'enter your email'}) 46 | ) 47 | password = forms.CharField(widget=forms.PasswordInput( 48 | attrs={'placeholder': 'enter your password'}) 49 | ) 50 | 51 | def clean_password(self): 52 | user = authenticate(email=self.cleaned_data.get('email'), password=self.cleaned_data.get('password')) 53 | if user is not None: 54 | return self.cleaned_data.get('password') 55 | raise ValidationError('username or password is incorrect', code='invalid_info') -------------------------------------------------------------------------------- /account/managers.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.models import BaseUserManager 2 | 3 | class UserManager(BaseUserManager): 4 | def create_user(self, email, username, password=None): 5 | 6 | if not email: 7 | raise ValueError('Users must have an email address') 8 | 9 | user = self.model( 10 | email=self.normalize_email(email), 11 | username=username, 12 | ) 13 | 14 | user.set_password(password) 15 | user.save(using=self._db) 16 | return user 17 | 18 | def create_superuser(self, email, username, password=None): 19 | 20 | user = self.create_user( 21 | email, 22 | password=password, 23 | username=username, 24 | ) 25 | user.is_admin = True 26 | user.save(using=self._db) 27 | return user -------------------------------------------------------------------------------- /account/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.6 on 2022-08-11 17:45 2 | 3 | import django.contrib.auth.models 4 | import django.contrib.auth.validators 5 | from django.db import migrations, models 6 | import django.utils.timezone 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | ('auth', '0012_alter_user_first_name_max_length'), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='User', 20 | fields=[ 21 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('password', models.CharField(max_length=128, verbose_name='password')), 23 | ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), 24 | ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), 25 | ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), 26 | ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), 27 | ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), 28 | ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), 29 | ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), 30 | ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), 31 | ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), 32 | ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')), 33 | ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')), 34 | ], 35 | options={ 36 | 'verbose_name': 'user', 37 | 'verbose_name_plural': 'users', 38 | 'abstract': False, 39 | }, 40 | managers=[ 41 | ('objects', django.contrib.auth.models.UserManager()), 42 | ], 43 | ), 44 | ] 45 | -------------------------------------------------------------------------------- /account/migrations/0002_user_bio_user_phone_number_user_profile_image_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.6 on 2022-08-11 20:42 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('account', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='user', 15 | name='bio', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | migrations.AddField( 19 | model_name='user', 20 | name='phone_number', 21 | field=models.CharField(default='09916883866', max_length=11, unique=True), 22 | preserve_default=False, 23 | ), 24 | migrations.AddField( 25 | model_name='user', 26 | name='profile_image', 27 | field=models.ImageField(blank=True, null=True, upload_to='user_profile'), 28 | ), 29 | migrations.AlterField( 30 | model_name='user', 31 | name='email', 32 | field=models.EmailField(max_length=254, unique=True, verbose_name='email address'), 33 | ), 34 | ] 35 | -------------------------------------------------------------------------------- /account/migrations/0003_alter_user_options_alter_user_managers_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.6 on 2022-08-17 17:49 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('account', '0002_user_bio_user_phone_number_user_profile_image_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='user', 15 | options={}, 16 | ), 17 | migrations.AlterModelManagers( 18 | name='user', 19 | managers=[ 20 | ], 21 | ), 22 | migrations.RenameField( 23 | model_name='user', 24 | old_name='profile_image', 25 | new_name='avatar', 26 | ), 27 | migrations.RemoveField( 28 | model_name='user', 29 | name='bio', 30 | ), 31 | migrations.RemoveField( 32 | model_name='user', 33 | name='date_joined', 34 | ), 35 | migrations.RemoveField( 36 | model_name='user', 37 | name='first_name', 38 | ), 39 | migrations.RemoveField( 40 | model_name='user', 41 | name='is_staff', 42 | ), 43 | migrations.RemoveField( 44 | model_name='user', 45 | name='last_name', 46 | ), 47 | migrations.AddField( 48 | model_name='user', 49 | name='is_admin', 50 | field=models.BooleanField(default=False), 51 | ), 52 | migrations.AlterField( 53 | model_name='user', 54 | name='email', 55 | field=models.EmailField(max_length=255, unique=True, verbose_name='email address'), 56 | ), 57 | migrations.AlterField( 58 | model_name='user', 59 | name='is_active', 60 | field=models.BooleanField(default=True), 61 | ), 62 | migrations.AlterField( 63 | model_name='user', 64 | name='username', 65 | field=models.CharField(max_length=100, unique=True), 66 | ), 67 | ] 68 | -------------------------------------------------------------------------------- /account/migrations/0004_alter_user_phone_number.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.6 on 2022-08-17 17:52 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('account', '0003_alter_user_options_alter_user_managers_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='user', 15 | name='phone_number', 16 | field=models.CharField(blank=True, max_length=11, null=True, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /account/migrations/0005_user_bio.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.6 on 2022-11-17 17:37 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('account', '0004_alter_user_phone_number'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='user', 15 | name='bio', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /account/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abolfazlz15/StudyBuddyDjangoProject/aef900571d534d1f8273e1df54e520d8988224d2/account/migrations/__init__.py -------------------------------------------------------------------------------- /account/models.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin 2 | from django.db import models 3 | from django.utils.html import format_html 4 | from django.utils.translation import gettext_lazy as _ 5 | 6 | from .managers import UserManager 7 | 8 | 9 | class User(AbstractBaseUser, PermissionsMixin): 10 | email = models.EmailField( 11 | verbose_name='email address', 12 | max_length=255, 13 | unique=True, 14 | ) 15 | username = models.CharField(max_length=100, unique=True) 16 | avatar = models.ImageField(upload_to='user_profile', null=True, blank=True) 17 | phone_number = models.CharField(max_length=11, unique=True, null=True, blank=True) 18 | bio = models.TextField(null=True, blank=True) 19 | is_active = models.BooleanField(default=True) 20 | is_admin = models.BooleanField(default=False) 21 | 22 | objects = UserManager() 23 | 24 | USERNAME_FIELD = 'email' 25 | REQUIRED_FIELDS = ['username'] 26 | 27 | def __str__(self): 28 | return self.email 29 | 30 | def has_perm(self, perm, obj=None): 31 | 32 | return True 33 | 34 | def has_module_perms(self, app_label): 35 | 36 | return True 37 | 38 | @property 39 | def is_staff(self): 40 | 41 | return self.is_admin 42 | 43 | def showImage(self): 44 | if self.avatar: 45 | return format_html(f'') 46 | else: 47 | return format_html('No Profile') 48 | 49 | showImage.short_description = 'Profile Image' 50 | -------------------------------------------------------------------------------- /account/templates/account/login.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | {% block tiitle %}Profile{% endblock %} 4 | 5 | {% block content %} 6 |
7 |
8 |
9 |
10 |
11 |

Login

12 |
13 |
14 |
15 |

Find your study partner

16 | 17 |
18 | {% csrf_token %} 19 |
20 | 21 | {{ form.email }} 22 |
23 | 24 | {% for error in form.email.errors %} 25 |

{{ error }}

26 | {% endfor %} 27 | 28 |
29 | 30 | {{ form.password }} 31 |
32 | {% for error in form.password.errors %} 33 |

{{ error }}

34 | {% endfor %} 35 | 54 |
55 | 56 |
57 |

Haven't signed up yet?

58 | Sign Up 59 |
60 |
61 |
62 |
63 |
64 | 65 | 66 | {% endblock %} -------------------------------------------------------------------------------- /account/templates/account/profile.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | {% block tiitle %}home{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 | 10 | {% include 'inc/topic_side.html' %} 11 | 12 | 13 | 14 |
15 |
16 |
17 |
18 | 19 | {% if user.avatar %} 20 | 21 | {% else %} 22 | 23 | {% endif %} 24 | 25 |
26 |
27 |
28 |

{{ user.username }}

29 |

@{{ user.username }}

30 | Edit Profile 31 |
32 |
33 |

About

34 | 35 | {% if user.bio %} 36 |

37 | {{ user.bio }} 38 |

39 | {% else %} 40 |

41 | No Bio 42 |

43 | {% endif %} 44 | 45 |
46 |
47 | 48 |
49 |
50 |

Study Rooms Hosted by {{ user.username }} 51 |

52 |
53 |
54 | 55 | {% for room in user.rooms.all %} 56 |
57 |
58 | 59 |
60 | 61 |
62 | @{{ room.host.username }} 63 |
64 |
65 | {{ room.created|timesince }} 66 | 67 |
68 |
69 |
70 | {{ room.name }} 71 |

72 | {{ room.description }} 73 |

74 |
75 | 96 |
97 | {% endfor %} 98 | 99 | 100 |
101 | 102 | 103 | 104 | {% include 'inc/activity_side.html' %} 105 | 106 |
107 |
108 | 109 | {% endblock %} -------------------------------------------------------------------------------- /account/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /account/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | 4 | app_name = 'account' 5 | urlpatterns = [ 6 | path('profile/', views.UserProfileView.as_view(), name='profile-detail'), 7 | path('login/', views.UserLoginView.as_view(), name='login'), 8 | ] 9 | -------------------------------------------------------------------------------- /account/views.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import login, logout 2 | from django.shortcuts import render 3 | from django.urls import reverse_lazy 4 | from django.views import generic 5 | from django.views.generic import DetailView 6 | 7 | from .forms import LoginForm 8 | from .models import User 9 | 10 | 11 | class UserProfileView(DetailView): 12 | model= User 13 | context_object_name = 'user' 14 | template_name = 'account/profile.html' 15 | 16 | 17 | 18 | class UserLoginView(generic.FormView): 19 | template_name = 'account/login.html' 20 | form_class = LoginForm 21 | success_url = reverse_lazy('core:home') 22 | 23 | def form_valid(self, form): 24 | data = form.cleaned_data 25 | user = User.objects.get(email=data['email']) 26 | login(self.request, user) 27 | return super().form_valid(form) 28 | -------------------------------------------------------------------------------- /context_processors/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abolfazlz15/StudyBuddyDjangoProject/aef900571d534d1f8273e1df54e520d8988224d2/context_processors/__init__.py -------------------------------------------------------------------------------- /context_processors/context_processors.py: -------------------------------------------------------------------------------- 1 | from core.models import Topic 2 | from core.models import Message 3 | 4 | 5 | 6 | def topics(request): 7 | topic = Topic.objects.all() 8 | return {'topics': topic} 9 | 10 | 11 | def recent_activities(request): 12 | message = Message.objects.filter(status=True) 13 | return {'messages': message} -------------------------------------------------------------------------------- /core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abolfazlz15/StudyBuddyDjangoProject/aef900571d534d1f8273e1df54e520d8988224d2/core/__init__.py -------------------------------------------------------------------------------- /core/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Topic, Room, Message 3 | from django.contrib import messages 4 | from django.utils.translation import ngettext 5 | 6 | admin.site.register(Topic) 7 | 8 | 9 | @admin.register(Room) 10 | class RoomAdminModel(admin.ModelAdmin): 11 | fields = ['host', 'topic', 'name', 'slug', 'status', 'description', 'participants'] 12 | list_display = ('host', 'topic', 'name', 'created') 13 | search_fields = ('host', 'topic', 'name') 14 | list_filter = ['created', 'status'] 15 | 16 | @admin.action(description='Mark selected rooms as published') 17 | def make_published(self, request, queryset): 18 | updated = queryset.update(status=True) 19 | self.message_user(request, ngettext( 20 | '%d room was successfully marked as published.', 21 | '%d rooms were successfully marked as published.', 22 | updated, 23 | ) % updated, messages.SUCCESS) 24 | 25 | @admin.action(description='Mark selected rooms as privated') 26 | def make_privated(self, request, queryset): 27 | updated = queryset.update(status=True) 28 | self.message_user(request, ngettext( 29 | '%d room was successfully marked as privated.', 30 | '%d rooms were successfully marked as privated.', 31 | updated, 32 | ) % updated, messages.SUCCESS) 33 | 34 | # admin.site.register(Message) 35 | @admin.register(Message) 36 | class MessageAdminModel(admin.ModelAdmin): 37 | fields = ['user', 'room', 'text', 'status'] 38 | list_display = ['user', 'room', 'text', 'status'] 39 | search_fields = ('user', 'room', 'name') 40 | list_filter = ['created', 'status'] 41 | 42 | @admin.action(description='Mark selected messages as published') 43 | def make_published(self, request, queryset): 44 | updated = queryset.update(status=True) 45 | self.message_user(request, ngettext( 46 | '%d message was successfully marked as published.', 47 | '%d messages were successfully marked as published.', 48 | updated, 49 | ) % updated, messages.SUCCESS) 50 | 51 | @admin.action(description='Mark selected messages as privated') 52 | def make_privated(self, request, queryset): 53 | updated = queryset.update(status=True) 54 | self.message_user(request, ngettext( 55 | '%d message was successfully marked as privated.', 56 | '%d messages were successfully marked as privated.', 57 | updated, 58 | ) % updated, messages.SUCCESS) 59 | -------------------------------------------------------------------------------- /core/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CoreConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'core' 7 | -------------------------------------------------------------------------------- /core/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import Message 3 | from django.forms import ValidationError, TextInput 4 | 5 | class MessageFrom(forms.ModelForm): 6 | class Meta: 7 | model = Message 8 | fields = ('text',) 9 | widgets = { 10 | 'text': TextInput(attrs={'class':'room__message', 'placeholder': 'Write Your Message'}) 11 | } -------------------------------------------------------------------------------- /core/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.6 on 2022-08-02 13:01 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Topic', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=155)), 19 | ], 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /core/migrations/0002_room.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.6 on 2022-08-02 13:03 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 12 | ('core', '0001_initial'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='Room', 18 | fields=[ 19 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('name', models.CharField(max_length=155)), 21 | ('slug', models.SlugField(blank=True, null=True)), 22 | ('description', models.TextField()), 23 | ('created', models.DateTimeField(auto_now_add=True)), 24 | ('updated', models.DateTimeField(auto_now=True)), 25 | ('host', models.ForeignKey(default='userNotFound', on_delete=django.db.models.deletion.SET_DEFAULT, to=settings.AUTH_USER_MODEL)), 26 | ('participants', models.ManyToManyField(blank=True, related_name='participants', to=settings.AUTH_USER_MODEL)), 27 | ('topic', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rooms', to='core.topic')), 28 | ], 29 | options={ 30 | 'ordering': ('-updated', '-created'), 31 | }, 32 | ), 33 | ] 34 | -------------------------------------------------------------------------------- /core/migrations/0003_message.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.6 on 2022-08-02 13:03 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 12 | ('core', '0002_room'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='Message', 18 | fields=[ 19 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('text', models.TextField()), 21 | ('created', models.DateTimeField(auto_now_add=True)), 22 | ('updated', models.DateTimeField(auto_now=True)), 23 | ('room', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='message', to='core.room')), 24 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='message', to=settings.AUTH_USER_MODEL)), 25 | ], 26 | options={ 27 | 'ordering': ('-updated', '-created'), 28 | }, 29 | ), 30 | ] 31 | -------------------------------------------------------------------------------- /core/migrations/0004_room_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.6 on 2022-08-04 09:22 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('core', '0003_message'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='room', 15 | name='status', 16 | field=models.BooleanField(default=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /core/migrations/0005_message_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.6 on 2022-08-04 09:45 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('core', '0004_room_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='message', 15 | name='status', 16 | field=models.BooleanField(default=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /core/migrations/0006_alter_room_host.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.6 on 2022-08-12 10:07 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 12 | ('core', '0005_message_status'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name='room', 18 | name='host', 19 | field=models.ForeignKey(default='userNotFound', on_delete=django.db.models.deletion.SET_DEFAULT, related_name='rooms', to=settings.AUTH_USER_MODEL), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /core/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abolfazlz15/StudyBuddyDjangoProject/aef900571d534d1f8273e1df54e520d8988224d2/core/migrations/__init__.py -------------------------------------------------------------------------------- /core/mixins.py: -------------------------------------------------------------------------------- 1 | # ---this code has bug--- 2 | 3 | # from django.http import Http404, HttpResponse 4 | 5 | # class AddTopicMixins(): 6 | # def dispach(self, request, *args, **kwargs): 7 | # if request.user.username == 'abolfazl': 8 | # print('sfsdf') 9 | # else: 10 | # print('aaaa') 11 | # return super().dispach(request, *args, **kwargs) -------------------------------------------------------------------------------- /core/models.py: -------------------------------------------------------------------------------- 1 | from account.models import User 2 | from django.db import models 3 | from django.urls import reverse 4 | from django.utils.text import slugify 5 | 6 | 7 | class Topic(models.Model): 8 | name = models.CharField(max_length=155) 9 | 10 | def __str__(self): 11 | return self.name 12 | 13 | 14 | class Room(models.Model): 15 | host = models.ForeignKey(User, default='userNotFound', on_delete=models.SET_DEFAULT, related_name='rooms') 16 | topic = models.ForeignKey(Topic, on_delete=models.CASCADE, related_name='rooms') 17 | name = models.CharField(max_length=155) 18 | slug = models.SlugField(null=True, blank=True) 19 | description = models.TextField() 20 | participants = models.ManyToManyField(User, related_name='participants', blank=True) 21 | created = models.DateTimeField(auto_now_add=True) 22 | updated = models.DateTimeField(auto_now=True) 23 | status = models.BooleanField(default=True) 24 | 25 | class Meta: 26 | ordering = ('-updated', '-created') 27 | 28 | def __str__(self): 29 | return f'{self.name} - {self.host}' 30 | 31 | def save(self, force_insert=False, force_update=False, using=None, update_fields=None): 32 | self.slug = slugify(self.name) 33 | super(Room, self).save() 34 | 35 | def get_absolute_url(self): 36 | return reverse('core:room-detail', kwargs={'pk': self.pk, 'slug': self.slug}) 37 | 38 | 39 | class Message(models.Model): 40 | user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='message') 41 | room = models.ForeignKey(Room, on_delete=models.CASCADE, related_name='message') 42 | text = models.TextField() 43 | created = models.DateTimeField(auto_now_add=True) 44 | updated = models.DateTimeField(auto_now=True) 45 | status = models.BooleanField(default=True) 46 | 47 | class Meta: 48 | ordering = ('-updated', '-created') 49 | 50 | def __str__(self): 51 | return f'{self.user}|{self.room}--{self.text[:25]}' 52 | -------------------------------------------------------------------------------- /core/templates/core/confirm_delete.html: -------------------------------------------------------------------------------- 1 |
{% csrf_token %} 2 |

Are you sure you want to delete "{{ object }}"?

3 | {{ form }} 4 | 5 |
-------------------------------------------------------------------------------- /core/templates/core/create_room.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | {% block tiitle %}Create Room{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 |
10 |
11 |
12 | 13 | 15 | arrow-left 16 | 18 | 19 | 20 | 21 |

Create Study Room

22 |
23 |
24 |
25 |
26 | {% csrf_token %} 27 |
28 | {{ form }} 29 |
30 | Cancel 31 | 32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | {% endblock %} 40 | -------------------------------------------------------------------------------- /core/templates/core/create_topic.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | {% block tiitle %}Create Topic{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 |
10 |
11 |
12 | 13 | 15 | arrow-left 16 | 18 | 19 | 20 | 21 |

Create Topic

22 |
23 |
24 |
25 |
26 | {% csrf_token %} 27 |
28 | {{ form }} 29 |
30 | Cancel 31 | 32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | {% endblock %} 40 | -------------------------------------------------------------------------------- /core/templates/core/home.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | {% block tiitle %}home{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 | 10 |
11 |
12 |

Browse Topics

13 |
14 | 24 | 25 | More 26 | 27 | chevron-down 28 | 29 | 30 | 31 |
32 | 33 | 34 | 35 |
36 |
37 | 49 | 53 |
54 |
55 |
56 |

Study Room

57 |

{{ count_all_room }} Rooms available

58 |
59 | 60 | 62 | add 63 | 66 | 67 | Create Room 68 | 69 |
70 | {% for room in rooms %} 71 | 119 | {% endfor %} 120 |
121 | 122 | 123 | 124 |
125 |
126 |

Recent Activities

127 |
128 | {% for message in messages %} 129 |
130 | 158 |
159 |

replied to post “{{ message.room.name }}

160 |
161 | {{ message.text }} 162 |
163 |
164 |
165 | {% endfor %} 166 |
167 | 168 |
169 |
170 | {% endblock %} -------------------------------------------------------------------------------- /core/templates/core/room.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | {% block tiitle %}home{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 | 10 |
11 | 73 |
74 |
75 |
76 |

{{ room.name }}

77 | {{ room.created|timesince }} ago 78 |
79 | 92 |
93 |

94 | {{ room.description }} 95 |

96 |
97 | {{ room.topic }} 98 |
99 |
100 |
101 | {% for message in messages %} 102 |
103 | 129 |
130 |

131 | {{ message.text }} 132 |

133 |
134 |
135 | {% endfor %} 136 |
137 |
138 |
139 | 140 | {% if request.user.is_authenticated %} 141 |
142 |
143 | {% csrf_token %} 144 | {{ form.text }} 145 | 146 |
147 |
148 | {% else %} 149 | 152 | 153 | {% endif %} 154 | 155 | 156 |
157 | 158 | 159 | 160 |
161 |

Participants (5.3k Joined)

162 | 179 |
180 | 181 |
182 |
183 | {% endblock %} -------------------------------------------------------------------------------- /core/templates/core/topics.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | {% block tiitle %}Topics{% endblock %} 5 | {% block content %} 6 |
7 |
8 |
9 |
10 |
11 | 12 | 13 | arrow-left 14 | 16 | 17 | 18 | 19 |

Browse Topics

20 |
21 |
22 | 23 |
24 | 35 | 36 | 47 |
48 |
49 |
50 |
51 | {% endblock %} -------------------------------------------------------------------------------- /core/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /core/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | 4 | app_name = 'core' 5 | urlpatterns = [ 6 | # room URL 7 | path('room//', views.RoomDetailView.as_view(), name='room-detail'), 8 | path('', views.HomeView.as_view(), name='home'), 9 | path('createroom', views.CreateRoomView.as_view(), name='create-room'), 10 | path('search/', views.SearchRoomView.as_view(), name='search-room'), 11 | path('deleteroom/', views.DeleteRoomView.as_view(), name='delete-room'), 12 | 13 | # topic URL 14 | path('topic/', views.TopicDetailView.as_view(), name='topic-detail'), 15 | path('topics', views.TopicListView.as_view(), name='topic'), 16 | path('topics/create', views.CreateTopicView.as_view(), name='create-topic'), 17 | 18 | # Message URL 19 | path('deletemesssge/', views.DeleteMessageView.as_view(), name='delete-message'), 20 | ] 21 | -------------------------------------------------------------------------------- /core/views.py: -------------------------------------------------------------------------------- 1 | from django.db.models import Q 2 | from django.shortcuts import get_object_or_404, redirect, render 3 | from django.urls import reverse, reverse_lazy 4 | from django.views.generic import (CreateView, DeleteView, ListView, 5 | TemplateView, View) 6 | 7 | from .forms import MessageFrom 8 | # from .mixins import AddTopicMixins 9 | from .models import Message, Room, Topic 10 | from django.contrib.auth.mixins import LoginRequiredMixin 11 | 12 | 13 | class HomeView(TemplateView): 14 | template_name = 'core/home.html' 15 | 16 | def get_context_data(self, **kwargs): 17 | context = super().get_context_data(**kwargs) 18 | context['rooms'] = Room.objects.filter(status=True) 19 | context['topics'] = Topic.objects.all() 20 | context['messages'] = Message.objects.filter(status=True) 21 | 22 | # get number_of_rooms 23 | number_of_rooms = 0 24 | for i in context['topics']: 25 | room = i.rooms.count() 26 | number_of_rooms = number_of_rooms + room 27 | context['count_all_room'] = number_of_rooms 28 | return context 29 | 30 | 31 | class CreateRoomView(CreateView): 32 | model = Room 33 | fields = ['topic', 'name', 'description'] 34 | template_name = 'core/create_room.html' 35 | success_url = reverse_lazy('core:home') 36 | 37 | def form_valid(self, form): 38 | form.instance.host = self.request.user 39 | return super().form_valid(form) 40 | 41 | 42 | class DeleteMessageView(DeleteView): 43 | model = Message 44 | template_name = 'core/confirm_delete.html' 45 | 46 | def get_success_url(self): 47 | room = Room.objects.get(id=self.object.room.id) 48 | test = Message.objects.filter(user=self.request.user, room=room) 49 | print(test.count()) 50 | if test.count() == 1: 51 | room.participants.remove(self.request.user) 52 | return reverse('core:home') 53 | 54 | 55 | class TopicDetailView(View): 56 | def setup(self, request, *args, **kwargs): 57 | self.topic = get_object_or_404(Topic, id=kwargs['pk']) 58 | self.rooms = self.topic.rooms.filter(status=True) 59 | self.topics = Topic.objects.all() 60 | self.message = Message.objects.filter(status=True) 61 | return super().setup(request, *args, **kwargs) 62 | 63 | def get(self, request, *arge, **kwarge): 64 | rooms = self.rooms 65 | topics = self.topics 66 | message = self.message 67 | 68 | context = { 69 | 'rooms': rooms, 70 | 'topics': topics, 71 | 'messages': message, 72 | 73 | } 74 | return render(request, 'core/home.html', context) 75 | 76 | 77 | class TopicListView(ListView): 78 | model = Topic 79 | template_name = 'core/topics.html' 80 | context_object_name = 'topics' 81 | 82 | def get_queryset(self, *args, **kwargs): 83 | topics = super().get_queryset(*args, **kwargs) 84 | 85 | q = self.request.GET.get('q') 86 | if q: 87 | return Topic.objects.filter(name__icontains=q) 88 | return topics 89 | 90 | 91 | class SearchRoomView(ListView): 92 | model = Room 93 | template_name = 'core/home.html' 94 | context_object_name = 'rooms' 95 | 96 | def get_queryset(self): 97 | rooms = super().get_queryset() 98 | 99 | q = self.request.GET.get('q') 100 | if q: 101 | return Room.objects.filter( 102 | Q(topic__name__icontains=q) | 103 | Q(name__icontains=q) | 104 | Q(description__icontains=q) 105 | ).filter(status=True) 106 | return rooms 107 | 108 | def get_context_data(self, **kwargs): 109 | context = super().get_context_data(**kwargs) 110 | context['topics'] = Topic.objects.all() 111 | context['messages'] = Message.objects.filter(status=True) 112 | return context 113 | 114 | 115 | class RoomDetailView(View): 116 | message_form_class = MessageFrom 117 | 118 | def setup(self, request, *args, **kwargs): 119 | self.room = get_object_or_404(Room, id=kwargs['pk'], slug=kwargs['slug']) 120 | return super().setup(request, *args, **kwargs) 121 | 122 | def get(self, request, *arge, **kwarge): 123 | room = self.room 124 | messages = room.message.all() 125 | context = { 126 | 'room': room, 127 | 'messages': messages, 128 | 'form': self.message_form_class 129 | } 130 | return render(request, 'core/room.html', context) 131 | 132 | def post(self, request, *args, **kwargs): 133 | form = self.message_form_class(request.POST) 134 | if form.is_valid(): 135 | message = form.save(commit=False) 136 | message.user = request.user 137 | message.room = self.room 138 | self.room.participants.add(request.user) # for add new user to participants 139 | message.save() 140 | return redirect('core:room-detail', self.room.id, self.room.slug) 141 | 142 | 143 | class DeleteRoomView(DeleteView): 144 | model = Room 145 | success_url = reverse_lazy('core:home') 146 | template_name = 'core/confirm_delete.html' 147 | 148 | # AddTopicMixins 149 | class CreateTopicView(LoginRequiredMixin, CreateView): 150 | model = Topic 151 | fields = ['name'] 152 | template_name = 'core/create_topic.html' 153 | success_url = reverse_lazy('core:home') 154 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 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', 'DjangoStudyBuddyProject.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() 23 | -------------------------------------------------------------------------------- /static/assets/avatar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /static/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abolfazlz15/StudyBuddyDjangoProject/aef900571d534d1f8273e1df54e520d8988224d2/static/assets/favicon.ico -------------------------------------------------------------------------------- /static/assets/icons/add.svg: -------------------------------------------------------------------------------- 1 | 2 | add 3 | 4 | 5 | -------------------------------------------------------------------------------- /static/assets/icons/arrow-left.svg: -------------------------------------------------------------------------------- 1 | 2 | arrow-left 3 | 4 | 5 | -------------------------------------------------------------------------------- /static/assets/icons/chevron-down.svg: -------------------------------------------------------------------------------- 1 | 2 | chevron-down 3 | 4 | 5 | -------------------------------------------------------------------------------- /static/assets/icons/delete.svg: -------------------------------------------------------------------------------- 1 | 2 | delete 3 | 4 | 5 | -------------------------------------------------------------------------------- /static/assets/icons/edit.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/assets/icons/ellipsis-horizontal.svg: -------------------------------------------------------------------------------- 1 | 2 | ellipsis-horizontal 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /static/assets/icons/ellipsis-vertical.svg: -------------------------------------------------------------------------------- 1 | 2 | ellipsis-vertical 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /static/assets/icons/lock.svg: -------------------------------------------------------------------------------- 1 | 2 | lock 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /static/assets/icons/remove.svg: -------------------------------------------------------------------------------- 1 | 2 | remove 3 | 4 | 5 | -------------------------------------------------------------------------------- /static/assets/icons/search.svg: -------------------------------------------------------------------------------- 1 | 2 | search 3 | 4 | 5 | -------------------------------------------------------------------------------- /static/assets/icons/sign-out.svg: -------------------------------------------------------------------------------- 1 | 2 | sign-out 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /static/assets/icons/tools.svg: -------------------------------------------------------------------------------- 1 | 2 | tools 3 | 4 | 5 | -------------------------------------------------------------------------------- /static/assets/icons/user-group.svg: -------------------------------------------------------------------------------- 1 | 2 | user-group 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /static/assets/icons/user.svg: -------------------------------------------------------------------------------- 1 | 2 | user 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /static/assets/images/sutdent-prof.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abolfazlz15/StudyBuddyDjangoProject/aef900571d534d1f8273e1df54e520d8988224d2/static/assets/images/sutdent-prof.png -------------------------------------------------------------------------------- /static/assets/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /static/css/style.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap"); 2 | 3 | :root { 4 | --color-main: #71c6dd; 5 | --color-main-light: #e1f6fb; 6 | --color-dark: #3f4156; 7 | --color-dark-medium: #51546e; 8 | --color-dark-light: #696d97; 9 | --color-light: #e5e5e5; 10 | --color-gray: #8b8b8b; 11 | --color-light-gray: #b2bdbd; 12 | --color-bg: #2d2d39; 13 | --color-success: #5dd693; 14 | --color-error: #fc4b0b; 15 | } 16 | 17 | /*========== base styles ==========*/ 18 | 19 | * { 20 | font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", 21 | "Helvetica Neue", sans-serif; 22 | margin: 0; 23 | padding: 0; 24 | box-sizing: border-box; 25 | text-rendering: optimizeLegibility; 26 | /* color: inherit; */ 27 | font-size: inherit; 28 | } 29 | 30 | html { 31 | font-size: 56.25%; 32 | } 33 | 34 | @media only screen and (min-width: 1200px) { 35 | html { 36 | font-size: 62.5%; 37 | } 38 | } 39 | 40 | @media only screen and (min-width: 2100px) { 41 | html { 42 | font-size: 75%; 43 | } 44 | } 45 | 46 | body { 47 | line-height: 1.6; 48 | font-weight: 400; 49 | font-size: 1.5rem; 50 | color: var(--color-light-gray); 51 | background-color: var(--color-bg); 52 | min-height: 100vh; 53 | } 54 | 55 | img { 56 | width: 100%; 57 | } 58 | 59 | a { 60 | display: inline-block; 61 | color: var(--color-main); 62 | text-decoration: none; 63 | } 64 | 65 | /*========== components ==========*/ 66 | .container { 67 | max-width: 120rem; 68 | width: 90%; 69 | margin: auto; 70 | } 71 | 72 | .btn { 73 | background-color: transparent; 74 | border: none; 75 | display: inline-flex; 76 | align-items: center; 77 | gap: 1rem; 78 | cursor: pointer; 79 | transition: all ease-in-out 0.3s; 80 | padding: 1rem 2rem; 81 | border-radius: 5px; 82 | box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); 83 | font-weight: 500; 84 | } 85 | 86 | .btn--link { 87 | border-radius: 0; 88 | padding: 0; 89 | color: var(--color-main); 90 | box-shadow: none; 91 | } 92 | 93 | .btn--link:hover { 94 | text-decoration: underline; 95 | } 96 | 97 | .btn--main { 98 | background-color: var(--color-main); 99 | color: var(--color-dark); 100 | } 101 | 102 | .btn:hover { 103 | opacity: 0.9; 104 | } 105 | 106 | .btn--dark { 107 | background-color: var(--color-dark-light); 108 | color: var(--color-light); 109 | } 110 | 111 | .btn > svg { 112 | fill: currentColor; 113 | width: 1.6rem; 114 | height: 1.6rem; 115 | } 116 | 117 | .btn--pill { 118 | border-radius: 10rem; 119 | font-size: 1.4rem; 120 | font-weight: 700; 121 | padding: 6px 2.5rem; 122 | color: var(--color-main); 123 | background: transparent; 124 | border: 2px solid var(--color-main); 125 | } 126 | 127 | .action-button { 128 | background: transparent; 129 | border: none; 130 | outline: none; 131 | cursor: pointer; 132 | } 133 | 134 | .avatar { 135 | position: relative; 136 | display: inline-block; 137 | border-radius: 50%; 138 | border: 2px solid var(--color-main); 139 | } 140 | 141 | .avatar img { 142 | display: block; 143 | border-radius: 50%; 144 | object-fit: cover; 145 | object-position: center; 146 | } 147 | 148 | .avatar::after { 149 | content: ""; 150 | display: block; 151 | position: absolute; 152 | background-color: var(--color-gray); 153 | z-index: 111; 154 | border-radius: 50%; 155 | border: 0.3rem solid var(--color-dark); 156 | } 157 | 158 | .avatar.active::after { 159 | background-color: var(--color-success); 160 | } 161 | 162 | .avatar.avatar--small img { 163 | width: 2.8rem; 164 | height: 2.8rem; 165 | } 166 | 167 | .avatar.avatar--small:after { 168 | width: 0.7rem; 169 | height: 0.7rem; 170 | bottom: 0px; 171 | right: -6px; 172 | } 173 | 174 | .avatar.avatar--medium img { 175 | width: 3.6rem; 176 | height: 3.6rem; 177 | border-radius: 50%; 178 | } 179 | 180 | .avatar.avatar--medium:after { 181 | width: 0.7rem; 182 | height: 0.7rem; 183 | bottom: 0px; 184 | right: -6px; 185 | } 186 | 187 | .avatar.avatar--large img { 188 | display: block; 189 | width: 8rem; 190 | height: 8rem; 191 | border-radius: 50%; 192 | } 193 | 194 | .avatar.avatar--large:after { 195 | width: 1rem; 196 | height: 1rem; 197 | bottom: 2px; 198 | right: 3.5px; 199 | } 200 | 201 | .scroll::-webkit-scrollbar { 202 | width: 0.6rem; 203 | background-color: rgb(41, 41, 46); 204 | } 205 | 206 | .scroll::-webkit-scrollbar-thumb { 207 | border-radius: 1rem; 208 | background-color: var(--color-gray); 209 | } 210 | 211 | .dropdown-menu { 212 | z-index: 111; 213 | position: absolute; 214 | top: 5rem; 215 | right: 0.5rem; 216 | background: var(--color-dark-light); 217 | border-radius: 5px; 218 | box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); 219 | overflow: hidden; 220 | display: none; 221 | } 222 | 223 | .dropdown-menu.show { 224 | display: block; 225 | } 226 | 227 | .dropdown-menu a { 228 | padding: 1.2rem 4rem; 229 | display: block; 230 | color: var(--color-light) !important; 231 | font-weight: 500; 232 | font-size: 1.4rem; 233 | } 234 | 235 | .dropdown-menu a:hover { 236 | background-color: var(--color-dark-medium); 237 | } 238 | 239 | .dropdown-menu > a:not(:last-child) { 240 | border-bottom: 1px solid var(--color-dark-medium); 241 | } 242 | 243 | .dropdown-menu a svg { 244 | fill: var(--color-light); 245 | } 246 | 247 | .mobile-menu { 248 | margin-bottom: 3rem; 249 | } 250 | 251 | .mobile-menuItems { 252 | display: flex; 253 | align-items: center; 254 | justify-content: center; 255 | gap: 1rem; 256 | } 257 | 258 | @media screen and (min-width: 500px) { 259 | .mobile-menu { 260 | display: none; 261 | } 262 | } 263 | 264 | /*============================== 265 | => Header Section 266 | ================================*/ 267 | 268 | .header { 269 | padding: 1.5rem; 270 | background-color: var(--color-dark); 271 | } 272 | 273 | .header > .container { 274 | display: flex; 275 | gap: 9.5rem; 276 | } 277 | 278 | .header__logo, 279 | .header__user { 280 | display: flex; 281 | gap: 2rem; 282 | align-items: center; 283 | } 284 | 285 | .header__logo > img { 286 | height: 3.2rem; 287 | width: 3.2rem; 288 | } 289 | 290 | .header__logo > h1 { 291 | font-weight: 700; 292 | font-size: 2rem; 293 | color: var(--color-light); 294 | } 295 | 296 | .header__search > label { 297 | background-color: var(--color-dark-medium); 298 | padding: 1.3rem 1rem; 299 | display: flex; 300 | align-items: center; 301 | gap: 1rem; 302 | border-radius: 4px; 303 | } 304 | 305 | .header__search svg { 306 | fill: var(--color-gray); 307 | width: 2rem; 308 | height: 2rem; 309 | margin-left: 1rem; 310 | } 311 | 312 | .header__search input { 313 | width: 30rem; 314 | background: transparent; 315 | border: none; 316 | outline: none; 317 | color: var(--color-light); 318 | } 319 | 320 | @media screen and (max-width: 800px) { 321 | .header__search input { 322 | width: 20rem; 323 | } 324 | 325 | .header > .container { 326 | gap: 3rem; 327 | } 328 | } 329 | 330 | @media screen and (max-width: 700px) { 331 | .header__logo h1 { 332 | display: none; 333 | } 334 | } 335 | 336 | @media screen and (max-width: 500px) { 337 | .header__search { 338 | display: none; 339 | } 340 | } 341 | 342 | .header__menu { 343 | margin-left: auto; 344 | position: relative; 345 | } 346 | 347 | .header__menu a { 348 | display: flex; 349 | gap: 1.5rem; 350 | align-items: center; 351 | font-weight: 500; 352 | text-decoration: none; 353 | color: var(--color-gray); 354 | } 355 | 356 | .header__menu img { 357 | height: 3.6rem; 358 | } 359 | 360 | .header__menu p { 361 | line-height: 1.2; 362 | } 363 | 364 | .header__menu span { 365 | color: var(--color-main); 366 | font-weight: 500; 367 | font-size: 1.4rem; 368 | display: block; 369 | } 370 | 371 | .header__menu svg { 372 | width: 1.6rem; 373 | height: 1.6rem; 374 | fill: var(--color-dark-light); 375 | } 376 | 377 | .dropdown-button { 378 | background: transparent; 379 | border: 0; 380 | outline: 0; 381 | cursor: pointer; 382 | } 383 | 384 | .dropdown-button:hover svg { 385 | fill: var(--color-main); 386 | } 387 | 388 | /*============================== 389 | => Layout 390 | ================================*/ 391 | 392 | .layout { 393 | margin-top: 2.4rem; 394 | } 395 | 396 | .layout > .container { 397 | display: flex; 398 | justify-content: space-between; 399 | align-items: flex-start; 400 | } 401 | 402 | .layout--3 > .container > div:first-child { 403 | flex-basis: 18%; 404 | max-width: 22.5rem; 405 | } 406 | 407 | .layout--3 > .container > div:nth-child(2) { 408 | flex-basis: 50%; 409 | } 410 | 411 | .layout--3 > .container > div:last-child { 412 | flex-basis: 25%; 413 | } 414 | 415 | .layout--2 > .container > div:first-child { 416 | flex-basis: 72%; 417 | } 418 | 419 | .layout--2 > .container > div:last-child { 420 | flex-basis: 25%; 421 | } 422 | /*========== Layout Box ==========*/ 423 | 424 | .layout__box { 425 | width: 90%; 426 | max-width: 48rem; 427 | min-height: 40rem; 428 | position: absolute; 429 | top: 50%; 430 | left: 50%; 431 | transform: translate(-50%, -46%); 432 | background-color: var(--color-dark); 433 | border-radius: 1rem; 434 | box-shadow: 1px 1px 6px 3px rgba(0, 0, 0, 0.1); 435 | overflow: hidden; 436 | } 437 | 438 | .layout__boxHeader { 439 | display: flex; 440 | padding: 1.5rem; 441 | background-color: var(--color-dark-light); 442 | } 443 | 444 | .layout__boxTitle { 445 | display: flex; 446 | gap: 1.5rem; 447 | align-items: center; 448 | } 449 | 450 | .layout__boxTitle h3 { 451 | text-transform: uppercase; 452 | font-weight: 500; 453 | color: var(--color-light); 454 | } 455 | 456 | .layout__boxTitle svg { 457 | width: 1.6rem; 458 | height: 1.6rem; 459 | fill: var(--color-main); 460 | } 461 | 462 | .layout__body { 463 | margin: 3rem; 464 | } 465 | 466 | @media screen and (max-width: 900px) { 467 | .activities, 468 | .topics { 469 | display: none; 470 | } 471 | 472 | .layout--3 > .container > div:nth-child(2) { 473 | flex-basis: 100%; 474 | } 475 | } 476 | 477 | /*============================== 478 | => Topics 479 | ================================*/ 480 | 481 | .form__group { 482 | margin-bottom: 2rem; 483 | width: 100%; 484 | } 485 | 486 | .form__split { 487 | display: flex; 488 | gap: 1.5rem; 489 | } 490 | 491 | .form__group label { 492 | display: block; 493 | font-size: 1.5rem; 494 | margin-bottom: 1rem; 495 | } 496 | 497 | .form__group input, 498 | .form__group textarea, 499 | .form__group select { 500 | background: transparent; 501 | border: 1px solid var(--color-dark-light); 502 | padding: 1rem; 503 | border-radius: 3px; 504 | width: 100%; 505 | color: var(--color-light); 506 | font-weight: 500; 507 | outline: none; 508 | } 509 | 510 | .form__group input:focus, 511 | .form__group textarea:focus { 512 | border-color: var(--color-main); 513 | } 514 | 515 | .form__group textarea { 516 | background: transparent; 517 | height: 10rem; 518 | resize: none; 519 | } 520 | 521 | .form__group select { 522 | color: var(--color-gray); 523 | font-weight: 400; 524 | } 525 | 526 | .form__group select option { 527 | background-color: var(--color-dark-light); 528 | color: var(--color-light); 529 | padding: 0 10rem; 530 | } 531 | 532 | .form__action { 533 | display: flex; 534 | justify-content: flex-end; 535 | gap: 3rem; 536 | } 537 | 538 | .form__hide { 539 | position: absolute; 540 | left: -9999px; 541 | } 542 | 543 | .form__avatar label { 544 | text-align: center; 545 | font-size: 1.8rem; 546 | font-weight: 500; 547 | color: var(--color-main); 548 | cursor: pointer; 549 | } 550 | 551 | .form__avatar label:hover { 552 | text-decoration: underline; 553 | } 554 | 555 | /*============================== 556 | => Topics 557 | ================================*/ 558 | 559 | .topics__header { 560 | margin-bottom: 2rem; 561 | } 562 | 563 | .topics__header h2 { 564 | text-transform: uppercase; 565 | font-weight: 500; 566 | color: var(--color-dark-light); 567 | } 568 | 569 | .topics__list { 570 | list-style: none; 571 | } 572 | 573 | .topics__list li a { 574 | display: flex; 575 | justify-content: space-between; 576 | margin-bottom: 3rem; 577 | font-weight: 500; 578 | color: var(--color-light-gray); 579 | transition: all 0.3s ease-in-out; 580 | } 581 | 582 | .topics__list li a.active, 583 | .topics__list li a:hover { 584 | color: var(--color-main); 585 | } 586 | 587 | .topics__list li a span { 588 | padding: 0.5rem 1rem; 589 | background-color: var(--color-dark); 590 | border-radius: 3px; 591 | font-size: 1.3rem; 592 | font-weight: 700; 593 | letter-spacing: 1px; 594 | } 595 | 596 | .topics-page a:hover { 597 | text-decoration: underline; 598 | } 599 | 600 | .topics-page .topics__list li:not(:last-child) a { 601 | margin: 2rem 0; 602 | padding-bottom: 1rem; 603 | text-decoration: none; 604 | border-bottom: 1px solid var(--color-dark-medium); 605 | } 606 | 607 | .topics-page .header__search { 608 | display: block; 609 | } 610 | 611 | @media screen and (max-width: 500px) { 612 | .mobile-menu .header__search { 613 | display: block; 614 | margin-bottom: 2.4rem; 615 | } 616 | } 617 | 618 | /*============================== 619 | => Room List 620 | ================================*/ 621 | 622 | .roomList__header { 623 | display: flex; 624 | justify-content: space-between; 625 | align-items: center; 626 | margin-bottom: 2.4rem; 627 | } 628 | 629 | .roomList__header h2 { 630 | text-transform: uppercase; 631 | font-weight: 500; 632 | color: var(--color-light); 633 | letter-spacing: 1px; 634 | } 635 | 636 | .roomList__header p { 637 | font-weight: 500; 638 | color: var(--color-dark-light); 639 | } 640 | 641 | /*========== Room List Room ==========*/ 642 | 643 | .roomListRoom { 644 | margin-bottom: 2.4rem; 645 | background-color: var(--color-dark); 646 | border-radius: 1rem; 647 | padding: 2rem; 648 | } 649 | 650 | .roomListRoom__header { 651 | display: flex; 652 | justify-content: space-between; 653 | align-items: center; 654 | } 655 | 656 | .roomListRoom__author { 657 | font-weight: 500; 658 | display: flex; 659 | align-items: center; 660 | gap: 1rem; 661 | } 662 | 663 | .roomListRoom__actions { 664 | display: flex; 665 | align-items: flex-start; 666 | gap: 1rem; 667 | position: relative; 668 | } 669 | 670 | .roomListRoom__actions span { 671 | font-size: 1.4rem; 672 | font-weight: 500; 673 | } 674 | 675 | .roomListRoom__actions svg { 676 | fill: var(--color-main); 677 | 678 | width: 1.6rem; 679 | height: 1.6rem; 680 | } 681 | 682 | .roomListRoom__content { 683 | margin: 1rem 0; 684 | } 685 | 686 | .roomListRoom__content a { 687 | font-size: 2rem; 688 | font-weight: 500; 689 | margin-bottom: 1.5rem; 690 | color: var(--color-light); 691 | transition: all 0.3s ease-in-out; 692 | } 693 | 694 | .roomListRoom__content a:hover { 695 | color: var(--color-main); 696 | } 697 | 698 | .roomListRoom__meta { 699 | border-top: 1px solid var(--color-dark-medium); 700 | padding-top: 1rem; 701 | display: flex; 702 | align-items: center; 703 | justify-content: space-between; 704 | } 705 | 706 | .roomListRoom__joined { 707 | color: var(--color-light-gray); 708 | display: flex; 709 | align-items: center; 710 | gap: 1rem; 711 | font-size: 1.4rem; 712 | font-weight: 500; 713 | } 714 | 715 | .roomListRoom__joined svg { 716 | fill: var(--color-main); 717 | width: 1.6rem; 718 | height: 1.6rem; 719 | } 720 | 721 | .roomListRoom__topic { 722 | padding: 5px 1.5rem; 723 | background-color: var(--color-dark-medium); 724 | border-radius: 5rem; 725 | font-weight: 500; 726 | font-size: 1.3rem; 727 | } 728 | 729 | /*============================== 730 | => Activities 731 | ================================*/ 732 | 733 | .activities { 734 | background: var(--color-dark); 735 | border-radius: 5px; 736 | overflow: hidden; 737 | } 738 | 739 | .activities__header h2 { 740 | background-color: var(--color-dark-light); 741 | text-transform: uppercase; 742 | font-weight: 500; 743 | padding: 1rem 1.5rem; 744 | color: var(--color-light); 745 | letter-spacing: 1px; 746 | font-size: 1.4rem; 747 | } 748 | 749 | .activities__box { 750 | margin: 1.5rem; 751 | padding: 1.5rem; 752 | border: 2px solid var(--color-dark-medium); 753 | border-radius: 5px; 754 | } 755 | 756 | .activities__boxHeader p { 757 | font-size: 1.4rem; 758 | line-height: 1.3; 759 | } 760 | 761 | .activities__boxHeader p span { 762 | color: var(--color-gray); 763 | font-size: 1.2rem; 764 | display: block; 765 | } 766 | 767 | .activities__boxContent { 768 | margin-left: 4.2rem; 769 | } 770 | 771 | .activities__boxContent { 772 | font-size: 1.4rem; 773 | } 774 | 775 | .activities__boxContent a:hover { 776 | text-decoration: underline; 777 | } 778 | 779 | .activities__boxRoomContent { 780 | background: var(--color-bg); 781 | padding: 1rem; 782 | border-radius: 5px; 783 | margin-top: 1rem; 784 | margin-left: -4.2rem; 785 | } 786 | 787 | .roomListRoom__actions svg { 788 | fill: var(--color-light-gray); 789 | } 790 | 791 | /*============================== 792 | => Create Room 793 | ================================*/ 794 | 795 | .create-room.layout .layout__box { 796 | max-width: 68rem; 797 | } 798 | 799 | /*============================== 800 | => Update Account 801 | ================================*/ 802 | 803 | .update-account.layout .layout__box { 804 | max-width: 68rem; 805 | } 806 | 807 | /*============================== 808 | => Delete Item 809 | ================================*/ 810 | 811 | .delete-item.layout .layout__box { 812 | max-width: 68rem; 813 | } 814 | 815 | /*============================== 816 | => Auth 817 | ================================*/ 818 | 819 | .auth__tagline { 820 | text-align: center; 821 | margin-bottom: 3rem; 822 | color: var(--color-main); 823 | font-weight: 500; 824 | font-size: 1.8rem; 825 | } 826 | .auth .layout__boxHeader { 827 | text-align: center; 828 | justify-content: center; 829 | } 830 | 831 | .auth__action { 832 | margin-top: 3rem; 833 | text-align: center; 834 | } 835 | 836 | /*============================== 837 | => Settings 838 | ================================*/ 839 | 840 | .settings__avatar { 841 | margin-bottom: 3rem; 842 | text-align: center; 843 | margin: 0 auto; 844 | display: flex; 845 | justify-content: center; 846 | } 847 | 848 | .settings__avatar .avatar { 849 | margin: 1rem; 850 | } 851 | 852 | /*============================== 853 | => Profile 854 | ================================*/ 855 | .profile { 856 | margin-bottom: 3rem; 857 | } 858 | 859 | .profile__avatar { 860 | text-align: center; 861 | } 862 | 863 | .profile__info { 864 | text-align: center; 865 | } 866 | 867 | .profile__info h3 { 868 | font-size: 2rem; 869 | color: var(--color-light); 870 | font-weight: 400; 871 | } 872 | 873 | .profile__info p { 874 | color: var(--color-main); 875 | font-weight: 500; 876 | margin-bottom: 1rem; 877 | } 878 | 879 | .profile__about { 880 | margin-top: 2rem; 881 | } 882 | 883 | .profile__about h3 { 884 | text-transform: uppercase; 885 | color: var(--color-dark-light); 886 | margin-bottom: 0.5rem; 887 | } 888 | 889 | .profile-page .roomList__header { 890 | margin-bottom: 1.5rem; 891 | } 892 | 893 | .profile-page .roomList__header h2 { 894 | color: var(--color-dark-light); 895 | } 896 | 897 | /*============================== 898 | => Room 899 | ================================*/ 900 | 901 | .room, 902 | .participants { 903 | background: var(--color-dark); 904 | max-height: 87.5vh; 905 | border-radius: 0.7rem; 906 | overflow: hidden; 907 | position: relative; 908 | } 909 | 910 | @media screen and (max-width: 900px) { 911 | .participants { 912 | display: none; 913 | } 914 | 915 | .layout--2 > .container > div:first-child { 916 | flex-basis: 100%; 917 | } 918 | } 919 | 920 | .room__top, 921 | .participants__top { 922 | background: var(--color-dark-light); 923 | display: flex; 924 | justify-content: space-between; 925 | align-items: center; 926 | padding: 1rem 2rem; 927 | position: relative; 928 | } 929 | 930 | .room__top svg, 931 | .thread__top svg { 932 | width: 1.6rem; 933 | height: 1.6rem; 934 | fill: var(--color-light); 935 | cursor: pointer; 936 | } 937 | 938 | .room__topLeft { 939 | display: flex; 940 | align-items: flex-end; 941 | gap: 1rem; 942 | } 943 | 944 | .room__topLeft h3, 945 | .participants__top { 946 | text-transform: uppercase; 947 | font-weight: 500; 948 | color: var(--color-light); 949 | } 950 | 951 | .room__topLeft svg { 952 | width: 1.6rem; 953 | height: 1.6rem; 954 | fill: var(--color-light); 955 | } 956 | 957 | .room__topRight { 958 | display: flex; 959 | column-gap: 1em; 960 | } 961 | 962 | .room__topRight svg { 963 | fill: var(--color-main-light); 964 | } 965 | 966 | .room__header { 967 | max-height: 30vh; 968 | overflow-y: auto; 969 | position: absolute; 970 | width: 95%; 971 | background: var(--color-dark); 972 | z-index: 999; 973 | top: 4.4rem; 974 | padding-top: 2rem; 975 | padding-bottom: 1rem; 976 | } 977 | 978 | @media screen and (max-width: 500px) { 979 | .room__header { 980 | top: 4.3rem; 981 | padding-right: 2rem; 982 | } 983 | } 984 | 985 | .room__box { 986 | padding-left: 2rem; 987 | padding-right: 2rem; 988 | height: 80.5vh; 989 | /* overflow-y: auto; */ 990 | padding-bottom: 0; 991 | } 992 | 993 | @media screen and (max-width: 500px) { 994 | .room__box { 995 | padding-left: 2.5rem; 996 | padding-right: 2rem; 997 | height: 80.5vh; 998 | overflow-y: auto; 999 | padding-bottom: 0; 1000 | } 1001 | } 1002 | 1003 | .room__info { 1004 | display: flex; 1005 | justify-content: space-between; 1006 | } 1007 | 1008 | .room__info h3 { 1009 | font-size: 2.4rem; 1010 | font-weight: 500; 1011 | color: var(--color-main); 1012 | } 1013 | 1014 | .room__hosted p { 1015 | text-transform: uppercase; 1016 | color: var(--color-gray); 1017 | font-size: 1.2rem; 1018 | font-weight: 700; 1019 | line-height: 2; 1020 | } 1021 | 1022 | .room__author { 1023 | display: flex; 1024 | gap: 1rem; 1025 | align-items: center; 1026 | margin-bottom: 1rem; 1027 | transition: all 0.3s ease-in-out; 1028 | } 1029 | 1030 | .room__author:hover { 1031 | text-decoration: underline; 1032 | } 1033 | 1034 | .room__topics { 1035 | padding: 0.5rem 1.5rem; 1036 | background: var(--color-dark-light); 1037 | color: var(--color-light); 1038 | display: inline-block; 1039 | font-size: 1.4rem; 1040 | border-radius: 1.5rem; 1041 | margin: 1rem 0; 1042 | } 1043 | 1044 | .room__conversation { 1045 | margin-top: 1rem; 1046 | margin-bottom: 4rem; 1047 | height: 64%; 1048 | } 1049 | 1050 | .threads h3 { 1051 | text-transform: uppercase; 1052 | font-weight: 500; 1053 | color: var(--color-gray); 1054 | } 1055 | 1056 | .threads { 1057 | background: var(--color-bg); 1058 | border-radius: 0.7rem; 1059 | overflow-y: auto; 1060 | height: 100%; 1061 | margin-top: 28vh; 1062 | padding: 0 2rem 4rem 2rem; 1063 | } 1064 | 1065 | .thread { 1066 | border-left: 2px solid var(--color-dark); 1067 | padding-left: 1rem; 1068 | margin: 2rem 0; 1069 | padding: 2rem; 1070 | } 1071 | 1072 | .thread__top { 1073 | display: flex; 1074 | align-items: center; 1075 | justify-content: space-between; 1076 | } 1077 | 1078 | .thread__top svg { 1079 | fill: var(--color-dark-light); 1080 | } 1081 | 1082 | .thread__author { 1083 | display: flex; 1084 | align-items: center; 1085 | gap: 1.5rem; 1086 | font-size: 1.4rem; 1087 | } 1088 | 1089 | .thread__authorInfo { 1090 | display: flex; 1091 | align-items: center; 1092 | gap: 1rem; 1093 | } 1094 | 1095 | .thread__details { 1096 | font-size: 1.4rem; 1097 | margin-top: 0.5rem; 1098 | } 1099 | 1100 | .room__message { 1101 | padding: 2rem; 1102 | position: absolute; 1103 | z-index: 111; 1104 | bottom: 0; 1105 | left: 0; 1106 | right: 0; 1107 | background: transparent; 1108 | } 1109 | 1110 | .room__message > form > input { 1111 | resize: none; 1112 | background-color: var(--color-dark-light); 1113 | color: var(--color-light); 1114 | border: none; 1115 | outline: none; 1116 | border-radius: 0.7rem; 1117 | height: 4.5rem; 1118 | width: 100%; 1119 | margin-top: -1rem; 1120 | padding: 1.2rem; 1121 | font-size: 1.4rem; 1122 | font-weight: 500; 1123 | position: relative; 1124 | } 1125 | 1126 | .room__message > form > input::placeholder { 1127 | color: var(--color-light-gray); 1128 | } 1129 | 1130 | .participants__top span { 1131 | color: var(--color-main); 1132 | font-size: 1.3rem; 1133 | text-transform: none; 1134 | } 1135 | 1136 | .participants__top { 1137 | justify-content: flex-start; 1138 | gap: 0.5rem; 1139 | } 1140 | 1141 | .participants__list { 1142 | padding: 2rem; 1143 | height: 82.5vh; 1144 | overflow-y: scroll; 1145 | padding-bottom: 0; 1146 | } 1147 | 1148 | .participant { 1149 | display: flex; 1150 | align-items: center; 1151 | gap: 1.5rem; 1152 | margin-bottom: 2rem; 1153 | } 1154 | 1155 | .participant p { 1156 | color: var(--color-light-gray); 1157 | line-height: 1.2; 1158 | } 1159 | 1160 | .participant span { 1161 | display: block; 1162 | font-weight: 500; 1163 | color: var(--color-main); 1164 | font-weight: 1.4rem; 1165 | } 1166 | -------------------------------------------------------------------------------- /static/js/script.js: -------------------------------------------------------------------------------- 1 | // // Actions: 2 | 3 | // const closeButton = ` 4 | // remove 5 | // 6 | // 7 | // `; 8 | // const menuButton = ` 9 | // ellipsis-horizontal 10 | // 11 | // 12 | // 13 | // 14 | // `; 15 | 16 | // const actionButtons = document.querySelectorAll('.action-button'); 17 | 18 | // if (actionButtons) { 19 | // actionButtons.forEach(button => { 20 | // button.addEventListener('click', () => { 21 | // const buttonId = button.dataset.id; 22 | // let popup = document.querySelector(`.popup-${buttonId}`); 23 | // console.log(popup); 24 | // if (popup) { 25 | // button.innerHTML = menuButton; 26 | // return popup.remove(); 27 | // } 28 | 29 | // const deleteUrl = button.dataset.deleteUrl; 30 | // const editUrl = button.dataset.editUrl; 31 | // button.innerHTML = closeButton; 32 | 33 | // popup = document.createElement('div'); 34 | // popup.classList.add('popup'); 35 | // popup.classList.add(`popup-${buttonId}`); 36 | // popup.innerHTML = `Edit 37 | //
38 | // 39 | //
`; 40 | // button.insertAdjacentElement('afterend', popup); 41 | // }); 42 | // }); 43 | // } 44 | 45 | // Menu 46 | 47 | const dropdownMenu = document.querySelector(".dropdown-menu"); 48 | const dropdownButton = document.querySelector(".dropdown-button"); 49 | 50 | if (dropdownButton) { 51 | dropdownButton.addEventListener("click", () => { 52 | dropdownMenu.classList.toggle("show"); 53 | }); 54 | } 55 | 56 | // Upload Image 57 | const photoInput = document.querySelector("#avatar"); 58 | const photoPreview = document.querySelector("#preview-avatar"); 59 | if (photoInput) 60 | photoInput.onchange = () => { 61 | const [file] = photoInput.files; 62 | if (file) { 63 | photoPreview.src = URL.createObjectURL(file); 64 | } 65 | }; 66 | 67 | // Scroll to Bottom 68 | const conversationThread = document.querySelector(".room__box"); 69 | if (conversationThread) conversationThread.scrollTop = conversationThread.scrollHeight; 70 | -------------------------------------------------------------------------------- /templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {% include 'inc/head.html' %} 5 | 6 | {% block title %}{% endblock %} 7 | 8 | 9 | {% include 'inc/header.html' %} 10 | 11 | {% block content %} 12 | 13 | {% endblock %} 14 | 15 | -------------------------------------------------------------------------------- /templates/inc/activity_side.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 |
3 |
4 |

Recent Activities

5 |
6 | 7 | {% for message in messages %} 8 |
9 | 37 |
38 |

replied to post “{{ message.room.name }}

39 |
40 | {{ message.text }} 41 |
42 |
43 |
44 | {% endfor %} 45 |
-------------------------------------------------------------------------------- /templates/inc/head.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /templates/inc/header.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 |
4 |
5 | 9 | 20 | 73 |
74 |
75 | 76 | -------------------------------------------------------------------------------- /templates/inc/topic_side.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Browse Topics

4 |
5 | 15 | 16 | More 17 | 18 | chevron-down 19 | 20 | 21 | 22 |
--------------------------------------------------------------------------------