Не понимаю как сделать правильно, нету отображения по ссылке.
Views.py:
from django.shortcuts import render
from categoris.models import Video_db
def catalog(request, categoris_video_db_id):
CatVid_db = Video_db.objects.filter(slug = categoris_video_db_id)
context = {
'CatVid_db': CatVid_db
}
return render(request, 'catalog/catalog.html', context=context)
models.py:
class Video_db(models.Model):
name = models.CharField(max_length=150, unique=True, verbose_name='Название')
slug = models.SlugField(max_length=200, unique=False, blank=True, verbose_name='URLS')
description = models.TextField(blank=True, null=True, verbose_name='Описание')
img = models.ImageField(upload_to='categoris_video', blank=True, null=True)
video = models.FileField(upload_to='categoris_videos', blank=True, null=True)
category_video = models.ForeignKey(to=Categories_db, on_delete=models.CASCADE)
class Meta:
db_table = 'categoris_video_db'
def __str__(self):
return self.name
urls.py:
from django.urls import path
from categoris import views
app_name = 'categories'
urlpatterns = [
path('<str:categoris_video_db_id>/', views.catalog, name = 'index'),