Skip to content

Commit

Permalink
Landing: fixed an issue that prevented hot products to be displayed.
Browse files Browse the repository at this point in the history
  • Loading branch information
flavoi committed Jan 14, 2023
1 parent 5298db0 commit a6150ee
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
4 changes: 2 additions & 2 deletions diventi/products/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ def project_categories(request):

def pinned_projects(request):
context = {}
pinned_projects = (Product.objects.hot() | Product.objects.pinned_list()).distinct()
context['pinned_projects'] = pinned_projects
context['pinned_products_nav'] = Product.objects.pinned_list().distinct()
context['hot_product_nav'] = Product.objects.hot().get()
return context
2 changes: 1 addition & 1 deletion diventi/products/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def pinned(self):

# Return the list of pinned products
def pinned_list(self):
products = self.published().filter(pinned=True).prefetch()
products = self.published().filter(pinned=True).not_hot().prefetch()
return products

# Get the list of published products of a certain category
Expand Down
12 changes: 6 additions & 6 deletions diventi/templates/base_quick.html
Original file line number Diff line number Diff line change
Expand Up @@ -313,21 +313,21 @@ <h6 class="dropdown-header text-info mt-4">{% trans "about us"|capfirst %}</h6>
<a class="nav-link" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{% trans "play"|capfirst %}</a>
<div class="dropdown-menu dropdown-menu-md p-0">
<div class="list-group list-group-flush px-lg-4">
{% if hot_product %}
<a href="{{ hot_product.get_absolute_url }}" class="list-group-item list-group-item-action" role="button">
{% if hot_product_nav %}
<a href="{{ hot_product_nav.get_absolute_url }}" class="list-group-item list-group-item-action" role="button">
<div class="d-flex">
<span class="h6">
<i data-feather="feather"></i>
</span>
<div class="ml-3">
<h6 class="heading mb-0">{{ hot_product.title|capfirst }}</h6>
<small class="text-sm">{{ hot_product.description|capfirst }}</small>
<h6 class="heading mb-0">{{ hot_product_nav.title|capfirst }}</h6>
<small class="text-sm">{{ hot_product_nav.short_description|capfirst }}</small>
</div>
</div>
</a>
{% endif %}
{% if pinned_projects %}
{% for pinned_product in pinned_projects %}
{% if pinned_products_nav %}
{% for pinned_product in pinned_products_nav %}
<a href="{{ pinned_product.get_absolute_url }}" class="list-group-item list-group-item-action" role="button">
<div class="d-flex">
<span class="h6">
Expand Down
24 changes: 15 additions & 9 deletions diventi/templates/landing/landing_quick.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
{% block title %}{% endblock title %}

{% block navbarclass %}navbar navbar-main navbar-expand-lg navbar-light{% endblock navbarclass %}
{% block headerclass %}{% endblock headerclass %}

{% block headerclass %}header-transparent{% endblock headerclass %}

{% block navbar_brand_style %}text-dark{% endblock navbar_brand_style %}

{% block extrahead %}
Expand All @@ -32,7 +34,7 @@

{% block content %}

<section class="slice py-5 py-lg-7">
<section class="slice py-6 pt-9 bg-section-secondary">
<div class="container">
<div class="row align-items-center">
<div class="col-12 col-md-6 col-lg-6 order-md-2 mb-5 mb-md-0">
Expand Down Expand Up @@ -73,16 +75,19 @@
{% if featured_section.subtitle %}<h6 class="">- {{ featured_section.subtitle }}</h6>{% endif %}
<h1 class="h1 mb-4">{{ featured_section.prefix|capfirst }} <strong>{{ featured_section.title|capfirst }}.</strong></h1>
<p class="lead text-muted">{{ featured_section.description|striptags|capfirst }}</p>
<div class="mt-5">
<a href="#sct-next" class="btn btn-primary" data-scroll-to="" data-scroll-to-offset="85">{% trans 'learn more'|capfirst %}</a>
<div class="mt-5 text-center text-md-left">
{% if pinned_package %}
<a href="{{ pinned_package.get_absolute_url }}" class="btn btn-outline-warning my-2">{{ featured_section.button_label|capfirst }}</a>
<a href="{{ pinned_package.get_absolute_url }}" class="btn btn-warning my-2">{{ featured_section.button_label|capfirst }}</a>
{% endif %}
{% if hot_product %}
<a href="{{ hot_product.get_absolute_url }}" class="btn btn-outline-danger my-2">{{ featured_section.button_label|capfirst }}</a>
<a href="{{ hot_product.get_absolute_url }}" class="btn btn-danger bg-gradient-danger btn-icon-label">
<span class="btn-inner--text">{{ featured_section.button_label|capfirst }}</span><span class="btn-inner--icon">
<i data-feather="book-open"></i>
</span>
</a>
{% endif %}
{% if pinned_survey %}
<a href="{{ pinned_survey.get_absolute_url }}" class="btn btn-outline-info my-2">{{ featured_section.button_label|capfirst }}</a>
<a href="{{ pinned_survey.get_absolute_url }}" class="btn btn-info my-2">{{ featured_section.button_label|capfirst }}</a>
{% endif %}
{% if featured_section.video %}
<a href="{{ featured_section.video }}" class="btn btn-neutral btn-icon d-none d-lg-inline-block" data-fancybox="">
Expand All @@ -92,12 +97,13 @@ <h1 class="h1 mb-4">{{ featured_section.prefix|capfirst }} <strong>{{ featured_s
</span>
</a>
{% endif %}
<a href="#sct-next" class="btn btn-neutral btn-icon d-none d-xl-inline-block" data-scroll-to="" data-scroll-to-offset="85">{% trans 'learn more'|capfirst %}</a>
</div>
</div>
</div>
</div>
</section>
<section class="slice slice-lg delimiter-top delimiter-bottom">
<section class="slice slice-lg">
<div class="container">
<div class="row mb-6 justify-content-center text-center">
<div class="col-lg-8 col-md-10">
Expand Down Expand Up @@ -174,7 +180,7 @@ <h3 class="mt-4">{% trans 'our latest contents'|capfirst %}</h3>
</div>
</section>

<section class="slice pb-6" id="sct-next">
<section class="slice pb-6 delimiter-top" id="sct-next">
<div class="container">
{% for section in sections %}
<div class="section-process-step">
Expand Down

0 comments on commit a6150ee

Please sign in to comment.