Created
October 20, 2021 07:35
-
-
Save skolo-online/9d2989bdf6753ace1501c34d83b946f0 to your computer and use it in GitHub Desktop.
Image Category View
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def categoryPage(request, slug): | |
category = Category.objects.get(slug=slug) | |
images = Image.objects.filter(category=category).order_by('-date_created')[:6] | |
for x in images: | |
x.shortDescription = x.description[:130] | |
context = {} | |
context['images'] = images | |
context['category'] = category | |
return render(request, 'main/category.html', context) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment