Merge version 3
This commit is contained in:
commit
0e47b590a3
@ -2,16 +2,12 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="b23c009e-2f8a-48f7-8b29-023f93596932" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/bestnotes/static/note.css" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bestnotes/templates/note.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bestnotes/templates/test.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bestnotes/templates/testid.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bestnotes/static/topics.css" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bestnotes/templates/topics.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/templates/subjects.html" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/templates/subjects.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" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4
bestnotes/static/topics.css
Normal file
4
bestnotes/static/topics.css
Normal file
@ -0,0 +1,4 @@
|
||||
.subjectname{
|
||||
text-decoration: none;
|
||||
color:white;
|
||||
}
|
@ -22,7 +22,7 @@
|
||||
<h4 class="text-white text-center" id="choose_subject_all">Wybierz przedmiot</h4>
|
||||
<ul class="list-group cProductsList mt-3" id="list_all">
|
||||
{% for subject in subjects %}
|
||||
<a href="/bestnotes/subject/{{ subject.id }}" id="{{ subject.name }}{{subject.id}}" class="list-group-item list-group-item-action">{{ subject.name }}</a>
|
||||
<a href="/bestnotes/topics_by_subject_id/{{ subject.id }}" id="{{ subject.name }}{{subject.id}}" class="list-group-item list-group-item-action">{{ subject.name }}</a>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
@ -31,7 +31,7 @@
|
||||
<h4 class="text-white text-center" id="choose_subject_yours">Wybierz przedmiot</h4>
|
||||
<ul class="list-group cProductsList mt-3" id="list_yours">
|
||||
{% for subject in student_subjects %}
|
||||
<a href="/bestnotes/subject/{{ subject.id }}" id="{{ subject.name }}{{subject.id}}" class="list-group-item list-group-item-action">{{ subject.name }}</a>
|
||||
<a href="/bestnotes/topics_by_subject_id/{{ subject.id }}" id="{{ subject.name }}{{subject.id}}" class="list-group-item list-group-item-action">{{ subject.name }}</a>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
25
bestnotes/templates/topics.html
Normal file
25
bestnotes/templates/topics.html
Normal file
@ -0,0 +1,25 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% block css %}
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'topics.css' %}">
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
{% include 'navbar.html' %}
|
||||
<div class="container d-flex justify-content-center">
|
||||
<div class="row mt-4"><h1 class="subjectname">{{subject_name}}</h1></div>
|
||||
</div>
|
||||
|
||||
<div class="container d-flex justify-content-center">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<h2 class="text-white text-center">Dostępne zagadnienia</h2>
|
||||
<ul class="list-group cProductsList mt-4">
|
||||
{% for topic in topics%}
|
||||
<a href="/bestnotes/notes_by_topic/{{ topic.id }}" class="list-group-item list-group-item-action">{{ topic.name }}</a>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
@ -9,6 +9,8 @@ urlpatterns = [
|
||||
path('subject/', views.subjects_all, name="subject"),
|
||||
path('subject/<id>', views.subject_id, name="subjectid"),
|
||||
path('note/<id>', views.note_id, name="note"),
|
||||
path('notes_by_topic/<topic_id>', views.notes_by_topic_id, name="notes"),
|
||||
path('topics_by_subject_id/<subject_id>', views.topics_by_subject_id, name="topics"),
|
||||
|
||||
path('notes/', views.notes_all, name="notes"),
|
||||
path('notes/<subject_id>', views.notes_name, name="notes_id")
|
||||
|
@ -1,5 +1,5 @@
|
||||
from django.shortcuts import render
|
||||
from bestnotes.models import Note,Subject
|
||||
from bestnotes.models import Note, Topic, Subject
|
||||
# Create your views here.
|
||||
|
||||
from django.http import HttpResponse
|
||||
@ -38,6 +38,32 @@ def notes_name(request,subject_id):
|
||||
#Change website here
|
||||
return render(request, "notes.html", context)
|
||||
|
||||
|
||||
def notes_by_topic_id(request,topic_id):
|
||||
all_notes = Note.objects.all()
|
||||
topic_notes = all_notes.filter(topic__id=topic_id) #Get all notes with given topic id
|
||||
context = {
|
||||
'notes' : topic_notes
|
||||
}
|
||||
#Change website here
|
||||
return render(request, "notes.html", context)
|
||||
|
||||
def topics_by_subject_id(request,subject_id):
|
||||
all_topics = Topic.objects.all()
|
||||
topics_under_subject = all_topics.filter(subject__id=subject_id) #get topics under given subject
|
||||
|
||||
if len(topics_under_subject) > 0:
|
||||
subject_name = all_topics[0].subject.name # Get note with given id
|
||||
|
||||
context = {
|
||||
'subject_name': subject_name,
|
||||
'topics': topics_under_subject
|
||||
}
|
||||
return render(request, "topics.html", context)
|
||||
else:
|
||||
return HttpResponse("Topics not found.")
|
||||
|
||||
|
||||
def notes_all(request):
|
||||
all_notes = Note.objects.all()
|
||||
context = {
|
||||
|
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
Loading…
Reference in New Issue
Block a user