mirror of
https://github.com/Superredstone/patrickcanal.it.git
synced 2026-09-20 09:41:14 +02:00
fix: move uploads away from static files & fix company logo
This commit is contained in:
@@ -129,9 +129,11 @@ except Exception as e:
|
||||
STATIC_URL = 'static/'
|
||||
STATICFILES_DIRS = [
|
||||
BASE_DIR / "static/",
|
||||
BASE_DIR / "uploads/",
|
||||
]
|
||||
|
||||
MEDIA_URL = "/uploads/"
|
||||
MEDIA_ROOT = BASE_DIR / "uploads/"
|
||||
|
||||
# Email
|
||||
# https://docs.djangoproject.com/en/6.1/topics/email/#topic-email-configuration
|
||||
EMAIL_BACKEND = 'post_office.EmailBackend'
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
{% for je in job_experiences %}
|
||||
<li class="timeline-event">
|
||||
<div class="timeline-event-icon bg-primary">
|
||||
<img src="{{ je.company.logo.url }}" alt="">
|
||||
<img src="{% url 'company-logo' pk=je.company.pk %}" alt="">
|
||||
</div>
|
||||
<div class="timeline-event-card card">
|
||||
<div class="card-body">
|
||||
|
||||
@@ -6,4 +6,5 @@ urlpatterns = [
|
||||
path("", views.PortfolioView.as_view(), name="portfolio"),
|
||||
path("projects/", views.ProjectList.as_view(), name="projects"),
|
||||
path("contact/", views.ContactSend.as_view(), name="contact"),
|
||||
path("company/<int:pk>/logo/", views.CompanyLogo.as_view(), name="company-logo"),
|
||||
]
|
||||
|
||||
+10
-2
@@ -1,7 +1,7 @@
|
||||
from django.conf import settings
|
||||
from django.http.response import HttpResponseBadRequest
|
||||
from django.http.response import FileResponse, HttpResponseBadRequest
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views.generic import ListView, TemplateView
|
||||
from django.views.generic import DetailView, ListView, TemplateView
|
||||
from post_office import mail
|
||||
|
||||
from portfolio import forms, models
|
||||
@@ -41,3 +41,11 @@ class ContactSend(TemplateView):
|
||||
)
|
||||
|
||||
return super().get(request, *args, **kwargs)
|
||||
|
||||
|
||||
class CompanyLogo(DetailView):
|
||||
model = models.Company
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
company = self.get_object()
|
||||
return FileResponse(company.logo)
|
||||
|
||||
Reference in New Issue
Block a user