Compare commits

...

2 Commits

Author SHA1 Message Date
ksanu
605648b6dc BES-28 Added simple homepage. 2019-12-02 00:14:10 +01:00
ksanu
57d469611d BES-29 Added backend logic and blank homepage. 2019-12-01 21:40:22 +01:00
37 changed files with 380 additions and 13 deletions

View File

@ -2,10 +2,27 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="b23c009e-2f8a-48f7-8b29-023f93596932" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/bestnotes/dbAPI.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/BestNotesProject/static/images/bg_notes.jpg" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/migrations/0002_subject_topic.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/static/bg_notes.jpg" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/static/homepage.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/static/laptop.jpg" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/static/laptop.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/static/login.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/static/navbar.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/static/subject.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/images/bg_notes.jpg" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/BestNotesProject/settings.py" beforeDir="false" afterPath="$PROJECT_DIR$/BestNotesProject/settings.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/BestNotesProject/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/BestNotesProject/urls.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/admin.py" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/admin.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/models.py" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/models.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/tests.py" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/tests.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/templates/homepage.html" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/templates/homepage.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/templates/navbar.html" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/templates/navbar.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/templates/profesor.html" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/templates/subjects.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/templates/przedmiot.html" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/templates/subject.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/urls.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/views.py" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/views.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/db.sqlite3" beforeDir="false" afterPath="$PROJECT_DIR$/db.sqlite3" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -14,10 +31,14 @@
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FavoritesManager">
<favorites_list name="BestNotes" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
<option value="HTML File" />
</list>
</option>
</component>
@ -32,10 +53,17 @@
<component name="ProjectId" id="1U5Jq3TEUnuX8tmyYK4OsXqAEBc" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="DefaultHtmlFileTemplate" value="HTML File" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/bestnotes" />
<property name="settings.editor.selected.configurable" value="preferences.general" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="E:\MojeDane\StudiaWMI\Semestr_2_Zimowy_2019-20\Systemy_informatyczne\merged_master\BestNotes\bestnotes" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
@ -49,7 +77,7 @@
</option>
</component>
<component name="RunManager">
<configuration name="Unittests in bestnotesunittests.py" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
<configuration name="Unittests in E:/MojeDane/StudiaWMI/Semestr_2_Zimowy_2019-20/Systemy_informatyczne/merged_master/BestNotes/bestnotes/bestnotesunittests.py" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
<module name="BestNotesProject" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
@ -65,7 +93,7 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python tests.Unittests in bestnotesunittests.py" />
<item itemvalue="Python tests.Unittests in E:/MojeDane/StudiaWMI/Semestr_2_Zimowy_2019-20/Systemy_informatyczne/merged_master/BestNotes/bestnotes/bestnotesunittests.py" />
</list>
</recent_temporary>
</component>

View File

@ -28,6 +28,11 @@ DEBUG = True
ALLOWED_HOSTS = []
STATIC_URL = '/static/'
#
LOGIN_REDIRECT_URL = '/bestnotes/'
LOGOUT_REDIRECT_URL = '/bestnotes/accounts/login/'
# Application definition
INSTALLED_APPS = [
@ -38,6 +43,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'widget_tweaks',
]
MIDDLEWARE = [

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -15,8 +15,10 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path, include
from bestnotes.views import homepage
urlpatterns = [
path('bestnotes/', include('bestnotes.urls')),
path('', homepage, name='homepage'),
path('admin/', admin.site.urls),
]

View File

@ -2,6 +2,8 @@ from django.contrib import admin
# Register your models here.
from django.contrib import admin
from .models import StudentProfile
from .models import StudentProfile, Subject, Topic
admin.site.register(StudentProfile)
admin.site.register(StudentProfile)
admin.site.register(Subject)
admin.site.register(Topic)

View File

@ -0,0 +1,31 @@
# Generated by Django 2.2.7 on 2019-12-01 22:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bestnotes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Subject',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=30)),
('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='bestnotes.StudentProfile')),
],
),
migrations.CreateModel(
name='Topic',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=30)),
('add_date', models.DateField()),
('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='bestnotes.Subject')),
],
),
]

View File

@ -33,4 +33,16 @@ def create_studentprofile(sender, instance, created, **kwargs):
@receiver(post_save, sender=User)
def save_studentprofile(sender, instance, **kwargs):
instance.studentprofile.save()
instance.studentprofile.save()
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()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

BIN
bestnotes/static/laptop.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
bestnotes/static/laptop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

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

@ -0,0 +1,29 @@
<!doctype html>
<html lang="pl">
{% load static %}
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="{% static 'navbar.css' %}">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
{% block css %}
{% endblock %}
<title>Best Notes</title>
</head>
<body>
{% block content %}
{% endblock %}
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>

View File

@ -0,0 +1,39 @@
{% extends 'base.html' %}
{% load static %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static 'homepage.css' %}">
{% endblock %}
{% block content %}
{% include 'navbar.html' %}
<div class="bg-secondary">
<div class="w-100 p-3 mb-2 text-white">
<div >
<img src="{% static 'bg_notes.jpg' %}" class="w-100 img-fluid"/>
</div>
</div>
<div>
<div class="w-25 d-flex justify-content-center">
<img src="{% static 'laptop.png' %}" class="img-fluid "/>
</div>
<div class="d-flex justify-content-center">
<h2>Stwórz najlepszą wersję mobilnych notatek</h2>
</div>
</div>
<div class="w-50 d-flex justify-content-center">
<div >
<h3>Dziel się notatkami ze znajomymi</h3>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,19 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="{% url 'homepage' %}">
<i class="fa fa-sticky-note logo"></i>
<strong>Best Notes</strong>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<ul class="navbar-nav collapse navbar-collapse" id="navbarNav">
<li class="nav-item nav-link active" ><a class="nolink" href="{% url 'homepage' %}">Strona główna</a> <span class="sr-only">(current)</span></li>
{% if user.is_authenticated %}
<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>
{% else %}
<li class="nav-item nav-link"><a class="nolink" href="{% url 'login' %}">Zaloguj się</a></li>
{% endif %}
</ul>
</nav>

View File

@ -0,0 +1,42 @@
{% extends 'base.html' %}
{% load widget_tweaks %}
{% load static %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static 'login.css' %}">
{% endblock %}
{% block content %}
{% include 'navbar.html' %}
<div class="container login-container">
<div class="row justify-content-md-center">
<div class="col-md-6 login-form-2">
<i class="fa fa-sticky-note-o fa-5x logo"> </i>
<h1><strong>Best Notes</strong></h1>
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
{% if form.errors %}
<p class="text-warning">Nieprawidłowy adres e-mail lub hasło. Spróbuj ponownie!</p>
{% endif %}
<div class="input-group mb-3">
<div class="input-group-prepend"><i class="input-group-text fa fa-envelope fa-lg"></i></div>
{% render_field form.username class="form-control" placeholder="Email"%}
</div>
<div class="input-group">
<div class="input-group-prepend"><i class="input-group-text fa fa-lock fa-lg"></i></div>
{% render_field form.password class="form-control" placeholder="Hasło"%}
</div>
<div class="form-group mt-3">
<input type="submit" class="btnSubmit" value="Login" />
</div>
</form>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,39 @@
{% extends 'base.html' %}
{% load static %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static 'subject.css' %}">
{% endblock %}
{% block content %}
{% include 'navbar.html' %}
<div class="container d-flex justify-content-center">
<div class="row mt-4"><h1>{{id}}</h1></div>
</div>
<div class="container">
<div class="d-flex justify-content-center mt-5">
<h3>Dodaj nowe zagadnienie</h3>
</div>
<div class="d-flex justify-content-center mt-3">
<form role="form">
<input type="text" class="form-control" placeholder="Nowe zagadnienie" name="przedmiot">
</form>
<button type="button" class="btn btn btn-primary ml-1">Dodaj</button>
</div>
<div class="d-flex justify-content-center mt-5">
<h3>Lista zagadnień</h3>
</div>
<a class="row justify-content-center">Liczba dostępnych zagadnień: 3/15</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">1. Podstawy sztucznej inteligencji</p>
<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">2. Jak dziala regresja liniowa</p>
<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">3. Regresja liniowa, a logistyczna</p>
<button class="btn-success mr-1">Edytuj</button> <button class="btn-danger">Usuń</button>
</li>
</ul>
</div>
{% endblock %}

View File

@ -0,0 +1,50 @@
{% extends 'base.html' %}
{% load static %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static 'profesor.css' %}">
{% endblock %}
{% block content %}
{% if user.is_authenticated %}
{% include 'navbar.html' %}
<div class="container">
<div class="d-flex justify-content-center mt-5">
<h3>Dodaj nowy przedmiot</h3>
</div>
<div class="d-flex justify-content-center mt-3">
<form role="form">
<input type="text" class="form-control" placeholder="Nowy przedmiot" name="przedmiot">
</form>
<button type="button" class="btn btn btn-primary ml-1">Dodaj</button>
</div>
<div class="d-flex justify-content-center mt-5">
<h3>Lista przedmiotów</h3>
</div>
<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="/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="/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="/bestnotes/subject/Programowanie">Zarządzaj</a></button>
<button class="btn-success mr-1">Edytuj</button>
<button class="btn-danger">Usuń</button>
</li>
</ul>
</div>
{% else %}
<a href="{% url 'login' %}">Zaloguj sie</a>
{% endif %}
{% endblock %}

View File

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

View File

@ -4,5 +4,13 @@ from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return HttpResponse("BestNotes' index will be here.")
def homepage(request):
#return HttpResponse("BestNotes' index will be here.")
return render(request, "homepage.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.

BIN
images/bg_notes.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB