Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add photos to house page (#1)

  • Loading branch information...
commit ceea3dbf99fdd0b64142275fb8efb582b464647c 1 parent 6b0f5e9
@putnik putnik authored
View
1  house/models.py
@@ -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
4 house/views.py
@@ -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))
View
5 static_base/css/content.css
@@ -28,6 +28,11 @@ table.info {
width: 100%;
}
+table.info.photo {
+ text-align: center;
+ margin-top: -1px;
+}
+
.info th {
text-align: right;
}
View
11 templates/house/house.html
@@ -122,4 +122,15 @@
</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 %}
Please sign in to comment.
Something went wrong with that request. Please try again.