Skip to content

Commit 47ee5fd

Browse files
authored
Initial pass at Profile creation (#42)
- Create urls for creating volunteer profile and portal profile - Add django bootstrap5 - Add basic templates
1 parent 7f3867a commit 47ee5fd

File tree

187 files changed

+832
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+832
-168
lines changed

portal/settings.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@
4242
"django.contrib.messages",
4343
"django.contrib.staticfiles",
4444
"django.contrib.sites",
45-
"portal",
46-
"volunteer",
45+
"django_bootstrap5",
4746
"allauth",
4847
"allauth.account",
49-
"django_bootstrap5",
48+
"portal",
49+
"volunteer",
50+
"portal_account",
5051
]
5152

5253
MIDDLEWARE = [

portal/static/styles.css

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.bi {
2+
display: inline-block;
3+
width: 1rem;
4+
height: 1rem;
5+
}
6+
7+
/*
8+
* Sidebar
9+
*/
10+
11+
@media (min-width: 768px) {
12+
.sidebar .offcanvas-lg {
13+
position: -webkit-sticky;
14+
position: sticky;
15+
top: 48px;
16+
}
17+
.navbar-search {
18+
display: block;
19+
}
20+
}
21+
22+
.sidebar .nav-link {
23+
font-size: .875rem;
24+
font-weight: 500;
25+
}
26+
27+
.sidebar .nav-link.active {
28+
color: #2470dc;
29+
}
30+
31+
.sidebar-heading {
32+
font-size: .75rem;
33+
}
34+
35+
/*
36+
* Navbar
37+
*/
38+
39+
.navbar-brand {
40+
padding-top: .75rem;
41+
padding-bottom: .75rem;
42+
background-color: rgba(0, 0, 0, .25);
43+
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
44+
}
45+
46+
.navbar .form-control {
47+
padding: .75rem 1rem;
48+
}

portal/templates/allauth/layouts/entrance.html

Lines changed: 0 additions & 3 deletions
This file was deleted.

portal/templates/allauth/layouts/manage.html

Lines changed: 0 additions & 2 deletions
This file was deleted.

portal/templates/portal/base.html

Lines changed: 0 additions & 57 deletions
This file was deleted.

portal/templates/portal/index.html

Lines changed: 0 additions & 84 deletions
This file was deleted.

portal/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222

2323
urlpatterns = [
2424
path("", views.index, name="index"),
25-
path("volunteer/", include("volunteer.urls")),
25+
path("volunteer/", include("volunteer.urls", namespace="volunteer")),
2626
path("admin/", admin.site.urls),
2727
path("accounts/", include("allauth.urls")),
28+
path("portal_account/", include("portal_account.urls", namespace="portal_account")),
2829
]

portal/views.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
from django.http import HttpResponse
2-
from django.shortcuts import render
1+
from django.shortcuts import render, redirect
32

43

54
def index(request):
5+
"""Redirect to profile creation page if user has not completed their profile."""
66
context = {}
7+
from portal_account.models import PortalProfile
8+
9+
if (
10+
request.user
11+
and request.user.is_authenticated
12+
and not PortalProfile.objects.filter(user=request.user).exists()
13+
):
14+
return redirect("portal_account:portal_profile_new")
715
return render(request, "portal/index.html", context)

portal_account/__init__.py

Whitespace-only changes.

portal_account/admin.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from django.contrib import admin
2+
from .models import PortalProfile
3+
4+
5+
class PortalProfileAdmin(admin.ModelAdmin):
6+
list_display = (
7+
"user",
8+
"user__first_name",
9+
"user__last_name",
10+
"pronouns",
11+
"coc_agreement",
12+
)
13+
search_fields = ("user__email", "user__first_name", "user__last_name")
14+
list_filter = ("pronouns", "coc_agreement")
15+
16+
17+
admin.site.register(PortalProfile, PortalProfileAdmin)

0 commit comments

Comments
 (0)