From 1b7dcdaf5f4f2e908dc424f37e564c89751632e8 Mon Sep 17 00:00:00 2001 From: Th3NiKo Date: Fri, 13 Dec 2019 12:20:11 +0100 Subject: [PATCH] BES-49 Change subjects website look, add IDs for testing, add buttons in note by id --- bestnotes/templates/homepage.html | 16 ++++----- bestnotes/templates/navbar.html | 10 +++--- bestnotes/templates/note.html | 9 +++-- bestnotes/templates/notes.html | 26 +++++++-------- bestnotes/templates/subjects.html | 53 ++++++++++++++---------------- bestnotes/urls.py | 2 +- bestnotes/views.py | 16 +++++++-- db.sqlite3 | Bin 172032 -> 172032 bytes 8 files changed, 72 insertions(+), 60 deletions(-) diff --git a/bestnotes/templates/homepage.html b/bestnotes/templates/homepage.html index 075aad7..7345ccc 100644 --- a/bestnotes/templates/homepage.html +++ b/bestnotes/templates/homepage.html @@ -16,20 +16,20 @@
-
- +
+
-
-

Stwórz najlepszą wersję mobilnych notatek

+
+

Stwórz najlepszą wersję mobilnych notatek

-
-

Dziel się notatkami ze znajomymi

+
+

Dziel się notatkami ze znajomymi

-
- +
+
diff --git a/bestnotes/templates/navbar.html b/bestnotes/templates/navbar.html index 7d611e8..66aae13 100644 --- a/bestnotes/templates/navbar.html +++ b/bestnotes/templates/navbar.html @@ -7,13 +7,13 @@ \ No newline at end of file diff --git a/bestnotes/templates/note.html b/bestnotes/templates/note.html index 4f650d7..f47b445 100644 --- a/bestnotes/templates/note.html +++ b/bestnotes/templates/note.html @@ -6,12 +6,17 @@ {% block content %} {% include 'navbar.html' %}
-

Tytuł: {{ note.name }}

+

Tytuł: {{ note.name }}

+{% if note.user.user.id == user.id %} +
+
+
+{% endif %}
-

{{ note.text }}

+

{{ note.text }}

diff --git a/bestnotes/templates/notes.html b/bestnotes/templates/notes.html index 07e3ca6..7a87026 100644 --- a/bestnotes/templates/notes.html +++ b/bestnotes/templates/notes.html @@ -11,23 +11,23 @@
-
-

Dostępne notatki

-
    - {% for note in notes%} +
    +

    Dostępne notatki

    +
    -
    -

    Twoje notatki

    -
      - {% for note in notes%} - {% if user.id == note.user.user.id %} - {{ note.name }} - {% endif %} +
      +

      Twoje notatki

      +
        + {% for note in notes %} + {% if user.id == note.user.user.id %} + {{ note.name }} + {% endif %} {% endfor %}
      diff --git a/bestnotes/templates/subjects.html b/bestnotes/templates/subjects.html index b4872e8..a9f3829 100644 --- a/bestnotes/templates/subjects.html +++ b/bestnotes/templates/subjects.html @@ -10,37 +10,32 @@ {% include 'navbar.html' %} -
      -
      -

      Dodaj nowy przedmiot

      +
      +
      + +
      +
      +
      +
      +
      +

      Dostępne notatki

      +

      Wybierz przedmiot

      + +
      +
      +

      Twoje notatki

      +

      Wybierz przedmiot

      +
      -
      -
      - -
      -
      -
      -

      Lista przedmiotów

      -
      - Liczba dostępnych przedmiotów: 3/5 -
        -
      • Programowanie

        - - - -
      • -
      • Matematyka

        - - - -
      • -
      • Systemy informatyczne

        - - - -
      • -
      {% else %} diff --git a/bestnotes/urls.py b/bestnotes/urls.py index e57149e..a828b86 100644 --- a/bestnotes/urls.py +++ b/bestnotes/urls.py @@ -6,7 +6,7 @@ urlpatterns = [ path('', views.homepage, name='homepage'), #path('/', views.login), path('accounts/', include("django.contrib.auth.urls")), - path('subject/', views.subject, name="subject"), + path('subject/', views.subjects_all, name="subject"), path('subject/', views.subject_id, name="subjectid"), path('note/', views.note_id, name="note"), diff --git a/bestnotes/views.py b/bestnotes/views.py index 83d7720..4ec5b8c 100644 --- a/bestnotes/views.py +++ b/bestnotes/views.py @@ -1,5 +1,5 @@ from django.shortcuts import render -from bestnotes.models import Note +from bestnotes.models import Note,Subject # Create your views here. from django.http import HttpResponse @@ -43,4 +43,16 @@ def notes_all(request): context = { 'notes' : all_notes } - return render(request, "test.html", context) \ No newline at end of file + return render(request, "test.html", context) + +def subjects_all(request): + all_subjects = Subject.objects.all() + student_notes = Note.objects.all().filter(user__user__id=request.user.id) + student_subjects = [] + for note in student_notes: + student_subjects.append(note.topic.subject) + context = { + 'subjects' : all_subjects, + 'student_subjects': student_subjects + } + return render(request, "subjects.html", context) \ No newline at end of file diff --git a/db.sqlite3 b/db.sqlite3 index b11f4b3a4604b0d61f990b7eaca89481650a5ca8..4b0ddabd817cd0c2b268f31494eb94ec54c48250 100644 GIT binary patch delta 261 zcmZoTz}0YoYl1Xm(nJ|&#-xo2OX3CCIC>cP4)L~db8w#GapUOOY$#B{q0wZ`&g$F3 z>S&N*WLTb8VUn9wTxecaWteQ3nw^xCY?hH+X=YwrQNGzAo0U<}Ou^95%Fx`(#8l7R z+|gPZeq{!J<;@%glKiSF%)X3-3}fHyQD31TWN3tBoSB)Wsb%w}`P(ne zXEX{BVB>dZ;D5w_n7@@jjeiNh`)0ugV}4~hW=BRN14Bz)LnB=y49Bp8q$j`2lG@(# IpRr~E0Ir=%K>z>% delta 125 zcmV-@0D}L3zzTrC3XmHCUXdI_0ba3Sq+bpN3CaKt!VQEA2noszMzb*xxCyh$X*vc3 z1rJC7vkGt-50RiJvq*n