├── LICENSE ├── Note_Keep ├── asgi.py ├── settings.py ├── urls.py └── wsgi.py ├── README.md ├── db.sqlite3 ├── home ├── admin.py ├── apps.py ├── migrations │ └── 0001_initial.py ├── models.py ├── tests.py ├── urls.py └── views.py ├── manage.py ├── media ├── default.jpg ├── note_keep.gif └── profile_pics │ └── default.jpg ├── requirements.txt ├── static ├── carasouel │ ├── deadline.jpg │ ├── deadline1.jfif │ ├── priority.jfif │ ├── priority.jpg │ ├── privacy.jfif │ └── privacy.jpg ├── contact-us.jfif ├── course-1.jfif ├── course-2.jfif ├── course-3.jfif ├── course-4.jfif ├── cover.jpg ├── cover2.jpg ├── cover3.png ├── digital-notes.jpg ├── favicon.ico └── taking-notes.jpg ├── templates ├── base.html ├── contact.html ├── index.html └── users │ ├── login.html │ ├── logout.html │ ├── notes.html │ ├── profile.html │ ├── register.html │ └── todo.html └── users ├── admin.py ├── apps.py ├── forms.py ├── migrations └── 0001_initial.py ├── models.py ├── signals.py ├── tests.py └── views.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 punitzen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Note_Keep/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Note_Keep 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/3.1/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Note_Keep.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /Note_Keep/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for Note_Keep project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.1.6. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.1/ref/settings/ 11 | """ 12 | 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'ardyy-btlw)qfsy*f!p_3!6v3nv-2b(fta##_l3yqhza@6!pj5' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'users.apps.UsersConfig', 35 | 'home.apps.HomeConfig', 36 | 'crispy_forms', 37 | 'django.contrib.admin', 38 | 'django.contrib.auth', 39 | 'django.contrib.contenttypes', 40 | 'django.contrib.sessions', 41 | 'django.contrib.messages', 42 | 'django.contrib.staticfiles', 43 | ] 44 | 45 | MIDDLEWARE = [ 46 | 'django.middleware.security.SecurityMiddleware', 47 | 'django.contrib.sessions.middleware.SessionMiddleware', 48 | 'django.middleware.common.CommonMiddleware', 49 | 'django.middleware.csrf.CsrfViewMiddleware', 50 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 51 | 'django.contrib.messages.middleware.MessageMiddleware', 52 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 53 | ] 54 | 55 | ROOT_URLCONF = 'Note_Keep.urls' 56 | 57 | TEMPLATES = [ 58 | { 59 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 60 | 'DIRS': [BASE_DIR / "templates"], 61 | 'APP_DIRS': True, 62 | 'OPTIONS': { 63 | 'context_processors': [ 64 | 'django.template.context_processors.debug', 65 | 'django.template.context_processors.request', 66 | 'django.contrib.auth.context_processors.auth', 67 | 'django.contrib.messages.context_processors.messages', 68 | ], 69 | }, 70 | }, 71 | ] 72 | 73 | WSGI_APPLICATION = 'Note_Keep.wsgi.application' 74 | 75 | 76 | # Database 77 | # https://docs.djangoproject.com/en/3.1/ref/settings/#databases 78 | 79 | DATABASES = { 80 | 'default': { 81 | 'ENGINE': 'django.db.backends.sqlite3', 82 | 'NAME': BASE_DIR / 'db.sqlite3', 83 | } 84 | } 85 | 86 | 87 | # Password validation 88 | # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators 89 | 90 | AUTH_PASSWORD_VALIDATORS = [ 91 | { 92 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 93 | }, 94 | { 95 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 96 | }, 97 | { 98 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 99 | }, 100 | { 101 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 102 | }, 103 | ] 104 | 105 | 106 | # Internationalization 107 | # https://docs.djangoproject.com/en/3.1/topics/i18n/ 108 | 109 | LANGUAGE_CODE = 'en-us' 110 | 111 | TIME_ZONE = 'UTC' 112 | 113 | USE_I18N = True 114 | 115 | USE_L10N = True 116 | 117 | USE_TZ = True 118 | 119 | 120 | # Static files (CSS, JavaScript, Images) 121 | # https://docs.djangoproject.com/en/3.1/howto/static-files/ 122 | 123 | STATIC_URL = '/static/' 124 | 125 | MEDIA_ROOT = BASE_DIR / 'media' 126 | MEDIA_URL = '/media/' 127 | 128 | STATICFILES_DIRS = [ 129 | BASE_DIR / "static" 130 | ] 131 | 132 | CRISPY_TEMPLATE_PACK = 'bootstrap4' 133 | 134 | LOGIN_REDIRECT_URL = '/' 135 | 136 | LOGIN_URL = 'login' -------------------------------------------------------------------------------- /Note_Keep/urls.py: -------------------------------------------------------------------------------- 1 | """Note_Keep URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.contrib.auth import views as auth_views 18 | from django.urls import path, include 19 | from django.views.generic.base import TemplateView 20 | from users import views as user_views 21 | from django.conf import settings 22 | from django.conf.urls.static import static 23 | 24 | admin.site.site_header = "Admin" 25 | admin.site.site_title = "Admin Portal" 26 | admin.site.index_title = "Admin's Site" 27 | urlpatterns = [ 28 | path('admin/', admin.site.urls), 29 | path('register/', user_views.register, name='register'), 30 | path('profile/', user_views.profile, name='profile'), 31 | path('login/', auth_views.LoginView.as_view(template_name='users/login.html'), name='login'), 32 | path('logout/', auth_views.LogoutView.as_view(template_name='users/logout.html'), name='logout'), 33 | path('to-dos/', user_views.todo, name='to-dos'), 34 | path('add-todo/', user_views.add_todo, name='add-todo'), 35 | path('delete-todo//', user_views.delete_todo, name='delete-todo'), 36 | path('notes/', user_views.notes, name='notes'), 37 | path('delete-notes//', user_views.delete_note, name='delete-note'), 38 | path('change-status///', user_views.change_todo, name='change-status'), 39 | path('',include('home.urls')) 40 | ] 41 | 42 | if settings.DEBUG: 43 | urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 44 | -------------------------------------------------------------------------------- /Note_Keep/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Note_Keep 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/3.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Note_Keep.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Note Keeping App 2 | 3 | ![demo gif](media/note_keep.gif) 4 | 5 | Use ```python3``` instead of ```python``` if neccessary 6 | 7 | Install all the dependencies 8 | 9 | ```bash 10 | $ pip install -r requirements.txt 11 | ``` 12 | 13 | Create a Super User for Admin using command 14 | 15 | ```bash 16 | $ python manage.py createsuperuser 17 | ``` 18 | 19 | I have made the migrations for the created models, If you change then run the following commands if not then just for running purposes 20 | 21 | ```bash 22 | $ python manage.py makemigrations 23 | $ python manage.py migrate 24 | ``` 25 | 26 | Now Access the web app at local host 27 | 28 | ```bash 29 | $ python manage.py runserver 30 | ``` 31 | 32 | Access the admin panel at ```127.0.0.1/admin``` 33 | -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/db.sqlite3 -------------------------------------------------------------------------------- /home/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from home.models import Contact 3 | # Register your models here. 4 | 5 | admin.site.register(Contact) -------------------------------------------------------------------------------- /home/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class HomeConfig(AppConfig): 5 | name = 'home' 6 | -------------------------------------------------------------------------------- /home/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.1.6 on 2021-04-19 15:00 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='Contact', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=50)), 19 | ('email', models.CharField(max_length=50)), 20 | ('contact', models.CharField(max_length=50)), 21 | ('desc', models.TextField()), 22 | ('date', models.DateField()), 23 | ], 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /home/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | class Contact(models.Model): 5 | name = models.CharField(max_length=50) 6 | email = models.CharField(max_length=50) 7 | contact = models.CharField(max_length=10) 8 | desc = models.TextField() 9 | date = models.DateField() 10 | 11 | def __str__(self): 12 | return self.name 13 | -------------------------------------------------------------------------------- /home/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here 4 | -------------------------------------------------------------------------------- /home/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path 3 | from home import views 4 | 5 | urlpatterns = [ 6 | path("", views.index, name='home'), 7 | path("contact", views.contact, name='contact') 8 | ] -------------------------------------------------------------------------------- /home/views.py: -------------------------------------------------------------------------------- 1 | from home.models import Contact 2 | from django.shortcuts import render, HttpResponse 3 | from datetime import datetime 4 | from django.contrib import messages 5 | # Create your views here. 6 | def index(request): 7 | return render(request,"index.html") 8 | # return HttpResponse("Hello Django App") 9 | 10 | def contact(request): 11 | if request.method == 'POST': 12 | name = request.POST.get('name') 13 | email = request.POST.get('email') 14 | contact = request.POST.get('contact') 15 | desc = request.POST.get('desc') 16 | contact = Contact(name=name, email=email, contact=contact, desc=desc, date=datetime.today()) 17 | contact.save() 18 | messages.success(request, 'Your Form has been Submitted') 19 | return render(request,"contact.html") -------------------------------------------------------------------------------- /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', 'Note_Keep.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 | -------------------------------------------------------------------------------- /media/default.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/media/default.jpg -------------------------------------------------------------------------------- /media/note_keep.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/media/note_keep.gif -------------------------------------------------------------------------------- /media/profile_pics/default.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/media/profile_pics/default.jpg -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2020.6.20 2 | chardet==3.0.4 3 | Django==3.1.6 4 | django-crispy-forms==1.11.0 5 | docutils==0.16 6 | idna==2.7 7 | imagesize==1.2.0 8 | itsdangerous==1.1.0 9 | python-dateutil==2.8.1 10 | requests==2.19.1 11 | urllib3==1.23 12 | -------------------------------------------------------------------------------- /static/carasouel/deadline.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/carasouel/deadline.jpg -------------------------------------------------------------------------------- /static/carasouel/deadline1.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/carasouel/deadline1.jfif -------------------------------------------------------------------------------- /static/carasouel/priority.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/carasouel/priority.jfif -------------------------------------------------------------------------------- /static/carasouel/priority.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/carasouel/priority.jpg -------------------------------------------------------------------------------- /static/carasouel/privacy.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/carasouel/privacy.jfif -------------------------------------------------------------------------------- /static/carasouel/privacy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/carasouel/privacy.jpg -------------------------------------------------------------------------------- /static/contact-us.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/contact-us.jfif -------------------------------------------------------------------------------- /static/course-1.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/course-1.jfif -------------------------------------------------------------------------------- /static/course-2.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/course-2.jfif -------------------------------------------------------------------------------- /static/course-3.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/course-3.jfif -------------------------------------------------------------------------------- /static/course-4.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/course-4.jfif -------------------------------------------------------------------------------- /static/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/cover.jpg -------------------------------------------------------------------------------- /static/cover2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/cover2.jpg -------------------------------------------------------------------------------- /static/cover3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/cover3.png -------------------------------------------------------------------------------- /static/digital-notes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/digital-notes.jpg -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/favicon.ico -------------------------------------------------------------------------------- /static/taking-notes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/punitzen/Note-keeping-app-django/2f431ae2048fbaa772926c92d8cc34fa79212d2d/static/taking-notes.jpg -------------------------------------------------------------------------------- /templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | Note Keep | {% block title %}{% endblock title %} 13 | 14 | 19 | 20 | 21 | 22 | 67 | 68 | {% if messages %} 69 | {% for message in messages %} 70 | 74 | {% endfor %} 75 | {% endif %} 76 | 77 | 78 | {% block body %}{% endblock body %} 79 | 80 | 83 | 84 | 85 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /templates/contact.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block title %} 4 | Contact Us 5 | {% endblock title %} 6 | 7 | {% block body %} 8 | 62 | 63 |
64 |
65 |
66 |

Contact Us

67 | {% csrf_token %} 68 |
69 | 70 | 71 |
72 |
73 | 74 | 75 |
76 |
77 | 78 | 79 |
80 |
81 | 82 | 83 |
84 |
85 | 86 |
87 |
88 | 89 |
90 |
91 | {% endblock body %} -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block title %} 4 | A Note Keeping 5 | {% endblock title %} 6 | 7 | {% block body %} 8 | 59 | 60 | 61 |
62 | 108 | 109 | 110 | 111 |
112 |
113 | 115 |

Never miss deadlines

116 |

Through Our Note Keep you can control almost all of your work and stay focus on your doing rather than 117 | remembering.

118 |
119 |
120 | 122 |

Prioritize Your Work

123 |

Through Our Note Keep you can Prioritize your work and take a step ahead to work faster than your regular boring 124 | alarm schedules.

125 |
126 |
127 | 129 |

User Privacy

130 |

We thinks Privacy is a major concern and Privacy is important for all of us, We won't sell your 131 | data

132 |
133 |
134 | 135 | 136 | 137 |
138 | 139 |
140 |
141 |

Keep your Schedules and done in awesome manner. 142 |

143 |

It's unique, one of the Kind.

144 |
145 |
146 | 149 |
150 |
151 | 152 |
153 | 154 |
155 |
156 |

It's is really good. See for yourself.

157 |

Customers are loving this.

158 |
159 |
160 | 163 |
164 |
165 |
166 | 167 |
168 |
169 |

All of our Resources are Free. 170 |

171 |

Contribute to our Open Source Platform.

172 |
173 |
174 | 177 |
178 |
179 |
180 | 181 | 182 | 183 | 184 | 189 | 190 | 192 | 193 | 194 | 195 |
196 | 197 | {% endblock body %} 198 | -------------------------------------------------------------------------------- /templates/users/login.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load crispy_forms_tags %} 3 | 4 | {% block title %} 5 | Login User 6 | {% endblock title %} 7 | 8 | {% block body %} 9 | 10 | 50 | 51 |
52 |
53 |
54 |
55 | {% csrf_token %} 56 |
57 | 58 | Log In 59 | 60 | {{ form|crispy }} 61 |
62 |
63 | 64 |
65 |
66 |
67 | 68 | Need an Account? Sign Up 69 | 70 |
71 |
72 | 73 |
74 |
75 | {% endblock body %} 76 | -------------------------------------------------------------------------------- /templates/users/logout.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block title %} 4 | Logout User 5 | {% endblock title %} 6 | 7 | {% block body %} 8 | 9 | 54 |
55 |
56 | 57 |
58 |

Logged Out

59 |

You have been successfully logged out of your account.

60 |

61 | Log in again 62 |

63 |
64 | 65 | 66 |
67 |
68 | 69 | {% endblock body %} 70 | -------------------------------------------------------------------------------- /templates/users/notes.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block title %} 4 | My Notes 5 | {% endblock title %} 6 | 7 | {% block nav %} 8 | 13 | {% endblock nav %} 14 | 15 | {% block body %} 16 | 17 | 18 |
19 |
20 |
21 | 29 |
30 |
31 |
32 | {%csrf_token%} 33 | 34 | 35 |
36 | 46 |
47 | 49 |
50 |
51 | 52 |
53 | 56 |
57 | 59 |
60 |
61 |
62 |
63 | 64 |
65 | {% if document %} 66 |
67 | Delete 68 |
69 | {% endif %} 70 |
71 |
72 |
73 |
74 |
75 | 76 | {% endblock body %} 77 | -------------------------------------------------------------------------------- /templates/users/profile.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load crispy_forms_tags %} 3 | {% block title %} 4 | Profile 5 | {% endblock title %} 6 | 7 | {% block body %} 8 | 9 | 74 | 75 |
76 |
77 |
78 | 79 |
80 | 81 |

{{ user.email }}

82 |
83 |
84 |
85 | {% csrf_token %} 86 |
87 | 88 | Profile Info 89 | 90 | {{ u_form |crispy }} 91 | {{ p_form |crispy }} 92 |
93 |
94 | 95 |
96 |
97 |
98 |
99 | 100 | {% endblock body %} -------------------------------------------------------------------------------- /templates/users/register.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load crispy_forms_tags %} 3 | 4 | {% block title %} 5 | Register User 6 | {% endblock title %} 7 | 8 | {% block body %} 9 | 10 | 51 |
52 |
53 |
54 |
55 | {% csrf_token %} 56 |
57 | 58 | Join Today! 59 | 60 | {{ form |crispy }} 61 |
62 |
63 | 64 |
65 |
66 |
67 | 68 | Already Have an Account? Sign In 69 | 70 |
71 |
72 | 75 |
76 |
77 | 78 | {% endblock body %} -------------------------------------------------------------------------------- /templates/users/todo.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load crispy_forms_tags %} 3 | 4 | {% block title %} 5 | My Notes 6 | {% endblock title %} 7 | 8 | {% block body %} 9 | 10 |
11 |
12 |
13 |
14 |

Add ToDos

15 |
16 |
17 | {% csrf_token %} 18 | {{ form|crispy }} 19 |
20 | 21 |
22 |
23 | 24 |
25 |
26 | 27 | {% if todos|length == 0 %} 28 | 29 |
30 |
31 |
32 |
33 |

No Todos

34 |
35 |
36 |
37 |
38 | 39 | {%else%} 40 |
41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | {% for todo in todos %} 55 | 56 | 57 | 58 | 65 | 66 | 74 | 75 | {%endfor%} 76 | 77 |
Sno.TitleStatusPriorityAction
{{forloop.counter}}{{todo.title}} 59 | {% if todo.status == 'C'%} 60 | ✅ 61 | {%else%} 62 | 🕒 63 | {%endif%} 64 | {{todo.priority}} 67 | 🗑️ 68 | {% if todo.status == 'P'%} 69 | 70 | {%else%} 71 | 🕒 72 | {%endif%} 73 |
78 |
79 | {%endif%} 80 | 81 |
82 |
83 |
84 |
85 | 86 | 87 | {% endblock body %} -------------------------------------------------------------------------------- /users/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Note, Profile, TODO, Note 3 | # Register your models here. 4 | 5 | admin.site.register(Profile) 6 | admin.site.register(TODO) 7 | admin.site.register(Note) -------------------------------------------------------------------------------- /users/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class UsersConfig(AppConfig): 5 | name = 'users' 6 | 7 | def ready(self): 8 | import users.signals 9 | -------------------------------------------------------------------------------- /users/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.contrib.auth.models import User 3 | from django.contrib.auth.forms import UserCreationForm 4 | from django.forms import fields 5 | from .models import Profile, TODO 6 | 7 | class UserRegisterForm(UserCreationForm): 8 | email = forms.EmailField() 9 | first_name = forms.CharField(max_length=30, required=False) 10 | last_name = forms.CharField(max_length=30, required=False) 11 | 12 | class Meta: 13 | model = User 14 | fields = ['username', 'first_name', 'last_name', 'email', 'password1', 'password2'] 15 | 16 | class UserUpdateForm(forms.ModelForm): 17 | email = forms.EmailField() 18 | first_name = forms.CharField(max_length=30, required=False) 19 | last_name = forms.CharField(max_length=30, required=False) 20 | 21 | class Meta: 22 | model = User 23 | fields = ['username', 'first_name', 'last_name','email'] 24 | 25 | class ProfileUpdateForm(forms.ModelForm): 26 | class Meta: 27 | model = Profile 28 | fields = ['image'] 29 | 30 | class TODOForm(forms.ModelForm): 31 | class Meta: 32 | model = TODO 33 | fields = ['title', 'status','priority'] 34 | -------------------------------------------------------------------------------- /users/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.1.6 on 2021-04-19 15:00 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 | initial = True 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='TODO', 19 | fields=[ 20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('title', models.CharField(max_length=50)), 22 | ('status', models.CharField(choices=[('C', 'COMPLETED'), ('P', 'PENDING')], max_length=2)), 23 | ('date', models.DateTimeField(auto_now_add=True)), 24 | ('priority', models.CharField(choices=[('1', '1️⃣'), ('2', '2️⃣'), ('3', '3️⃣'), ('4', '4️⃣'), ('5', '5️⃣')], max_length=5)), 25 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 26 | ], 27 | ), 28 | migrations.CreateModel( 29 | name='Profile', 30 | fields=[ 31 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 32 | ('image', models.ImageField(default='default.jpg', upload_to='profile_pics')), 33 | ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 34 | ], 35 | ), 36 | migrations.CreateModel( 37 | name='Note', 38 | fields=[ 39 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 40 | ('title', models.CharField(max_length=150)), 41 | ('content', models.TextField(blank=True, null=True)), 42 | ('created_at', models.DateTimeField(auto_now_add=True)), 43 | ('modified_at', models.DateTimeField(auto_now=True)), 44 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 45 | ], 46 | options={ 47 | 'ordering': ('title',), 48 | }, 49 | ), 50 | ] 51 | -------------------------------------------------------------------------------- /users/models.py: -------------------------------------------------------------------------------- 1 | from django.db import DefaultConnectionProxy, models 2 | from django.contrib.auth.models import User 3 | from PIL import Image 4 | 5 | # Create your models here. 6 | 7 | class TODO(models.Model): 8 | status_choices = [ 9 | ('C', 'COMPLETED'), 10 | ('P', 'PENDING') 11 | ] 12 | priority_choices = [ 13 | ('1', '1️⃣'), 14 | ('2', '2️⃣'), 15 | ('3', '3️⃣'), 16 | ('4', '4️⃣'), 17 | ('5', '5️⃣') 18 | ] 19 | 20 | title = models.CharField(max_length=50) 21 | status = models.CharField(max_length=2, choices=status_choices) 22 | user = models.ForeignKey(User, on_delete=models.CASCADE) 23 | date = models.DateTimeField(auto_now_add=True) 24 | priority = models.CharField(max_length=5, choices=priority_choices) 25 | 26 | def __str__(self): 27 | return f'{self.user.username} ToDo' 28 | 29 | class Note(models.Model): 30 | user = models.ForeignKey(User, on_delete=models.CASCADE) 31 | title = models.CharField(max_length=150) 32 | content = models.TextField(blank=True,null=True) 33 | created_at = models.DateTimeField(auto_now_add=True) 34 | modified_at = models.DateTimeField(auto_now=True) 35 | 36 | class Meta: 37 | ordering = ('title',) 38 | 39 | def __str__(self): 40 | return f'{self.user.username} Note' 41 | 42 | class Profile(models.Model): 43 | user = models.OneToOneField(User, on_delete=models.CASCADE) 44 | image = models.ImageField(default='default.jpg', upload_to='profile_pics') 45 | 46 | def __str__(self): 47 | return f'{self.user.username} Profile' 48 | 49 | # For Profile Image Size Shortening 50 | # def save(self): 51 | # super().save() 52 | # img = Image.open(self.image.path) 53 | # if img.height > 300 or img.width > 300: 54 | # output_size = (300, 300) 55 | # img.thumbnail(output_size) 56 | # img.save(self.image.path) -------------------------------------------------------------------------------- /users/signals.py: -------------------------------------------------------------------------------- 1 | from django.db.models.signals import post_save 2 | from django.contrib.auth.models import User 3 | from django.dispatch import receiver 4 | from .models import Profile 5 | 6 | @receiver(post_save, sender=User) 7 | def create_profile(sender, instance, created, **kwargs): 8 | if created: 9 | Profile.objects.create(user=instance) 10 | 11 | @receiver(post_save, sender=User) 12 | def save_profile(sender, instance, **kwargs): 13 | instance.profile.save() -------------------------------------------------------------------------------- /users/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /users/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render, redirect 2 | from django.contrib import messages 3 | from .forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm, TODOForm 4 | from django.contrib.auth.decorators import login_required 5 | from .models import Note, Profile, TODO 6 | 7 | # Create your views here. 8 | 9 | def register(request): 10 | if request.method == 'POST': 11 | form = UserRegisterForm(request.POST) 12 | if form.is_valid(): 13 | form.save() 14 | username = form.cleaned_data.get('username') 15 | messages.success(request, f'Your Account has been created, You can Login Now!') 16 | return redirect('/login') 17 | else: 18 | form = UserRegisterForm() 19 | return render(request, 'users/register.html', {'form':form}) 20 | 21 | 22 | @login_required 23 | def profile(request): 24 | if request.method == 'POST': 25 | u_form = UserUpdateForm(request.POST, instance=request.user) 26 | p_form = ProfileUpdateForm(request.POST, request.FILES, instance=request.user.profile) 27 | 28 | if u_form.is_valid() and p_form.is_valid(): 29 | u_form.save() 30 | p_form.save() 31 | messages.success(request, f'Your Account has been updated') 32 | return redirect('/profile') 33 | else: 34 | u_form = UserUpdateForm(instance=request.user) 35 | p_form = ProfileUpdateForm(instance=request.user.profile) 36 | 37 | context = { 38 | 'u_form' : u_form, 39 | 'p_form' : p_form 40 | } 41 | 42 | return render(request, 'users/profile.html', context) 43 | 44 | @login_required 45 | def todo(request): 46 | if request.user.is_authenticated: 47 | user = request.user 48 | form = TODOForm() 49 | todos = TODO.objects.filter(user=user).order_by('priority') 50 | context = { 51 | 'form' : form, 52 | 'todos' : todos 53 | } 54 | return render(request, 'users/todo.html', context) 55 | 56 | @login_required 57 | def add_todo(request): 58 | if request.user.is_authenticated: 59 | user = request.user 60 | form = TODOForm(request.POST) 61 | context = {'form' : form} 62 | if form.is_valid(): 63 | todo = form.save(commit=False) 64 | todo.user = user 65 | todo.save() 66 | messages.success(request, f'ToDo Added Successfully') 67 | return redirect("/to-dos") 68 | else: 69 | return render(request, 'users/todo.html', context) 70 | 71 | @login_required 72 | def delete_todo(request, id): 73 | TODO.objects.get(pk=id).delete() 74 | messages.success(request, f'ToDo Deleted Successfully') 75 | return redirect("/to-dos") 76 | 77 | @login_required 78 | def change_todo(request, id, status): 79 | todo = TODO.objects.get(pk=id) 80 | todo.status = status 81 | todo.save() 82 | messages.success(request, f'Status Changed Successfully') 83 | return redirect("/to-dos") 84 | 85 | @login_required 86 | def notes(request): 87 | user = request.user 88 | docid = int(request.GET.get('docid', 0)) 89 | documents = Note.objects.filter(user=user) 90 | 91 | if request.method == 'POST': 92 | docid = int(request.POST.get('docid', 0)) 93 | title = request.POST.get('title') 94 | content = request.POST.get('content','') 95 | 96 | if docid > 0: 97 | document = Note.objects.get(pk=docid, user=user) 98 | document.title = title 99 | document.content = content 100 | document.save() 101 | return redirect('/notes/?docid=%i' % docid) 102 | else: 103 | document = Note.objects.create(title=title, content=content, user=user) 104 | return redirect('/notes/?docid=%i' % document.id) 105 | 106 | 107 | if docid > 0: 108 | document = Note.objects.get(pk=docid, user=user) 109 | else: 110 | document = '' 111 | 112 | context = { 113 | 'docid':docid, 114 | 'documents':documents, 115 | 'document':document 116 | } 117 | return render(request, 'users/notes.html', context) 118 | 119 | @login_required 120 | def delete_note(request, docid): 121 | user = request.user 122 | document = Note.objects.get(pk=docid, user=user) 123 | document.delete() 124 | messages.success(request, f'Note Deleted Successfully') 125 | return redirect('/notes/?docid=0') --------------------------------------------------------------------------------