Skip to content

Commit

Permalink
adding readymade images, using order_set in model
Browse files Browse the repository at this point in the history
  • Loading branch information
shashashasha committed Apr 22, 2012
1 parent d60a8da commit 3583cd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions meshu/models.py
Expand Up @@ -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'
Expand Down Expand Up @@ -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")

Expand Down
7 changes: 6 additions & 1 deletion templates/meshu/item/readymade.html
Expand Up @@ -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.