{% if fotosList|length > 4 %} not a valid tag; you cannot use more or less statements in the Django if tag. (You can use operators in the latest development version, but I assume that you are not using the latest version from the Django SVN repository.)
The reason you get the TemplateDoesNotExist error is because Django throws 500 internal server errors (due to an invalid tag), but you did not specify the 500.html error template, as noted here .
source share