python - Trying to understand Django's sorl-thumbnail -


I'm playing with Django for sorl-thumbnail . And it's trying to understand how it works better.

I have read the guide for it, installed it in my site-package, it has been ensured that PIL is installed correctly, sorl.thumbnail is set to < Code> INSTALLED APPS In my settings.py , import ImageWithThumbnailsFile with the sorl.thumbnail.fields located at the top in my models.py , Added image = ImageWithThumbnailsField (= "images /", upload thumbnail = {'size': (80, 80)}) as my model field, the mean of your view on the template The model has passed, and above template {% load thumbnail%} was added and the put in variable {{mymodel.image.thumbnail_tag}} .

But what I have understood is that when I upload an image through an administrator, it will create a thumbnail directly, but when I see my template in the browser, is it exactly the same? is made? is this correct? Thumbnail looks fine, it looks really great, but I think its model will make field part thumbnail after uploading the image? ... why not use models.imagefield in your model?

... or have I done all this and I have found a way to work right now?

I am one of the shawl-thumbnail developers.

First of all, you do not need to {% load thumbnail%} until you use the thumbnail tag instead of the thumbnail field.

Currently, only one thumbnail has been created for the first time it is used - even if you use the field [I will change one day, if someone else does not do it] The advantage of the field is that you can specify the designer to resize instead of giving the freedom to the template level [and admin thumbnails].

Work in both ways, you decide which works best for you.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -