diff --git a/medical_prescription/medical_prescription/settings.py b/medical_prescription/medical_prescription/settings.py index a1f485af..94b7228f 100644 --- a/medical_prescription/medical_prescription/settings.py +++ b/medical_prescription/medical_prescription/settings.py @@ -192,3 +192,12 @@ STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static/'), ] + + +# Media Files +MEDIA_URL = '/public/' + +MEDIA_ROOT = os.path.join( + os.path.dirname(__file__), + '../public', +) diff --git a/medical_prescription/medical_prescription/urls.py b/medical_prescription/medical_prescription/urls.py index d87b364e..62e3d489 100644 --- a/medical_prescription/medical_prescription/urls.py +++ b/medical_prescription/medical_prescription/urls.py @@ -1,9 +1,10 @@ from django.conf.urls.i18n import i18n_patterns +from django.conf.urls.static import static from django.conf.urls import include, url from django.contrib import admin from landing.views import home - +from medical_prescription import settings urlpatterns = [ url(r'^user/', include('user.urls')), url(r'^dashboard_health_professional/', include('dashboardHealthProfessional.urls')), @@ -17,7 +18,8 @@ url(r'^prescription/', include('prescription.urls')), url(r'^chat/', include('chat.urls')), url(r'^recommendation/', include('recommendation.urls')), -] +] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + urlpatterns += i18n_patterns( url(r'^user/', include('user.urls')), diff --git a/medical_prescription/public/image_profile/user.png b/medical_prescription/public/image_profile/user.png new file mode 100644 index 00000000..75ac2b5f Binary files /dev/null and b/medical_prescription/public/image_profile/user.png differ diff --git a/medical_prescription/templates/dashboardHealthProfessional/side_bar.html b/medical_prescription/templates/dashboardHealthProfessional/side_bar.html index 1bf90abb..41f37bb1 100644 --- a/medical_prescription/templates/dashboardHealthProfessional/side_bar.html +++ b/medical_prescription/templates/dashboardHealthProfessional/side_bar.html @@ -49,7 +49,6 @@
  • {% trans "Exame"%}
  • {% trans "Medicamento"%}
  • {% trans "Princípio ativo"%}
  • -
  • {% trans "Princípio ativo"%}
  • Recomendações Customizadas
  • diff --git a/medical_prescription/user/constants.py b/medical_prescription/user/constants.py index f78848f8..3a72701d 100644 --- a/medical_prescription/user/constants.py +++ b/medical_prescription/user/constants.py @@ -144,3 +144,6 @@ LINKED_PATIENT_SUCESS = 'O paciente foi adicionado à sua lista de pacientes.' LINKED_PATIENT_EXISTS = 'O paciente já está adicionado em sua lista de pacientes.' ALERT_HEALTH_PROFESSIONAL = 'Esta conta pertence a um professional da saúde.' + +# DEFAULT PATH IMAGE. +DEFAULT_IMG = 'image_profile/user.png' diff --git a/medical_prescription/user/models/user.py b/medical_prescription/user/models/user.py index c2decb9a..0b52819d 100644 --- a/medical_prescription/user/models/user.py +++ b/medical_prescription/user/models/user.py @@ -5,7 +5,6 @@ from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.models import PermissionsMixin from django.db import models - # Local Django from .usermanager import UserManager from user import constants @@ -17,6 +16,7 @@ class User(AbstractBaseUser, PermissionsMixin): phone = models.CharField(max_length=constants.PHONE_NUMBER_FIELD_LENGTH_MAX, blank=True, default='00000000000') email = models.EmailField(unique=True) sex = models.CharField(choices=constants.SEX_CHOICE, max_length=10, default=constants.SEX_M) + image_profile = models.ImageField(upload_to='image_profile/', default=constants.DEFAULT_IMG) is_active = models.BooleanField(default=False) is_staff = models.BooleanField(default=False) diff --git a/requirements-dev.txt b/requirements-dev.txt index 1334a0ca..243e3c31 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -15,3 +15,5 @@ dj-static==0.0.6 python-decouple==3.0 django-widget-tweaks==1.4.1 django-localflavor==1.5.0 +Pillow==4.2.1 +