Made a lot of changes
`Fix` pdf generator, remove junk files, clean code, and many more...
This commit is contained in:
parent
cb739c7cab
commit
905cbbaa46
6
.gitignore
vendored
6
.gitignore
vendored
@ -131,6 +131,8 @@ dmypy.json
|
|||||||
# Custome
|
# Custome
|
||||||
datadump.json
|
datadump.json
|
||||||
local_note.txt
|
local_note.txt
|
||||||
|
|
||||||
docs/
|
docs/
|
||||||
media/
|
media/course_files/
|
||||||
|
media/course_videos/
|
||||||
|
media/profile_pictures/
|
||||||
|
media/uploads/
|
||||||
@ -14,6 +14,7 @@ import os
|
|||||||
import posixpath
|
import posixpath
|
||||||
import environ
|
import environ
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
env = environ.Env()
|
env = environ.Env()
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
@ -35,7 +36,7 @@ AUTH_USER_MODEL = 'accounts.User'
|
|||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
DJANGO_APPS = [
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
@ -46,24 +47,26 @@ INSTALLED_APPS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Thired party apps
|
# Thired party apps
|
||||||
INSTALLED_APPS += [
|
THIRED_PARTY_APPS = [
|
||||||
'crispy_forms',
|
'crispy_forms',
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'channels',
|
'channels',
|
||||||
]
|
]
|
||||||
|
|
||||||
# Custom apps
|
# Custom apps
|
||||||
INSTALLED_APPS += [
|
PROJECT_APPS = [
|
||||||
'app.apps.AppConfig',
|
'app.apps.AppConfig',
|
||||||
'accounts.apps.AccountsConfig',
|
'accounts.apps.AccountsConfig',
|
||||||
'coursemanagement',
|
|
||||||
'course.apps.CourseConfig',
|
'course.apps.CourseConfig',
|
||||||
'result.apps.ResultConfig',
|
'result.apps.ResultConfig',
|
||||||
'search.apps.SearchConfig',
|
'search.apps.SearchConfig',
|
||||||
'quiz.apps.QuizConfig',
|
'quiz.apps.QuizConfig',
|
||||||
'payments',
|
'payments.apps.PaymentsConfig',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Combine all apps
|
||||||
|
INSTALLED_APPS = DJANGO_APPS + THIRED_PARTY_APPS + PROJECT_APPS
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
@ -113,7 +116,8 @@ ASGI_APPLICATION = "SMS.asgi.application"
|
|||||||
# }
|
# }
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Some model fields may not work on sqlite db, so configure your postgresql
|
# NOTE: Some model fields may not work on sqlite db,
|
||||||
|
# so consider using postgresql instead
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
@ -173,18 +177,23 @@ STATIC_ROOT = posixpath.join(*(BASE_DIR.split(os.path.sep) + ['staticfiles']))
|
|||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||||
|
|
||||||
|
# -----------------------------------
|
||||||
|
# E-mail configuration
|
||||||
|
|
||||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||||
EMAIL_HOST = 'smtp.gmail.com' # Here i'm using gmail as the email host, but you can change it
|
EMAIL_HOST = 'smtp.gmail.com' # Here i'm using gmail as the email host, but you can change it
|
||||||
EMAIL_PORT = 587
|
EMAIL_PORT = 587
|
||||||
EMAIL_USE_TLS = True
|
EMAIL_USE_TLS = True
|
||||||
EMAIL_HOST_USER = os.environ.get('USER_EMAIL')
|
EMAIL_HOST_USER = env('USER_EMAIL')
|
||||||
EMAIL_HOST_PASSWORD = os.environ.get('USER_PASSWORD')
|
EMAIL_HOST_PASSWORD = env('USER_PASSWORD')
|
||||||
|
|
||||||
|
# crispy config
|
||||||
CRISPY_TEMPLATE_PACK = 'bootstrap4'
|
CRISPY_TEMPLATE_PACK = 'bootstrap4'
|
||||||
|
|
||||||
LOGIN_REDIRECT_URL = '/'
|
LOGIN_REDIRECT_URL = '/'
|
||||||
LOGOUT_REDIRECT_URL = '/'
|
LOGOUT_REDIRECT_URL = '/'
|
||||||
|
|
||||||
|
# DRF setup
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
'DEFAULT_PERMISSION_CLASSES': [
|
'DEFAULT_PERMISSION_CLASSES': [
|
||||||
'rest_framework.permissions.IsAuthenticated',
|
'rest_framework.permissions.IsAuthenticated',
|
||||||
@ -195,6 +204,6 @@ REST_FRAMEWORK = {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Strip payment config
|
||||||
STRIPE_SECRET_KEY = os.environ.get('STRIPE_SECRET_KEY')
|
STRIPE_SECRET_KEY = env('STRIPE_SECRET_KEY')
|
||||||
STRIPE_PUBLISHABLE_KEY = os.environ.get('STRIPE_PUBLISHABLE_KEY')
|
STRIPE_PUBLISHABLE_KEY = env('STRIPE_PUBLISHABLE_KEY')
|
||||||
|
|||||||
@ -6,7 +6,6 @@ from django.db import migrations, models
|
|||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('coursemanagement', '0002_coursesetting'),
|
|
||||||
('course', '0004_auto_20200822_2238'),
|
('course', '0004_auto_20200822_2238'),
|
||||||
('accounts', '0011_auto_20210823_0825'),
|
('accounts', '0011_auto_20210823_0825'),
|
||||||
]
|
]
|
||||||
|
|||||||
17
accounts/migrations/0014_alter_user_managers.py
Normal file
17
accounts/migrations/0014_alter_user_managers.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 4.1.6 on 2023-05-14 08:05
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("accounts", "0013_alter_departmenthead_id_alter_parent_id_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelManagers(
|
||||||
|
name="user",
|
||||||
|
managers=[],
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -1,6 +1,6 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.contrib.auth.models import AbstractUser
|
from django.contrib.auth.models import AbstractUser, UserManager
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
@ -9,7 +9,6 @@ from PIL import Image
|
|||||||
from course.models import Program
|
from course.models import Program
|
||||||
from .validators import ASCIIUsernameValidator
|
from .validators import ASCIIUsernameValidator
|
||||||
|
|
||||||
User = settings.AUTH_USER_MODEL
|
|
||||||
|
|
||||||
# LEVEL_COURSE = "Level course"
|
# LEVEL_COURSE = "Level course"
|
||||||
BACHLOAR_DEGREE = "Bachloar"
|
BACHLOAR_DEGREE = "Bachloar"
|
||||||
@ -39,17 +38,17 @@ RELATION_SHIP = (
|
|||||||
(OTHER, "Other"),
|
(OTHER, "Other"),
|
||||||
)
|
)
|
||||||
|
|
||||||
# class UserManager(models.Manager):
|
class UserManager(UserManager):
|
||||||
# def search(self, query=None):
|
def search(self, query=None):
|
||||||
# qs = self.get_queryset()
|
qs = self.get_queryset()
|
||||||
# if query is not None:
|
if query is not None:
|
||||||
# or_lookup = (Q(username__icontains=query) |
|
or_lookup = (Q(username__icontains=query) |
|
||||||
# Q(first_name__icontains=query)|
|
Q(first_name__icontains=query)|
|
||||||
# Q(last_name__icontains=query)|
|
Q(last_name__icontains=query)|
|
||||||
# Q(email__icontains=query)
|
Q(email__icontains=query)
|
||||||
# )
|
)
|
||||||
# qs = qs.filter(or_lookup).distinct() # distinct() is often necessary with Q lookups
|
qs = qs.filter(or_lookup).distinct() # distinct() is often necessary with Q lookups
|
||||||
# return qs
|
return qs
|
||||||
|
|
||||||
|
|
||||||
class User(AbstractUser):
|
class User(AbstractUser):
|
||||||
@ -64,7 +63,7 @@ class User(AbstractUser):
|
|||||||
|
|
||||||
username_validator = ASCIIUsernameValidator()
|
username_validator = ASCIIUsernameValidator()
|
||||||
|
|
||||||
# objects = UserManager()
|
objects = UserManager()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def get_full_name(self):
|
def get_full_name(self):
|
||||||
|
|||||||
@ -1,19 +1,12 @@
|
|||||||
from django.shortcuts import render, redirect, get_object_or_404
|
from django.shortcuts import render, redirect, get_object_or_404
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.http import HttpResponseRedirect
|
|
||||||
from django.urls import reverse_lazy
|
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib.auth import update_session_auth_hash
|
|
||||||
from django.views.generic import CreateView, ListView
|
|
||||||
from django.core.paginator import Paginator
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.decorators import method_decorator
|
|
||||||
|
|
||||||
from accounts.decorators import lecturer_required, student_required
|
from accounts.decorators import lecturer_required
|
||||||
from .forms import SessionForm, SemesterForm, NewsAndEventsForm
|
from .forms import SessionForm, SemesterForm, NewsAndEventsForm
|
||||||
from .models import *
|
from .models import *
|
||||||
|
|
||||||
User = settings.AUTH_USER_MODEL
|
|
||||||
|
|
||||||
# ########################################################
|
# ########################################################
|
||||||
# News & Events
|
# News & Events
|
||||||
|
|||||||
36
course/migrations/0006_courseoffer.py
Normal file
36
course/migrations/0006_courseoffer.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Generated by Django 4.1.6 on 2023-05-14 08:05
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("accounts", "0014_alter_user_managers"),
|
||||||
|
("course", "0005_alter_course_id_alter_courseallocation_id_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="CourseOffer",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"dep_head",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="accounts.departmenthead",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -3,13 +3,11 @@ from django.urls import reverse
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.validators import FileExtensionValidator
|
from django.core.validators import FileExtensionValidator
|
||||||
from django.db.models.signals import pre_save
|
from django.db.models.signals import pre_save
|
||||||
|
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from app.models import Session
|
# project import
|
||||||
from .utils import *
|
from .utils import *
|
||||||
|
|
||||||
User = settings.AUTH_USER_MODEL
|
|
||||||
|
|
||||||
YEARS = (
|
YEARS = (
|
||||||
(1, '1'),
|
(1, '1'),
|
||||||
@ -117,9 +115,9 @@ pre_save.connect(course_pre_save_receiver, sender=Course)
|
|||||||
|
|
||||||
|
|
||||||
class CourseAllocation(models.Model):
|
class CourseAllocation(models.Model):
|
||||||
lecturer = models.ForeignKey(User, on_delete=models.CASCADE, related_name='allocated_lecturer')
|
lecturer = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='allocated_lecturer')
|
||||||
courses = models.ManyToManyField(Course, related_name='allocated_course')
|
courses = models.ManyToManyField(Course, related_name='allocated_course')
|
||||||
session = models.ForeignKey(Session, on_delete=models.CASCADE, blank=True, null=True)
|
session = models.ForeignKey("app.Session", on_delete=models.CASCADE, blank=True, null=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.lecturer.get_full_name
|
return self.lecturer.get_full_name
|
||||||
@ -182,3 +180,11 @@ def video_pre_save_receiver(sender, instance, *args, **kwargs):
|
|||||||
instance.slug = unique_slug_generator(instance)
|
instance.slug = unique_slug_generator(instance)
|
||||||
|
|
||||||
pre_save.connect(video_pre_save_receiver, sender=UploadVideo)
|
pre_save.connect(video_pre_save_receiver, sender=UploadVideo)
|
||||||
|
|
||||||
|
|
||||||
|
class CourseOffer(models.Model):
|
||||||
|
"""NOTE: Only department head can offer semester courses"""
|
||||||
|
dep_head = models.ForeignKey("accounts.DepartmentHead", on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "{}".format(self.dep_head)
|
||||||
|
|||||||
@ -17,7 +17,6 @@ from .forms import (
|
|||||||
EditCourseAllocationForm, UploadFormFile, UploadFormVideo
|
EditCourseAllocationForm, UploadFormFile, UploadFormVideo
|
||||||
)
|
)
|
||||||
from .models import Program, Course, CourseAllocation, Upload, UploadVideo
|
from .models import Program, Course, CourseAllocation, Upload, UploadVideo
|
||||||
from coursemanagement.models import CourseSetting
|
|
||||||
|
|
||||||
|
|
||||||
# ########################################################
|
# ########################################################
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
# Register your models here.
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
from django.apps import AppConfig
|
|
||||||
|
|
||||||
|
|
||||||
class CoursemanagementConfig(AppConfig):
|
|
||||||
name = 'coursemanagement'
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
# Generated by Django 3.1.3 on 2021-08-23 05:26
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
initial = True
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('accounts', '0011_auto_20210823_0825'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='CourseOffer',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('dep_head', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accounts.dephead')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
# Generated by Django 3.1.3 on 2021-10-29 22:09
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('coursemanagement', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='CourseSetting',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('add_drop', models.BooleanField(default=False)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
# Generated by Django 4.1.6 on 2023-02-01 12:30
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('coursemanagement', '0002_coursesetting'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='courseoffer',
|
|
||||||
name='id',
|
|
||||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='coursesetting',
|
|
||||||
name='id',
|
|
||||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
from django.db import models
|
|
||||||
from course.models import Course
|
|
||||||
from accounts.models import DepartmentHead
|
|
||||||
|
|
||||||
|
|
||||||
class CourseOffer(models.Model):
|
|
||||||
"""Only department head can offer a course"""
|
|
||||||
dep_head = models.ForeignKey(DepartmentHead, on_delete=models.CASCADE)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return "{}".format(self.dep_head)
|
|
||||||
|
|
||||||
|
|
||||||
class CourseSetting(models.Model):
|
|
||||||
add_drop = models.BooleanField(default=False)
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
from django.shortcuts import render
|
|
||||||
|
|
||||||
# Create your views here.
|
|
||||||
BIN
media/default.png
Normal file
BIN
media/default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
94
media/registration_form/ezod-s-1108.pdf
Normal file
94
media/registration_form/ezod-s-1108.pdf
Normal file
File diff suppressed because one or more lines are too long
94
media/registration_form/student1.pdf
Normal file
94
media/registration_form/student1.pdf
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,94 @@
|
|||||||
|
%PDF-1.4
|
||||||
|
%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com
|
||||||
|
1 0 obj
|
||||||
|
<<
|
||||||
|
/F1 2 0 R /F2 5 0 R
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
2 0 obj
|
||||||
|
<<
|
||||||
|
/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
3 0 obj
|
||||||
|
<<
|
||||||
|
/BitsPerComponent 8 /ColorSpace /DeviceRGB /Filter [ /ASCII85Decode /FlateDecode ] /Height 52 /Length 349 /SMask 4 0 R
|
||||||
|
/Subtype /Image /Type /XObject /Width 46
|
||||||
|
>>
|
||||||
|
stream
|
||||||
|
Gb"/eYn;UB$q5sB'F_ebCqp6K^]GR-!>p?YR\#t:r/2'q//'-R"3LLC"eW&,A0]2563n`fr$lELjqIN<Ma19BIG^*$L1.%H3m4gE1uL(U!M:W/i]1E:Y3U6g*1.U>VJY(?)RE*G%;Tg"009d<`42rSif)X%g]EO*;0^R4ZLggE:%sV-(/i$n6\fk#9q%q^/rkQ\>l5;m-_l.ea704kN(T;sQosQ'TT1Qt;#<FMcI_:2BOhYBJ@<<=o>t%qq&7og8/\CX*36,K6=FlSKI-^$_00D>:9ZP2D:o)\3JPOV),u9fc'!?Z#-TXP0)Nl_B7gX"7PK9aC[JVdjUslc+lk;%!S_7t$3~>endstream
|
||||||
|
endobj
|
||||||
|
4 0 obj
|
||||||
|
<<
|
||||||
|
/BitsPerComponent 8 /ColorSpace /DeviceGray /Decode [ 0 1 ] /Filter [ /ASCII85Decode /FlateDecode ] /Height 52 /Length 322
|
||||||
|
/Subtype /Image /Type /XObject /Width 46
|
||||||
|
>>
|
||||||
|
stream
|
||||||
|
Gb"0PY7?.\'Z]_oJ^)GIYY^-:s%KJU=!280NG#K,=fb*4"1VKj7%,cZO\q'TClH3XUV_[)\D1WR)r[",mkR?h[-\IuSZ70u!2<u<M3TuCG^&%;>c_3Sn#FoBoaHQ"C:3Hr6RW];HaN1Ar3F<><JS@_Qa3!j/6g(eW\?\I._f$@4fU+-fZ?/)]m>T^qT$l$^;ZTk@tR_8$j4GG_4djI%]sVkX'>NE/U#ea><'m31]LeB)rG6Dq,Nc2mCS&uZ-mBV>(n77>q'$oF[4Vf9e@J$>?=M3'_/#3\M94J_(3XK?5s1L`PKK!1YC?g-fg=9q$>Po~>endstream
|
||||||
|
endobj
|
||||||
|
5 0 obj
|
||||||
|
<<
|
||||||
|
/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
6 0 obj
|
||||||
|
<<
|
||||||
|
/Contents 10 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 9 0 R /Resources <<
|
||||||
|
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] /XObject <<
|
||||||
|
/FormXob.ab6576e0909ab2766881c4d5db8bbca8 3 0 R
|
||||||
|
>>
|
||||||
|
>> /Rotate 0 /Trans <<
|
||||||
|
|
||||||
|
>>
|
||||||
|
/Type /Page
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
7 0 obj
|
||||||
|
<<
|
||||||
|
/PageMode /UseNone /Pages 9 0 R /Type /Catalog
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
8 0 obj
|
||||||
|
<<
|
||||||
|
/Author (\(anonymous\)) /CreationDate (D:20200823223010-03'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20200823223010-03'00') /Producer (ReportLab PDF Library - www.reportlab.com)
|
||||||
|
/Subject (\(unspecified\)) /Title (\(anonymous\)) /Trapped /False
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
9 0 obj
|
||||||
|
<<
|
||||||
|
/Count 1 /Kids [ 6 0 R ] /Type /Pages
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
10 0 obj
|
||||||
|
<<
|
||||||
|
/Filter [ /ASCII85Decode /FlateDecode ] /Length 1120
|
||||||
|
>>
|
||||||
|
stream
|
||||||
|
Gb!l]9lo#B&;KZOMETC0;"S<jcHQBRUgkOP9rGI\#p`4l%S`BeVuOJoNJ%Qqd&&r`9G$&dam\X]dYInS+&[MoQN3pD*"N>e$Mb,BN]?)+`-LOF6WT>6U4@c'*/.?A4fNMaHUW`i8/4Z]?,0B/d`SbK*lStB4>?KhiUXPW[%*h!-3>V335f5[UJ_Aoa>KRpo9l&lXpYDcV1-V<Q3ta1pC^a,So6\O$0(MbOI&!UC3'_U7RYG<<6N4Ac_3G58@';AGSFe9S-$YD6Q0Ud6lXJ43.D2/4lf,[gRP2-d]<d#fi4Hp9*=?odi:?lf[Hog`'\5rpF"EHM]mrSq)")['8Qia"D9cNrqUXfG[jX@@%pKE/f6D-I;7,#R6VD>=4CF*g22Gg:#_4REWVN5MQt=]4cT=$aWsKLjN[@$,R]/8CQKO?)F$Nuo=Go*)B8k_QpXZ1cO76ClBk^beUb+Z"%rg3QS4UpLd:D9PBAfG*a?`IN-MDUplOc1g[L+%N$l]9i<>BpTTIpLiA=,6*0&t?@*/PHP`q5*ngJ44A69u>"Iu=9TOg]lYc%,6E\Yk/"$*988/p3RN(3>,W9M2)rI;S^H$Z>0Ib;5u<TWn7#KSA6?CC;;"g::.kJk08`c_Sq6bE(N<7Cnl8TV=d\_<\;dt(8Y]ZS_^c^Z^O2KN0+f1NVOH1u+km$>gJ79M8*hA]._IbSumCGh7tN*Fr]'\,LI/Y*Y8kHK(@c>;@(;3pV;0#Bp)hs,SBc+n-O$*S\g7VAMb<(8[HNCq_j4ZXf$2%=/>7aC;nQuQ\*%PS+ph@CH@!Y"N!9Stb/7LoU&a8V#Og'lVMnGk5#D`>Y]`?ALN'6QN@rV-3)Osp)Q?kLohQ8AAFXc4B(cKKoBN':>oUB=.Rf7:BpG-G5-&(\nU!Z$7n=R8;Wk[-Ka`^RFWLLKpS5LDguj+eUZ_gQp?;nD+,(gSEeq8$'<PIT\5f;+[uWC,?C:DLGF%9LC2%'%47/q8N5AT@;;lM#SUh^bE`mJ9GuPhnIg3[c>28UF0M=#F;.=PeQgNjclWA%K.[gm0'k2pq(.,eLZ?*acYI46SD001G\Z>JM3$djg7?HXRY/=EVi"g:k!/Y<)Z':654*c7cpF%#P~>endstream
|
||||||
|
endobj
|
||||||
|
xref
|
||||||
|
0 11
|
||||||
|
0000000000 65535 f
|
||||||
|
0000000073 00000 n
|
||||||
|
0000000114 00000 n
|
||||||
|
0000000221 00000 n
|
||||||
|
0000000771 00000 n
|
||||||
|
0000001298 00000 n
|
||||||
|
0000001410 00000 n
|
||||||
|
0000001677 00000 n
|
||||||
|
0000001745 00000 n
|
||||||
|
0000002028 00000 n
|
||||||
|
0000002087 00000 n
|
||||||
|
trailer
|
||||||
|
<<
|
||||||
|
/ID
|
||||||
|
[<4145c4eabfd293c394b1524ad5759f15><4145c4eabfd293c394b1524ad5759f15>]
|
||||||
|
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
|
||||||
|
|
||||||
|
/Info 8 0 R
|
||||||
|
/Root 7 0 R
|
||||||
|
/Size 11
|
||||||
|
>>
|
||||||
|
startxref
|
||||||
|
3299
|
||||||
|
%%EOF
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,13 +1,9 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.views import get_user_model
|
from django.conf import settings
|
||||||
from django.contrib.postgres.fields import ArrayField
|
|
||||||
from accounts.models import User
|
|
||||||
|
|
||||||
User = get_user_model()
|
|
||||||
|
|
||||||
|
|
||||||
class Invoice(models.Model):
|
class Invoice(models.Model):
|
||||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
|
||||||
total = models.FloatField(null=True, blank=True)
|
total = models.FloatField(null=True, blank=True)
|
||||||
amount = models.FloatField(null=True, blank=True)
|
amount = models.FloatField(null=True, blank=True)
|
||||||
payment_complete = models.BooleanField(default=False)
|
payment_complete = models.BooleanField(default=False)
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
# Set your secret key. Remember to switch to your live secret key in production.
|
|
||||||
# See your keys here: https://dashboard.stripe.com/account/apikeys
|
|
||||||
stripe.api_key = "sk_test_51IcEVZHbzY4cUA9T3BZdDayN4gmbJyXuaLCzpLT15HZoOmC17G7CxeEdXeIHSWyhYfxpljsclzzjsFukYNqJTbrW00tv3qIbN2"
|
|
||||||
|
|
||||||
intent = stripe.PaymentIntent.create(
|
|
||||||
amount=1099,
|
|
||||||
currency='usd',
|
|
||||||
)
|
|
||||||
@ -3,21 +3,17 @@ from . import views
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.PaymentGetwaysView.as_view(), name='payment_gateways'),
|
path('', views.PaymentGetwaysView.as_view(), name='payment_gateways'),
|
||||||
# path('gateways/', views.payment_gateways, name="gateways"),
|
|
||||||
|
|
||||||
path('paypal/', views.payment_paypal, name="paypal"),
|
path('paypal/', views.payment_paypal, name="paypal"),
|
||||||
path('stripe/', views.payment_stripe, name="stripe"),
|
path('stripe/', views.payment_stripe, name="stripe"),
|
||||||
path('coinbase/', views.payment_coinbase, name="coinbase"),
|
path('coinbase/', views.payment_coinbase, name="coinbase"),
|
||||||
path('paylike/', views.payment_paylike, name="paylike"),
|
path('paylike/', views.payment_paylike, name="paylike"),
|
||||||
|
|
||||||
path('create_invoice/', views.create_invoice, name="create_invoice"),
|
path('stripe-charge/', views.stripe_charge, name='stripe_charge'),
|
||||||
path('invoice_detail/<int:id>/', views.invoice_detail, name="invoice_detail"),
|
path('gopay-charge/', views.gopay_charge, name="gopay_charge"),
|
||||||
|
|
||||||
# path('charge/', views.charge, name="charge"),
|
|
||||||
path('payment-succeed/', views.payment_succeed, name="payment-succeed"),
|
path('payment-succeed/', views.payment_succeed, name="payment-succeed"),
|
||||||
|
|
||||||
path('charge/', views.charge, name='charge'), # new
|
|
||||||
|
|
||||||
path('complete/', views.paymentComplete, name="complete"),
|
path('complete/', views.paymentComplete, name="complete"),
|
||||||
path('gopay_payment/', views.gopay_payment, name="gopay_payment"),
|
path('create-invoice/', views.create_invoice, name="create_invoice"),
|
||||||
|
path('invoice-detail/<int:id>/', views.invoice_detail, name="invoice_detail"),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,26 +1,18 @@
|
|||||||
|
|
||||||
from django.shortcuts import render
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
|
|
||||||
from django.http import JsonResponse
|
|
||||||
from .models import Invoice
|
|
||||||
|
|
||||||
import stripe
|
import stripe
|
||||||
import uuid
|
import uuid
|
||||||
import json
|
import json
|
||||||
|
|
||||||
stripe.api_key = settings.STRIPE_SECRET_KEY
|
from django.shortcuts import render
|
||||||
# stripe.ApplePayDomain.create(
|
from django.http import JsonResponse
|
||||||
# domain_name='example.com',
|
from django.conf import settings
|
||||||
# )
|
from django.shortcuts import redirect
|
||||||
|
from django.views.generic.base import TemplateView
|
||||||
|
|
||||||
# def payment_gateways(request):
|
from django.http import JsonResponse
|
||||||
# print(settings.STRIPE_PUBLISHABLE_KEY)
|
|
||||||
# context = {
|
import gopay
|
||||||
# 'key': settings.STRIPE_PUBLISHABLE_KEY
|
from gopay.enums import Recurrence, PaymentInstrument, BankSwiftCode, Currency, Language
|
||||||
# }
|
from .models import Invoice
|
||||||
# return render(request, 'payments/payment_gateways.html', context)
|
|
||||||
|
|
||||||
|
|
||||||
def payment_paypal(request):
|
def payment_paypal(request):
|
||||||
@ -43,26 +35,10 @@ def payment_succeed(request):
|
|||||||
return render(request, 'payments/payment_succeed.html', context={})
|
return render(request, 'payments/payment_succeed.html', context={})
|
||||||
|
|
||||||
|
|
||||||
# def charge(request):
|
|
||||||
# if request.method == 'POST':
|
|
||||||
# charge = stripe.Charge.create(
|
|
||||||
# amount=500,
|
|
||||||
# currency='eur',
|
|
||||||
# description='Payment GetWays',
|
|
||||||
# source=request.POST['stripeToken']
|
|
||||||
# )
|
|
||||||
# return render(request, 'payments/charge.html')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from django.shortcuts import redirect
|
|
||||||
from django.views.generic.base import TemplateView
|
|
||||||
|
|
||||||
class PaymentGetwaysView(TemplateView):
|
class PaymentGetwaysView(TemplateView):
|
||||||
template_name = 'payments/payment_gateways.html'
|
template_name = 'payments/payment_gateways.html'
|
||||||
|
|
||||||
def get_context_data(self, **kwargs): # new
|
def get_context_data(self, **kwargs):
|
||||||
context = super(PaymentGetwaysView, self).get_context_data(**kwargs)
|
context = super(PaymentGetwaysView, self).get_context_data(**kwargs)
|
||||||
context['key'] = settings.STRIPE_PUBLISHABLE_KEY
|
context['key'] = settings.STRIPE_PUBLISHABLE_KEY
|
||||||
context['amount'] = 500
|
context['amount'] = 500
|
||||||
@ -72,8 +48,9 @@ class PaymentGetwaysView(TemplateView):
|
|||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
def stripe_charge(request):
|
||||||
|
stripe.api_key = settings.STRIPE_SECRET_KEY
|
||||||
|
|
||||||
def charge(request): # new
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
charge = stripe.Charge.create(
|
charge = stripe.Charge.create(
|
||||||
amount=500,
|
amount=500,
|
||||||
@ -90,87 +67,14 @@ def charge(request): # new
|
|||||||
# return render(request, 'payments/charge.html')
|
# return render(request, 'payments/charge.html')
|
||||||
|
|
||||||
|
|
||||||
def create_invoice(request):
|
def gopay_charge(request):
|
||||||
print(request.is_ajax())
|
|
||||||
if request.method == 'POST':
|
|
||||||
invoice = Invoice.objects.create(
|
|
||||||
user = request.user,
|
|
||||||
amount = request.POST.get('amount'),
|
|
||||||
total=26,
|
|
||||||
invoice_code=str(uuid.uuid4()),
|
|
||||||
)
|
|
||||||
request.session['invoice_session'] = invoice.invoice_code
|
|
||||||
return redirect('payment_gateways')
|
|
||||||
# if request.is_ajax():
|
|
||||||
# invoice = Invoice.objects.create(
|
|
||||||
# user = request.user,
|
|
||||||
# amount = 15,
|
|
||||||
# total=26,
|
|
||||||
# )
|
|
||||||
# return JsonResponse({'invoice': invoice}, status=201) # created
|
|
||||||
|
|
||||||
return render(request, 'invoices.html', context={
|
|
||||||
'invoices': Invoice.objects.filter(user=request.user)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
def invoice_detail(request, slug):
|
|
||||||
return render(request, 'invoice_detail.html', context={
|
|
||||||
'invoice': Invoice.objects.get(invoice_code=slug)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
def paymentComplete(request):
|
|
||||||
print(request.is_ajax())
|
|
||||||
if request.is_ajax() or request.method == 'POST':
|
|
||||||
invoice_id = request.session['invoice_session']
|
|
||||||
invoice = Invoice.objects.get(id=invoice_id)
|
|
||||||
invoice.payment_complete = True
|
|
||||||
invoice.save()
|
|
||||||
# return redirect('invoice', invoice.invoice_code)
|
|
||||||
body = json.loads(request.body)
|
|
||||||
print('BODY:', body)
|
|
||||||
return JsonResponse('Payment completed!', safe=False)
|
|
||||||
|
|
||||||
|
|
||||||
from django.http import JsonResponse
|
|
||||||
|
|
||||||
import gopay
|
|
||||||
from gopay.enums import Recurrence, PaymentInstrument, BankSwiftCode, Currency, Language
|
|
||||||
|
|
||||||
|
|
||||||
def gopay_payment(request):
|
|
||||||
print("\nrequest \n", request.method)
|
|
||||||
# api = gopay.payments({
|
|
||||||
# 'goid': '8302931681',
|
|
||||||
# 'clientId': '1061399163',
|
|
||||||
# 'clientSecret': 'stDTmVXF',
|
|
||||||
# 'isProductionMode': False,
|
|
||||||
# 'scope': gopay.TokenScope.ALL,
|
|
||||||
# 'language': gopay.Language.ENGLISH,
|
|
||||||
# 'timeout': 30
|
|
||||||
# })
|
|
||||||
# # token is retrieved automatically, you don't have to call some method `get_token`
|
|
||||||
|
|
||||||
# response = api.get_status('3000006542')
|
|
||||||
# if response.has_succeed():
|
|
||||||
# print("hooray, API returned " + str(response))
|
|
||||||
# else:
|
|
||||||
# print("oops, API returned " + str(response.status_code) + ": " + str(response))
|
|
||||||
|
|
||||||
# payments = gopay.payments({
|
|
||||||
# 'goid': 'my goid',
|
|
||||||
# 'clientId': 'my id',
|
|
||||||
# 'clientSecret': 'my secret',
|
|
||||||
# 'isProductionMode': False
|
|
||||||
# })
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
user = request.user
|
user = request.user
|
||||||
|
|
||||||
payments = gopay.payments({
|
payments = gopay.payments({
|
||||||
'goid': '8302931681',
|
'goid': '[PAYMENT_ID]',
|
||||||
'clientId': '1061399163',
|
'clientId': '[GOPAY_CLIENT_ID]',
|
||||||
'clientSecret': 'stDTmVXF',
|
'clientSecret': '[GOPAY_CLIENT_SECRET]',
|
||||||
'isProductionMode': False,
|
'isProductionMode': False,
|
||||||
'scope': gopay.TokenScope.ALL,
|
'scope': gopay.TokenScope.ALL,
|
||||||
'language': gopay.Language.ENGLISH,
|
'language': gopay.Language.ENGLISH,
|
||||||
@ -207,16 +111,6 @@ def gopay_payment(request):
|
|||||||
'postal_code': '373 01',
|
'postal_code': '373 01',
|
||||||
'country_code': 'CZE',
|
'country_code': 'CZE',
|
||||||
},
|
},
|
||||||
# 'contact': {
|
|
||||||
# 'first_name': 'Zbynek',
|
|
||||||
# 'last_name': 'Zak',
|
|
||||||
# 'email': 'zbynek.zak@gopay.cz',
|
|
||||||
# 'phone_number': '+420777456123',
|
|
||||||
# 'city': 'C.Budejovice',
|
|
||||||
# 'street': 'Plana 67',
|
|
||||||
# 'postal_code': '373 01',
|
|
||||||
# 'country_code': 'CZE',
|
|
||||||
# },
|
|
||||||
},
|
},
|
||||||
'amount': 150,
|
'amount': 150,
|
||||||
'currency': Currency.CZECH_CROWNS,
|
'currency': Currency.CZECH_CROWNS,
|
||||||
@ -245,3 +139,46 @@ def gopay_payment(request):
|
|||||||
return JsonResponse({"message": str(response)})
|
return JsonResponse({"message": str(response)})
|
||||||
|
|
||||||
return JsonResponse({"message": "GET requested"})
|
return JsonResponse({"message": "GET requested"})
|
||||||
|
|
||||||
|
|
||||||
|
def paymentComplete(request):
|
||||||
|
print(request.is_ajax())
|
||||||
|
if request.is_ajax() or request.method == 'POST':
|
||||||
|
invoice_id = request.session['invoice_session']
|
||||||
|
invoice = Invoice.objects.get(id=invoice_id)
|
||||||
|
invoice.payment_complete = True
|
||||||
|
invoice.save()
|
||||||
|
# return redirect('invoice', invoice.invoice_code)
|
||||||
|
body = json.loads(request.body)
|
||||||
|
print('BODY:', body)
|
||||||
|
return JsonResponse('Payment completed!', safe=False)
|
||||||
|
|
||||||
|
|
||||||
|
def create_invoice(request):
|
||||||
|
print(request.is_ajax())
|
||||||
|
if request.method == 'POST':
|
||||||
|
invoice = Invoice.objects.create(
|
||||||
|
user = request.user,
|
||||||
|
amount = request.POST.get('amount'),
|
||||||
|
total=26,
|
||||||
|
invoice_code=str(uuid.uuid4()),
|
||||||
|
)
|
||||||
|
request.session['invoice_session'] = invoice.invoice_code
|
||||||
|
return redirect('payment_gateways')
|
||||||
|
# if request.is_ajax():
|
||||||
|
# invoice = Invoice.objects.create(
|
||||||
|
# user = request.user,
|
||||||
|
# amount = 15,
|
||||||
|
# total=26,
|
||||||
|
# )
|
||||||
|
# return JsonResponse({'invoice': invoice}, status=201) # created
|
||||||
|
|
||||||
|
return render(request, 'invoices.html', context={
|
||||||
|
'invoices': Invoice.objects.filter(user=request.user)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
def invoice_detail(request, slug):
|
||||||
|
return render(request, 'invoice_detail.html', context={
|
||||||
|
'invoice': Invoice.objects.get(invoice_code=slug)
|
||||||
|
})
|
||||||
|
|||||||
@ -13,6 +13,15 @@
|
|||||||
# from flask import Flask, render_template, jsonify, request, send_from_directory
|
# from flask import Flask, render_template, jsonify, request, send_from_directory
|
||||||
# from dotenv import load_dotenv, find_dotenv
|
# from dotenv import load_dotenv, find_dotenv
|
||||||
|
|
||||||
|
# # Set your secret key. Remember to switch to your live secret key in production.
|
||||||
|
# # See your keys here: https://dashboard.stripe.com/account/apikeys
|
||||||
|
# stripe.api_key = "sk_test_51IcEVZHbzY4cUA9T3BZdDayN4gmbJyXuaLCzpLT15HZoOmC17G7CxeEdXeIHSWyhYfxpljsclzzjsFukYNqJTbrW00tv3qIbN2"
|
||||||
|
|
||||||
|
# intent = stripe.PaymentIntent.create(
|
||||||
|
# amount=1099,
|
||||||
|
# currency='usd',
|
||||||
|
# )
|
||||||
|
|
||||||
# # Setup Stripe python client library
|
# # Setup Stripe python client library
|
||||||
# load_dotenv(find_dotenv())
|
# load_dotenv(find_dotenv())
|
||||||
# stripe.api_key = os.getenv('STRIPE_SECRET_KEY')
|
# stripe.api_key = os.getenv('STRIPE_SECRET_KEY')
|
||||||
|
|||||||
@ -1,84 +1 @@
|
|||||||
-r requirements/local.txt
|
-r requirements/local.txt
|
||||||
|
|
||||||
# alabaster==0.7.13
|
|
||||||
# arrow==1.2.3
|
|
||||||
# asgiref==3.6.0
|
|
||||||
# attrs==22.2.0
|
|
||||||
# autobahn==23.1.1
|
|
||||||
# Automat==22.10.0
|
|
||||||
# Babel==2.11.0
|
|
||||||
# binaryornot==0.4.4
|
|
||||||
# black==22.10.0
|
|
||||||
# certifi==2022.12.7
|
|
||||||
# cffi==1.15.1
|
|
||||||
# channels==4.0.0
|
|
||||||
# chardet==5.1.0
|
|
||||||
# charset-normalizer==2.1.1
|
|
||||||
# click==8.1.3
|
|
||||||
# colorama==0.4.6
|
|
||||||
# constantly==15.1.0
|
|
||||||
# cookiecutter==2.1.1
|
|
||||||
# cryptography==39.0.0
|
|
||||||
# daphne==4.0.0
|
|
||||||
# Deprecated==1.2.13
|
|
||||||
# Django==4.1.6
|
|
||||||
# django-cleanup==6.0.0
|
|
||||||
# django-crispy-forms==1.14.0
|
|
||||||
# django-environ==0.9.0
|
|
||||||
# django-model-utils==4.3.1
|
|
||||||
# djangorestframework==3.14.0
|
|
||||||
# docutils==0.19
|
|
||||||
# ghp-import==2.1.0
|
|
||||||
# gopay==1.3.0
|
|
||||||
# hyperlink==21.0.0
|
|
||||||
# idna==3.4
|
|
||||||
# imagesize==1.4.1
|
|
||||||
# incremental==22.10.0
|
|
||||||
# Jinja2==3.1.2
|
|
||||||
# jinja2-time==0.2.0
|
|
||||||
# Markdown==3.3.7
|
|
||||||
# MarkupSafe==2.1.1
|
|
||||||
# mergedeep==1.3.4
|
|
||||||
# mkdocs==1.4.2
|
|
||||||
# mypy-extensions==0.4.3
|
|
||||||
# packaging==21.3
|
|
||||||
# pathspec==0.10.2
|
|
||||||
# Pillow==9.4.0
|
|
||||||
# platformdirs==2.5.4
|
|
||||||
# psycopg2==2.9.5
|
|
||||||
# pyasn1==0.4.8
|
|
||||||
# pyasn1-modules==0.2.8
|
|
||||||
# pycparser==2.21
|
|
||||||
# Pygments==2.14.0
|
|
||||||
# pyOpenSSL==23.0.0
|
|
||||||
# pyparsing==3.0.9
|
|
||||||
# python-dateutil==2.8.2
|
|
||||||
# python-slugify==7.0.0
|
|
||||||
# pytz==2022.7.1
|
|
||||||
# PyYAML==6.0
|
|
||||||
# pyyaml_env_tag==0.1
|
|
||||||
# reportlab==3.6.12
|
|
||||||
# requests==2.28.1
|
|
||||||
# service-identity==21.1.0
|
|
||||||
# six==1.16.0
|
|
||||||
# snowballstemmer==2.2.0
|
|
||||||
# Sphinx==6.1.3
|
|
||||||
# sphinxcontrib-devhelp==1.0.2
|
|
||||||
# sphinxcontrib-htmlhelp==2.0.0
|
|
||||||
# sphinxcontrib-jsmath==1.0.1
|
|
||||||
# sphinxcontrib-qthelp==1.0.3
|
|
||||||
# sphinxcontrib-serializinghtml==1.1.5
|
|
||||||
# sphinxcontrib.applehelp==1.0.3
|
|
||||||
# sqlparse==0.4.3
|
|
||||||
# stripe==5.0.0
|
|
||||||
# text-unidecode==1.3
|
|
||||||
# tomli==2.0.1
|
|
||||||
# Twisted==22.10.0
|
|
||||||
# twisted-iocpsupport==1.0.2
|
|
||||||
# txaio==23.1.1
|
|
||||||
# typing_extensions==4.4.0
|
|
||||||
# tzdata==2022.7
|
|
||||||
# urllib3==1.26.13
|
|
||||||
# watchdog==2.1.9
|
|
||||||
# wrapt==1.14.1
|
|
||||||
# zope.interface==5.5.2
|
|
||||||
|
|||||||
@ -12,8 +12,6 @@ from course.models import Course
|
|||||||
from accounts.decorators import lecturer_required, student_required
|
from accounts.decorators import lecturer_required, student_required
|
||||||
from .models import TakenCourse, Result
|
from .models import TakenCourse, Result
|
||||||
|
|
||||||
User = settings.AUTH_USER_MODEL
|
|
||||||
|
|
||||||
#pdf
|
#pdf
|
||||||
from django.core.files.storage import FileSystemStorage
|
from django.core.files.storage import FileSystemStorage
|
||||||
from django.http import HttpResponse, JsonResponse
|
from django.http import HttpResponse, JsonResponse
|
||||||
@ -24,12 +22,10 @@ from reportlab.lib.enums import TA_JUSTIFY,TA_LEFT,TA_CENTER,TA_RIGHT
|
|||||||
from reportlab.platypus.tables import Table
|
from reportlab.platypus.tables import Table
|
||||||
from reportlab.lib.units import inch
|
from reportlab.lib.units import inch
|
||||||
from reportlab.lib import colors
|
from reportlab.lib import colors
|
||||||
|
from .models import *
|
||||||
|
|
||||||
cm = 2.54
|
cm = 2.54
|
||||||
|
|
||||||
from SMS.settings import MEDIA_ROOT, BASE_DIR, STATIC_URL
|
|
||||||
import os
|
|
||||||
|
|
||||||
from .models import *
|
|
||||||
# ########################################################
|
# ########################################################
|
||||||
# Score Add & Add for
|
# Score Add & Add for
|
||||||
# ########################################################
|
# ########################################################
|
||||||
@ -251,7 +247,9 @@ def result_sheet_pdf_view(request, id):
|
|||||||
# im_logo.__setattr__("_offs_y", -60)
|
# im_logo.__setattr__("_offs_y", -60)
|
||||||
# Story.append(im_logo)
|
# Story.append(im_logo)
|
||||||
|
|
||||||
logo = settings.MEDIA_ROOT + "/logo/you-logo-here.png"
|
print("\nsettings.MEDIA_ROOT", settings.MEDIA_ROOT)
|
||||||
|
print("\nsettings.STATICFILES_DIRS[0]", settings.STATICFILES_DIRS[0])
|
||||||
|
logo = settings.STATICFILES_DIRS[0] + "/img/logo.png"
|
||||||
im = Image(logo, 1*inch, 1*inch)
|
im = Image(logo, 1*inch, 1*inch)
|
||||||
im.__setattr__("_offs_x", -200)
|
im.__setattr__("_offs_x", -200)
|
||||||
im.__setattr__("_offs_y", -45)
|
im.__setattr__("_offs_y", -45)
|
||||||
@ -550,13 +548,13 @@ def course_registration_form(request):
|
|||||||
|
|
||||||
# FIRST SEMESTER ENDS HERE
|
# FIRST SEMESTER ENDS HERE
|
||||||
|
|
||||||
logo = MEDIA_ROOT + "/logo/you-logo-here.png"
|
logo = settings.STATICFILES_DIRS[0] + "/img/logo.png"
|
||||||
im_logo = Image(logo, 1*inch, 1*inch)
|
im_logo = Image(logo, 1*inch, 1*inch)
|
||||||
im_logo.__setattr__("_offs_x", -218)
|
im_logo.__setattr__("_offs_x", -218)
|
||||||
im_logo.__setattr__("_offs_y", 480)
|
im_logo.__setattr__("_offs_y", 480)
|
||||||
Story.append(im_logo)
|
Story.append(im_logo)
|
||||||
|
|
||||||
picture = BASE_DIR + request.user.get_picture()
|
picture = settings.BASE_DIR + request.user.get_picture()
|
||||||
im = Image(picture, 1.0*inch, 1.0*inch)
|
im = Image(picture, 1.0*inch, 1.0*inch)
|
||||||
im.__setattr__("_offs_x", 218)
|
im.__setattr__("_offs_x", 218)
|
||||||
im.__setattr__("_offs_y", 550)
|
im.__setattr__("_offs_y", 550)
|
||||||
|
|||||||
@ -43,12 +43,12 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('.au-input').focus(function () {
|
$('#primary-search').focus(function () {
|
||||||
$('#top-navbar').attr('class', 'dim');
|
$('#top-navbar').attr('class', 'dim');
|
||||||
$('#side-nav').css('pointer-events', 'none');
|
$('#side-nav').css('pointer-events', 'none');
|
||||||
$('#main-content').css('pointer-events', 'none');
|
$('#main-content').css('pointer-events', 'none');
|
||||||
});
|
});
|
||||||
$('.au-input').focusout(function () {
|
$('#primary-search').focusout(function () {
|
||||||
$('#top-navbar').removeAttr('class');
|
$('#top-navbar').removeAttr('class');
|
||||||
$('#side-nav').css('pointer-events', 'auto');
|
$('#side-nav').css('pointer-events', 'auto');
|
||||||
$('#main-content').css('pointer-events', 'auto');
|
$('#main-content').css('pointer-events', 'auto');
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="content-center">
|
<div class="content-center">
|
||||||
<form class="search-form" action="" method="GET">
|
<form class="search-form" action="." method="GET">
|
||||||
<input class="au-input" type="text" name="name" placeholder="Course Name" value="{{ request.GET.name }}" />
|
<input class="au-input" type="text" name="name" placeholder="Course Name" value="{{ request.GET.name }}" />
|
||||||
<input class="au-input" type="text" name="code" placeholder="Course Code" value="{{ request.GET.code }}" />
|
<input class="au-input" type="text" name="code" placeholder="Course Code" value="{{ request.GET.code }}" />
|
||||||
<input class="au-input" type="number" name="year" placeholder="Course Year" value="{{ request.GET.year }}" />
|
<input class="au-input" type="number" name="year" placeholder="Course Year" value="{{ request.GET.year }}" />
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form class="form-header" action="{% url 'query' %}" method="GET">
|
<form class="form-header" action="{% url 'query' %}" method="GET">
|
||||||
<input class="au-input au-input--xl" type="text" name="q" value="{{ request.GET.q }}"
|
<input id="primary-search" class="au-input au-input--xl" type="text" name="q" value="{{ request.GET.q }}"
|
||||||
placeholder="Search All... #course, #program, #Quiz, #News, #Events" required />
|
placeholder="Search All... #course, #program, #Quiz, #News, #Events" required />
|
||||||
<button class="au-btn--submit" type="submit">
|
<button class="au-btn--submit" type="submit">
|
||||||
<i class="fas fa-search"></i>
|
<i class="fas fa-search"></i>
|
||||||
@ -18,9 +18,9 @@
|
|||||||
<button class="btn btn-sm dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown"
|
<button class="btn btn-sm dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown"
|
||||||
aria-haspopup="true" aria-expanded="false">
|
aria-haspopup="true" aria-expanded="false">
|
||||||
<img class="profile-pic" src="{{ request.user.picture.url }}">
|
<img class="profile-pic" src="{{ request.user.picture.url }}">
|
||||||
{{ request.user.get_full_name|truncatechars:15 }}
|
<!-- {{ request.user.get_full_name|truncatechars:15 }} -->
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
<div class="dropdown-menu" style="min-width: 14rem !important;" aria-labelledby="dropdownMenuButton">
|
||||||
<p class="container text-muted-xs text-center">
|
<p class="container text-muted-xs text-center">
|
||||||
Last login: {{ request.user.last_login|date }}</p>
|
Last login: {{ request.user.last_login|date }}</p>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user