diff options
author | Andrea Lepori <alepori@student.ethz.ch> | 2021-08-16 14:54:06 +0200 |
---|---|---|
committer | Andrea Lepori <alepori@student.ethz.ch> | 2021-08-16 14:54:31 +0200 |
commit | 2a8c89a1a6e39854b0e9d341db578215496b346c (patch) | |
tree | f372355234df812e150406be4a95ce5513af0ca0 | |
parent | fix RO documents visible for non group capi (diff) | |
download | scout-subs-2a8c89a1a6e39854b0e9d341db578215496b346c.tar.gz scout-subs-2a8c89a1a6e39854b0e9d341db578215496b346c.zip |
remove unused import and variables
-rw-r--r-- | accounts/admin.py | 2 | ||||
-rw-r--r-- | accounts/models.py | 2 | ||||
-rw-r--r-- | accounts/views.py | 11 | ||||
-rw-r--r-- | client/admin.py | 2 | ||||
-rw-r--r-- | client/views.py | 5 | ||||
-rw-r--r-- | server/admin.py | 2 | ||||
-rw-r--r-- | server/models.py | 2 | ||||
-rw-r--r-- | server/views.py | 19 | ||||
-rw-r--r-- | version.txt | 2 |
9 files changed, 10 insertions, 37 deletions
diff --git a/accounts/admin.py b/accounts/admin.py index 8c38f3f..5538909 100644 --- a/accounts/admin.py +++ b/accounts/admin.py @@ -1,3 +1,3 @@ -from django.contrib import admin +#from django.contrib import admin # Register your models here. diff --git a/accounts/models.py b/accounts/models.py index 71a8362..54f60fe 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -1,3 +1,3 @@ -from django.db import models +#from django.db import models # Create your models here. diff --git a/accounts/views.py b/accounts/views.py index c42bc52..7038ccd 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,16 +1,10 @@ from django.shortcuts import render from django.contrib.auth.forms import UserCreationForm from django.contrib.auth import login, authenticate -from django.views import generic -from django.contrib.auth.models import Group -from django.core.files.storage import FileSystemStorage from django.http import FileResponse from django.contrib.auth.decorators import login_required from django.views.decorators.debug import sensitive_variables from django.http import HttpResponseRedirect -from django import forms -from django.contrib.auth.models import User -from django.core.exceptions import ValidationError from client.models import UserCode @@ -18,9 +12,8 @@ import dateparser import os from io import BytesIO from PIL import Image, UnidentifiedImageError -from pdf2image import convert_from_path, convert_from_bytes +from pdf2image import convert_from_bytes from pdf2image.exceptions import ( - PDFInfoNotInstalledError, PDFPageCountError, PDFSyntaxError ) @@ -28,7 +21,7 @@ from pdf2image.exceptions import ( # override to remove help text class RegisterForm(UserCreationForm): def __init__(self, *args, **kwargs): - super(UserCreationForm, self).__init__(*args, **kwargs) + super(RegisterForm, self).__init__(*args, **kwargs) for fieldname in ['username', 'password1', 'password2']: self.fields[fieldname].help_text = None diff --git a/client/admin.py b/client/admin.py index 8c38f3f..5538909 100644 --- a/client/admin.py +++ b/client/admin.py @@ -1,3 +1,3 @@ -from django.contrib import admin +#from django.contrib import admin # Register your models here. diff --git a/client/views.py b/client/views.py index d18c074..4b8b11d 100644 --- a/client/views.py +++ b/client/views.py @@ -1,8 +1,7 @@ from random import randint -from django.contrib.auth.models import Group, Permission, User from client.models import GroupSettings, UserCode, Keys, DocumentType, Document, PersonalData, KeyVal, MedicalData from django.db.models import Q -from django.http import HttpResponseRedirect, FileResponse, HttpResponse +from django.http import HttpResponseRedirect, FileResponse from django.contrib.auth.decorators import login_required from django.shortcuts import render @@ -10,7 +9,6 @@ from django.shortcuts import render from django.template.loader import get_template from io import BytesIO import pdfkit -import base64 from subprocess import check_output from datetime import datetime import pytz @@ -231,7 +229,6 @@ def create(request): if document_type.auto_sign: status = "autosign" - keys = [] # copy personal data and medical data if document_type.personal_data: personal_data = PersonalData(email=request.user.email, parent_name=usercode.parent_name, via=usercode.via, cap=usercode.cap, country=usercode.country, diff --git a/server/admin.py b/server/admin.py index 8c38f3f..5538909 100644 --- a/server/admin.py +++ b/server/admin.py @@ -1,3 +1,3 @@ -from django.contrib import admin +#from django.contrib import admin # Register your models here. diff --git a/server/models.py b/server/models.py index 71a8362..54f60fe 100644 --- a/server/models.py +++ b/server/models.py @@ -1,3 +1,3 @@ -from django.db import models +#from django.db import models # Create your models here. diff --git a/server/views.py b/server/views.py index 244bf60..56b1a77 100644 --- a/server/views.py +++ b/server/views.py @@ -1,5 +1,5 @@ from django.shortcuts import render
-from client.models import MedicalData, UserCode, Keys, DocumentType, Document, KeyVal
+from client.models import UserCode, Keys, DocumentType, Document, KeyVal
from django.conf import settings
from django.core.mail import send_mail
from client.models import GroupSettings, UserCode, Keys, DocumentType, Document, KeyVal
@@ -13,7 +13,6 @@ from django.contrib.admin.views.decorators import staff_member_required from django.contrib.auth.decorators import user_passes_test
from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.backends.db import SessionStore
-from django import template
import csv
import dateparser
@@ -22,13 +21,11 @@ from datetime import timedelta import pytz
import pdfkit
from io import BytesIO
-import os
import base64
from PIL import Image, UnidentifiedImageError
import zipfile
import json
import threading
-import random
# custom staff check function for non primary group staff members
def isStaff(user):
@@ -182,11 +179,6 @@ def docapprove(request): context = {}
data = []
- # group name and obj
- parent_group = request.user.groups.values_list('name', flat=True)[
- 0]
- group = Group.objects.get(name=parent_group)
-
# if user not staff of primary has only controll of non primary groups
if request.user.is_staff:
groups = request.user.groups.values_list('name', flat=True)
@@ -317,7 +309,6 @@ def ulist(request): # generate link for images
vac_file = ""
health_file = ""
- sign_doc_file = ""
if usercode.medic:
if usercode.medic.vac_certificate.name:
vac_file = "/server/media/" + str(usercode.id) + "/vac_certificate/usercode"
@@ -566,11 +557,6 @@ def doctype(request): message = True
group_bool = True
- # group name and obj
- parent_group = request.user.groups.values_list('name', flat=True)[
- 0]
- group = Group.objects.get(name=parent_group)
-
# get documents from the list
q_obj = Q()
for i in parent_groups:
@@ -1459,9 +1445,6 @@ def zip_documents(docs, session_key): @user_passes_test(isStaff)
def upload_doc(request):
# setup group based on staff primary or not
- parent_group = request.user.groups.values_list('name', flat=True)[
- 0]
- group = Group.objects.get(name=parent_group)
if request.user.is_staff:
groups = request.user.groups.values_list('name', flat=True)
else:
diff --git a/version.txt b/version.txt index 8e2a6b5..033ebb1 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.3 -rev=2 +rev=3 |