Add notes listing html connected with backend
This commit is contained in:
parent
cfb9840d1a
commit
587aec09bc
37
bestnotes/templates/notes.html
Normal file
37
bestnotes/templates/notes.html
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{% 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="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<h2>Dostępne notatki</h2>
|
||||||
|
<ul class="list-group cProductsList mt-3">
|
||||||
|
{% for note in notes%}
|
||||||
|
{% if user.id != note.user.user.id %}
|
||||||
|
<a href="/bestnotes/note/{{ note.id }}" class="list-group-item list-group-item-action">{{ note.name }}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<h2>Twoje notatki</h2>
|
||||||
|
<ul class="list-group cProductsList mt-3">
|
||||||
|
{% for note in notes%}
|
||||||
|
{% if user.id == note.user.user.id %}
|
||||||
|
<a href="/bestnotes/note/{{ note.id }}" class="list-group-item list-group-item-action">{{ note.name }}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -25,18 +25,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<a class="row justify-content-center">Liczba dostępnych przedmiotów: 3/5</a>
|
<a class="row justify-content-center">Liczba dostępnych przedmiotów: 3/5</a>
|
||||||
<ul class="list-group cProductsList mt-3">
|
<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>
|
<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/Sztuczna inteligencja">Zarządzaj</a></button>
|
<button class="btn-primary mr-1" ><a class="nolink" href="/bestnotes/notes/1">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">Matematyka</p>
|
||||||
|
<button class="btn-primary mr-1"><a class="nolink" href="/bestnotes/notes/2">Zarządzaj</a></button>
|
||||||
<button class="btn-success mr-1">Edytuj</button>
|
<button class="btn-success mr-1">Edytuj</button>
|
||||||
<button class="btn-danger">Usuń</button>
|
<button class="btn-danger">Usuń</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item d-sm-flex justify-content-between"><p class="p-0 m-0 flex-grow-1">Systemy informatyczne</p>
|
<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-primary mr-1"><a class="nolink" href="/bestnotes/notes/3">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-success mr-1">Edytuj</button>
|
||||||
<button class="btn-danger">Usuń</button>
|
<button class="btn-danger">Usuń</button>
|
||||||
</li>
|
</li>
|
||||||
|
@ -11,5 +11,5 @@ urlpatterns = [
|
|||||||
path('note/<id>', views.note_id, name="note"),
|
path('note/<id>', views.note_id, name="note"),
|
||||||
|
|
||||||
path('notes/', views.notes_all, name="notes"),
|
path('notes/', views.notes_all, name="notes"),
|
||||||
path('notes/<subject_name>', views.notes_name, name="notes_name")
|
path('notes/<subject_id>', views.notes_name, name="notes_id")
|
||||||
]
|
]
|
||||||
|
@ -29,14 +29,14 @@ def note_id(request,id):
|
|||||||
|
|
||||||
|
|
||||||
#Give all notes connected with subject name and pass it to html
|
#Give all notes connected with subject name and pass it to html
|
||||||
def notes_name(request,subject_name):
|
def notes_name(request,subject_id):
|
||||||
all_notes = Note.objects.all()
|
all_notes = Note.objects.all()
|
||||||
subject_notes = all_notes.filter(topic__subject__name=subject_name) #Get all notes with subject name
|
subject_notes = all_notes.filter(topic__subject__id=subject_id) #Get all notes with subject name
|
||||||
context = {
|
context = {
|
||||||
'notes' : subject_notes
|
'notes' : subject_notes
|
||||||
}
|
}
|
||||||
#Change website here
|
#Change website here
|
||||||
return render(request, "test.html", context)
|
return render(request, "notes.html", context)
|
||||||
|
|
||||||
def notes_all(request):
|
def notes_all(request):
|
||||||
all_notes = Note.objects.all()
|
all_notes = Note.objects.all()
|
||||||
|
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
Loading…
Reference in New Issue
Block a user