BES-38 Merged Homepage(BES-28_29) with master

This commit is contained in:
ksanu 2019-12-07 17:00:49 +01:00
parent c120a9d1d1
commit 16f0e52ff9
30 changed files with 113 additions and 25 deletions

View File

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

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.contrib import admin
from django.urls import path, include from django.urls import path, include
from bestnotes.views import homepage
urlpatterns = [ urlpatterns = [
path('bestnotes/', include('bestnotes.urls')), path('bestnotes/', include('bestnotes.urls')),
path('', homepage, name='homepage'),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
] ]

View File

@ -2,6 +2,8 @@ from django.contrib import admin
# Register your models here. # Register your models here.
from django.contrib import admin 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

@ -20,14 +20,6 @@ class StudentProfile(models.Model):
""" """
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()
@ -42,3 +34,15 @@ def create_studentprofile(sender, instance, created, **kwargs):
@receiver(post_save, sender=User) @receiver(post_save, sender=User)
def save_studentprofile(sender, instance, **kwargs): 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

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

@ -1,5 +1,5 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-primary"> <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="#"> <a class="navbar-brand" href="{% url 'homepage' %}">
<i class="fa fa-sticky-note logo"></i> <i class="fa fa-sticky-note logo"></i>
<strong>Best Notes</strong> <strong>Best Notes</strong>
</a> </a>
@ -7,10 +7,13 @@
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<ul class="navbar-nav collapse navbar-collapse" id="navbarNav"> <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> <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 %} {% 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 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> <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 %} {% endif %}
</ul> </ul>
</nav> </nav>

View File

@ -5,6 +5,9 @@
<link rel="stylesheet" type="text/css" href="{% static 'login.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'login.css' %}">
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% include 'navbar.html' %}
<div class="container login-container"> <div class="container login-container">
<div class="row justify-content-md-center"> <div class="row justify-content-md-center">
<div class="col-md-6 login-form-2"> <div class="col-md-6 login-form-2">

View File

@ -1,6 +1,8 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load static %} {% load static %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static 'subject.css' %}">
{% endblock %}
{% block content %} {% block content %}
{% include 'navbar.html' %} {% include 'navbar.html' %}
<div class="container d-flex justify-content-center"> <div class="container d-flex justify-content-center">

View File

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

View File

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

Binary file not shown.