mirror of
https://github.com/daniviga/django-ram.git
synced 2026-02-04 01:50:39 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
74d7df2c8b
|
|||
|
c81508bbd5
|
@@ -3,12 +3,19 @@
|
||||
|
||||
<div class="col">
|
||||
<div class="card shadow-sm">
|
||||
{% if d.image.exists %}
|
||||
<a href="{{d.get_absolute_url}}"><img class="card-img-top" src="{{ d.image.first.image.url }}" alt="{{ d }}"></a>
|
||||
{% else %}
|
||||
<!-- Do not show the "Coming soon" image when running in a single card column mode (e.g. on mobile) -->
|
||||
<a href="{{d.get_absolute_url}}"><img class="card-img-top d-none d-sm-block" src="{% static DEFAULT_CARD_IMAGE %}" alt="{{ d }}"></a>
|
||||
{% endif %}
|
||||
<div id="card-img-container" class="position-relative">
|
||||
{% if d.featured %}
|
||||
<span class="position-absolute translate-middle top-0 start-0 m-3 text-danger">
|
||||
<abbr title="Featured item"><i class="bi bi-heart-fill"></i></abbr>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if d.image.exists %}
|
||||
<a href="{{d.get_absolute_url}}"><img class="card-img-top" src="{{ d.image.first.image.url }}" alt="{{ d }}"></a>
|
||||
{% else %}
|
||||
<!-- Do not show the "Coming soon" image when running in a single card column mode (e.g. on mobile) -->
|
||||
<a href="{{d.get_absolute_url}}"><img class="card-img-top d-none d-sm-block" src="{% static DEFAULT_CARD_IMAGE %}" alt="{{ d }}"></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text" style="position: relative;">
|
||||
<strong>{{ d }}</strong>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from ram.utils import git_suffix
|
||||
|
||||
__version__ = "0.18.9"
|
||||
__version__ = "0.18.10"
|
||||
__version__ += git_suffix(__file__)
|
||||
|
||||
@@ -175,7 +175,12 @@ class RollingStock(BaseModel):
|
||||
def clean(self, *args, **kwargs):
|
||||
if self.featured:
|
||||
MAX = settings.FEATURED_ITEMS_MAX
|
||||
if RollingStock.objects.filter(featured=True).count() > MAX - 1:
|
||||
featured_count = (
|
||||
RollingStock.objects.filter(featured=True)
|
||||
.exclude(uuid=self.uuid)
|
||||
.count()
|
||||
)
|
||||
if featured_count > MAX - 1:
|
||||
raise ValidationError(
|
||||
"There are already {} featured items".format(MAX)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user