Commit for MarcinK50

This commit is contained in:
Pengwius 2021-01-07 00:48:06 +01:00
parent 4d36b5864c
commit e4bf2d86ad
18 changed files with 108 additions and 909 deletions

29
.github/workflows/python-app.yml vendored Normal file
View file

@ -0,0 +1,29 @@
name: Python application
on: [push]
jobs:
build:
runs-on: ubuntu-latest
env:
SECRET_KEY: SECRET_KEY123
services:
postgres:
image: postgres:10.8
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: psycopg2 prerequisites
run: sudo apt-get install python-dev libpq-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest-django
- name: Run tests
run: python manage.py test

View file

@ -1,6 +1,7 @@
import os
import sys
import requests
from django.http import JsonResponse
from django import template
from django.utils.safestring import mark_safe
from django.shortcuts import render
@ -10,31 +11,23 @@ from django.shortcuts import redirect
from bs4 import BeautifulSoup
import datetime
oun = ''
s = requests.Session()
symbol = ''
def sender(url, loginName, Password, params_names, fail_phrase, symbol, diary_url):
data = [params_names[0], loginName, params_names[1], Password]
def sender(url, loginName, Password, params_names, fail_phrase, sym, diary_url):
global symbol
data = []
data.append((params_names[0], loginName, params_names[1], Password))
symbol = sym
sender_return = send(url, data, fail_phrase, diary_url, symbol)
print(sender_return)
if sender_return == {'success': False}:
return {'success': False}
else:
return sender_return
for index, single_data in enumerate(data):
index += 1
if send(url, single_data, fail_phrase, diary_url):
return True
else:
return False
def send(url, data, fail, diary_url):
def send(url, data, fail, diary_url, symbol):
s = requests.Session()
ready_data = {data[0]: data[1], data[2]: data[3]}
page = s.post(url=url, data=ready_data)
print(page.text)
if fail in page.text:
return False
return {'success': False}
else:
global symbol
if diary_url == 'http://cufs.fakelog.cf/':
page = s.get('http://cufs.fakelog.cf/powiatwulkanowy/FS/LS?wa=wsignin1.0&wtrealm=http://uonetplus.fakelog.localhost:300/powiatwulkanowy/LoginEndpoint.aspx&wctx=http://uonetplus.fakelog.localhost:300/powiatwulkanowy/LoginEndpoint.aspx')
bs = BeautifulSoup(page.text, 'html.parser')
@ -42,17 +35,9 @@ def send(url, data, fail, diary_url):
cert = bs.find('input', {'name': 'wresult'})['value']
wctx = bs.find('input', {'name': 'wctx'})['value']
print(wa)
print('------------------------------------------------------------')
print(cert)
print('------------------------------------------------------------')
print(wctx)
print('------------------------------------------------------------')
crtr = s.post(url=wctx, headers={"User-Agent": "Wulkanowy-web :)"}, data={"wa": wa, "wresult": cert, "wctx": wctx})
bs = BeautifulSoup(crtr.content, 'html.parser')
global oun
for a in bs.find_all('a', title='Uczeń'):
oun = a['href']
break
@ -60,11 +45,11 @@ def send(url, data, fail, diary_url):
if diary_url == 'http://cufs.fakelog.cf/':
oun = 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458'
return True
cookies = get_cookies(symbol, oun, s)
def get_cookies():
global symbol
global oun
return cookies
def get_cookies(symbol, oun, s):
register_r = s.post(oun+'/UczenDziennik.mvc/Get')
register_id = register_r.json()['data'][0]['Okresy'][0]['Id']
@ -83,4 +68,13 @@ def get_cookies():
school_year = register_r.json()['data'][0]['DziennikRokSzkolny']
return [register_id, register_r, oun, s, date, school_year, symbol]
data = {
'register_id': register_id,
'register_r': register_r.json(),
'oun': oun,
'date': date,
'school_year': school_year,
'symbol': symbol,
}
return data

View file

@ -1,85 +0,0 @@
from django import template
from django.utils.safestring import mark_safe
from app.login import get_cookies
from app.API.homework import prepare_homework_for_display
register = template.Library()
@register.filter
def return_item(l, i):
try:
if l[i] == []:
return ['Brak Ocen']
else:
return l[i]
except:
return None
@register.filter
def set_color(grade):
if grade == '6' or grade == '6-':
return '#3dbbf5'
elif grade == '5' or grade == '5-' or grade == '5+':
return '#4caf50'
elif grade == '4' or grade == '4-' or grade == '4+':
return '#a0c431'
elif grade == '3' or grade == '3-' or grade == '3+':
return '#ffb940'
elif grade == '2' or grade == '2-' or grade == '2+':
return '#ff774d'
elif grade == '1' or grade == '1+':
return '#d43f3f'
else:
return '#607d8b'
@register.filter
def simple_data(exam):
return_html = []
if exam != {}:
for exams in exam:
lesson = exam[exams]['Przedmiot']
if exam[exams]['Opis'] == '':
description = 'Brak Opisu'
else:
description = exam[exams]['Opis']
date = exam[exams]['Data']
if return_html == []:
return_html.append([lesson, description, date])
else:
return_html.append([lesson, description, date])
return return_html
else:
return mark_safe('Brak Sprawdzianów')
homework_all = None
@register.filter
def week_homework(no):
global homework_all
cookie = get_cookies()
if homework_all == None:
homework_all = prepare_homework_for_display(cookie[0], cookie[1], cookie[2], cookie[3], cookie[5])
homework = []
for i in range(4):
homework.append(homework_all[i][no])
return homework
@register.filter
def points_color(points):
if int(points) < 0:
return 'red;'
elif int(points) > 0:
return 'green;'
else:
return 'black;'
@register.filter
def suffix(points):
if int(points) == 0 or int(points) >= 5 or int(points) <= -5:
return points+' punktów'
elif int(points) == -1 or int(points) == 1:
return points+' punkt'
elif int(points) > -5 and int(points) <= -2:
return points+' punkty'

View file

@ -2,9 +2,9 @@ from requests import get
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
import json
from .login import sender, get_cookies
from django.shortcuts import redirect
from django.contrib.sessions.models import Session
from .login import sender
from .API.grades import prepare_grades_for_display
from .API.exams import prepare_exams_for_display
from .API.timetable import prepare_timetable_for_display
@ -12,126 +12,12 @@ from .API.notes import prepare_notes_for_display
from .API.attendance import prepare_attendance_for_display
from .API.messages import get_messages
#views
def default_view(request, *args, **kwargs):
return render(request, 'index.html')
def grades_view(request, *args, **kwargs):
if request.session.has_key('is_logged'):
cookies = get_cookies()
grades = prepare_grades_for_display(cookies[0], cookies[1], cookies[2], cookies[3])
grade = {}
description = {}
for i in grades[1]:
grade.update({i: []})
description.update({i: []})
for items in grades[0][i]:
grade[i].append(items['Ocena'])
description[i].append(items['Opis'])
content = {'gc': grade, 'dc': description, 'lesson': grades[1]}
return render(request, 'oceny.html', content)
else:
return redirect(default_view)
def homework_view(request, *args, **kwargs):
if request.session.has_key('is_logged'):
return render(request, 'zadania.html')
else:
return redirect(default_view)
def timetable_view(request, *args, **kwargs):
if request.session.has_key('is_logged'):
cookies = get_cookies()
timetable = prepare_timetable_for_display(cookies[0], cookies[1], cookies[2], cookies[3], cookies[4])
hour = {}
for i in timetable['hour']:
hour.update({i[0]: []})
hour[i[0]].append(i[1])
hour[i[0]].append(i[2])
content = {
'hour': hour,
'monday': timetable['monday'],
'tuesday': timetable['tuesday'],
'wednesday': timetable['wednesday'],
'thrusday': timetable['thrusday'],
'friday': timetable['friday']
}
return render(request, 'plan.html', content)
else:
return redirect(default_view)
def attendance_view(request, *args, **kwargs):
if request.session.has_key('is_logged'):
cookies = get_cookies()
attendance = prepare_attendance_for_display(cookies[0], cookies[1], cookies[2], cookies[3], cookies[4])
content = {'attendance': attendance}
return render(request, 'frekwencja.html', content)
else:
return redirect(default_view)
def notes_view(request, *args, **kwargs):
if request.session.has_key('is_logged'):
cookies = get_cookies()
notes = prepare_notes_for_display(cookies[0], cookies[1], cookies[2], cookies[3])
content = {
'notes': notes[0],
'achievements': notes[1]
}
return render(request, 'uwagi.html', content)
else:
return redirect(default_view)
def exams_view(request, *args, **kwargs):
if request.session.has_key('is_logged'):
cookies = get_cookies()
print(cookies)
exams = prepare_exams_for_display(cookies[0], cookies[1], cookies[2], cookies[3], cookies[4], cookies[5])
positions = []
for x in range(4):
positions.append(exams[x])
content = {'content': positions}
return render(request, 'sprawdziany.html', content)
else:
return redirect(default_view)
def messages_view(request, *args, **kwargs):
if request.session.has_key('is_logged'):
cookies = get_cookies()
messages = get_messages(cookies[0], cookies[1], cookies[2], cookies[3], cookies[4], cookies[5], cookies[6])
content = {'messages': messages[0]}
return render(request, 'wiadomosci.html', content)
else:
return redirect(default_view)
def change_messages_content(request, *args, **kwargs):
if request.session.has_key('is_logged'):
cookies = get_cookies()
messages = get_messages(cookies[0], cookies[1], cookies[2], cookies[3], cookies[4], cookies[5], cookies[6])
id = request.GET.get('id')
if id == 'received':
content = {'messages': messages[0]}
elif id == 'sent':
content = {'messages': messages[1]}
elif id == 'deleted':
content = {'messages': messages[2]}
return render(request, 'messages_content.html', content)
else:
return redirect(default_view)
def content_view(request, *args, **kwargs):
return render(request, 'content.html')
#API
def login(request, *args, **kwargs):
@ -146,14 +32,12 @@ def login(request, *args, **kwargs):
else:
link = 'http://cufs.fakelog.cf/powiatwulkanowy/FS/LS?wa=wsignin1.0&wtrealm=http://uonetplus.fakelog.localhost:300/powiatwulkanowy/LoginEndpoint.aspx&wctx=http://uonetplus.fakelog.localhost:300/powiatwulkanowy/LoginEndpoint.aspx'
sender_return = sender(link, loginName, Password, ('loginName', 'Password'), 'Zła nazwa użytkownika lub hasło', symbol, diary_url)
print(sender_return)
if sender_return == False:
data = {
if sender_return == {'success': False}:
data_response = {
'success': False
}
elif sender_return == True:
else:
request.session['is_logged'] = True
data = {
'success': True
}
return JsonResponse(data)
data_response = {'success': True, 'data': sender_return}
print(data_response)
return JsonResponse(data_response)

View file

@ -31,7 +31,7 @@ const login = () => {
body: JSON.stringify(data)
}).then(response => response.json()).then(data => {
if(data['success']){
window.location.href = "/oceny/"
window.location.href = "/content/"
}
else{
document.querySelector('#error').innerHTML = 'Nieprawidłowy login, hasło lub symbol'

36
templates/content.html Normal file
View file

@ -0,0 +1,36 @@
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="{% static 'start.css' %}" type="text/css" />
<link rel="stylesheet" media="min-width: 768px" href="{% static 'start.css' %}" />
<script src="{% static 'js/start.js' %}"></script>
<link rel="shortcut icon" href="{% static 'images/27146352.png' %}">
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lora:wght@500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&family=Quicksand:wght@300&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<title>Wulkanowy | Aplikacja ucznia i rodzica</title>
</head>
<body>
<div data-v-cd2b8d62 data-v-09be56d6 id="container">
<div id="menu">
<h1 data-v-cd2b8d62="" class="logo">
<img data-v-cd2b8d62 src="{% static 'images/wulkanowy-full-flat.4ff8222a.svg' %}" alt="Wulkanowy">
<a href="#"><div id="uwagi" class="option">Uwagi</div></a>
<a href="#"><div id="wiadomosci" class="option">Wiadomości</div></a>
<a href="#"><div id="frekwencja" class="option">Frekwencja</div></a>
<a href="#"><div id="zadania" class="option">Zadania Domowe</div></a>
<a href="#"><div id="sprawdziany" class="option">Sprawdziany</div></a>
<a href="#"><div id="plan" class="option">Plan Lekcji</div></a>
<a href="#"><div id="oceny" class="option">Oceny</div></a>
</h1>
</div>
<div class="content">
</div>
</body>
</html>

View file

@ -1,86 +0,0 @@
{% load static %}
{% load custom_filters_tags %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="{% static 'start.css' %}" type="text/css" />
<link rel="stylesheet" media="min-width: 768px" href="{% static 'start.css' %}" />
<script src="{% static 'js/start.js' %}"></script>
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lora:wght@500&display=swap" rel="stylesheet">
<link rel="shortcut icon" href="{% static 'images/27146352.png' %}">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&family=Quicksand:wght@300&display=swap" rel="stylesheet">
<title>Wulkanowy | Aplikacja ucznia i rodzica</title>
</head>
<body>
<div data-v-cd2b8d62 data-v-09be56d6 id="container">
<div id="menu">
<h1 data-v-cd2b8d62="" class="logo">
<img data-v-cd2b8d62 src="{% static 'images/wulkanowy-full-flat.4ff8222a.svg' %}" alt="Wulkanowy">
<a href="/uwagi/"><div id="uwagi" class="option">Uwagi</div></a>
<a href="/wiadomosci/"><div id="wiadomosci" class="option">Wiadomości</div></a>
<a href="/frekwencja/"><div id="frekwencja" class="option">Frekwencja</div></a>
<a href="/zadania/"><div id="zadania" class="option">Zadania Domowe</div></a>
<a href="/sprawdziany/"><div id="sprawdziany" class="option">Sprawdziany</div></a>
<a href="/plan/"><div id="plan" class="option">Plan Lekcji</div></a>
<a href="/oceny/"><div id="oceny" class="option">Oceny</div></a>
</h1>
</div>
<div class="content">
<div class='column' style='width: 20%;'>
<div class='header' style='background-color: #bcbcbc;'>PONIEDZIAŁEK</div>
{% if 0 in attendance %}
{% for i in attendance.0 %}
<div class='item' style='background-color: #bcbcbc;'>{{ i.Content|force_escape }}<br />{{ i.Lesson|force_escape }}</div>
{% endfor %}
{% else %}
<div class='item' style='background-color: #bcbcbc;'>Brak danych o frekwencji</div>
{% endif %}
</div>
<div class='column' style='width: 20%;'>
<div class='header'>WTOREK</div>
{% if 1 in attendance %}
{% for i in attendance.1 %}
<div class='item'>{{ i.Content|force_escape }}<br /> {{ i.Lesson|force_escape }}</div>
{% endfor %}
{% else %}
<div class='item'>Brak danych o frekwencji</div>
{% endif %}
</div>
<div class='column' style='width: 20%;'>
<div class='header' style='background-color: #bcbcbc;'>ŚRODA</div>
{% if 2 in attendance %}
{% for i in attendance.2 %}
<div class='item' style='background-color: #bcbcbc;'>{{ i.Content|force_escape }}<br />{{ i.Lesson|force_escape }}</div>
{% endfor %}
{% else %}
<div class='item' style='background-color: #bcbcbc;'>Brak danych o frekwencji</div>
{% endif %}
</div>
<div class='column' style='width: 20%;'>
<div class='header'>CZWARTEK</div>
{% if 3 in attendance %}
{% for i in attendance.3 %}
<div class='item'>{{ i.Content|force_escape }}<br />{{ i.Lesson|force_escape }}</div>
{% endfor %}
{% else %}
<div class='item'>Brak danych o frekwencji</div>
{% endif %}
</div>
<div class='column' style='width: 20%;'>
<div class='header' style='background-color: #bcbcbc;'>PIĄTEK</div>
{% if 4 in attendance %}
{% for i in attendance.4 %}
<div class='item' style='background-color: #bcbcbc;'>{{ i.Content|force_escape }}<br />{{ i.Lesson|force_escape }}</div>
{% endfor %}
{% else %}
<div class='item' style='background-color: #bcbcbc;'>Brak danych o frekwencji</div>
{% endif %}
</div>
</div>
</div>
</body>
</html>

View file

@ -13,7 +13,6 @@
<link href="https://fonts.googleapis.com/css2?family=Lora:wght@500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<title>Wulkanowy | Aplikacja ucznia i rodzica</title>
</head>
<body>

View file

@ -1,11 +0,0 @@
{% for i in messages %}
{% if 'Sender' in i %}
<div class='message-item'><div class='message-block-left'>Temat: {{ i.Subject|force_escape }}<br />Nadawca: {{ i.Sender|force_escape }}</div><div class='message-block-right'>Data: {{ i.Date|force_escape }}</div></div>
{% else %}
<div class='message-item'><div class='message-block-left'>Temat: {{ i.Subject|force_escape }}<br />Obiorca:
{% for j in i.Recipients %}
{{ j.Name|force_escape }}
{% endfor %}
</div><div class='message-block-right'>Data: {{ i.Date|force_escape }}</div></div>
{% endif %}
{% endfor %}

View file

@ -1,76 +0,0 @@
{% load static %}
{% load custom_filters_tags %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="{% static 'start.css' %}" type="text/css" />
<link rel="stylesheet" media="min-width: 768px" href="{% static 'start.css' %}" />
<script src="{% static 'js/start.js' %}"></script>
<link rel="shortcut icon" href="{% static 'images/27146352.png' %}">
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lora:wght@500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&family=Quicksand:wght@300&display=swap" rel="stylesheet">
<title>Wulkanowy | Aplikacja ucznia i rodzica</title>
</head>
<body>
<div data-v-cd2b8d62 data-v-09be56d6 id="container">
<div id="menu">
<h1 data-v-cd2b8d62="" class="logo">
<img data-v-cd2b8d62 src="{% static 'images/wulkanowy-full-flat.4ff8222a.svg' %}" alt="Wulkanowy">
<a href="/uwagi/"><div id="uwagi" class="option">Uwagi</div></a>
<a href="/wiadomosci/"><div id="wiadomosci" class="option">Wiadomości</div></a>
<a href="/frekwencja/"><div id="frekwencja" class="option">Frekwencja</div></a>
<a href="/zadania/"><div id="zadania" class="option">Zadania Domowe</div></a>
<a href="/sprawdziany/"><div id="sprawdziany" class="option">Sprawdziany</div></a>
<a href="/plan/"><div id="plan" class="option">Plan Lekcji</div></a>
<a href="/oceny/"><div id="oceny" class="option">Oceny</div></a>
</h1>
</div>
<div class="content">
{% for l in lesson %}
<div class="lesson">
<li id='id-{{l}}' onclick='grade_action(this.id)'>{{ l }}
<ul>
<li style='display: none;'>
{% for i in gc %}
{% if i == l %}
<div id='grades_content'>
<div id='grades'>
{% for grade in gc|return_item:i %}
{% if grade != 'Brak Ocen' %}
<div class='grade' style='background-color: {{grade|set_color}};'>{{ grade }}</div>
{{ content|force_escape }}
<br />
{% endif %}
{% endfor %}
</div>
<div id='descriptions'>
{% for description in dc|return_item:i %}
{% if description == 'Brak Ocen' %}
<div class='description' style='margin-right: 2vw;'>Brak Ocen</div>
<br />
{% elif description == '' %}
<div class='description'>Brak Opisu</div>
<br />
{% else %}
<div class='description'>{{ description|force_escape }}</div>
<br />
{% endif %}
{% endfor%}
</div>
</div>
{% endif %}
{% endfor %}
</li>
</ul>
</li>
</div>
<br />
{% endfor %}
</div>
</div>
</body>
</html>

View file

@ -1,71 +0,0 @@
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="{% static 'start.css' %}" type="text/css" />
<link rel="stylesheet" media="min-width: 768px" href="{% static 'start.css' %}" />
<script src="{% static 'js/start.js' %}"></script>
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<link rel="shortcut icon" href="{% static 'images/27146352.png' %}">
<link href="https://fonts.googleapis.com/css2?family=Lora:wght@500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&family=Quicksand:wght@300&display=swap" rel="stylesheet">
<title>Wulkanowy | Aplikacja ucznia i rodzica</title>
</head>
<body>
<div data-v-cd2b8d62 data-v-09be56d6 id="container">
<div id="menu">
<h1 data-v-cd2b8d62="" class="logo">
<img data-v-cd2b8d62 src="{% static 'images/wulkanowy-full-flat.4ff8222a.svg' %}" alt="Wulkanowy">
<a href="/uwagi/"><div id="uwagi" class="option">Uwagi</div></a>
<a href="/wiadomosci/"><div id="wiadomosci" class="option">Wiadomości</div></a>
<a href="/frekwencja/"><div id="frekwencja" class="option">Frekwencja</div></a>
<a href="/zadania/"><div id="zadania" class="option">Zadania Domowe</div></a>
<a href="/sprawdziany/"><div id="sprawdziany" class="option">Sprawdziany</div></a>
<a href="/plan/"><div id="plan" class="option">Plan Lekcji</div></a>
<a href="/oceny/"><div id="oceny" class="option">Oceny</div></a>
</h1>
</div>
<div class="content">
<div class='column'>
<div class='header'>GODZINA</div>
{% for hours in hour.items %}
<div class='item' style='height: 10%;'>{{ hours.1.0 }} - {{ hours.1.1 }}</div>
{% endfor %}
</div>
<div class='column'>
<div class='header' style='background-color: #bcbcbc;'>PONIEDZIAŁEK</div>
{% for lessons in monday %}
<div class='item' style='background-color: #bcbcbc; height: 10%;'>{{ lessons }}</div>
{% endfor %}
</div>
<div class='column'>
<div class='header'>WTOREK</div>
{% for lessons in tuesday %}
<div class='item' style='height: 10%;'>{{ lessons }}</div>
{% endfor %}
</div>
<div class='column'>
<div class='header' style='background-color: #bcbcbc;'>ŚRODA</div>
{% for lessons in wednesday %}
<div class='item' style='background-color: #bcbcbc; height: 10%;'>{{ lessons }}</div>
{% endfor %}
</div>
<div class='column'>
<div class='header'>CZWARTEK</div>
{% for lessons in thrusday %}
<div class='item' style='height: 10%;'>{{ lessons }}</div>
{% endfor %}
</div>
<div class='column'>
<div class='header' style='background-color: #bcbcbc;'>PIĄTEK</div>
{% for lessons in friday %}
<div class='item' style='background-color: #bcbcbc; height: 10%;'>{{ lessons }}</div>
{% endfor %}
</div>
</div>
</div>
</body>
</html>

View file

@ -1,156 +0,0 @@
{% load static %}
{% load custom_filters_tags %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="{% static 'start.css' %}" type="text/css" />
<link rel="stylesheet" media="min-width: 768px" href="{% static 'start.css' %}" />
<script src="{% static 'js/start.js' %}"></script>
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<link rel="shortcut icon" href="{% static 'images/27146352.png' %}">
<link href="https://fonts.googleapis.com/css2?family=Lora:wght@500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&family=Quicksand:wght@300&display=swap" rel="stylesheet">
<title>Wulkanowy | Aplikacja ucznia i rodzica</title>
</head>
<body>
<div data-v-cd2b8d62 data-v-09be56d6 id="container">
<div id="menu">
<h1 data-v-cd2b8d62="" class="logo">
<img data-v-cd2b8d62 src="{% static 'images/wulkanowy-full-flat.4ff8222a.svg' %}" alt="Wulkanowy">
<a href="/uwagi/"><div id="uwagi" class="option">Uwagi</div></a>
<a href="/wiadomosci/"><div id="wiadomosci" class="option">Wiadomości</div></a>
<a href="/frekwencja/"><div id="frekwencja" class="option">Frekwencja</div></a>
<a href="/zadania/"><div id="zadania" class="option">Zadania Domowe</div></a>
<a href="/sprawdziany/"><div id="sprawdziany" class="option">Sprawdziany</div></a>
<a href="/plan/"><div id="plan" class="option">Plan Lekcji</div></a>
<a href="/oceny/"><div id="oceny" class="option">Oceny</div></a>
</h1>
</div>
<div class="content">
<div class='column' style='width: 20%;'>
<div class='header' style='background-color: #bcbcbc;'>PONIEDZIAŁEK</div>
{% for i in content %}
{% if i.0|simple_data == 'Brak Sprawdzianów' %}
<div class='item' style='background-color: #bcbcbc;'>Brak Sprawdzianów</div>
{% else %}
<div class='item' style='background-color: #bcbcbc;'>{% for x in i.0|simple_data %}
{% if x.0 == i.0.0.Przedmiot %}
{% if x.1 == 'Brak Opisu' %}
{{ x.0|force_escape }}<br /><span style="color: #d11204;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% else %}
{{ x.0|force_escape }}<br /><span style="color: green;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% endif %}
{% else %}
{% if x.1 == 'Brak Opisu' %}
<div class="line"></div>{{ x.0|force_escape }}<br /><span style="color: #d11204;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% else %}
<div class="line"></div>{{ x.0|force_escape }}<br /><span style="color: green;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% endif %}
{% endif %}
{% endfor %}</div>
{% endif %}
{% endfor %}
</div>
<div class='column' style='width: 20%;'>
<div class='header'>WTOREK</div>
{% for i in content %}
{% if i.1|simple_data == 'Brak Sprawdzianów' %}
<div class='item'>Brak Sprawdzianów</div>
{% else %}
<div class='item'>{% for x in i.1|simple_data %}
{% if x.0 == i.1.0.Przedmiot %}
{% if x.1 == 'Brak Opisu' %}
{{ x.0|force_escape }}<br /><span style="color: #d11204;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% else %}
{{ x.0|force_escape }}<br /><span style="color: green;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% endif %}
{% else %}
{% if x.1 == 'Brak Opisu' %}
<div class="line"></div>{{ x.0|force_escape }}<br /><span style="color: #d11204;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% else %}
<div class="line"></div>{{ x.0|force_escape }}<br /><span style="color: green;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% endif %}
{% endif %}
{% endfor %}</div>
{% endif %}
{% endfor %}
</div>
<div class='column' style='width: 20%;'>
<div class='header' style='background-color: #bcbcbc;'>ŚRODA</div>
{% for i in content %}
{% if i.2|simple_data == 'Brak Sprawdzianów' %}
<div class='item' style='background-color: #bcbcbc;'>Brak Sprawdzianów</div>
{% else %}
<div class='item' style='background-color: #bcbcbc;'>{% for x in i.2|simple_data %}
{% if x.0 == i.2.0.Przedmiot %}
{% if x.1 == 'Brak Opisu' %}
{{ x.0|force_escape }}<br /><span style="color: #d11204;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% else %}
{{ x.0|force_escape }}<br /><span style="color: green;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% endif %}
{% else %}
{% if x.1 == 'Brak Opisu' %}
<div class="line"></div>{{ x.0|force_escape }}<br /><span style="color: #d11204;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% else %}
<div class="line"></div>{{ x.0|force_escape }}<br /><span style="color: green;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% endif %}
{% endif %}
{% endfor %}</div>
{% endif %}
{% endfor %}
</div>
<div class='column' style='width: 20%;'>
<div class='header'>CZWARTEK</div>
{% for i in content %}
{% if i.3|simple_data == 'Brak Sprawdzianów' %}
<div class='item'>Brak Sprawdzianów</div>
{% else %}
<div class='item'>{% for x in i.3|simple_data %}
{% if x.0 == i.3.0.Przedmiot %}
{% if x.1 == 'Brak Opisu' %}
{{ x.0|force_escape }}<br /><span style="color: #d11204;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% else %}
{{ x.0|force_escape }}<br /><span style="color: green;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% endif %}
{% else %}
{% if x.1 == 'Brak Opisu' %}
<div class="line"></div>{{ x.0|force_escape }}<br /><span style="color: #d11204;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% else %}
<div class="line"></div>{{ x.0|force_escape }}<br /><span style="color: green;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% endif %}
{% endif %}
{% endfor %}</div>
{% endif %}
{% endfor %}
</div>
<div class='column' style='width: 20%;'>
<div class='header' style='background-color: #bcbcbc;'>PIĄTEK</div>
{% for i in content %}
{% if i.4|simple_data == 'Brak Sprawdzianów' %}
<div class='item' style='background-color: #bcbcbc;'>Brak Sprawdzianów</div>
{% else %}
<div class='item' style='background-color: #bcbcbc;'>{% for x in i.4|simple_data %}
{% if x.0 == i.4.0.Przedmiot %}
{% if x.0 == 'Brak Opisu' %}
{{ x.0|force_escape }}<br /><span style="color: #d11204;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% else %}
{{ x.0|force_escape }}<br /><span style="color: green;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% endif %}
{% else %}
{% if x.1 == 'Brak Opisu' %}
<div class="line"></div>{{ x.0|force_escape }}<br /><span style="color: #d11204;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% else %}
<div class="line"></div>{{ x.0|force_escape }}<br /><span style="color: green;"><i>{{ x.1|force_escape }}</i></span><br />{{ x.2|force_escape }}<br />
{% endif %}
{% endif %}
{% endfor %}</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
</body>
</html>

View file

@ -1,56 +0,0 @@
{% load static %}
{%load custom_filters_tags %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="{% static 'start.css' %}" type="text/css" />
<link rel="stylesheet" media="min-width: 768px" href="{% static 'start.css' %}" />
<script src="{% static 'js/start.js' %}"></script>
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<link rel="shortcut icon" href="{% static 'images/27146352.png' %}">
<link href="https://fonts.googleapis.com/css2?family=Lora:wght@500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&family=Quicksand:wght@300&display=swap" rel="stylesheet">
<title>Wulkanowy | Aplikacja ucznia i rodzica</title>
</head>
<body>
<div data-v-cd2b8d62 data-v-09be56d6 id="container">
<div id="menu">
<h1 data-v-cd2b8d62="" class="logo">
<img data-v-cd2b8d62 src="{% static 'images/wulkanowy-full-flat.4ff8222a.svg' %}" alt="Wulkanowy">
<a href="/uwagi/"><div id="uwagi" class="option">Uwagi</div></a>
<a href="/wiadomosci/"><div id="wiadomosci" class="option">Wiadomości</div></a>
<a href="/frekwencja/"><div id="frekwencja" class="option">Frekwencja</div></a>
<a href="/zadania/"><div id="zadania" class="option">Zadania Domowe</div></a>
<a href="/sprawdziany/"><div id="sprawdziany" class="option">Sprawdziany</div></a>
<a href="/plan/"><div id="plan" class="option">Plan Lekcji</div></a>
<a href="/oceny/"><div id="oceny" class="option">Oceny</div></a>
</h1>
</div>
<div class="content">
<div class='column' style='width: 50%;'>
<div class='header' style='background-color: #bcbcbc;'>UWAGI</div>
{% if notes.0.content == 'Brak uwag!' %}
<div class='item'>Brak uwag!</div>
{% else %}
{% for i in notes %}
<div class='item'>{{ i.content|force_escape }}<br /><i>{{ i.category|force_escape }}</i><br /><div class='line'></div>{{ i.date|force_escape }}<br />{{ i.teacher|force_escape }}<br /><span style='color: {{ i.points|points_color }}'>{{ i.points|suffix|force_escape }}</span><br /></div>
{% endfor %}
{% endif %}
</div>
<div class='column' style='width: 50%;'>
<div class='header' style='background-color: #bcbcbc;'>OSIĄGNIĘCIA</div>
{% if achievements.0.content == 'Brak osiągnięć!' %}
<div class='item'>Brak osiągnięć!</div>
{% else %}
{% for i in achievements %}
<div class='item'>{{ i.content|force_escape }}</div>
{% endfor %}
{% endif %}
</div>
</div>
</div>
</body>
</html>

View file

@ -1,47 +0,0 @@
{% load static %}
{% load custom_filters_tags %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="{% static 'start.css' %}" type="text/css" />
<link rel="stylesheet" media="min-width: 768px" href="{% static 'start.css' %}" />
<script src="{% static 'js/start.js' %}"></script>
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<link rel="shortcut icon" href="{% static 'images/27146352.png' %}">
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lora:wght@500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&family=Quicksand:wght@300&display=swap" rel="stylesheet">
<title>Wulkanowy | Aplikacja ucznia i rodzica</title>
</head>
<body>
<div data-v-cd2b8d62 data-v-09be56d6 id="container">
<div id="menu">
<h1 data-v-cd2b8d62="" class="logo">
<img data-v-cd2b8d62 src="{% static 'images/wulkanowy-full-flat.4ff8222a.svg' %}" alt="Wulkanowy">
<a href="/uwagi/"><div id="uwagi" class="option">Uwagi</div></a>
<a href="/wiadomosci/"><div id="wiadomosci" class="option">Wiadomości</div></a>
<a href="/frekwencja/"><div id="frekwencja" class="option">Frekwencja</div></a>
<a href="/zadania/"><div id="zadania" class="option">Zadania Domowe</div></a>
<a href="/sprawdziany/"><div id="sprawdziany" class="option">Sprawdziany</div></a>
<a href="/plan/"><div id="plan" class="option">Plan Lekcji</div></a>
<a href="/oceny/"><div id="oceny" class="option">Oceny</div></a>
</h1>
</div>
<div class="content" style='padding-top: 0;'>
<div id='buttons'>
<div id='received' onclick='change_message_content(this.id)' class='button'>ODEBRANE</div>
<div id='sent' onclick='change_message_content(this.id)' class='button'>WYSŁANE</div>
<div id='deleted' onclick='change_message_content(this.id)' class='button'>USUNIĘTE</div>
</div>
<div id='messages_content'>
{% for i in messages %}
<div class='message-item'><div class='message-block-left'>Temat: {{ i.Subject|force_escape }}<br />Nadawca: {{ i.Sender|force_escape }}</div><div class='message-block-right'>Data: {{ i.Date|force_escape }}</div></div>
{% endfor %}
</div>
</div>
</div>
</body>
</html>

View file

@ -1,120 +0,0 @@
{% load static %}
{% load custom_filters_tags %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="{% static 'start.css' %}" type="text/css" />
<link rel="stylesheet" media="min-width: 768px" href="{% static 'start.css' %}" />
<script src="{% static 'js/start.js' %}"></script>
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<link rel="shortcut icon" href="{% static 'images/27146352.png' %}">
<link href="https://fonts.googleapis.com/css2?family=Lora:wght@500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&family=Quicksand:wght@300&display=swap" rel="stylesheet">
<title>Wulkanowy | Aplikacja ucznia i rodzica</title>
</head>
<body>
<div data-v-cd2b8d62 data-v-09be56d6 id="container">
<div id="menu">
<h1 data-v-cd2b8d62="" class="logo">
<img data-v-cd2b8d62 src="{% static 'images/wulkanowy-full-flat.4ff8222a.svg' %}" alt="Wulkanowy">
<a href="/uwagi/"><div id="uwagi" class="option">Uwagi</div></a>
<a href="/wiadomosci/"><div id="wiadomosci" class="option">Wiadomości</div></a>
<a href="/frekwencja/"><div id="frekwencja" class="option">Frekwencja</div></a>
<a href="/zadania/"><div id="zadania" class="option">Zadania Domowe</div></a>
<a href="/sprawdziany/"><div id="sprawdziany" class="option">Sprawdziany</div></a>
<a href="/plan/"><div id="plan" class="option">Plan Lekcji</div></a>
<a href="/oceny/"><div id="oceny" class="option">Oceny</div></a>
</h1>
</div>
<div class="content">
<div class='column' style='width: 20%;'>
<div class='header' style='background-color: #bcbcbc;'>PONIEDZIAŁEK</div>
{% for i in 0|week_homework %}
<div class='item' style='background-color: #bcbcbc;'>
{% if i.0 == 'Brak zadań domowych na ten dzień' %}
Brak zadań domowych na ten dzień
{% else %}
{% for j in i %}
{% if j == i.0 %}
{{ j.Przedmiot }}<br /><div style='color: green;'><i>{{ j.Opis }}</i></div>{{ j.Data }}
{% else %}
<div class='line'></div>{{ j.Przedmiot }}<br /><div style='color: green;'><i>{{ j.Opis }}</i></div>{{ j.Data }}
{% endif %}
{% endfor %}
{% endif %}</div>
{% endfor %}
</div>
<div class='column' style='width: 20%;'>
<div class='header'>WTOREK</div>
{% for i in 1|week_homework %}
<div class='item'>
{% if i.0 == 'Brak zadań domowych na ten dzień' %}
Brak zadań domowych na ten dzień
{% else %}
{% for j in i %}
{% if j == i.0 %}
{{ j.Przedmiot }}<br /><div style='color: green;'><i>{{ j.Opis }}</i></div>{{ j.Data }}
{% else %}
<div class='line'></div>{{ j.Przedmiot }}<br /><div style='color: green;'><i>{{ j.Opis }}</i></div>{{ j.Data }}
{% endif %}
{% endfor %}
{% endif %}</div>
{% endfor %}
</div>
<div class='column' style='width: 20%;'>
<div class='header' style='background-color: #bcbcbc;'>ŚRODA</div>
{% for i in 2|week_homework %}
<div class='item' style='background-color: #bcbcbc;'>
{% if i.0 == 'Brak zadań domowych na ten dzień' %}
Brak zadań domowych na ten dzień
{% else %}
{% for j in i %}
{% if j == i.0 %}
{{ j.Przedmiot }}<br /><div style='color: green;'><i>{{ j.Opis }}</i></div>{{ j.Data }}
{% else %}
<div class='line'></div>{{ j.Przedmiot }}<br /><div style='color: green;'><i>{{ j.Opis }}</i></div>{{ j.Data }}
{% endif %}
{% endfor %}
{% endif %}</div>
{% endfor %}
</div>
<div class='column' style='width: 20%;'>
<div class='header'>CZWARTEK</div>
{% for i in 3|week_homework %}
<div class='item'>
{% if i.0 == 'Brak zadań domowych na ten dzień' %}
Brak zadań domowych na ten dzień
{% else %}
{% for j in i %}
{% if j == i.0 %}
{{ j.Przedmiot }}<br /><div style='color: green;'><i>{{ j.Opis }}</i></div>{{ j.Data }}
{% else %}
<div class='line'></div>{{ j.Przedmiot }}<br /><div style='color: green;'><i>{{ j.Opis }}</i></div>{{ j.Data }}
{% endif %}
{% endfor %}
{% endif %}</div>
{% endfor %}
</div>
<div class='column' style='width: 20%;'>
<div class='header' style='background-color: #bcbcbc;'>PIĄTEK</div>
{% for i in 4|week_homework %}
<div class='item' style='background-color: #bcbcbc;'>
{% if i.0 == 'Brak zadań domowych na ten dzień' %}
Brak zadań domowych na ten dzień
{% else %}
{% for j in i %}
{% if j == i.0 %}
{{ j.Przedmiot }}<br /><div style='color: green;'><i>{{ j.Opis }}</i></div>{{ j.Data }}
{% else %}
<div class='line'></div>{{ j.Przedmiot }}<br /><div style='color: green;'><i>{{ j.Opis }}</i></div>{{ j.Data }}
{% endif %}
{% endfor %}
{% endif %}</div>
{% endfor %}
</div>
</div>
</body>
</html>

View file

@ -1,6 +1,6 @@
from django.test import SimpleTestCase
from django.urls import reverse, resolve
from app.views import default_view, grades_view, timetable_view, exams_view, homework_view, attendance_view, messages_view, notes_view, change_messages_content
from app.views import default_view, content_view
from app.views import login
class TestUrls(SimpleTestCase):
@ -9,37 +9,9 @@ class TestUrls(SimpleTestCase):
url = reverse('home')
self.assertEquals(resolve(url).func, default_view)
def test_grades_is_resolved(self):
url = reverse('grades')
self.assertEquals(resolve(url).func, grades_view)
def test_timetable_is_resolved(self):
url = reverse('timetable')
self.assertEquals(resolve(url).func, timetable_view)
def test_exams_is_resolved(self):
url = reverse('exams')
self.assertEquals(resolve(url).func, exams_view)
def test_homework_is_resolved(self):
url = reverse('homework')
self.assertEquals(resolve(url).func, homework_view)
def test_attendance_is_resolved(self):
url = reverse('attendance')
self.assertEquals(resolve(url).func, attendance_view)
def test_messages_is_resolved(self):
url = reverse('messages')
self.assertEquals(resolve(url).func, messages_view)
def test_notes_is_resolved(self):
url = reverse('notes')
self.assertEquals(resolve(url).func, notes_view)
def test_cmc_is_resolved(self):
url = reverse('cmc')
self.assertEquals(resolve(url).func, change_messages_content)
def test_content_is_resolved(self):
url = reverse('content')
self.assertEquals(resolve(url).func, content_view)
#API
def test_login_is_resolved(self):

View file

@ -16,20 +16,13 @@ Including another URLconf
from django.urls import path
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from app.views import default_view, grades_view, timetable_view, exams_view, homework_view, attendance_view, messages_view, notes_view, change_messages_content
from app.views import default_view, content_view
from app.views import login
urlpatterns = [
#views
path('', default_view, name='home'),
path('oceny/', grades_view, name='grades'),
path('plan/', timetable_view, name='timetable'),
path('sprawdziany/', exams_view, name='exams'),
path('zadania/', homework_view, name='homework'),
path('frekwencja/', attendance_view, name='attendance'),
path('wiadomosci/', messages_view, name='messages'),
path('uwagi/', notes_view, name='notes'),
path('change_messages_content/', change_messages_content, name='cmc'),
path('content/', content_view, name='content'),
#api
path('api/login', login, name='login')
]