您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

15 行
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))