Hi,
El viernes, 20 de noviembre de 2015, 17:19:55 (UTC+1), miguel angel lopez mendo escribió:
-- This is an english version of the Django forum, there is another one (not official) in:
Also please, use dpaste services or similar for code.
Regards,
El viernes, 20 de noviembre de 2015, 17:19:55 (UTC+1), miguel angel lopez mendo escribió:
------mi view ----Usados def (solicitud):productos = Coche.objects.filter (tipo = '1')productos / usados.html '= plantillavolver render (solicitud, plantilla, locals ())--------template-------{% Extends% 'base.html'}{Carga% staticfiles%}{% Block%} head_title{%}% Endblock<head><title> Soni Compañia </ title></ head><style>{% Estilo de bloque%}cuerpo{margin: 0;padding: 0;}{%}% Endblock</ style>{% Block content%}<div class = "contenedor">{% Para el producto en los productos de%}<div class = 'fila'><div class = "col-sm-2 col-sm-offset-2"><div><br>{% If%} product.cocheimage_set.all{% Para el artículo en product.cocheimage_set.all%}<div style = "width: 20px; margin: 0 auto;"></ div> <a href='{{ product.get_absolute_url }}'><img class = src 'img sensibles' = "{{item.image.url}}" /></a>{% Endfor%}{% más %}<div><a href='{{ product.get_absolute_url }}'><div style = "altura: 10px;"> </ div></a></ div>{% terminara si %}<div class = "leyenda"><a href='{{ product.get_absolute_url }}'> <h3> {{}} product.title </ h3> </a>Marca: {{}} <br/> product.marcaModelo: {{product.modelo}}<p> <a href="{{ product.get_absolute_url }}"> <a href="/s" class="btn btn-default text-align-center" role="button"> Tomar Auto </a></ div></ div></ div>{% Ciclo "" "" "" "" "" "</ div> <hr /> <div class = 'fila'>"%}{% Endfor%}{%}% Endblock</ div>---models-----clase Coche (models.Model):titulo = models.CharField (max_length = 120)marca = models.ForeignKey ('Marca', null = True, en blanco = True, verbose_name = "Marca")Modelo = models.ForeignKey ('Modelo', null = True, en blanco = True)version = models.CharField (max_length = 120)tipo = models.CharField (max_length = 12, las opciones = TIPO_CHOICES)precio = models.DecimalField (decimal_places = 2, MAX_DIGITS = 100)babosa = models.SlugField (unique = True)timestamp = models.DateTimeField (auto_now_add = True, auto_now = False)actualizado = models.DateTimeField (auto_now_add = False, auto_now = True)activo = models.BooleanField (por defecto = True)def __unicode __ (self):retorno self.tituloclase Meta:unique_together = ('titulo', 'bala')get_absolute_url def (self):inversa volver ("single_product", kwargs = {"babosa": self.slug})CocheImage clase (models.Model):producto = models.ForeignKey (Coche)image = models.ImageField (upload_to "productos / images / '=)destacado = models.BooleanField (default = false)miniatura = models.BooleanField (por defecto = True)activo = models.BooleanField (por defecto = True)actualizado = models.DateTimeField (auto_now_add = False, auto_now = True)def __unicode __ (self):retorno self.product.tituloLo que intento realizar es que en el template se muestre solamente la ultima imagen que he subido
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c9d75632-90be-43e0-826a-1d26725dad90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment