def albums(request, cat_id):
show_albums = Album.objects.all().filter(cat=cat_id)
random = Photo.objects.filter(alb__cat_id=cat_id).order_by('?')[: 1]
categir = Categories.objects.all()
context = {'albom': show_albums,'categor': categir,'thumb':random}
return render(request,' adst/albums.html',context)
Note, however, that like Model.full_clean(), a model’s clean() method is not invoked when you call your model’s save() method.