-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding user picture and username to navbar.
When the user is logged into Hotails, they'll see their profile picture, and their username in every page on Hotails. Signed-off-by: Ofir Matasas <[email protected]> Signed-off-by: tamirmatok <[email protected]>
- Loading branch information
1 parent
f12de6e
commit 650c0ea
Showing
6 changed files
with
69 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from daycare.models import DayCare, Image | ||
from dogowner.models import DogOwner | ||
|
||
|
||
def navbar_extras(request): | ||
navbar_picture_url = navbar_name = None | ||
if request.user.is_authenticated: | ||
if DogOwner.objects.filter(user=request.user).exists(): | ||
dog_owner = DogOwner.objects.filter(user=request.user).first() | ||
navbar_picture_url = dog_owner.dog_picture_url | ||
navbar_name = dog_owner.first_name + ' ' + dog_owner.last_name | ||
|
||
elif DayCare.objects.filter(user=request.user).exists(): | ||
daycare = DayCare.objects.filter(user=request.user).first() | ||
navbar_picture_url = Image.objects.filter(daycare_id=daycare).first().url | ||
navbar_name = daycare.name | ||
context = { | ||
'navbar_picture_url': navbar_picture_url, | ||
'navbar_name': navbar_name, | ||
} | ||
return context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{% extends "main/base_template.html" %} | ||
{% load static %} | ||
{% block content %} | ||
|
||
<h1>Coming soon...</h1> | ||
|
||
<h1>Coming soon...</h1> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters