├── DJangoemail ├── djangoemail │ ├── readme.txt │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── emailapp │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── models.py │ ├── readme.txt │ ├── tests.py │ ├── urls.py │ └── views.py ├── readme.txt └── templates │ ├── home.html │ ├── readme.txt │ └── signup.html ├── Djangoapi ├── apiapp │ ├── admin.py │ ├── api_test.py │ ├── apps.py │ ├── models.py │ └── readme.txt ├── apitest │ ├── readme.txt │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py ├── readme.txt └── templates │ ├── index.html │ └── readme.txt ├── Testslug ├── db.sqlite3 ├── manage.py ├── readme ├── templates │ ├── detail.html │ ├── home.html │ └── readme ├── testapp │ ├── admin.py │ ├── apps.py │ ├── models.py │ ├── readme │ ├── tests.py │ ├── urls.py │ └── views.py └── testslugs │ ├── readme │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── chat ├── chat │ ├── readme │ ├── routing.py │ ├── settings.py │ └── urls.py ├── chatapp │ ├── admin.py │ ├── apps.py │ ├── consumers.py │ ├── models.py │ ├── readme.txt │ ├── routing.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── db.sqlite3 ├── manage.py ├── readme └── templates │ ├── index.html │ ├── readme.txt │ └── room.html ├── django ajax post ├── db.sqlite3 ├── manage.py ├── readme.md ├── templates │ ├── index.html │ ├── index1.html │ └── readme.md ├── testapp │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── models.py │ ├── readme.md │ ├── tests.py │ └── views.py └── testproject │ ├── asgi.py │ ├── readme.md │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── django forget password ├── forgetpassword │ ├── readme.txt │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── readme.txt ├── templates │ ├── home.html │ ├── login.html │ ├── readme.txt │ └── registration │ │ ├── base.html │ │ ├── password_reset_complete.html │ │ ├── password_reset_confirm.html │ │ ├── password_reset_done.html │ │ ├── password_reset_email.html │ │ ├── password_reset_form.html │ │ └── readme.txt └── testapp │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── models.py │ ├── readme.txt │ ├── tests.py │ └── views.py ├── djangograph ├── chartapp │ ├── admin.py │ ├── apps.py │ ├── models.py │ ├── readme.txt │ ├── tests.py │ └── views.py ├── chartproject │ ├── asgi.py │ ├── readme.txt │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── readme.txt └── templates │ ├── base.html │ ├── css.html │ ├── index.html │ ├── js.html │ └── readme.txt ├── djangopermissions ├── db.sqlite3 ├── djangopermissions │ ├── readme.txt │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── manage.py ├── myapp │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── models.py │ ├── readme.txt │ ├── tests.py │ └── views.py ├── readme.txt └── templates │ ├── create.html │ ├── home.html │ ├── login.html │ ├── readme.txt │ ├── signup.html │ ├── success.html │ ├── userprofile.html │ └── viewpost.html ├── excelupload ├── importexport │ ├── readme.txt │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── projectapp │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── models.py │ ├── readme.txt │ ├── resources.py │ ├── tests.py │ └── views.py ├── readme.txt └── templates │ ├── input.html │ └── readme.txt ├── login ├── login │ ├── readme.txt │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── myapp │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── models.py │ ├── readme.txt │ ├── tests.py │ ├── urls.py │ └── views.py ├── readme.txt └── templates │ ├── home.html │ ├── login.html │ ├── readme.txt │ ├── signup.html │ └── userprofile.html ├── pollform ├── db.sqlite3 ├── manage.py ├── pollapp │ ├── __pycache__ │ │ ├── __init__.cpython-37.pyc │ │ ├── admin.cpython-37.pyc │ │ ├── forms.cpython-37.pyc │ │ ├── models.cpython-37.pyc │ │ ├── readme.txt │ │ └── views.cpython-37.pyc │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── __pycache__ │ │ │ ├── 0001_initial.cpython-37.pyc │ │ │ ├── __init__.cpython-37.pyc │ │ │ └── readme.txt │ │ └── readme.txt │ ├── models.py │ ├── readme.txt │ ├── tests.py │ └── views.py ├── questionpoll │ ├── __pycache__ │ │ ├── __init__.cpython-37.pyc │ │ ├── readme.txt │ │ ├── settings.cpython-37.pyc │ │ ├── urls.cpython-37.pyc │ │ └── wsgi.cpython-37.pyc │ ├── readme.txt │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── readme.txt ├── static │ ├── css │ │ ├── page.css │ │ └── readme.txt │ └── readme.txt └── templates │ ├── poll.html │ └── readme.txt ├── problemmanagement ├── Users │ ├── admin.py │ ├── apps.py │ ├── filters.py │ ├── forms.py │ ├── models.py │ ├── readme │ ├── tests.py │ └── views.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_auto_20191102_1357.py │ ├── 0003_auto_20191104_1418.py │ ├── 0004_auto_20191104_1441.py │ └── readme ├── problemmanagement │ ├── readme │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── readme └── templates │ ├── new.html │ ├── readme │ ├── search.html │ └── user.html ├── signup ├── Readme ├── db.sqlite3 ├── manage.py ├── myapp │ ├── __pycache__ │ │ ├── __init__.cpython-37.pyc │ │ ├── admin.cpython-37.pyc │ │ ├── forms.cpython-37.pyc │ │ ├── models.cpython-37.pyc │ │ ├── readme.txt │ │ ├── urls.cpython-37.pyc │ │ └── views.cpython-37.pyc │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ └── readme.txt │ ├── models.py │ ├── readme.txt │ ├── tests.py │ ├── urls.py │ └── views.py ├── signup │ ├── Readme.txt │ ├── settings.py │ ├── urls.py │ └── wsgi.py └── templates │ ├── readme.txt │ ├── signup.html │ └── success.html ├── stylish form with db ├── liveapp │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── models.py │ ├── readme │ ├── tests.py │ └── views.py ├── liveproject │ ├── readme │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── readme └── template │ ├── about.html │ ├── base.html │ ├── contact.html │ ├── forms.html │ ├── home.html │ ├── indian.jpg │ └── readme └── webscraping ├── readme.txt ├── templates ├── index.html └── readme.txt ├── webapp ├── admin.py ├── apps.py ├── models.py ├── readme.txt ├── tests.py └── views.py └── webscrap ├── asgi.py ├── readme.txt ├── settings.py ├── urls.py └── wsgi.py /DJangoemail/djangoemail/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /DJangoemail/djangoemail/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for djangoemail project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'oc*ekfx(+zd**jhmh$2dts8(l$n_sx-!@^=s$yj$(nd+9g4a7v' 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 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'emailapp', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'djangoemail.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'djangoemail.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | 123 | EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' 124 | EMAIL_HOST = 'smtp.gmail.com' 125 | EMAIL_USE_TLS = True 126 | EMAIL_PORT = 587 127 | EMAIL_HOST_USER = 'youremail@gmail.com' 128 | EMAIL_HOST_PASSWORD = 'your password' 129 | -------------------------------------------------------------------------------- /DJangoemail/djangoemail/urls.py: -------------------------------------------------------------------------------- 1 | """djangoemail URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path,include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path('app/', include('emailapp.urls',namespace='app')), 22 | ] 23 | -------------------------------------------------------------------------------- /DJangoemail/djangoemail/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for djangoemail project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/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', 'djangoemail.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /DJangoemail/emailapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /DJangoemail/emailapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class EmailappConfig(AppConfig): 5 | name = 'emailapp' 6 | -------------------------------------------------------------------------------- /DJangoemail/emailapp/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.contrib.auth.models import User 3 | from django.contrib.auth.forms import UserCreationForm 4 | 5 | class SignupForm(UserCreationForm): 6 | username = forms.CharField(max_length=50) 7 | email = forms.EmailField(max_length=100) 8 | 9 | class Meta: 10 | model = User 11 | fields = ('username','email','password1','password2') -------------------------------------------------------------------------------- /DJangoemail/emailapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /DJangoemail/emailapp/readme.txt: -------------------------------------------------------------------------------- 1 | Follow the code and video step by step and ask your doubts in comments 2 | -------------------------------------------------------------------------------- /DJangoemail/emailapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /DJangoemail/emailapp/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | app_name = 'app' 4 | urlpatterns = [ 5 | 6 | path('signup/',views.signup_view, name='signup'), 7 | path('home/',views.Homepage,name='home' ), 8 | ] -------------------------------------------------------------------------------- /DJangoemail/emailapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,redirect 2 | from django.contrib.auth import login,authenticate 3 | from django.core.mail import send_mail 4 | from django.conf import settings 5 | from .forms import SignupForm 6 | 7 | def Homepage(request): 8 | return render(request,'home.html') 9 | 10 | def signup_view(request): 11 | subject = "Thank you for registering to our site" 12 | message = "You have succesfully created an account" 13 | email_from = settings.EMAIL_HOST_USER 14 | if request.method == 'POST': 15 | form = SignupForm(request.POST) 16 | if form.is_valid(): 17 | form.save() 18 | email = form.cleaned_data.get('email') 19 | recipient_list = [email,] 20 | username = form.cleaned_data.get('username') 21 | password = form.cleaned_data.get('password') 22 | user = authenticate(username=username,password=password) 23 | send_mail(subject,message,email_from,recipient_list) 24 | login(request,user) 25 | return redirect('app:home') 26 | else: 27 | form = SignupForm() 28 | return render(request,'signup.html',{'form':form}) 29 | 30 | -------------------------------------------------------------------------------- /DJangoemail/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /DJangoemail/templates/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home 5 | 6 | 7 |

You signed up succesfully

8 | 9 | -------------------------------------------------------------------------------- /DJangoemail/templates/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /DJangoemail/templates/signup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | {% csrf_token %} 10 | {{form.as_p}} 11 | 12 |
13 | 14 | -------------------------------------------------------------------------------- /Djangoapi/apiapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import APIData 3 | 4 | admin.site.register(APIData) 5 | -------------------------------------------------------------------------------- /Djangoapi/apiapp/api_test.py: -------------------------------------------------------------------------------- 1 | import json 2 | import requests 3 | 4 | name_list = [] 5 | home_list = [] 6 | resp = requests.get('https://app.oddsapi.io/api/v1/odds?apikey=50d15b50-960e-11ea-991d-0bda95767014') 7 | data = resp.json() 8 | #print(data[1]['league']) 9 | 10 | for i in range(0,5): 11 | x = data[i]['league']['name'] 12 | y = data[i]['event']['home'] 13 | name_list.append(x) 14 | home_list.append(y) 15 | #print(x,end=' ') 16 | #print(y) 17 | -------------------------------------------------------------------------------- /Djangoapi/apiapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ApiappConfig(AppConfig): 5 | name = 'apiapp' 6 | -------------------------------------------------------------------------------- /Djangoapi/apiapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | class APIData(models.Model): 4 | name = models.CharField(max_length=50) 5 | Home = models.CharField(max_length=50) 6 | -------------------------------------------------------------------------------- /Djangoapi/apiapp/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Djangoapi/apitest/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Djangoapi/apitest/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for apitest project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.6. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'v3z8)^ofeecqukm09thadcozd9qe&)+^x=hd!u%dt1)$l#hu-9' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | INSTALLED_APPS = [ 31 | 'django.contrib.admin', 32 | 'django.contrib.auth', 33 | 'django.contrib.contenttypes', 34 | 'django.contrib.sessions', 35 | 'django.contrib.messages', 36 | 'django.contrib.staticfiles', 37 | 'apiapp', 38 | 'rest_framework', 39 | 40 | ] 41 | 42 | MIDDLEWARE = [ 43 | 'django.middleware.security.SecurityMiddleware', 44 | 'django.contrib.sessions.middleware.SessionMiddleware', 45 | 'django.middleware.common.CommonMiddleware', 46 | 'django.middleware.csrf.CsrfViewMiddleware', 47 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 48 | 'django.contrib.messages.middleware.MessageMiddleware', 49 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 50 | ] 51 | 52 | ROOT_URLCONF = 'apitest.urls' 53 | 54 | TEMPLATES = [ 55 | { 56 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 57 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 58 | 'APP_DIRS': True, 59 | 'OPTIONS': { 60 | 'context_processors': [ 61 | 'django.template.context_processors.debug', 62 | 'django.template.context_processors.request', 63 | 'django.contrib.auth.context_processors.auth', 64 | 'django.contrib.messages.context_processors.messages', 65 | ], 66 | }, 67 | }, 68 | ] 69 | 70 | WSGI_APPLICATION = 'apitest.wsgi.application' 71 | 72 | 73 | # Database 74 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 75 | 76 | DATABASES = { 77 | 'default': { 78 | 'ENGINE': 'django.db.backends.sqlite3', 79 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 80 | } 81 | } 82 | 83 | 84 | # Password validation 85 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 86 | 87 | AUTH_PASSWORD_VALIDATORS = [ 88 | { 89 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 90 | }, 91 | { 92 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 93 | }, 94 | { 95 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 96 | }, 97 | { 98 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 99 | }, 100 | ] 101 | 102 | 103 | # Internationalization 104 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 105 | 106 | LANGUAGE_CODE = 'en-us' 107 | 108 | TIME_ZONE = 'UTC' 109 | 110 | USE_I18N = True 111 | 112 | USE_L10N = True 113 | 114 | USE_TZ = True 115 | 116 | 117 | # Static files (CSS, JavaScript, Images) 118 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 119 | 120 | STATIC_URL = '/static/' 121 | -------------------------------------------------------------------------------- /Djangoapi/apitest/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path 3 | from apiapp import views 4 | 5 | urlpatterns = [ 6 | path('admin/', admin.site.urls), 7 | path('', views.index), 8 | ] 9 | -------------------------------------------------------------------------------- /Djangoapi/apitest/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for apitest project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/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', 'apitest.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /Djangoapi/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/Djangoapi/db.sqlite3 -------------------------------------------------------------------------------- /Djangoapi/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 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'apitest.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /Djangoapi/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Djangoapi/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

This is an API view page

8 | {%for i in data%} 9 | {{i.name}} 10 | {{i.Home}} 11 | {% endfor%} 12 | 13 | -------------------------------------------------------------------------------- /Djangoapi/templates/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Testslug/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/Testslug/db.sqlite3 -------------------------------------------------------------------------------- /Testslug/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 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'testslug.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /Testslug/readme: -------------------------------------------------------------------------------- 1 | This is all about the django slugs. 2 | -------------------------------------------------------------------------------- /Testslug/templates/detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Detail 5 | 6 | 7 | {% if detail.slug%} 8 |

{{detail.title}}


9 |

{{detail.author}}

10 |

{{detail.description}}

11 | {% endif%} 12 | 13 | 14 | -------------------------------------------------------------------------------- /Testslug/templates/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {% for post in posts %} 9 |
10 | ... 11 |
12 |
{{post.title}}
13 |

{{post.description|truncatechars:12}}

14 | View 15 |
16 |
17 | {% endfor %} 18 | 19 | 20 | -------------------------------------------------------------------------------- /Testslug/templates/readme: -------------------------------------------------------------------------------- 1 | In this folder we have all the html files, like home and details. 2 | -------------------------------------------------------------------------------- /Testslug/testapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import PostData 3 | 4 | admin.site.register(PostData) 5 | -------------------------------------------------------------------------------- /Testslug/testapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class TestappConfig(AppConfig): 5 | name = 'testapp' 6 | -------------------------------------------------------------------------------- /Testslug/testapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.utils.text import slugify 3 | from django.urls import reverse 4 | from django.db.models.signals import pre_save 5 | 6 | class PostData(models.Model): 7 | title = models.CharField(max_length=100) 8 | author = models.CharField(max_length=100) 9 | description = models.TextField() 10 | slug = models.SlugField(max_length=100,unique=True,blank=True) 11 | 12 | def __str__(self): 13 | return self.title 14 | 15 | def get_absolute_url(self): 16 | return reverse("apps:detail",kwargs = {'slug':self.slug}) 17 | 18 | def create_slug(instance,new_slug = None): 19 | slug = slugify(instance.title) 20 | if new_slug is not None: 21 | slug = new_slug 22 | qs = PostData.objects.filter(slug=slug).order_by("-id") 23 | exists = qs.exists() 24 | if exists: 25 | new_slug = "%s-%s"%(slug,qs.first().id) 26 | return create_slug(instance,new_slug=new_slug) 27 | return slug 28 | 29 | def pre_save_post_receiver(sender,instance,*args,**kwargs): 30 | if not instance.slug: 31 | instance.slug = create_slug(instance) 32 | 33 | pre_save.connect(pre_save_post_receiver,PostData) 34 | 35 | 36 | -------------------------------------------------------------------------------- /Testslug/testapp/readme: -------------------------------------------------------------------------------- 1 | This folder contains models, views of the website. 2 | -------------------------------------------------------------------------------- /Testslug/testapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Testslug/testapp/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path,include 2 | from . import views 3 | 4 | app_name = 'testapp' 5 | 6 | urlpatterns = [ 7 | path('posts/',views.PostView,name='post'), 8 | path('detail/',views.PostDetail,name='detail'), 9 | ] 10 | -------------------------------------------------------------------------------- /Testslug/testapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.http import HttpResponse 3 | from .models import PostData 4 | 5 | def PostView(request): 6 | posts = PostData.objects.all() 7 | return render(request,'home.html',{'posts':posts}) 8 | 9 | 10 | def PostDetail(request,slug): 11 | detail = PostData.objects.filter(slug=slug) 12 | 13 | if detail.exists(): 14 | detail = detail.first() 15 | else: 16 | return HttpResponse("

Page Not Founddjango views is added by default) 7 | 'websocket': AuthMiddlewareStack( 8 | URLRouter( 9 | chatapp.routing.websocket_urlpatterns 10 | ) 11 | ), 12 | }) -------------------------------------------------------------------------------- /chat/chat/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for chat project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '9lf-wy#^w_j-73y7+9_oc&l+jaa77u3=oy39vn40-m*t&m=)&n' 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 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'channels', 41 | 'chatapp', 42 | ] 43 | 44 | MIDDLEWARE = [ 45 | 'django.middleware.security.SecurityMiddleware', 46 | 'django.contrib.sessions.middleware.SessionMiddleware', 47 | 'django.middleware.common.CommonMiddleware', 48 | 'django.middleware.csrf.CsrfViewMiddleware', 49 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 50 | 'django.contrib.messages.middleware.MessageMiddleware', 51 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 52 | ] 53 | 54 | ROOT_URLCONF = 'chat.urls' 55 | 56 | TEMPLATES = [ 57 | { 58 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 59 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 60 | 'APP_DIRS': True, 61 | 'OPTIONS': { 62 | 'context_processors': [ 63 | 'django.template.context_processors.debug', 64 | 'django.template.context_processors.request', 65 | 'django.contrib.auth.context_processors.auth', 66 | 'django.contrib.messages.context_processors.messages', 67 | ], 68 | }, 69 | }, 70 | ] 71 | 72 | WSGI_APPLICATION = 'chat.wsgi.application' 73 | ASGI_APPLICATION = 'chat.routing.application' 74 | 75 | # Database 76 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 77 | 78 | DATABASES = { 79 | 'default': { 80 | 'ENGINE': 'django.db.backends.sqlite3', 81 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 82 | } 83 | } 84 | 85 | 86 | # Password validation 87 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 88 | 89 | AUTH_PASSWORD_VALIDATORS = [ 90 | { 91 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 92 | }, 93 | { 94 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 95 | }, 96 | { 97 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 98 | }, 99 | { 100 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 101 | }, 102 | ] 103 | 104 | 105 | # Internationalization 106 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 107 | 108 | LANGUAGE_CODE = 'en-us' 109 | 110 | TIME_ZONE = 'UTC' 111 | 112 | USE_I18N = True 113 | 114 | USE_L10N = True 115 | 116 | USE_TZ = True 117 | 118 | 119 | # Static files (CSS, JavaScript, Images) 120 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 121 | 122 | STATIC_URL = '/static/' 123 | 124 | CHANNEL_LAYERS = { 125 | 'default': { 126 | 'BACKEND': 'channels_redis.core.RedisChannelLayer', 127 | 'CONFIG': { 128 | "hosts": [('127.0.0.1', 6379)], 129 | }, 130 | }, 131 | } -------------------------------------------------------------------------------- /chat/chat/urls.py: -------------------------------------------------------------------------------- 1 | """chat URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path,include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path('chat/', include('chatapp.urls')), 22 | ] 23 | -------------------------------------------------------------------------------- /chat/chatapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chat/chatapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ChatappConfig(AppConfig): 5 | name = 'chatapp' 6 | -------------------------------------------------------------------------------- /chat/chatapp/consumers.py: -------------------------------------------------------------------------------- 1 | import json 2 | from asgiref.sync import async_to_sync 3 | from channels.generic.websocket import WebsocketConsumer 4 | 5 | class ChatConsumer(WebsocketConsumer): 6 | def connect(self): 7 | self.room_name = self.scope['url_route']['kwargs']['room_name'] 8 | self.room_group_name = 'chat_%s' % self.room_name 9 | 10 | # Join room group 11 | async_to_sync(self.channel_layer.group_add)( 12 | self.room_group_name, 13 | self.channel_name 14 | ) 15 | 16 | self.accept() 17 | 18 | def disconnect(self, close_code): 19 | # Leave room group 20 | async_to_sync(self.channel_layer.group_discard)( 21 | self.room_group_name, 22 | self.channel_name 23 | ) 24 | 25 | # Receive message from WebSocket 26 | def receive(self, text_data): 27 | text_data_json = json.loads(text_data) 28 | message = text_data_json['message'] 29 | 30 | # Send message to room group 31 | async_to_sync(self.channel_layer.group_send)( 32 | self.room_group_name, 33 | { 34 | 'type': 'chat_message', 35 | 'message': message 36 | } 37 | ) 38 | 39 | # Receive message from room group 40 | def chat_message(self, event): 41 | message = event['message'] 42 | 43 | # Send message to WebSocket 44 | self.send(text_data=json.dumps({ 45 | 'message': message 46 | })) -------------------------------------------------------------------------------- /chat/chatapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chat/chatapp/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chat/chatapp/routing.py: -------------------------------------------------------------------------------- 1 | from django.urls import re_path 2 | 3 | from . import consumers 4 | 5 | websocket_urlpatterns = [ 6 | re_path(r'ws/chat/(?P\w+)/$', consumers.ChatConsumer), 7 | ] -------------------------------------------------------------------------------- /chat/chatapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chat/chatapp/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from . import views 4 | 5 | urlpatterns = [ 6 | path('', views.index, name='index'), 7 | path('/', views.room, name='room'), 8 | ] -------------------------------------------------------------------------------- /chat/chatapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | 4 | def index(request): 5 | return render(request, 'index.html') 6 | 7 | 8 | def room(request, room_name): 9 | return render(request, 'room.html', { 10 | 'room_name': room_name 11 | }) -------------------------------------------------------------------------------- /chat/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/chat/db.sqlite3 -------------------------------------------------------------------------------- /chat/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 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'chat.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /chat/readme: -------------------------------------------------------------------------------- 1 | For any queries you can directly contact us through info@maskottchen.tech 2 | or visit www.maskottchen.tech 3 | -------------------------------------------------------------------------------- /chat/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Chat Rooms 6 | 7 | 8 | What chat room would you like to enter?
9 |
10 | 11 | 12 | 25 | 26 | -------------------------------------------------------------------------------- /chat/templates/readme.txt: -------------------------------------------------------------------------------- 1 | template section 2 | -------------------------------------------------------------------------------- /chat/templates/room.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Chat Room 6 | 7 | 8 |
9 |
10 | 11 | {{ room_name|json_script:"room-name" }} 12 | 48 | 49 | -------------------------------------------------------------------------------- /django ajax post/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/django ajax post/db.sqlite3 -------------------------------------------------------------------------------- /django ajax post/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 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'testproject.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /django ajax post/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /django ajax post/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Form Example 5 | 6 | 7 | 8 | 9 |
10 |

Django Form

11 | 12 |
13 | 14 | 15 | 22 | 23 | 24 | 31 | 32 | 33 | 40 | 41 | 44 |
45 | 46 |
47 | 48 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /django ajax post/templates/index1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Form Example 5 | 6 | 7 | 8 | 9 |
10 |

Django Form

11 | 12 |
13 | 14 | {% csrf_token %} 15 | 16 | 23 | 24 | 25 | 32 | 33 | 34 | 41 | 42 | 45 |
46 | 47 |
48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /django ajax post/templates/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /django ajax post/testapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /django ajax post/testapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class TestappConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'testapp' 7 | -------------------------------------------------------------------------------- /django ajax post/testapp/forms.py: -------------------------------------------------------------------------------- 1 | from socket import fromshare 2 | from django import forms 3 | 4 | class ContactForm(forms.Form): 5 | name = forms.CharField(max_length=50) 6 | email = forms.EmailField(max_length=50) 7 | message = forms.CharField(max_length=500) 8 | -------------------------------------------------------------------------------- /django ajax post/testapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /django ajax post/testapp/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /django ajax post/testapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /django ajax post/testapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from .forms import ContactForm 3 | from django.http import JsonResponse 4 | 5 | def readval(request): 6 | if request.method == "POST": 7 | form = ContactForm(request.POST) 8 | if form.is_valid(): 9 | print(form.cleaned_data['name']) 10 | print(form.cleaned_data['email']) 11 | print(form.cleaned_data['message']) 12 | return JsonResponse({"response":"success"}, status=200) 13 | 14 | 15 | def index(request): 16 | 17 | form = ContactForm() 18 | return render(request,'index.html',{'form':form}) 19 | 20 | def index1(request): 21 | if request.method == 'POST': 22 | form = ContactForm(request.POST) 23 | 24 | if form.is_valid(): 25 | print(form.cleaned_data['name']) 26 | print(form.cleaned_data['email']) 27 | print(form.cleaned_data['message']) 28 | else: 29 | form = ContactForm() 30 | return render(request,'index1.html',{'form':form}) 31 | 32 | -------------------------------------------------------------------------------- /django ajax post/testproject/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for testproject 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.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', 'testproject.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /django ajax post/testproject/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /django ajax post/testproject/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for testproject project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.0.5. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.0/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'f@_u^a^_o^in=y5bkpc5e#0d&s8la!9h6!x+4nx8i3h)z6=f%!' 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 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'testapp', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'testproject.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'testproject.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/3.0/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/3.0/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/3.0/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | -------------------------------------------------------------------------------- /django ajax post/testproject/urls.py: -------------------------------------------------------------------------------- 1 | """testproject URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.0/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from testapp import views 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('index1/', views.index1,name="index1"), 23 | path('readval/', views.readval,name="readval"), 24 | path('', views.index,name="index"), 25 | ] 26 | -------------------------------------------------------------------------------- /django ajax post/testproject/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for testproject 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.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', 'testproject.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /django forget password/forgetpassword/readme.txt: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /django forget password/forgetpassword/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for forgetpassword project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'q&2_6q%bzb@ph_w(e76#vhu1y38ja)ga&6mem75le6(^6e58m@' 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 | 'testapp', 35 | 'django.contrib.admin', 36 | 'django.contrib.auth', 37 | 'django.contrib.contenttypes', 38 | 'django.contrib.sessions', 39 | 'django.contrib.messages', 40 | 'django.contrib.staticfiles', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'forgetpassword.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'forgetpassword.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | 123 | EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' 124 | EMAIL_HOST = 'smtp.gmail.com' 125 | EMAIL_USE_TLS = True 126 | EMAIL_PORT = 587 127 | EMAIL_HOST_USER = 'theshubhankertiwari@gmail.com' 128 | EMAIL_HOST_PASSWORD = 'igvuevxeqdsbmdqz' 129 | DEFAULT_FROM_EMAIL = 'theshubhankertiwari@gmail.com' 130 | #EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' -------------------------------------------------------------------------------- /django forget password/forgetpassword/urls.py: -------------------------------------------------------------------------------- 1 | """forgetpassword URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from testapp import views 19 | from django.contrib.auth import views as auth_views 20 | 21 | urlpatterns = [ 22 | path('admin/', admin.site.urls), 23 | path('admin/', admin.site.urls), 24 | path('signup/', views.signupform,name='signup'), 25 | path('login/', views.Userlogin,name='login'), 26 | path('home/', views.Homepage,name='home'), 27 | path('password_reset/$', auth_views.PasswordResetView.as_view(), name='password_reset'), 28 | path('password_reset/done/$', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'), 29 | path('password-reset-confirm///',auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'), 30 | path('reset/done/$', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'), 31 | 32 | ] 33 | -------------------------------------------------------------------------------- /django forget password/forgetpassword/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for forgetpassword project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/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', 'forgetpassword.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /django forget password/readme.txt: -------------------------------------------------------------------------------- 1 | This is project directory 2 | -------------------------------------------------------------------------------- /django forget password/templates/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

This is home page

8 | 9 | -------------------------------------------------------------------------------- /django forget password/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Login 5 | 6 | 7 |
8 | {% csrf_token%} 9 | {{loginForm.as_p}} 10 | 11 | 12 | 13 |
14 | 15 | -------------------------------------------------------------------------------- /django forget password/templates/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /django forget password/templates/registration/base.html: -------------------------------------------------------------------------------- 1 | 2 | 5 |
6 |
7 |
8 | {% block content %} 9 | {% endblock %} 10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /django forget password/templates/registration/password_reset_complete.html: -------------------------------------------------------------------------------- 1 | {% extends 'registration/base.html' %} 2 | 3 | {% block content %} 4 |

5 | Your password has been set. You may go ahead and sign in now. 6 |

7 | {% endblock %} -------------------------------------------------------------------------------- /django forget password/templates/registration/password_reset_confirm.html: -------------------------------------------------------------------------------- 1 | {% extends 'registration/base.html' %} 2 | 3 | {% block content %} 4 | {% if validlink %} 5 |

Change password

6 |
7 | {% csrf_token %} 8 | {{ form.as_p }} 9 | 10 |
11 | {% else %} 12 |

13 | The password reset link was invalid, possibly because it has already been used. 14 | Please request a new password reset. 15 |

16 | {% endif %} 17 | {% endblock %} -------------------------------------------------------------------------------- /django forget password/templates/registration/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends 'registration/base.html' %} 2 | 3 | {% block content %} 4 |

5 | We've emailed you instructions for setting your password, if an account exists with the email you entered. 6 | You should receive them shortly. 7 |

8 |

9 | If you don't receive an email, please make sure you've entered the address you registered with, 10 | and check your spam folder. 11 |

12 | {% endblock %} -------------------------------------------------------------------------------- /django forget password/templates/registration/password_reset_email.html: -------------------------------------------------------------------------------- 1 | {% autoescape off %} 2 | To initiate the password reset process for your {{ user.get_username }} TestSite Account, 3 | click the link below: 4 | 5 | {{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} 6 | 7 | If clicking the link above doesn't work, please copy and paste the URL in a new browser 8 | window instead. 9 | 10 | Sincerely, 11 | The TestSite Team 12 | {% endautoescape %} -------------------------------------------------------------------------------- /django forget password/templates/registration/password_reset_form.html: -------------------------------------------------------------------------------- 1 | {% extends 'registration/base.html' %} 2 | 3 | {% block content %} 4 |

Forgot password

5 |
6 | {% csrf_token %} 7 | {{ form.as_p }} 8 | 9 |
10 | {% endblock %} -------------------------------------------------------------------------------- /django forget password/templates/registration/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /django forget password/testapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /django forget password/testapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class TestappConfig(AppConfig): 5 | name = 'testapp' 6 | -------------------------------------------------------------------------------- /django forget password/testapp/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.contrib.auth.forms import UserCreationForm 3 | from django.contrib.auth.models import User 4 | from django.contrib.auth import authenticate 5 | 6 | 7 | class SignupUser(UserCreationForm): 8 | first_name = forms.CharField(max_length=100,required = True) 9 | last_name = forms.CharField(max_length=100,required = True) 10 | email = forms.EmailField(max_length=250) 11 | 12 | class Meta: 13 | model = User 14 | fields = ('username','first_name','last_name','password1','password2',) 15 | 16 | class UserLoginForm(forms.Form): 17 | username = forms.CharField() 18 | password = forms.CharField(widget=forms.PasswordInput) 19 | 20 | def clean(self, *args, **kwargs): 21 | username = self.cleaned_data.get('username') 22 | password = self.cleaned_data.get('password') 23 | 24 | if username and password: 25 | user = authenticate(username=username, password=password) 26 | if not user: 27 | raise forms.ValidationError('This user does not exist') 28 | if not user.check_password(password): 29 | raise forms.ValidationError('Incorrect password') 30 | if not user.is_active: 31 | raise forms.ValidationError('This user is not active') 32 | return super(UserLoginForm, self).clean(*args, **kwargs) -------------------------------------------------------------------------------- /django forget password/testapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /django forget password/testapp/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /django forget password/testapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /django forget password/testapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,redirect 2 | from .forms import UserLoginForm,SignupUser 3 | from django.contrib.auth import authenticate,login,logout 4 | from django.contrib.auth.models import User,Permission 5 | from django.contrib.auth.decorators import login_required 6 | 7 | def Userlogin(request): 8 | if request.method == 'POST': 9 | loginForm = UserLoginForm(request.POST or None) 10 | if loginForm.is_valid(): 11 | username = loginForm.cleaned_data.get('username') 12 | password = loginForm.cleaned_data.get('password') 13 | user = authenticate(username=username,password=password) 14 | if user.is_active: 15 | login(request,user) 16 | return redirect(Homepage) 17 | else: 18 | loginForm = UserLoginForm() 19 | return render(request,'login.html',{'loginForm':loginForm}) 20 | 21 | def signupform(request): 22 | if request.method == 'POST': 23 | UserRegister = SignupUser(request.POST or None) 24 | if UserRegister.is_valid(): 25 | UserRegister.save() 26 | username = UserRegister.cleaned_data.get('username') 27 | password = UserRegister.cleaned_data.get('password') 28 | user = authenticate(username=username,password=password) 29 | return redirect(Userlogin) 30 | else: 31 | UserRegister = SignupUser() 32 | return render(request,'signup.html',{'UserRegister':UserRegister}) 33 | 34 | @login_required 35 | def UserLogout(request): 36 | logout(request) 37 | return redirect(Userlogin) 38 | 39 | def Homepage(request): 40 | return render(request,'home.html') -------------------------------------------------------------------------------- /djangograph/chartapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /djangograph/chartapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ChartappConfig(AppConfig): 5 | name = 'chartapp' 6 | -------------------------------------------------------------------------------- /djangograph/chartapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /djangograph/chartapp/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /djangograph/chartapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /djangograph/chartapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from rest_framework.views import APIView 3 | from rest_framework.response import Response 4 | 5 | 6 | def homepage(request): 7 | return render(request,'index.html') 8 | 9 | class GraphData(APIView): 10 | 11 | def get(self,request,format=None): 12 | labels = ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'] 13 | DefaultData = [12, 19, 3, 5, 2, 3] 14 | data = { 15 | "labels":labels, 16 | "DefaultData":DefaultData, 17 | } 18 | return Response(data) 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /djangograph/chartproject/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for chartproject 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', 'chartproject.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /djangograph/chartproject/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /djangograph/chartproject/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for chartproject project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.1. 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(strict=True).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 = 'e0f++=g0n%33x2oo7ii=92wck=ixflv72amx_%bsuyah@j!@o=' 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 | 'rest_framework', 35 | 'django.contrib.admin', 36 | 'django.contrib.auth', 37 | 'django.contrib.contenttypes', 38 | 'django.contrib.sessions', 39 | 'django.contrib.messages', 40 | 'django.contrib.staticfiles', 41 | 'chartapp', 42 | ] 43 | 44 | MIDDLEWARE = [ 45 | 'django.middleware.security.SecurityMiddleware', 46 | 'django.contrib.sessions.middleware.SessionMiddleware', 47 | 'django.middleware.common.CommonMiddleware', 48 | 'django.middleware.csrf.CsrfViewMiddleware', 49 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 50 | 'django.contrib.messages.middleware.MessageMiddleware', 51 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 52 | ] 53 | 54 | ROOT_URLCONF = 'chartproject.urls' 55 | 56 | TEMPLATES = [ 57 | { 58 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 59 | 'DIRS': [BASE_DIR / 'templates'], 60 | 'APP_DIRS': True, 61 | 'OPTIONS': { 62 | 'context_processors': [ 63 | 'django.template.context_processors.debug', 64 | 'django.template.context_processors.request', 65 | 'django.contrib.auth.context_processors.auth', 66 | 'django.contrib.messages.context_processors.messages', 67 | ], 68 | }, 69 | }, 70 | ] 71 | 72 | WSGI_APPLICATION = 'chartproject.wsgi.application' 73 | 74 | 75 | # Database 76 | # https://docs.djangoproject.com/en/3.1/ref/settings/#databases 77 | 78 | DATABASES = { 79 | 'default': { 80 | 'ENGINE': 'django.db.backends.sqlite3', 81 | 'NAME': BASE_DIR / 'db.sqlite3', 82 | } 83 | } 84 | 85 | 86 | # Password validation 87 | # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators 88 | 89 | AUTH_PASSWORD_VALIDATORS = [ 90 | { 91 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 92 | }, 93 | { 94 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 95 | }, 96 | { 97 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 98 | }, 99 | { 100 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 101 | }, 102 | ] 103 | 104 | 105 | # Internationalization 106 | # https://docs.djangoproject.com/en/3.1/topics/i18n/ 107 | 108 | LANGUAGE_CODE = 'en-us' 109 | 110 | TIME_ZONE = 'UTC' 111 | 112 | USE_I18N = True 113 | 114 | USE_L10N = True 115 | 116 | USE_TZ = True 117 | 118 | 119 | # Static files (CSS, JavaScript, Images) 120 | # https://docs.djangoproject.com/en/3.1/howto/static-files/ 121 | 122 | STATIC_URL = '/static/' 123 | -------------------------------------------------------------------------------- /djangograph/chartproject/urls.py: -------------------------------------------------------------------------------- 1 | """chartproject 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.urls import path 18 | from chartapp import views 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('', views.homepage), 23 | path('api/data/', views.GraphData.as_view()), 24 | ] 25 | -------------------------------------------------------------------------------- /djangograph/chartproject/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for chartproject 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', 'chartproject.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /djangograph/readme.txt: -------------------------------------------------------------------------------- 1 | https://hobbybench.in/ 2 | https://maskottchen.tech/ 3 | -------------------------------------------------------------------------------- /djangograph/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dashboard 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {% block content %} 17 | 18 | {% include 'js.html' %} 19 | 23 | {% endblock %} 24 | 25 | 26 | -------------------------------------------------------------------------------- /djangograph/templates/css.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /djangograph/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% block content %} 3 | 4 | 5 | 65 | {% endblock %} -------------------------------------------------------------------------------- /djangograph/templates/js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /djangograph/templates/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /djangopermissions/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/djangopermissions/db.sqlite3 -------------------------------------------------------------------------------- /djangopermissions/djangopermissions/readme.txt: -------------------------------------------------------------------------------- 1 | This is the project folder with settings and urls 2 | -------------------------------------------------------------------------------- /djangopermissions/djangopermissions/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for djangopermissions project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '0r7&_-m7+#d^#&@r1!p5su-*f(%v^u826tq5hj3*9ycuqy44=)' 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 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'myapp', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'djangopermissions.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'djangopermissions.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | #AUTH_USER_MODEL = "myapp.User" 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | -------------------------------------------------------------------------------- /djangopermissions/djangopermissions/urls.py: -------------------------------------------------------------------------------- 1 | """djangopermissions URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from myapp import views 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('login/', views.Userlogin,name ='login'), 23 | path('logout/', views.UserLogout,name ='logout'), 24 | path('signup/', views.UserRegistration,name ='singup'), 25 | path('create/', views.Create,name ='create'), 26 | path('viewpost/', views.ViewPost,name ='viewpost'), 27 | path('home/', views.HomeView,name ='home'), 28 | path('profile/', views.userprofile,name ='profile'), 29 | path('sucess/', views.registersuccesfull,name ='success'), 30 | 31 | ] 32 | -------------------------------------------------------------------------------- /djangopermissions/djangopermissions/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for djangopermissions project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/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', 'djangopermissions.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /djangopermissions/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 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangopermissions.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /djangopermissions/myapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Article 3 | 4 | admin.site.register(Article) 5 | -------------------------------------------------------------------------------- /djangopermissions/myapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class MyappConfig(AppConfig): 5 | name = 'myapp' 6 | -------------------------------------------------------------------------------- /djangopermissions/myapp/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.contrib.auth.forms import UserCreationForm 3 | from django.contrib.auth.models import User 4 | from django.contrib.auth import authenticate 5 | from .models import Article 6 | 7 | class SignupUser(UserCreationForm): 8 | first_name = forms.CharField(max_length=100,required = True) 9 | last_name = forms.CharField(max_length=100,required = True) 10 | email = forms.EmailField(max_length=250) 11 | 12 | class Meta: 13 | model = User 14 | fields = ('username','first_name','last_name','email','password1','password2',) 15 | 16 | class UserLoginForm(forms.Form): 17 | username = forms.CharField() 18 | password = forms.CharField(widget=forms.PasswordInput) 19 | 20 | def clean(self, *args, **kwargs): 21 | username = self.cleaned_data.get('username') 22 | password = self.cleaned_data.get('password') 23 | 24 | if username and password: 25 | user = authenticate(username=username, password=password) 26 | if not user: 27 | raise forms.ValidationError('This user does not exist') 28 | if not user.check_password(password): 29 | raise forms.ValidationError('Incorrect password') 30 | if not user.is_active: 31 | raise forms.ValidationError('This user is not active') 32 | return super(UserLoginForm, self).clean(*args, **kwargs) 33 | 34 | 35 | class PostCreate(forms.ModelForm): 36 | class Meta: 37 | model = Article 38 | fields = '__all__' -------------------------------------------------------------------------------- /djangopermissions/myapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.auth.models import AbstractUser 3 | from django.utils import timezone 4 | from django.contrib.auth.models import User 5 | 6 | 7 | class Article(models.Model): 8 | title = models.CharField(max_length=100) 9 | description = models.TextField() 10 | 11 | def __str__(self): 12 | return self.title 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /djangopermissions/myapp/readme.txt: -------------------------------------------------------------------------------- 1 | This is the project app of django permissions 2 | -------------------------------------------------------------------------------- /djangopermissions/myapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /djangopermissions/myapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,redirect 2 | from .models import Article 3 | from .forms import UserLoginForm,PostCreate,SignupUser 4 | from django.contrib.auth import authenticate,login,logout 5 | from django.contrib.auth.models import User,Permission 6 | from django.contrib.auth.decorators import login_required 7 | from django.contrib.contenttypes.models import ContentType 8 | 9 | def Userlogin(request): 10 | if request.method == 'POST': 11 | loginForm = UserLoginForm(request.POST or None) 12 | if loginForm.is_valid(): 13 | username = loginForm.cleaned_data.get('username') 14 | password = loginForm.cleaned_data.get('password') 15 | user = authenticate(username=username,password=password) 16 | if user.is_active: 17 | login(request,user) 18 | return redirect(HomeView) 19 | else: 20 | loginForm = UserLoginForm() 21 | return render(request,'login.html',{'loginForm':loginForm}) 22 | 23 | def UserRegistration(request): 24 | if request.method == 'POST': 25 | UserRegister = SignupUser(request.POST or None) 26 | if UserRegister.is_valid(): 27 | UserRegister.save() 28 | username = UserRegister.cleaned_data.get('username') 29 | password = UserRegister.cleaned_data.get('password') 30 | user = authenticate(username=username,password=password) 31 | return redirect(registersuccesfull) 32 | else: 33 | UserRegister = SignupUser() 34 | return render(request,'signup.html',{'UserRegister':UserRegister}) 35 | 36 | @login_required 37 | def UserLogout(request): 38 | logout(request) 39 | return redirect(Userlogin) 40 | 41 | def registersuccesfull(request): 42 | return render(request,'success.html') 43 | 44 | @login_required 45 | def userprofile(request,pk=None): 46 | if pk: 47 | user = User.objects.get(pk=pk) 48 | if (user == User.objects.get(username='anil')): 49 | user.has_perm('myapp.view_Article') 50 | else: 51 | user = request.user 52 | print(user) 53 | return render(request,'userprofile.html',{'user':user}) 54 | 55 | @login_required 56 | def HomeView(request): 57 | return render(request,'home.html') 58 | 59 | @login_required 60 | def Create(request): 61 | if request.method == 'POST': 62 | postform = PostCreate(request.POST or None) 63 | if postform.is_valid(): 64 | postform.save() 65 | redirect(ViewPost) 66 | else: 67 | postform = PostCreate() 68 | return render(request,'create.html',{'postform':postform}) 69 | 70 | @login_required 71 | def ViewPost(request): 72 | post = Article.objects.all() 73 | return render(request,'viewpost.html',{'post':post}) 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /djangopermissions/readme.txt: -------------------------------------------------------------------------------- 1 | This code have full guide of how to use django permission step by step 2 | -------------------------------------------------------------------------------- /djangopermissions/templates/create.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | {% csrf_token %} 10 | {{postform.as_p}} 11 | 12 | 13 |
14 | 15 | -------------------------------------------------------------------------------- /djangopermissions/templates/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /djangopermissions/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Login 5 | 6 | 7 |
8 | {% csrf_token%} 9 | {{loginForm.as_p}} 10 | 11 | 12 |
13 | 14 | -------------------------------------------------------------------------------- /djangopermissions/templates/readme.txt: -------------------------------------------------------------------------------- 1 | All the html files will be loaded here 2 | -------------------------------------------------------------------------------- /djangopermissions/templates/signup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Signup 5 | 6 | 7 |
8 | 9 | {% csrf_token %} 10 | {{UserRegister.as_p}} 11 | 12 | 13 | 14 |
15 | 16 | -------------------------------------------------------------------------------- /djangopermissions/templates/success.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | succesfull 5 | 6 | 7 |

Signup succesfull

8 | 9 | -------------------------------------------------------------------------------- /djangopermissions/templates/userprofile.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | profile 5 | 6 | 7 | {{user}}
8 | {{user.first_name}}
9 | {{user.last_name}}
10 | {{user.email}}
11 | 12 | 14 | 15 |
{{ perms.myapp }}
16 | 17 | 18 | -------------------------------------------------------------------------------- /djangopermissions/templates/viewpost.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Post View 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | {% if perms.myapp.view_article %} 13 | {% for a in post %} 14 | 15 | {{a.title}}
16 | {{a.description}}
17 | {% endfor %} 18 | {% else %} 19 | {{user.username}} 20 |

You don't have permission to do anything in the myapp.

21 | 22 | 23 | 24 | {% endif %} 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /excelupload/importexport/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /excelupload/importexport/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for importexport project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'awrm1#y@x^0@6!n6$x0-@ie&&7q&4fb#g&mjq_g2uq9f3_aad&' 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 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'projectapp', 41 | 'import_export' 42 | ] 43 | 44 | MIDDLEWARE = [ 45 | 'django.middleware.security.SecurityMiddleware', 46 | 'django.contrib.sessions.middleware.SessionMiddleware', 47 | 'django.middleware.common.CommonMiddleware', 48 | 'django.middleware.csrf.CsrfViewMiddleware', 49 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 50 | 'django.contrib.messages.middleware.MessageMiddleware', 51 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 52 | ] 53 | 54 | ROOT_URLCONF = 'importexport.urls' 55 | 56 | TEMPLATES = [ 57 | { 58 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 59 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 60 | 'APP_DIRS': True, 61 | 'OPTIONS': { 62 | 'context_processors': [ 63 | 'django.template.context_processors.debug', 64 | 'django.template.context_processors.request', 65 | 'django.contrib.auth.context_processors.auth', 66 | 'django.contrib.messages.context_processors.messages', 67 | ], 68 | }, 69 | }, 70 | ] 71 | 72 | WSGI_APPLICATION = 'importexport.wsgi.application' 73 | 74 | 75 | # Database 76 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 77 | 78 | DATABASES = { 79 | 'default': { 80 | 'ENGINE': 'django.db.backends.sqlite3', 81 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 82 | } 83 | } 84 | 85 | 86 | # Password validation 87 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 88 | 89 | AUTH_PASSWORD_VALIDATORS = [ 90 | { 91 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 92 | }, 93 | { 94 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 95 | }, 96 | { 97 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 98 | }, 99 | { 100 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 101 | }, 102 | ] 103 | 104 | 105 | # Internationalization 106 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 107 | 108 | LANGUAGE_CODE = 'en-us' 109 | 110 | TIME_ZONE = 'UTC' 111 | 112 | USE_I18N = True 113 | 114 | USE_L10N = True 115 | 116 | USE_TZ = True 117 | 118 | 119 | # Static files (CSS, JavaScript, Images) 120 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 121 | 122 | STATIC_URL = '/static/' 123 | -------------------------------------------------------------------------------- /excelupload/importexport/urls.py: -------------------------------------------------------------------------------- 1 | """importexport URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from projectapp import views 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('export/', views.export), 23 | path('', views.simple_upload), 24 | ] 25 | -------------------------------------------------------------------------------- /excelupload/importexport/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for importexport project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/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', 'importexport.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /excelupload/projectapp/admin.py: -------------------------------------------------------------------------------- 1 | from import_export.admin import ImportExportModelAdmin 2 | from django.contrib import admin 3 | from .models import Person 4 | 5 | @admin.register(Person) 6 | class PersonAdmin(ImportExportModelAdmin): 7 | list_display = ('name', 'email', 'location') -------------------------------------------------------------------------------- /excelupload/projectapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ProjectappConfig(AppConfig): 5 | name = 'projectapp' 6 | -------------------------------------------------------------------------------- /excelupload/projectapp/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import Person 3 | 4 | class PersonData(forms.Form): 5 | class meta: 6 | model = Person 7 | fields = '__all__' -------------------------------------------------------------------------------- /excelupload/projectapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | class Person(models.Model): 4 | name = models.CharField(max_length=30) 5 | email = models.EmailField(blank=True) 6 | #birth_date = models.DateField() 7 | location = models.CharField(max_length=100, blank=True) 8 | -------------------------------------------------------------------------------- /excelupload/projectapp/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /excelupload/projectapp/resources.py: -------------------------------------------------------------------------------- 1 | from import_export import resources 2 | from .models import Person 3 | 4 | class PersonResource(resources.ModelResource): 5 | class Meta: 6 | model = Person -------------------------------------------------------------------------------- /excelupload/projectapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /excelupload/projectapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.http import HttpResponse 3 | from .resources import PersonResource 4 | from tablib import Dataset 5 | from .models import Person 6 | 7 | def export(request): 8 | person_resource = PersonResource() 9 | dataset = person_resource.export() 10 | response = HttpResponse(dataset.xls, content_type='application/vnd.ms-excel') 11 | response['Content-Disposition'] = 'attachment; filename="persons.xls"' 12 | return response 13 | 14 | def simple_upload(request): 15 | if request.method == 'POST': 16 | person_resource = PersonResource() 17 | dataset = Dataset() 18 | new_persons = request.FILES['myfile'] 19 | 20 | imported_data = dataset.load(new_persons.read(),format='xlsx') 21 | #print(imported_data) 22 | for data in imported_data: 23 | print(data[1]) 24 | value = Person( 25 | data[0], 26 | data[1], 27 | data[2], 28 | data[3] 29 | ) 30 | value.save() 31 | 32 | #result = person_resource.import_data(dataset, dry_run=True) # Test the data import 33 | 34 | #if not result.has_errors(): 35 | # person_resource.import_data(dataset, dry_run=False) # Actually import now 36 | 37 | return render(request, 'input.html') 38 | -------------------------------------------------------------------------------- /excelupload/readme.txt: -------------------------------------------------------------------------------- 1 | For any help or guidence visit www.maskottchen.tech 2 | and go to contact to get my contact details. 3 | -------------------------------------------------------------------------------- /excelupload/templates/input.html: -------------------------------------------------------------------------------- 1 |
2 | {% csrf_token %} 3 | 4 | 5 |
-------------------------------------------------------------------------------- /excelupload/templates/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /login/login/readme.txt: -------------------------------------------------------------------------------- 1 | Inside login project 2 | -------------------------------------------------------------------------------- /login/login/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for signup project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '5np$ykoa)w+#x9gwa&%fv=70!2d7m7+re8jrf&^lvct+x!n9_h' 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 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'myapp', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'signup.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'signup.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | STATICFILES_DIRS = [ 123 | os.path.join(BASE_DIR, "static"), 124 | ] 125 | -------------------------------------------------------------------------------- /login/login/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path,include 3 | from django.conf import settings 4 | from django.conf.urls.static import static 5 | 6 | urlpatterns = [ 7 | path('admin/', admin.site.urls), 8 | path('',include('myapp.urls',namespace='myapp')), 9 | 10 | ]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) 11 | -------------------------------------------------------------------------------- /login/login/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for signup project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/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', 'signup.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /login/myapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | 4 | -------------------------------------------------------------------------------- /login/myapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class MyappConfig(AppConfig): 5 | name = 'myapp' 6 | -------------------------------------------------------------------------------- /login/myapp/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.contrib.auth.forms import UserCreationForm 3 | from django.contrib.auth.models import User 4 | from django.contrib.auth import authenticate 5 | 6 | 7 | class SignupUser(UserCreationForm): 8 | first_name = forms.CharField(max_length=100,required = True) 9 | last_name = forms.CharField(max_length=100,required = True) 10 | email = forms.EmailField(max_length=250) 11 | 12 | class Meta: 13 | model = User 14 | fields = ('username','first_name','last_name','password1','password2',) 15 | 16 | class UserLoginForm(forms.Form): 17 | username = forms.CharField() 18 | password = forms.CharField(widget=forms.PasswordInput) 19 | 20 | def clean(self, *args, **kwargs): 21 | username = self.cleaned_data.get('username') 22 | password = self.cleaned_data.get('password') 23 | 24 | if username and password: 25 | user = authenticate(username=username, password=password) 26 | if not user: 27 | raise forms.ValidationError('This user does not exist') 28 | if not user.check_password(password): 29 | raise forms.ValidationError('Incorrect password') 30 | if not user.is_active: 31 | raise forms.ValidationError('This user is not active') 32 | return super(UserLoginForm, self).clean(*args, **kwargs) 33 | 34 | 35 | class PostCreate(forms.ModelForm): 36 | class Meta: 37 | model = ArticlePkandSlug 38 | fields = '__all__' 39 | -------------------------------------------------------------------------------- /login/myapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | -------------------------------------------------------------------------------- /login/myapp/readme.txt: -------------------------------------------------------------------------------- 1 | login project app 2 | -------------------------------------------------------------------------------- /login/myapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /login/myapp/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | 4 | app_name = 'myapp' 5 | 6 | urlpatterns = [ 7 | path('signup/', views.signupform,name='signup'), 8 | path('login/', views.Userlogin,name='login'), 9 | path('profile/', views.userprofile,name='profile'), 10 | path('home/', views.Homepage,name='home'), 11 | 12 | 13 | ] 14 | -------------------------------------------------------------------------------- /login/myapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,redirect 2 | from .forms import UserLoginForm,SignupUser 3 | from django.contrib.auth import authenticate,login,logout 4 | from django.contrib.auth.models import User,Permission 5 | from django.contrib.auth.decorators import login_required 6 | 7 | def Userlogin(request): 8 | if request.method == 'POST': 9 | loginForm = UserLoginForm(request.POST or None) 10 | if loginForm.is_valid(): 11 | username = loginForm.cleaned_data.get('username') 12 | password = loginForm.cleaned_data.get('password') 13 | user = authenticate(username=username,password=password) 14 | if user.is_active: 15 | login(request,user) 16 | return redirect(Homepage) 17 | else: 18 | loginForm = UserLoginForm() 19 | return render(request,'login.html',{'loginForm':loginForm}) 20 | 21 | def signupform(request): 22 | if request.method == 'POST': 23 | UserRegister = SignupUser(request.POST or None) 24 | if UserRegister.is_valid(): 25 | UserRegister.save() 26 | username = UserRegister.cleaned_data.get('username') 27 | password = UserRegister.cleaned_data.get('password') 28 | user = authenticate(username=username,password=password) 29 | return redirect(Userlogin) 30 | else: 31 | UserRegister = SignupUser() 32 | return render(request,'signup.html',{'UserRegister':UserRegister}) 33 | 34 | @login_required 35 | def UserLogout(request): 36 | logout(request) 37 | return redirect(Userlogin) 38 | 39 | @login_required 40 | def userprofile(request,pk=None): 41 | if pk: 42 | user = User.objects.get(pk=pk) 43 | else: 44 | user = request.user 45 | print(user) 46 | return render(request,'userprofile.html',{'user':user}) 47 | 48 | @login_required 49 | def Homepage(request): 50 | return render(request,'home.html') 51 | -------------------------------------------------------------------------------- /login/readme.txt: -------------------------------------------------------------------------------- 1 | This is program is the combination of signup and login screen Please follow along my video tutorial to learn 2 | how to login and register a user 3 | -------------------------------------------------------------------------------- /login/templates/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /login/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Login 5 | 6 | 7 |
8 | {% csrf_token%} 9 | {{loginForm.as_p}} 10 | 11 | 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /login/templates/readme.txt: -------------------------------------------------------------------------------- 1 | inside templates 2 | -------------------------------------------------------------------------------- /login/templates/signup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Signup 5 | 6 | 7 |
8 | 9 | {% csrf_token %} 10 | {{UserRegister.as_p}} 11 | 12 | 13 | 14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /login/templates/userprofile.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | profile 5 | 6 | 7 | {{user}}
8 | {{user.first_name}}
9 | {{user.last_name}}
10 | {{user.email}}
11 | 12 | 14 | 15 |
{{ perms.myapp }}
16 | 17 | -------------------------------------------------------------------------------- /pollform/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/pollform/db.sqlite3 -------------------------------------------------------------------------------- /pollform/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 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'questionpoll.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /pollform/pollapp/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/pollform/pollapp/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /pollform/pollapp/__pycache__/admin.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/pollform/pollapp/__pycache__/admin.cpython-37.pyc -------------------------------------------------------------------------------- /pollform/pollapp/__pycache__/forms.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/pollform/pollapp/__pycache__/forms.cpython-37.pyc -------------------------------------------------------------------------------- /pollform/pollapp/__pycache__/models.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/pollform/pollapp/__pycache__/models.cpython-37.pyc -------------------------------------------------------------------------------- /pollform/pollapp/__pycache__/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pollform/pollapp/__pycache__/views.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/pollform/pollapp/__pycache__/views.cpython-37.pyc -------------------------------------------------------------------------------- /pollform/pollapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import PollQuestions 3 | 4 | admin.site.register(PollQuestions) 5 | -------------------------------------------------------------------------------- /pollform/pollapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PollappConfig(AppConfig): 5 | name = 'pollapp' 6 | -------------------------------------------------------------------------------- /pollform/pollapp/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import PollQuestions 3 | 4 | FILM_CHOICE = ( 5 | ('SPIDERMAN','Spiderman'), 6 | ('IRONMAN','Ironman'), 7 | ('BLACK PANTHER','Black Panther'), 8 | ('SPIDERMAN2','Spiderman2'), 9 | ('CAPTAIN AMERICA','Captain America'), 10 | ) 11 | 12 | AGE_CHOICE = ( 13 | ('UNDER 18','Under 18'), 14 | ('45-54','45-54'), 15 | ('35-44','35-44'), 16 | ('25-34','25-34'), 17 | ('18-24','18-24'), 18 | ('55-64','55-64'), 19 | ('ABOVE 64','Above 64'), 20 | 21 | ) 22 | 23 | GENDER_CHOICE = ( 24 | ('MALE','Male'), 25 | ('FEMALE','Female'), 26 | ('OTHER','Other'), 27 | ) 28 | 29 | class PollForm(forms.ModelForm): 30 | age = forms.ChoiceField(choices=AGE_CHOICE, widget=forms.RadioSelect) 31 | gender = forms.ChoiceField(choices=GENDER_CHOICE, widget=forms.RadioSelect) 32 | 33 | class Meta: 34 | model = PollQuestions 35 | fields = '__all__' -------------------------------------------------------------------------------- /pollform/pollapp/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.4 on 2019-11-20 08:19 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='PollQuestions', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('movie_list', models.CharField(choices=[('SPIDERMAN', 'Spiderman'), ('IRONMAN', 'Ironman'), ('BLACK PANTHER', 'Black Panther'), ('SPIDERMAN2', 'Spiderman2'), ('CAPTAIN AMERICA', 'Captain America')], max_length=100)), 19 | ('age', models.CharField(choices=[('UNDER 18', 'Under 18'), ('45-54', '45-54'), ('35-44', '35-44'), ('25-34', '25-34'), ('18-24', '18-24'), ('55-64', '55-64'), ('ABOVE 64', 'Above 64')], max_length=100)), 20 | ('gender', models.CharField(choices=[('MALE', 'Male'), ('FEMALE', 'Female'), ('OTHER', 'Other')], max_length=100)), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /pollform/pollapp/migrations/__pycache__/0001_initial.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/pollform/pollapp/migrations/__pycache__/0001_initial.cpython-37.pyc -------------------------------------------------------------------------------- /pollform/pollapp/migrations/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/pollform/pollapp/migrations/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /pollform/pollapp/migrations/__pycache__/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pollform/pollapp/migrations/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pollform/pollapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | FILM_CHOICE = ( 4 | ('SPIDERMAN','Spiderman'), 5 | ('IRONMAN','Ironman'), 6 | ('BLACK PANTHER','Black Panther'), 7 | ('SPIDERMAN2','Spiderman2'), 8 | ('CAPTAIN AMERICA','Captain America'), 9 | ) 10 | 11 | AGE_CHOICE = ( 12 | ('UNDER 18','Under 18'), 13 | ('45-54','45-54'), 14 | ('35-44','35-44'), 15 | ('25-34','25-34'), 16 | ('18-24','18-24'), 17 | ('55-64','55-64'), 18 | ('ABOVE 64','Above 64'), 19 | 20 | ) 21 | 22 | GENDER_CHOICE = ( 23 | ('MALE','Male'), 24 | ('FEMALE','Female'), 25 | ('OTHER','Other'), 26 | ) 27 | 28 | class PollQuestions(models.Model): 29 | movie_list = models.CharField(choices= FILM_CHOICE,max_length=100) 30 | age = models.CharField(choices= AGE_CHOICE,max_length=100) 31 | gender = models.CharField(choices= GENDER_CHOICE,max_length=100) 32 | 33 | def __str__(self): 34 | return self.movie_list -------------------------------------------------------------------------------- /pollform/pollapp/readme.txt: -------------------------------------------------------------------------------- 1 | app of pollform 2 | -------------------------------------------------------------------------------- /pollform/pollapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /pollform/pollapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,redirect 2 | from .forms import PollForm 3 | from django.http import HttpResponse 4 | 5 | 6 | def pollpage(request): 7 | if request.method == 'POST': 8 | form = PollForm(request.POST or None) 9 | if form.is_valid(): 10 | form.save() 11 | return HttpResponse("

Succesfull

") 12 | #return redirect() 13 | else: 14 | form = PollForm() 15 | return render(request,'poll.html',{'form':form}) 16 | 17 | def Thankyou(request): 18 | pass -------------------------------------------------------------------------------- /pollform/questionpoll/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/pollform/questionpoll/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /pollform/questionpoll/__pycache__/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pollform/questionpoll/__pycache__/settings.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/pollform/questionpoll/__pycache__/settings.cpython-37.pyc -------------------------------------------------------------------------------- /pollform/questionpoll/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/pollform/questionpoll/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /pollform/questionpoll/__pycache__/wsgi.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/pollform/questionpoll/__pycache__/wsgi.cpython-37.pyc -------------------------------------------------------------------------------- /pollform/questionpoll/readme.txt: -------------------------------------------------------------------------------- 1 | hello123 2 | -------------------------------------------------------------------------------- /pollform/questionpoll/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for questionpoll project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '-ridiazd7g=!sz@5d_drjxhqw4qm0b8rr@*)spl0dex2mnh30n' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = False 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'pollapp', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'questionpoll.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'questionpoll.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | STATICFILES_DIRS = [ 123 | os.path.join(BASE_DIR, "static"), 124 | ] -------------------------------------------------------------------------------- /pollform/questionpoll/urls.py: -------------------------------------------------------------------------------- 1 | """questionpoll URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from django.conf import settings 19 | from django.conf.urls.static import static 20 | from pollapp import views 21 | 22 | urlpatterns = [ 23 | path('admin/', admin.site.urls), 24 | path('', views.pollpage,name='poll'), 25 | ]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) 26 | -------------------------------------------------------------------------------- /pollform/questionpoll/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for questionpoll project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/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', 'questionpoll.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /pollform/readme.txt: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /pollform/static/css/page.css: -------------------------------------------------------------------------------- 1 | .inputGroup { 2 | background-color: #fff; 3 | display: block; 4 | margin: 10px 0; 5 | position: relative; 6 | 7 | label { 8 | padding: 12px 30px; 9 | width: 100%; 10 | display: block; 11 | text-align: left; 12 | color: #3C454C; 13 | cursor: pointer; 14 | position: relative; 15 | z-index: 2; 16 | transition: color 200ms ease-in; 17 | overflow: hidden; 18 | 19 | &:before { 20 | width: 10px; 21 | height: 10px; 22 | border-radius: 50%; 23 | content: ''; 24 | background-color: #5562eb; 25 | position: absolute; 26 | left: 50%; 27 | top: 50%; 28 | transform: translate(-50%, -50%) scale3d(1, 1, 1); 29 | transition: all 300ms cubic-bezier(0.4, 0.0, 0.2, 1); 30 | opacity: 0; 31 | z-index: -1; 32 | } 33 | 34 | &:after { 35 | width: 32px; 36 | height: 32px; 37 | content: ''; 38 | border: 2px solid #D1D7DC; 39 | background-color: #fff; 40 | background-image: url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.414 11L4 12.414l5.414 5.414L20.828 6.414 19.414 5l-10 10z' fill='%23fff' fill-rule='nonzero'/%3E%3C/svg%3E "); 41 | background-repeat: no-repeat; 42 | background-position: 2px 3px; 43 | border-radius: 50%; 44 | z-index: 2; 45 | position: absolute; 46 | right: 30px; 47 | top: 50%; 48 | transform: translateY(-50%); 49 | cursor: pointer; 50 | transition: all 200ms ease-in; 51 | } 52 | } 53 | 54 | input:checked ~ label { 55 | color: #fff; 56 | 57 | &:before { 58 | transform: translate(-50%, -50%) scale3d(56, 56, 1); 59 | opacity: 1; 60 | } 61 | 62 | &:after { 63 | background-color: #54E0C7; 64 | border-color: #54E0C7; 65 | } 66 | } 67 | 68 | input { 69 | width: 32px; 70 | height: 32px; 71 | order: 1; 72 | z-index: 2; 73 | position: absolute; 74 | right: 30px; 75 | top: 50%; 76 | transform: translateY(-50%); 77 | cursor: pointer; 78 | visibility: hidden; 79 | } 80 | } 81 | 82 | 83 | // codepen formatting 84 | .form { 85 | padding: 0 16px; 86 | max-width: 550px; 87 | margin: 50px auto; 88 | font-size: 18px; 89 | font-weight: 600; 90 | line-height: 36px; 91 | } 92 | 93 | body { 94 | background-color: #D1D7DC; 95 | font-family: 'Fira Sans', sans-serif; 96 | } 97 | 98 | *, 99 | *::before, 100 | *::after { 101 | box-sizing: inherit; 102 | } 103 | 104 | html { 105 | box-sizing: border-box; 106 | } 107 | 108 | code { 109 | background-color: #9AA3AC; 110 | padding: 0 8px; 111 | } -------------------------------------------------------------------------------- /pollform/static/css/readme.txt: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /pollform/static/readme.txt: -------------------------------------------------------------------------------- 1 | erterre 2 | -------------------------------------------------------------------------------- /pollform/templates/poll.html: -------------------------------------------------------------------------------- 1 | 2 | {% load staticfiles %} 3 | 4 | 12 | 13 | Poll 14 | 15 | 16 | 17 |
18 | 21 |
22 | {% csrf_token %} 23 | 24 | {{form.as_p}} 25 | 26 | 27 |
28 |
29 | 30 | -------------------------------------------------------------------------------- /pollform/templates/readme.txt: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /problemmanagement/Users/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import information 3 | 4 | admin.site.register(information) 5 | -------------------------------------------------------------------------------- /problemmanagement/Users/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class UsersConfig(AppConfig): 5 | name = 'users' 6 | -------------------------------------------------------------------------------- /problemmanagement/Users/filters.py: -------------------------------------------------------------------------------- 1 | from .models import information 2 | import django_filters 3 | 4 | class UserFilter(django_filters.FilterSet): 5 | class Meta: 6 | model = information 7 | fields = ['id', 'name', 'room','floor','date','time','branch','status' ] -------------------------------------------------------------------------------- /problemmanagement/Users/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import information 3 | 4 | class problemform(forms.ModelForm): 5 | class Meta: 6 | model = information 7 | fields = '__all__' -------------------------------------------------------------------------------- /problemmanagement/Users/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | class information(models.Model): 4 | s_choice=( 5 | ('Pending','Pending'), 6 | ('In progress','In progress'), 7 | ('Done','Done') 8 | ) 9 | id = models.AutoField(primary_key=True) 10 | name=models.CharField(max_length=30) 11 | room=models.IntegerField() 12 | floor=models.IntegerField() 13 | branch=models.CharField(max_length=30) 14 | date=models.DateField() 15 | time=models.TimeField() 16 | status=models.CharField(max_length=30,choices=s_choice) 17 | 18 | 19 | 20 | def __str__(self): 21 | return self.name 22 | 23 | 24 | -------------------------------------------------------------------------------- /problemmanagement/Users/readme: -------------------------------------------------------------------------------- 1 | This is users file 2 | -------------------------------------------------------------------------------- /problemmanagement/Users/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /problemmanagement/Users/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,redirect 2 | from django.views.generic import TemplateView 3 | from .models import information 4 | from .forms import problemform 5 | from django.db.models import Q 6 | from .filters import UserFilter 7 | 8 | 9 | def indexpage(request): 10 | if request.method == 'POST': 11 | form = problemform(request.POST) 12 | if form.is_valid(): 13 | form.save() 14 | return redirect(search) 15 | else: 16 | form = problemform() 17 | return render(request,'user.html',{'form':form}) 18 | 19 | return render(req,'user.html') 20 | 21 | #def newpage(request): 22 | # data = information.objects.all() 23 | # return render(request,'new.html',{'data': data}) 24 | 25 | def search(request): 26 | user_list = information.objects.all() 27 | user_filter = UserFilter(request.GET, queryset=user_list) 28 | 29 | return render(request, 'search.html', {'filter': user_filter}) 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /problemmanagement/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2 on 2019-11-02 08:24 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='information', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=30)), 19 | ('room', models.IntegerField(max_length=10)), 20 | ('floor', models.IntegerField(max_length=10)), 21 | ('branch1', models.CharField(max_length=30)), 22 | ('date', models.DateField()), 23 | ('time', models.TimeField()), 24 | ('status', models.CharField(max_length=30)), 25 | ], 26 | ), 27 | ] 28 | -------------------------------------------------------------------------------- /problemmanagement/migrations/0002_auto_20191102_1357.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2 on 2019-11-02 08:27 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('users', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='information', 15 | name='floor', 16 | field=models.IntegerField(), 17 | ), 18 | migrations.AlterField( 19 | model_name='information', 20 | name='room', 21 | field=models.IntegerField(), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /problemmanagement/migrations/0003_auto_20191104_1418.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2 on 2019-11-04 08:48 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('users', '0002_auto_20191102_1357'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='information', 15 | name='id', 16 | field=models.AutoField(primary_key=True, serialize=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /problemmanagement/migrations/0004_auto_20191104_1441.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2 on 2019-11-04 09:11 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('users', '0003_auto_20191104_1418'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='information', 15 | old_name='branch1', 16 | new_name='branch', 17 | ), 18 | migrations.AlterField( 19 | model_name='information', 20 | name='status', 21 | field=models.CharField(choices=[('Pending', 'Pending'), ('In progress', 'In progress'), ('Done', 'Done')], max_length=30), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /problemmanagement/migrations/readme: -------------------------------------------------------------------------------- 1 | This is migration folder. 2 | -------------------------------------------------------------------------------- /problemmanagement/problemmanagement/readme: -------------------------------------------------------------------------------- 1 | This is pronlem management 2 | -------------------------------------------------------------------------------- /problemmanagement/problemmanagement/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for problemmangment project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '5%py&63iis(+=64p8+whs0^e5^%v^of7pn#2nwts47iwv#@&t*' 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 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'users', 41 | 'django_filters', 42 | 'bootstrapform', 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 = 'problemmangment.urls' 56 | 57 | TEMPLATES = [ 58 | { 59 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 60 | 'DIRS': [], 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 = 'problemmangment.wsgi.application' 74 | 75 | 76 | # Database 77 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 78 | 79 | DATABASES = { 80 | 'default': { 81 | 'ENGINE': 'django.db.backends.sqlite3', 82 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 83 | } 84 | } 85 | 86 | 87 | # Password validation 88 | # https://docs.djangoproject.com/en/2.2/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/2.2/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/2.2/howto/static-files/ 122 | 123 | STATIC_URL = '/static/' 124 | -------------------------------------------------------------------------------- /problemmanagement/problemmanagement/urls.py: -------------------------------------------------------------------------------- 1 | """problemmangment URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from django.conf.urls import url 19 | 20 | 21 | from users import views 22 | urlpatterns = [ 23 | 24 | path('admin/', admin.site.urls), 25 | path('',views.indexpage), 26 | path('new/',views.newpage), 27 | path('search/',views.search), 28 | ] 29 | 30 | -------------------------------------------------------------------------------- /problemmanagement/problemmanagement/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for problemmangment project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/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', 'problemmangment.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /problemmanagement/readme: -------------------------------------------------------------------------------- 1 | This all about the pronlem management,it contains all the files like templates,user etc. 2 | -------------------------------------------------------------------------------- /problemmanagement/templates/new.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | {% for a in data %} 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | {% endfor %} 39 | 40 | 41 |
Serial No.NameRoomFloorBranchDateTimeStatus
{{a.id}}{{a.name}}{{a.room}}{{a.floor}}{{a.branch}}{{a.date}}{{a.time}}{{a.status}}
42 | 43 | 44 | -------------------------------------------------------------------------------- /problemmanagement/templates/readme: -------------------------------------------------------------------------------- 1 | This is the tempalte folder 2 | -------------------------------------------------------------------------------- /problemmanagement/templates/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {% block content %} 9 | 10 | 11 | 12 |
13 | {{ filter.form.as_p }} 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | {% for user in filter.qs %} 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | {% empty %} 41 | 42 | 43 | 44 | {% endfor %} 45 | 46 |
IdNameRoomFloorDateTimeStatus
{{ user.id }}{{ user.name }}{{ user.room }}{{ user.floor }}{{ user.date }}{{ user.time }}{{ user.status }}
No data
47 | {% endblock %} 48 | 49 | -------------------------------------------------------------------------------- /problemmanagement/templates/user.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | {% csrf_token %} 7 | 8 |
{{ form.as_p}}
9 | 10 | 11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /signup/Readme: -------------------------------------------------------------------------------- 1 | this is the main project of django singup form without custom design 2 | 3 | Create project by using following commands 4 | 1. django-admin startproject signup 5 | 2. cd signup 6 | 3. python manage.py startapp myapp 7 | 4. python manage.py runserver 8 | 9 | Please do not forget to use following commands 10 | 1. python manage.py makemigrations 11 | 2. python migrate 12 | 3. python create superuser 13 | 4. username = 'admin' # You can name it of your choice 14 | 5. email = leave it blank 15 | 6. password = 1234 # You can create it of your choice 16 | 7. password = 1234 17 | 8. press Y for yes and runserver again 18 | 9. python manage.py runserver 19 | -------------------------------------------------------------------------------- /signup/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/signup/db.sqlite3 -------------------------------------------------------------------------------- /signup/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 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'signup.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /signup/myapp/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/signup/myapp/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /signup/myapp/__pycache__/admin.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/signup/myapp/__pycache__/admin.cpython-37.pyc -------------------------------------------------------------------------------- /signup/myapp/__pycache__/forms.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/signup/myapp/__pycache__/forms.cpython-37.pyc -------------------------------------------------------------------------------- /signup/myapp/__pycache__/models.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/signup/myapp/__pycache__/models.cpython-37.pyc -------------------------------------------------------------------------------- /signup/myapp/__pycache__/readme.txt: -------------------------------------------------------------------------------- 1 | do not edit anything in this file 2 | -------------------------------------------------------------------------------- /signup/myapp/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/signup/myapp/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /signup/myapp/__pycache__/views.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/signup/myapp/__pycache__/views.cpython-37.pyc -------------------------------------------------------------------------------- /signup/myapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /signup/myapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class MyappConfig(AppConfig): 5 | name = 'myapp' 6 | -------------------------------------------------------------------------------- /signup/myapp/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.contrib.auth.forms import UserCreationForm 3 | from django.contrib.auth.models import User 4 | 5 | class SignupUser(UserCreationForm): 6 | first_name = forms.CharField(max_length=100,required = True) 7 | last_name = forms.CharField(max_length=100,required = True) 8 | email = forms.EmailField(max_length=250) 9 | 10 | class Meta: 11 | model = User 12 | fields = ('username','first_name','last_name','email','password1','password2',) 13 | -------------------------------------------------------------------------------- /signup/myapp/migrations/readme.txt: -------------------------------------------------------------------------------- 1 | not editable 2 | -------------------------------------------------------------------------------- /signup/myapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /signup/myapp/readme.txt: -------------------------------------------------------------------------------- 1 | application 2 | -------------------------------------------------------------------------------- /signup/myapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /signup/myapp/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | 4 | urlpatterns = [ 5 | path('Signup/', views.signupform,name='signup'), 6 | path('success/', views.success,name='success'), 7 | ] 8 | -------------------------------------------------------------------------------- /signup/myapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,redirect 2 | from .forms import SignupUser 3 | from django.contrib.auth import authenticate,login 4 | 5 | def signupform(request): 6 | if request.method == 'POST': 7 | form = SignupUser(request.POST or None) 8 | if form.is_valid(): 9 | form.save() 10 | username = form.cleaned_data.get('username') 11 | password = form.cleaned_data.get('password') 12 | user = authenticate(username=username,password=password) 13 | login(request,user) 14 | return redirect(success) 15 | else: 16 | form = SignupUser() 17 | return render(request,'accounts/signup.html',{'form':form}) 18 | 19 | def success(request): 20 | return render(request,'webpages/home.html') 21 | -------------------------------------------------------------------------------- /signup/signup/Readme.txt: -------------------------------------------------------------------------------- 1 | i would recommend to use code from this project instead of downloading it because some of the files from django db are not added by me. You can freely copy and paste this project methods. 2 | -------------------------------------------------------------------------------- /signup/signup/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for signup project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '5np$ykoa)w+#x9gwa&%fv=70!2d7m7+re8jrf&^lvct+x!n9_h' 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 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'myapp', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'signup.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'signup.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | STATICFILES_DIRS = [ 123 | os.path.join(BASE_DIR, "static"), 124 | ] 125 | -------------------------------------------------------------------------------- /signup/signup/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path,include 3 | from django.conf import settings 4 | from django.conf.urls.static import static 5 | 6 | urlpatterns = [ 7 | path('admin/', admin.site.urls), 8 | path('',include('myapp.urls')), 9 | 10 | ]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) 11 | -------------------------------------------------------------------------------- /signup/signup/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for signup project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/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', 'signup.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /signup/templates/readme.txt: -------------------------------------------------------------------------------- 1 | all the html files are in this 2 | -------------------------------------------------------------------------------- /signup/templates/signup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Signup 5 | 6 | 7 |
8 | {% csrf_token%} 9 | {{form.as_p}} 10 | 11 |
12 | 13 | -------------------------------------------------------------------------------- /signup/templates/success.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Success 5 | 6 | 7 |

Signup Succesfull

8 | 9 | -------------------------------------------------------------------------------- /stylish form with db/liveapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import sampledata 3 | 4 | admin.site.register(sampledata) 5 | -------------------------------------------------------------------------------- /stylish form with db/liveapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class LiveappConfig(AppConfig): 5 | name = 'Liveapp' 6 | -------------------------------------------------------------------------------- /stylish form with db/liveapp/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import sampledata 3 | 4 | class formdata(forms.ModelForm): 5 | class Meta: 6 | model = sampledata 7 | fields = '__all__' -------------------------------------------------------------------------------- /stylish form with db/liveapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | CHOICES = [ 4 | ('Ambala','Ambala'), 5 | ('Chandigarh','Chandigarh'), 6 | ('Zirakpur','Zirakpur'), 7 | ] 8 | 9 | class sampledata(models.Model): 10 | 11 | first_name = models.CharField(max_length=20) 12 | last_name = models.CharField(max_length=20) 13 | city = models.CharField(choices=CHOICES,max_length=25,blank = True) 14 | age = models.IntegerField() 15 | email_id = models.EmailField(max_length=70) 16 | contact_num = models.IntegerField() 17 | 18 | 19 | def __str__(self): 20 | return self.first_name 21 | -------------------------------------------------------------------------------- /stylish form with db/liveapp/readme: -------------------------------------------------------------------------------- 1 | sample readme 2 | -------------------------------------------------------------------------------- /stylish form with db/liveapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /stylish form with db/liveapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from .forms import formdata 3 | 4 | 5 | 6 | def base(request): 7 | return render(request,'base.html') 8 | 9 | 10 | def home(request): 11 | return render(request,'home.html') 12 | 13 | 14 | def about(request): 15 | return render(request,'about.html') 16 | 17 | 18 | def contact(request): 19 | return render(request,'contact.html') 20 | 21 | def c(request): 22 | if request.method == 'POST': 23 | form = formdata(request.POST) 24 | if form.is_valid(): 25 | print(form) 26 | form.save(commit=True) 27 | else: 28 | form = formdata() 29 | 30 | return render(request,'forms.html',{'form':form}) 31 | 32 | 33 | # Create your views here. 34 | -------------------------------------------------------------------------------- /stylish form with db/liveproject/readme: -------------------------------------------------------------------------------- 1 | live project read me 2 | -------------------------------------------------------------------------------- /stylish form with db/liveproject/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for Liveproject project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.6. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '&fj55w5(%8l7y42wsvassay@+yp=n9cl=@ksxa5y3xykhxxt0i' 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 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'Liveapp' 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'Liveproject.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'template')], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'Liveproject.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | -------------------------------------------------------------------------------- /stylish form with db/liveproject/urls.py: -------------------------------------------------------------------------------- 1 | """Liveproject URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from Liveapp import views 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('base/',views.base,name='base'), 23 | path('home/',views.home,name='home'), 24 | path('about/',views.about,name='about'), 25 | path('contact/',views.contact,name='contact'), 26 | path('forms/',views.forms,name='forms') 27 | ] 28 | -------------------------------------------------------------------------------- /stylish form with db/liveproject/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Liveproject project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/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', 'Liveproject.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /stylish form with db/readme: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /stylish form with db/template/about.html: -------------------------------------------------------------------------------- 1 | 2 | {% extends 'base.html'%} 3 | 4 | 5 | {% block content %} 6 | About Work 7 | 8 | 9 |

Welcome to the about Menu

10 | 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /stylish form with db/template/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 72 | 73 | 74 | 75 | 87 | {% block content %} 88 | 89 | {% endblock %} 90 | 91 | 92 | -------------------------------------------------------------------------------- /stylish form with db/template/contact.html: -------------------------------------------------------------------------------- 1 | 2 | {% extends 'base.html'%} 3 | 4 | 5 | {% block content %} 6 | Contact Menu 7 | 8 | 9 |

Welcome to the Contact Menu

10 | 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /stylish form with db/template/forms.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 84 | 85 | 86 | Index 87 | 88 | 89 | 90 | 91 |
92 |
Provide your information
93 |
94 | {% csrf_token %} 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 106 | 107 | 108 | 109 | 114 | 115 | 116 |
117 | 118 | 119 | 120 |
121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /stylish form with db/template/home.html: -------------------------------------------------------------------------------- 1 | 2 | {% extends 'base.html'%} 3 | 4 | 5 | {% block content%} 6 | Home Work 7 | 8 | 9 |

Welcom to home Menu

10 | 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /stylish form with db/template/indian.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maskottchentech/Django/083844984d410076de404661540eb0c0f9cf3c6c/stylish form with db/template/indian.jpg -------------------------------------------------------------------------------- /stylish form with db/template/readme: -------------------------------------------------------------------------------- 1 | template readme 2 | -------------------------------------------------------------------------------- /webscraping/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /webscraping/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | {% csrf_token %} 9 | 10 | 11 | 12 |
13 | {% for i in value%} 14 | 15 | {% endfor %} 16 | 17 | 18 | -------------------------------------------------------------------------------- /webscraping/templates/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /webscraping/webapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /webscraping/webapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class WebappConfig(AppConfig): 5 | name = 'webapp' 6 | -------------------------------------------------------------------------------- /webscraping/webapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /webscraping/webapp/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /webscraping/webapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /webscraping/webapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | import requests 3 | import bs4 4 | 5 | def index(request): 6 | value = [] 7 | if request.method == 'POST': 8 | form = request.POST['your_url'] 9 | resp = requests.get(form) 10 | scrapval = bs4.BeautifulSoup(resp.text,"html.parser") 11 | for data in scrapval.find_all('img'): 12 | srcval = data.get('src') 13 | print(srcval) 14 | value.append(srcval) 15 | 16 | return render(request,'index.html',{'value':value}) 17 | 18 | 19 | -------------------------------------------------------------------------------- /webscraping/webscrap/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for webscrap 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', 'webscrap.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /webscraping/webscrap/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /webscraping/webscrap/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for webscrap project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.1. 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(strict=True).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 = '6-ay$c55ro@e9$n^u5l#j*f^agx2y1hfw0w^()#!(4unhpbb1_' 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 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'webapp' 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'webscrap.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [BASE_DIR / 'templates'], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'webscrap.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/3.1/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': BASE_DIR / 'db.sqlite3', 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/3.1/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/3.1/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | -------------------------------------------------------------------------------- /webscraping/webscrap/urls.py: -------------------------------------------------------------------------------- 1 | """webscrap 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.urls import path 18 | from webapp import views 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('', views.index), 23 | ] 24 | -------------------------------------------------------------------------------- /webscraping/webscrap/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for webscrap 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', 'webscrap.settings') 15 | 16 | application = get_wsgi_application() 17 | --------------------------------------------------------------------------------