Permalink
Browse files

Add photos to house page (#1)

  • Loading branch information...
putnik committed Mar 20, 2012
1 parent 6b0f5e9 commit ceea3dbf99fdd0b64142275fb8efb582b464647c
Showing with 20 additions and 1 deletion.
  1. +1 −0 house/models.py
  2. +3 −1 house/views.py
  3. +5 −0 static_base/css/content.css
  4. +11 −0 templates/house/house.html
View
@@ -133,6 +133,7 @@ def make_upload_folder(instance, filename):
house = models.ForeignKey('House', verbose_name=_("House"))
file = YFField(upload_to=make_upload_folder)
title = models.CharField(max_length=250, blank=True, verbose_name=_("Title"))
+ author = models.CharField(max_length=250, blank=True, verbose_name=_("Author"))
def __unicode__(self):
return self.title
View
@@ -3,7 +3,7 @@
from django.template import RequestContext
from django.conf import settings
from django.db.models import Count, Max, Min
-from house.models import Street, House
+from house.models import *
def index_page(request):
@@ -36,9 +36,11 @@ def street(request, id):
def house(request, id):
h = House.objects.get(pk=id)
+ photo = HousePhoto.objects.filter(house=h)
return render_to_response('house/house.html', {
'house': h,
+ 'photo': photo,
'is_admin': True,
'CMADE_KEY': settings.CMADE_KEY,
}, context_instance=RequestContext(request))
@@ -28,6 +28,11 @@ table.info {
width: 100%;
}
+table.info.photo {
+ text-align: center;
+ margin-top: -1px;
+}
+
.info th {
text-align: right;
}
View
@@ -122,4 +122,15 @@ <h1><a href="/street/{{ house.street.id }}">{{ house.street }}</a>, {{ house.num
</tr>
{% endif %}
</table>
+
+{% if house.kult_id %}
+<table class="info photo">
+{% for p in photo %}
+ <tr class="{% cycle 'even' 'odd' %}"><td>
+ <a href="{{ p.file.src }}" title="Автор: {{ p.author }}" target="_blank"><img src="{{ p.file.src_300 }}" alt="Автор: {{ p.author }}" /></a>
+ </td></tr>
+{% endfor %}
+</table>
+{% endif %}
+
{% endblock %}

0 comments on commit ceea3db

Please sign in to comment.