Задать вопрос

Тел: +7 965 3737 888

424

Просмотров

4

Ответов

Random-image template tag

This tag makes it easy to have a random rotation of images on a page. Don't forget to set your MEDIA_URL.

Вопрос полезен? Да0/Нет0
file_4591.py(838.0б)
None

Ответы (4):

Ответjnievas:01.05.2007
Ответ полезен? Да0/Нет0

The latest os.path.join will make this version not compatible for running over Windows, since URLs always have forward slashes. Should be changed to use always a forward slash.

Ответlongnight:26.07.2014
Ответ полезен? Да0/Нет0

ext = os.path.splitext(filename)[1] + .lower()
that could prevent missing from caps up exts.

Ответlosttrekker:11.06.2010
Ответ полезен? Да0/Нет0

I'm sure its possible, but I'm failing to grasp it right now. How can I get this snippet to grab only images of a specific size?

Ответpbx:16.05.2007
Ответ полезен? Да0/Нет0

Good point. I updated it to fix this, using posixpath.join (which works better for this example than urlparse.urljoin).