fix_test #4
@ -60,15 +60,12 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Скрипт для модального окна -->
|
||||
<script src="{% static 'programmer/js/recall.js' %}"></script>
|
||||
|
||||
<!-- Модальное окно для увеличения изображений -->
|
||||
<div id="imageModal" class="modal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 id="modalTitle">Просмотр изображения</h3>
|
||||
<button class="modal-close" onclick="closeModal()">×</button>
|
||||
<button class="modal-close" onclick="ImageModal.close()">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<img class="modal-image" id="modalImage" alt="">
|
||||
@ -76,6 +73,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Скрипт для модального окна -->
|
||||
<script src="{% static 'programmer/js/recall.js' %}"></script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_js %}
|
||||
@ -90,7 +90,7 @@
|
||||
img.style.cursor = 'pointer';
|
||||
img.addEventListener('click', function() {
|
||||
// Вызываем глобальную функцию openModal из recall.js
|
||||
openModal(this.src, this.alt || 'Изображение из статьи');
|
||||
ImageModal.open(this.src, this.alt || 'Изображение из статьи');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -68,10 +68,12 @@ class SolutionAdmin(BaseContentAdmin):
|
||||
list_display = ('id', 'title', 'time_create', 'is_published')
|
||||
list_display_links = ('id', 'title')
|
||||
search_fields = ('title', 'description', 'implementation')
|
||||
prepopulated_fields = {'slug': ('title',)}
|
||||
|
||||
|
||||
fieldsets = (
|
||||
(None, {
|
||||
'fields': ('title', 'is_published'),
|
||||
'fields': ('title', 'slug', 'is_published'),
|
||||
}),
|
||||
('Содержание', {
|
||||
'fields': ('description', 'implementation', 'closing'),
|
||||
|
||||
@ -69,12 +69,24 @@ class Solution(models.Model):
|
||||
time_create = models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')
|
||||
time_update = models.DateTimeField(auto_now=True, verbose_name='Дата изменения')
|
||||
is_published = models.BooleanField(default=True, verbose_name='Опубликован')
|
||||
|
||||
slug = models.SlugField(
|
||||
max_length=255,
|
||||
unique=False, # временно не уникальное
|
||||
db_index=True,
|
||||
verbose_name='URL-идентификатор',
|
||||
blank=True,
|
||||
null=True, # разрешаем NULL
|
||||
)
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.slug:
|
||||
self.slug = slugify(self.title)
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse('solution_detail', kwargs={'pk': self.pk})
|
||||
return reverse('solution_detail', kwargs={'slug': self.slug})
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'Проекты'
|
||||
|
||||
@ -15,27 +15,6 @@
|
||||
|
||||
<div class="projects-grid" id="projects-container">
|
||||
{% include 'programmer/includes/project_cards.html' %}
|
||||
<!-- {% for solution in posts %}
|
||||
<article class="modern-card">
|
||||
<h2 class="card-title">
|
||||
<a href="{{ solution.get_absolute_url }}">{{ solution.title }}</a>
|
||||
</h2>
|
||||
<p class="card-subtitle">
|
||||
{{ solution.description|striptags|truncatewords:30 }}
|
||||
</p>
|
||||
<div class="meta" style="display: flex; justify-content: space-between; margin-top: 1rem;">
|
||||
<span>📅 {{ solution.time_create|date:"d.m.Y" }}</span>
|
||||
<a href="{{ solution.get_absolute_url }}" class="btn btn-outline" style="padding: 0.5rem 1rem;">
|
||||
Подробнее →
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
{% empty %}
|
||||
<div class="content-card text-center" style="grid-column: 1/-1;">
|
||||
<h3>Примеры решений скоро появятся</h3>
|
||||
<p>Мы готовим для вас интересные кейсы и решения</p>
|
||||
</div>
|
||||
{% endfor %} -->
|
||||
</div>
|
||||
|
||||
{% if not posts %}
|
||||
|
||||
@ -14,7 +14,7 @@ urlpatterns = [
|
||||
path('', views.HomePageView.as_view(), name='home'),
|
||||
path('about/', views.AboutPageView.as_view(), name='about'),
|
||||
path('solutions/', views.SolutionListView.as_view(), name='solution'),
|
||||
path('solutions/<int:pk>/', SolutionDetailView.as_view(), name='solution_detail'),
|
||||
path('solutions/<slug:slug>/', SolutionDetailView.as_view(), name='solution_detail'),
|
||||
# path('competence/', ability, name='ability'),
|
||||
# path('competence/<int:pk>/', CompetenceDetailView.as_view(), name='competence_detail'),
|
||||
path('recall/', views.RecallListView.as_view(), name='recall'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user