Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
library-app-django
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ilham Maulana
library-app-django
Commits
df36497b
Commit
df36497b
authored
Jul 16, 2024
by
Ilham Maulana
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: context prosesor
parent
9a5d21c0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
settings.py
config/settings.py
+2
-0
profile.html
dashboard/templates/profile.html
+2
-2
context_processors.py
users/utils/context_processors.py
+8
-0
No files found.
config/settings.py
View file @
df36497b
...
@@ -88,6 +88,8 @@ TEMPLATES = [
...
@@ -88,6 +88,8 @@ TEMPLATES = [
"django.template.context_processors.request"
,
"django.template.context_processors.request"
,
"django.contrib.auth.context_processors.auth"
,
"django.contrib.auth.context_processors.auth"
,
"django.contrib.messages.context_processors.messages"
,
"django.contrib.messages.context_processors.messages"
,
# local
"users.utils.context_processors.user_context"
,
],
],
},
},
},
},
...
...
dashboard/templates/profile.html
View file @
df36497b
...
@@ -5,11 +5,11 @@
...
@@ -5,11 +5,11 @@
data-bs-toggle=
"dropdown"
data-bs-toggle=
"dropdown"
>
>
<i
class=
"bi bi-person-circle"
></i>
<i
class=
"bi bi-person-circle"
></i>
{% if user %}
<span
class=
"text-truncate"
>
{{ user.name }}
</span>
{% endif %}
{% if user %}
<span
class=
"text-truncate"
>
{{ user.
user
name }}
</span>
{% endif %}
</button>
</button>
<a
<a
class=
"w-100 btn btn-outline-primary border-white text-white text-start"
class=
"w-100 btn btn-outline-primary border-white text-white text-start"
href=
"/
dashboard/librarians/{{ user.
id }}/"
href=
"/
users/librarians/{{ librarian_
id }}/"
><i
class=
"bi bi-person-fill-gear"
></i>
profile
</a
><i
class=
"bi bi-person-fill-gear"
></i>
profile
</a
>
>
<a
<a
...
...
users/utils/context_processors.py
0 → 100644
View file @
df36497b
from
..models
import
Librarian
def
user_context
(
request
):
user
=
request
.
user
librarian
=
Librarian
.
objects
.
get
(
user
=
user
)
return
{
"user"
:
user
,
"librarian_id"
:
librarian
.
id
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment