+
+
+
+
+{% endblock content %}
-{% endblock content %}
\ No newline at end of file
diff --git a/accounts_app/views/invite_user.py b/accounts_app/views/invite_user.py
index 40eb85f..ef5c4c0 100644
--- a/accounts_app/views/invite_user.py
+++ b/accounts_app/views/invite_user.py
@@ -1,20 +1,21 @@
from django.shortcuts import render
from django.views import View
from django.contrib.auth.mixins import LoginRequiredMixin
-
from accounts_app.forms import InviteUserForm
from accounts_app.models import UserInvitation
class InviteUserView(LoginRequiredMixin, View):
def get(self, request, *args, **kwargs):
- # This would be the view where the invited user can join.
- # Here we have to check if the provided token points to an invitation which is valid and not expired.
- ...
+ # Instantiate the form for the GET request
+ form = InviteUserForm()
+
+ # Render the template and pass the form to the context
+ return render(request, "accounts_app/profile.html", {"inviteForm": form})
def post(self, request, *args, **kwargs):
form = InviteUserForm(request.POST)
-
+
if form.is_valid():
# We could further improve this here to first check if an invitation for this email already exists and is not expired
UserInvitation.objects.filter(email=form.cleaned_data["email"]).delete()
@@ -24,6 +25,6 @@ def post(self, request, *args, **kwargs):
invitation.send_invitation_email()
- return render(request, "accounts_app/profile.html", {"invite_user_form": form, "invited": True})
+ return render(request, "accounts_app/profile.html", {"inviteForm": form, "invited": True})
else:
- return render(request, "accounts_app/profile.html", {"invite_user_form": form})
\ No newline at end of file
+ return render(request, "accounts_app/profile.html", {"inviteForm": form})
\ No newline at end of file
diff --git a/accounts_app/views/profile.py b/accounts_app/views/profile.py
index ec8b6f0..bf84428 100644
--- a/accounts_app/views/profile.py
+++ b/accounts_app/views/profile.py
@@ -1,4 +1,4 @@
-from django.shortcuts import render
+from django.shortcuts import render, redirect
from django.views import View
from django.contrib.auth.mixins import LoginRequiredMixin
@@ -8,12 +8,11 @@
class ProfileView(LoginRequiredMixin, View):
def get(self, request, *args, **kwargs):
return render(request, "accounts_app/profile.html", {"form": EditUserForm(instance=request.user), "invite_user_form": InviteUserForm() })
-
def post(self, request, *args, **kwargs):
form = EditUserForm(request.POST, instance=request.user)
invite_user_form = InviteUserForm()
-
if form.is_valid():
form.save()
-
- return render(request, "accounts_app/profile.html", {"form": form, "invite_user_form": invite_user_form})
\ No newline at end of file
+ return redirect('home')
+ return render(request, "accounts_app/profile.html", {"form": form, "invite_user_form": invite_user_form})
+
diff --git a/accounts_app/views/sign_in.py b/accounts_app/views/sign_in.py
index b908f91..7d5a07d 100644
--- a/accounts_app/views/sign_in.py
+++ b/accounts_app/views/sign_in.py
@@ -3,10 +3,8 @@
from django.contrib import messages
from django.contrib.auth import login, authenticate
from django.utils.translation import gettext as _
-
-
from accounts_app.forms import SignInForm
-
+from accounts_app.forms import InviteUserForm
def sign_in(request: HttpRequest) -> HttpResponse:
if request.method == "GET":
@@ -14,7 +12,8 @@ def sign_in(request: HttpRequest) -> HttpResponse:
return redirect("home")
form = SignInForm()
- return render(request, "accounts_app/sign_in.html", {"form": form})
+ inviteForm = InviteUserForm() #I've added this form
+ return render(request, "accounts_app/sign_in.html", {"form": form, "inviteForm":inviteForm})
elif request.method == "POST":
form = SignInForm(request.POST)
diff --git a/staticfiles/src/styles.css b/staticfiles/src/styles.css
index 3adbd1f..35120cf 100644
--- a/staticfiles/src/styles.css
+++ b/staticfiles/src/styles.css
@@ -1657,3 +1657,7 @@ img.dragging {
padding: 1.25rem;
}
}
+
+/* Modal form */
+#modal { display: none; }
+#modal.active { display: flex; }
diff --git a/templates/base.html b/templates/base.html
index 23c4940..302cf0d 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -22,13 +22,13 @@
-
+
- {% include "navbar/navbar.html" %}
- {% block content %}
- This is an empty page and should never be seen.
- {% endblock content %}
+ {% include "navbar/navbar.html" %}
+ {% block content %}
+ This is an empty page and should never be seen.
+ {% endblock content %}