commit 6ab1ac1452eaf16a03c5abcee66d270ddcec2210 Author: Siddharth Date: Fri Oct 28 14:48:04 2022 +0530 initial commit diff --git a/Hello/__init__.py b/Hello/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Hello/__pycache__/__init__.cpython-310.pyc b/Hello/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..829fe0b Binary files /dev/null and b/Hello/__pycache__/__init__.cpython-310.pyc differ diff --git a/Hello/__pycache__/__init__.cpython-39.pyc b/Hello/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000..c960b65 Binary files /dev/null and b/Hello/__pycache__/__init__.cpython-39.pyc differ diff --git a/Hello/__pycache__/settings.cpython-310.pyc b/Hello/__pycache__/settings.cpython-310.pyc new file mode 100644 index 0000000..eb3ecfe Binary files /dev/null and b/Hello/__pycache__/settings.cpython-310.pyc differ diff --git a/Hello/__pycache__/settings.cpython-39.pyc b/Hello/__pycache__/settings.cpython-39.pyc new file mode 100644 index 0000000..c943a2c Binary files /dev/null and b/Hello/__pycache__/settings.cpython-39.pyc differ diff --git a/Hello/__pycache__/urls.cpython-310.pyc b/Hello/__pycache__/urls.cpython-310.pyc new file mode 100644 index 0000000..07c95e9 Binary files /dev/null and b/Hello/__pycache__/urls.cpython-310.pyc differ diff --git a/Hello/__pycache__/urls.cpython-39.pyc b/Hello/__pycache__/urls.cpython-39.pyc new file mode 100644 index 0000000..6b5f66a Binary files /dev/null and b/Hello/__pycache__/urls.cpython-39.pyc differ diff --git a/Hello/__pycache__/wsgi.cpython-310.pyc b/Hello/__pycache__/wsgi.cpython-310.pyc new file mode 100644 index 0000000..bc09766 Binary files /dev/null and b/Hello/__pycache__/wsgi.cpython-310.pyc differ diff --git a/Hello/__pycache__/wsgi.cpython-39.pyc b/Hello/__pycache__/wsgi.cpython-39.pyc new file mode 100644 index 0000000..831c2ad Binary files /dev/null and b/Hello/__pycache__/wsgi.cpython-39.pyc differ diff --git a/Hello/asgi.py b/Hello/asgi.py new file mode 100644 index 0000000..d2139c7 --- /dev/null +++ b/Hello/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for Hello project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Hello.settings') + +application = get_asgi_application() diff --git a/Hello/settings.py b/Hello/settings.py new file mode 100644 index 0000000..df3c499 --- /dev/null +++ b/Hello/settings.py @@ -0,0 +1,141 @@ +""" +Django settings for Hello project. + +Generated by 'django-admin startproject' using Django 4.0.6. + +For more information on this file, see +https://docs.djangoproject.com/en/4.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.0/ref/settings/ +""" + +from pathlib import Path +import os #manual + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-+a2^9tz2x4lv$-p@ya%ekby8v7v13@^j6%o(226-t^$bk-ah=t' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'jazzmin', #manually added + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'Info' +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'Hello.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'Hello.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/4.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'mydatabase', + 'USER': 'root', + 'PASSWORD': '1234', + 'HOST': 'localhost', # Or an IP Address that your DB is hosted on + 'PORT': '3306', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/4.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.0/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +#Manually added everything below +# EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" +# EMAIL_USE_TLS = True +# EMAIL_HOST = "smtp.gmail.com" +# EMAIL_PORT = 25 +# EMAIL_HOST_USER = os.environ.get("EMAIL_USER") +# EMAIL_HOST_PASSWORD = os.environ.get("EMAIL_PASSWORD") +# DEFAULT_FROM_EMAIL = EMAIL_HOST_USER + + diff --git a/Hello/test.py b/Hello/test.py new file mode 100644 index 0000000..6e8c7ff --- /dev/null +++ b/Hello/test.py @@ -0,0 +1,4 @@ +from django.core.mail import EmailMessage +email = EmailMessage('Subject here', 'Here is the message.',['siddharthsrivastava77@gmail.com']) +email.send() + diff --git a/Hello/urls.py b/Hello/urls.py new file mode 100644 index 0000000..5d2a796 --- /dev/null +++ b/Hello/urls.py @@ -0,0 +1,33 @@ +"""Hello URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path, include #include manually added +from django.contrib.auth import views as auth_views #Manually added +# from Info import views #Manually added + +#Manually added (20,21,22) +admin.site.site_header = "UMSRA Admin" +admin.site.site_title = "UMSRA Admin Portal" +admin.site.index_title = "Welcome to UMSRA Researcher Portal" + +urlpatterns = [ + #Everything below is manually added + path('admin/password_reset/', auth_views.PasswordResetView.as_view(), name='admin_password_reset'), + path('admin/password_reset/done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'), + path('reset///', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'), + path('reset/done/', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'), + path('admin/', admin.site.urls) +] diff --git a/Hello/wsgi.py b/Hello/wsgi.py new file mode 100644 index 0000000..76b6d76 --- /dev/null +++ b/Hello/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for Hello project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Hello.settings') + +application = get_wsgi_application() diff --git a/Info/__init__.py b/Info/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Info/__pycache__/__init__.cpython-39.pyc b/Info/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000..e902dd5 Binary files /dev/null and b/Info/__pycache__/__init__.cpython-39.pyc differ diff --git a/Info/__pycache__/admin.cpython-39.pyc b/Info/__pycache__/admin.cpython-39.pyc new file mode 100644 index 0000000..c3700d1 Binary files /dev/null and b/Info/__pycache__/admin.cpython-39.pyc differ diff --git a/Info/__pycache__/apps.cpython-39.pyc b/Info/__pycache__/apps.cpython-39.pyc new file mode 100644 index 0000000..078a638 Binary files /dev/null and b/Info/__pycache__/apps.cpython-39.pyc differ diff --git a/Info/__pycache__/models.cpython-39.pyc b/Info/__pycache__/models.cpython-39.pyc new file mode 100644 index 0000000..50d1e81 Binary files /dev/null and b/Info/__pycache__/models.cpython-39.pyc differ diff --git a/Info/__pycache__/views.cpython-39.pyc b/Info/__pycache__/views.cpython-39.pyc new file mode 100644 index 0000000..a826da9 Binary files /dev/null and b/Info/__pycache__/views.cpython-39.pyc differ diff --git a/Info/admin.py b/Info/admin.py new file mode 100644 index 0000000..be3e72e --- /dev/null +++ b/Info/admin.py @@ -0,0 +1,15 @@ +from django.contrib import admin +from django.contrib.auth.models import Group, User +from .models import UserDeviceInformation + + +# Register your models here. + +class UserDeviceInformationAdmin(admin.ModelAdmin): + list_display = ('device', 'browser', 'date', 'session_id') + list_display_links = None + + +admin.site.register(UserDeviceInformation, UserDeviceInformationAdmin) +admin.site.unregister(Group) +admin.site.unregister(User) \ No newline at end of file diff --git a/Info/apps.py b/Info/apps.py new file mode 100644 index 0000000..ad2ead8 --- /dev/null +++ b/Info/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class InfoConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "Info" + verbose_name = "" diff --git a/Info/migrations/__init__.py b/Info/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Info/migrations/__pycache__/__init__.cpython-39.pyc b/Info/migrations/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000..662898f Binary files /dev/null and b/Info/migrations/__pycache__/__init__.cpython-39.pyc differ diff --git a/Info/models.py b/Info/models.py new file mode 100644 index 0000000..38cdf49 --- /dev/null +++ b/Info/models.py @@ -0,0 +1,24 @@ +from django.db import models + +# Create your models here. +# This is an auto-generated Django model module. +# You'll have to do the following manually to clean this up: +# * Rearrange models' order +# * Make sure each model has one field with primary_key=True +# * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior +# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table +# Feel free to rename the models, but don't rename db_table values or field names. +from django.db import models + + +class UserDeviceInformation(models.Model): + device = models.CharField(db_column='Device', max_length=255, blank=True, null=True) # Field name made lowercase. + browser = models.CharField(db_column='Browser', max_length=255, blank=True, null=True) # Field name made lowercase. + date = models.CharField(db_column='Date', max_length=255, blank=True, null=True) # Field name made lowercase. + session_id = models.CharField(db_column='Session_ID', max_length=255, blank=True, primary_key=True) # Field name made lowercase. + + class Meta: + managed = False + db_table = 'user_device_information' + verbose_name_plural = "User Information" + ordering = ['date'] \ No newline at end of file diff --git a/Info/tests.py b/Info/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/Info/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/Info/views.py b/Info/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/Info/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000..47ff37c Binary files /dev/null and b/db.sqlite3 differ diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..b9e9897 --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Hello.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main()