projects changes

This commit is contained in:
Karen 2011-10-05 17:32:49 +05:30
commit 77eb530663
3 changed files with 5 additions and 4 deletions

View File

@ -145,6 +145,4 @@
<li><img src="/static/images/dummy1.jpg" width="100" height="100" class="selected"></li> <li><img src="/static/images/dummy1.jpg" width="100" height="100" class="selected"></li>
--> -->
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -1,5 +1,6 @@
from django.db import models from django.db import models
from os.path import join from os.path import join
from sorl.thumbnail import get_thumbnail
def project_thumb_path(instance, filename): def project_thumb_path(instance, filename):
return join('project_thumbs', instance.slug, filename) return join('project_thumbs', instance.slug, filename)
@ -32,8 +33,9 @@ class Project(models.Model):
def get_images(self): def get_images(self):
imgs = [] imgs = []
for i in self.projectimage_set.all(): for i in self.projectimage_set.all():
image_url = get_thumbnail(i.image, "x450", crop="center").url
imgs.append({ imgs.append({
'url': i.image.url, 'url': image_url,
'caption': i.caption 'caption': i.caption
}) })
return imgs return imgs

View File

@ -4,6 +4,7 @@ from models import *
import json import json
from ox.django.shortcuts import render_to_json_response from ox.django.shortcuts import render_to_json_response
def home(request): def home(request):
return render_to_response("home.html", {}) return render_to_response("home.html", {})