feat: на странице заявки на модерацию показать бренд, описание и ссылку на карточку; карточка доступна модератору
This commit is contained in:
1 parent
970450cce2
commit
24e6144401
2 files changed
+19
-6
No files matched your search
@@ -1,3 +1,4 @@
|
||||
from django.http import Http404
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
|
||||
from apps.catalog.models import Brand, Category, ModerationStatus, Product
|
||||
@@ -50,7 +51,10 @@ def product_detail(request, slug):
|
||||
|
||||
|
||||
def brand_detail(request, slug):
|
||||
brand = get_object_or_404(Brand, slug=slug, verification_status='approved')
|
||||
brand = get_object_or_404(Brand, slug=slug)
|
||||
# Неодобренные бренды видны только модераторам/администраторам (для проверки).
|
||||
if brand.verification_status != 'approved' and not request.user.is_staff:
|
||||
raise Http404
|
||||
products = brand.products.filter(moderation_status=PUBLISHED, is_active=True)
|
||||
return render(request, 'catalog/brand_detail.html', {
|
||||
'brand': brand,
|
||||
|
||||
Reference in new issue
Block a user