BES-27 Basic files merge, login works

This commit is contained in:
Th3NiKo 2019-11-28 11:26:30 +01:00
parent eff2492c4c
commit cb3440b52f
15 changed files with 179 additions and 20 deletions

92
.gitignore vendored
View File

@ -4,4 +4,94 @@
/test/allure-results/*.log
/test/allure-results/*.json
/test/screenshots/*.png
/allure-report/
/allure-report/
# Created by https://www.gitignore.io
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
*.pot
# Sphinx documentation
docs/_build/
# PyBuilder
target/
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
.env
db.sqlite3

View File

@ -38,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'widget_tweaks'
]
MIDDLEWARE = [
@ -119,3 +120,6 @@ USE_TZ = True
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = '/static/'
LOGIN_REDIRECT_URL = '/bestnotes/subject/' #To change, at this moment we have no home site
LOGOUT_REDIRECT_URL = '/bestnotes/accounts/login'

View File

@ -1,11 +0,0 @@
from django.db import models
#Klasa opisująca zagadnienie dla danego przedmiotu
class Zagadnienie(models.Model):
nazwa = models.CharField(max_length=30)
przedmiot = models.ForeignKey(Przedmiot, on_delete=models.CASCADE)
data_dodania = models.DateField()
class Przedmiot(models.Model):
nazwa = models.CharField(max_length=30)
#uzytkownik_id = models.ForeignKey(User, on_delete=models.CASCADE)

View File

@ -18,9 +18,17 @@ class StudentProfile(models.Model):
to add as foreign key, when coresponding table is added:
CourseId
"""
class Subject(models.Model):
name = models.CharField(max_length=30)
student = models.ForeignKey(StudentProfile, on_delete=models.CASCADE)
class Topic(models.Model):
name = models.CharField(max_length=30)
subject = models.ForeignKey(Subject, on_delete=models.CASCADE)
add_date = models.DateField()

View File

@ -0,0 +1,47 @@
.login-container{
margin-top: 5%;
text-align: center;
}
.logo{
color:white;
margin-bottom: 5%;
}
.login-form-2{
border-radius: 5%;
padding: 5%;
background: #0062cc;
box-shadow: 0 5px 8px 0 rgba(0, 0, 0, 0.2), 0 9px 26px 0 rgba(0, 0, 0, 0.19);
}
.input-group-text{
font-size: 1.5rem;
min-width: 50px;
}
.icon{
text-align: center;
}
.login-form-2 h1{
text-align: center;
color: #fff;
}
.login-container form{
padding: 8%;
}
.btnSubmit
{
width: 50%;
border-radius: 1rem;
padding: 1.5%;
border: none;
cursor: pointer;
}
.login-form-2 .btnSubmit{
font-weight: 600;
color: #0062cc;
background-color: #fff;
}

View File

@ -0,0 +1,9 @@
.nolink{
text-decoration: none;
color:white;
}
.nolink:hover{
text-decoration: none;
color:white;
}

View File

View File

@ -9,7 +9,7 @@
<ul class="navbar-nav collapse navbar-collapse" id="navbarNav">
<li class="nav-item nav-link" href="#">Strona główna <span class="sr-only">(current)</span></li>
{% if user.is_authenticated %}
<li class="nav-item nav-link active"><a class="nolink" href="{% url 'profesor' %}">Przedmioty</a></li>
<li class="nav-item nav-link active"><a class="nolink" href="{% url 'subject' %}">Przedmioty</a></li>
<li class="nav-item nav-link"><a class="nolink" href="{% url 'logout' %}">Wyloguj się</a></li>
{% endif %}
</ul>

View File

@ -26,17 +26,17 @@
<a class="row justify-content-center">Liczba dostępnych przedmiotów: 3/5</a>
<ul class="list-group cProductsList mt-3">
<li class="list-group-item d-sm-flex justify-content-between"><p class="p-0 m-0 flex-grow-1">Sztuczna inteligencja</p>
<button class="btn-primary mr-1" ><a class="nolink" href="/profesor/Sztuczna inteligencja">Zarządzaj</a></button>
<button class="btn-primary mr-1" ><a class="nolink" href="/bestnotes/subject/Sztuczna inteligencja">Zarządzaj</a></button>
<button class="btn-success mr-1">Edytuj</button>
<button class="btn-danger">Usuń</button>
</li>
<li class="list-group-item d-sm-flex justify-content-between"><p class="p-0 m-0 flex-grow-1">Systemy informatyczne</p>
<button class="btn-primary mr-1"><a class="nolink" href="/profesor/Systemy informatyczne">Zarządzaj</a></button>
<button class="btn-primary mr-1"><a class="nolink" href="/bestnotes/subject/Systemy informatyczne">Zarządzaj</a></button>
<button class="btn-success mr-1">Edytuj</button>
<button class="btn-danger">Usuń</button>
</li>
<li class="list-group-item d-sm-flex justify-content-between"><p class="p-0 m-0 flex-grow-1">Programowanie</p>
<button class="btn-primary mr-1"><a class="nolink" href="/profesor/Programowanie">Zarządzaj</a></button>
<button class="btn-primary mr-1"><a class="nolink" href="/bestnotes/subject/Programowanie">Zarządzaj</a></button>
<button class="btn-success mr-1">Edytuj</button>
<button class="btn-danger">Usuń</button>
</li>

View File

@ -1,7 +1,10 @@
from django.urls import path
from django.urls import path, include
from . import views
urlpatterns = [
path('', views.index, name='index')
path('', views.index, name='index'),
path('accounts/', include("django.contrib.auth.urls")),
path('subject/', views.subject, name="subject"),
path('subject/<id>', views.subject_id, name="subjectid"),
]

View File

@ -5,4 +5,13 @@ from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return HttpResponse("BestNotes' index will be here.")
return HttpResponse("BestNotes' index will be here.")
def login(request):
return render(request, "login.html", {})
def subject(request):
return render(request, "subjects.html", {})
def subject_id(request,id):
return render(request, "subject.html", {'id': id})

Binary file not shown.