Add image to profile and display it in backend
This commit is contained in:
parent
4b666ec1ad
commit
0e228063b6
3 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
from polymorphic.models import PolymorphicModel
|
||||
from phonenumber_field.modelfields import PhoneNumberField
|
||||
|
||||
from django.db.models import OneToOneField, CASCADE, CharField
|
||||
from django.db.models import OneToOneField, CASCADE, CharField, ImageField
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
class Profile(PolymorphicModel):
|
||||
|
@ -10,3 +10,4 @@ class Profile(PolymorphicModel):
|
|||
|
||||
class AdminProfile(Profile):
|
||||
role = CharField(max_length=64)
|
||||
image = ImageField(null=True)
|
BIN
static/backend/images/avatars/noimage.png
Normal file
BIN
static/backend/images/avatars/noimage.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
|
@ -93,7 +93,7 @@
|
|||
<div class="widget-content-left">
|
||||
<div class="btn-group">
|
||||
<a data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="p-0 btn">
|
||||
<img width="42" class="rounded-circle" src="https://kumi.website/img/img-profile.png" alt="">
|
||||
<img width="42" class="rounded-circle" src="{% if request.user.profile.image %}{{ request.user.profile.image.url }}{% else %}{% static "backend/images/avatars/noimage.png" %}{% endif %}" alt="">
|
||||
<i class="fa fa-angle-down ml-2 opacity-8"></i>
|
||||
</a>
|
||||
<div tabindex="-1" role="menu" aria-hidden="true" class="dropdown-menu dropdown-menu-right">
|
||||
|
|
Loading…
Reference in a new issue