Merge branch 'master' of https://git.eleves.ens.fr/cof-geek/gestioCOF into Aufinal/bda_revente

This commit is contained in:
Ludovic Stephan 2016-09-11 13:40:03 +02:00
commit 02527e6f16
2 changed files with 35 additions and 3 deletions

View file

@ -34,7 +34,8 @@ class Tirage(models.Model):
default=False) default=False)
def date_no_seconds(self): def date_no_seconds(self):
return self.fermeture.strftime('%d %b %Y %H:%M') return self.fermeture.astimezone(timezone.get_current_timezone()) \
.strftime('%d %b %Y %H:%M')
def __str__(self): def __str__(self):
return "%s - %s" % (self.title, self.date_no_seconds()) return "%s - %s" % (self.title, self.date_no_seconds())
@ -91,7 +92,8 @@ class Spectacle(models.Model):
return "%d" % calendar.timegm(self.date.utctimetuple()) return "%d" % calendar.timegm(self.date.utctimetuple())
def date_no_seconds(self): def date_no_seconds(self):
return self.date.strftime('%d %b %Y %H:%M') return self.date.astimezone(timezone.get_current_timezone()) \
.strftime('%d %b %Y %H:%M')
def __str__(self): def __str__(self):
return "%s - %s, %s, %.02f" % (self.title, self.date_no_seconds(), return "%s - %s, %s, %.02f" % (self.title, self.date_no_seconds(),

View file

@ -34,6 +34,7 @@
</style> </style>
<meta charset="utf8" /> <meta charset="utf8" />
</head> </head>
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<body> <body>
{% for show in shows %} {% for show in shows %}
<table class="descTable"> <table class="descTable">
@ -59,11 +60,40 @@
</tr> </tr>
{% if show.image %} {% if show.image %}
<tr> <tr>
<td colspan="2"><p style="text-align:center;"><a href="{{ show.ext_link }}"><img style="display: inline;" src="{{ MEDIA_URL }}{{ show.image }}" alt="{{ show.title }}" height="500px"></a></p></td> <td colspan="2"><p style="text-align:center;"><a href="{{ show.ext_link }}"><img class="imgDesc" style="display: inline;" src="{{ MEDIA_URL }}{{ show.image }}" alt="{{ show.title }}"></a></p></td>
</tr> </tr>
{% endif %} {% endif %}
</tbody> </tbody>
</table> </table>
{% endfor %} {% endfor %}
<script>
// Correction de la taille des images
$(document).ready(function() {
$(".imgDesc").on("load", function() {
// Dimensions
origHeight = 500; // Hauteur souhaitée
w = $(this).width();
h = $(this).height();
r = w/h; // Ratio de l'image
maxWidth = $(this).parent().width();
if (r * origHeight > maxWidth)
{
$(this).width(maxWidth);
$(this).height(maxWidth/r);
}
else
{
$(this).width(r * origHeight);
$(this).height(origHeight);
}
});
});
</script>
</body> </body>
</html> </html>