25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

15 lines
479 B

  1. from django.http import HttpResponseNotFound
  2. from django.shortcuts import get_object_or_404, redirect
  3. from . import models
  4. from .settings import IMAGE_SIZES
  5. def thumbnail(request, image_id, size):
  6. image = get_object_or_404(models.Image, id=image_id)
  7. if size not in IMAGE_SIZES:
  8. return HttpResponseNotFound()
  9. return redirect(models.Thumbnail.objects.get_or_create_at_size(image.id,
  10. size))