BES-65 Usunięcie mozliwosci logowania ze strony logowania
This commit is contained in:
parent
d123241d1c
commit
269cda217d
@ -2,12 +2,10 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="b23c009e-2f8a-48f7-8b29-023f93596932" name="Default Changelist" comment="">
|
<list default="true" id="b23c009e-2f8a-48f7-8b29-023f93596932" name="Default Changelist" comment="">
|
||||||
<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$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/templates/registration/login.html" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/templates/registration/login.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$/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>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@ -36,7 +34,7 @@
|
|||||||
<component name="PropertiesComponent">
|
<component name="PropertiesComponent">
|
||||||
<property name="DefaultHtmlFileTemplate" value="HTML File" />
|
<property name="DefaultHtmlFileTemplate" value="HTML File" />
|
||||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
<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-BES-55/bestnotes" />
|
||||||
<property name="settings.editor.selected.configurable" value="preferences.general" />
|
<property name="settings.editor.selected.configurable" value="preferences.general" />
|
||||||
</component>
|
</component>
|
||||||
<component name="RunDashboard">
|
<component name="RunDashboard">
|
||||||
|
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.
@ -6,14 +6,31 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% include 'navbar.html' %}
|
<nav class="navbar navbar-expand-lg navbar-dark">
|
||||||
|
<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 id="home" class="nav-item nav-link"><a class="nolink" href="{% url 'homepage' %}"><i class="fa fa-home fa-2x"></a></i></li>
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<li id="add_note" class="nav-item nav-link"><a class="nolink" href="{% url 'add' %}"><i class="fa fa-pencil-square-o fa-2x"></a></i></li>
|
||||||
|
<li id="all_subjects" class="nav-item nav-link active"><a class="nolink" href="{% url 'subject' %}"><i class="fa fa-list-ul fa-2x"></i></a></li>
|
||||||
|
<li id="logout" class="nav-item nav-link"><a class="nolink" href="{% url 'logout' %}"><i class="fa fa-sign-out fa-2x"></i></a></li>
|
||||||
|
{% else %}
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
<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">
|
||||||
<i class="fa fa-sticky-note-o fa-5x logo"> </i>
|
<i class="fa fa-sticky-note-o fa-5x logo"> </i>
|
||||||
<h1><strong>Best Notes</strong></h1>
|
<h1><strong>Best Notes</strong></h1>
|
||||||
<form method="post" action="{% url 'login' %}">
|
<form method="post" action="{% url 'login' %}?next={{ request.GET.next }}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
{% for hidden in form.hidden_fields %}
|
{% for hidden in form.hidden_fields %}
|
||||||
|
@ -5,22 +5,27 @@ from .forms import EditorForm
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
|
||||||
def homepage(request):
|
def homepage(request):
|
||||||
#return HttpResponse("BestNotes' index will be here.")
|
#return HttpResponse("BestNotes' index will be here.")
|
||||||
return render(request, "homepage.html", {})
|
return render(request, "homepage.html", {})
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
def add(request):
|
def add(request):
|
||||||
form = EditorForm()
|
form = EditorForm()
|
||||||
return render(request, "add.html", {"form": form})
|
return render(request, "add.html", {"form": form})
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
def subject(request):
|
def subject(request):
|
||||||
return render(request, "subjects.html", {})
|
return render(request, "subjects.html", {})
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
def subject_id(request,id):
|
def subject_id(request,id):
|
||||||
return render(request, "subject.html", {'id': id})
|
return render(request, "subject.html", {'id': id})
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
def note_id(request,id):
|
def note_id(request,id):
|
||||||
all_notes = Note.objects.all()
|
all_notes = Note.objects.all()
|
||||||
notes = all_notes.filter(id=id)
|
notes = all_notes.filter(id=id)
|
||||||
@ -34,6 +39,7 @@ def note_id(request,id):
|
|||||||
return HttpResponse("Note not found.")
|
return HttpResponse("Note not found.")
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
#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_id):
|
def notes_name(request,subject_id):
|
||||||
all_notes = Note.objects.all()
|
all_notes = Note.objects.all()
|
||||||
@ -45,6 +51,7 @@ def notes_name(request,subject_id):
|
|||||||
return render(request, "notes.html", context)
|
return render(request, "notes.html", context)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
def notes_by_topic_id(request,topic_id):
|
def notes_by_topic_id(request,topic_id):
|
||||||
all_notes = Note.objects.all()
|
all_notes = Note.objects.all()
|
||||||
topic_notes = all_notes.filter(topic__id=topic_id) #Get all notes with given topic id
|
topic_notes = all_notes.filter(topic__id=topic_id) #Get all notes with given topic id
|
||||||
@ -54,6 +61,7 @@ def notes_by_topic_id(request,topic_id):
|
|||||||
#Change website here
|
#Change website here
|
||||||
return render(request, "notes.html", context)
|
return render(request, "notes.html", context)
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
def topics_by_subject_id(request,subject_id):
|
def topics_by_subject_id(request,subject_id):
|
||||||
all_topics = Topic.objects.all()
|
all_topics = Topic.objects.all()
|
||||||
topics_under_subject = all_topics.filter(subject__id=subject_id) #get topics under given subject
|
topics_under_subject = all_topics.filter(subject__id=subject_id) #get topics under given subject
|
||||||
@ -70,6 +78,7 @@ def topics_by_subject_id(request,subject_id):
|
|||||||
return HttpResponse("Topics not found.")
|
return HttpResponse("Topics not found.")
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
def notes_all(request):
|
def notes_all(request):
|
||||||
all_notes = Note.objects.all()
|
all_notes = Note.objects.all()
|
||||||
context = {
|
context = {
|
||||||
@ -77,6 +86,7 @@ def notes_all(request):
|
|||||||
}
|
}
|
||||||
return render(request, "test.html", context)
|
return render(request, "test.html", context)
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
def subjects_all(request):
|
def subjects_all(request):
|
||||||
all_subjects = Subject.objects.all()
|
all_subjects = Subject.objects.all()
|
||||||
student_notes = Note.objects.all().filter(user__user__id=request.user.id)
|
student_notes = Note.objects.all().filter(user__user__id=request.user.id)
|
||||||
@ -89,6 +99,7 @@ def subjects_all(request):
|
|||||||
}
|
}
|
||||||
return render(request, "subjects.html", context)
|
return render(request, "subjects.html", context)
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
def create_note(request):
|
def create_note(request):
|
||||||
form = EditorForm(request.POST)
|
form = EditorForm(request.POST)
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
@ -123,6 +134,7 @@ def create_note(request):
|
|||||||
url = reverse('subject')
|
url = reverse('subject')
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
def delete_note(request, note_id):
|
def delete_note(request, note_id):
|
||||||
#Get values
|
#Get values
|
||||||
note = Note.objects.get(pk=note_id)
|
note = Note.objects.get(pk=note_id)
|
||||||
@ -137,6 +149,7 @@ def delete_note(request, note_id):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
#Update note view html
|
#Update note view html
|
||||||
def update_note(request, note_id):
|
def update_note(request, note_id):
|
||||||
|
|
||||||
@ -152,6 +165,7 @@ def update_note(request, note_id):
|
|||||||
}
|
}
|
||||||
return render(request, "update.html", context)
|
return render(request, "update.html", context)
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
def update_note_id(request, note_id):
|
def update_note_id(request, note_id):
|
||||||
note = Note.objects.get(pk=note_id)
|
note = Note.objects.get(pk=note_id)
|
||||||
form = EditorForm(request.POST)
|
form = EditorForm(request.POST)
|
||||||
@ -184,6 +198,7 @@ def update_note_id(request, note_id):
|
|||||||
url = reverse('note', args=[note_id])
|
url = reverse('note', args=[note_id])
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
@login_required(login_url='/bestnotes/accounts/login/')
|
||||||
def delete_empty_categories():
|
def delete_empty_categories():
|
||||||
#Get all topics
|
#Get all topics
|
||||||
topics = Topic.objects.all()
|
topics = Topic.objects.all()
|
||||||
|
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
Loading…
Reference in New Issue
Block a user