Permalink
Browse files

adding readymade images, using order_set in model

  • Loading branch information...
1 parent d60a8da commit 3583cd4b014914413efc612a3964365fa548c9c1 @shashashasha committed Apr 22, 2012
Showing with 8 additions and 3 deletions.
  1. +2 −2 meshu/models.py
  2. +6 −1 templates/meshu/item/readymade.html
View
@@ -9,7 +9,7 @@ class UserProfile(models.Model):
def num_orders(self):
# return Order.objects.filter(user=self.user).count()
- return self.meshu_set.all().count()
+ return self.order_set.all().count()
def amount_orders(self):
return str(self.num_orders()) + ' orders'
@@ -64,7 +64,7 @@ class Meshu(models.Model):
# the equivalent of overriding the .toString() function
def __unicode__(self):
return str(self.id) + ' - ' + self.title
-
+
def get_encoded_id(self):
return str(self.id).encode("hex")
@@ -9,8 +9,13 @@
{% block materials %}
<h2>{{ meshu.title }}</h2>
<p id="readymade-desc">{{ meshu.description }}</p>
- <img src="{{ STATIC_URL }}images/r_1.jpg" class="other-view" id="l-r-1">
+ {% for object in meshu.meshuimage_set.all %}
+ <img src="{{ STATIC_URL }}{{ object.image }}" class="other-view" id="l-r-{{ forloop.counter }}">
+ {% endfor %}
<ul id="img-thumbs">
+ {% for object in meshu.meshuimage_set.all %}
+ <img src="{{ STATIC_URL }}{{ object.image }}" style="width:25%; height: 25%" id="r-{{ forloop.counter }}">
+ {% endfor %}
</ul>
<h2 id="readymade-type">Object</h2>
{% endblock %}

0 comments on commit 3583cd4

Please sign in to comment.