def test_webp_querysets(self):
     WebPImage.objects.create(static_path='image_1.png', quality=80)
     WebPImage.objects.create(static_path='image_2.png', quality=80)
     WebPImage.objects.create(static_path='image_3.png', quality=80)
     ids = [
         item.id
         for qs in utils.webp_image_querysets(3, 2)
         for item in qs]
     assert ids == [1, 2, 3]
Beispiel #2
0
 def handle(self, *args, **options):
     total_count = WebPImage.objects.all().count()
     for qs in webp_image_querysets(total_count):
         for webp_image in qs:
             key = make_image_key(webp_image.static_path,
                                  webp_image.quality)
             cache.delete(key)
     WebPImage.objects.all().delete()
     delete_webp_folder()
     self.stdout.write('Successfully cleared cache')
 def handle(self, *args, **options):
     total_count = WebPImage.objects.all().count()
     for qs in webp_image_querysets(total_count):
         for webp_image in qs:
             key = make_image_key(webp_image.static_path, webp_image.quality)
             cache.delete(key)
     WebPImage.objects.all().delete()
     delete_webp_folder()
     self.stdout.write('Successfully cleared cache')