diff options
author | luxagraf <sng@luxagraf.net> | 2012-10-21 22:59:12 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2012-10-21 22:59:12 -0400 |
commit | 83e49fa3c3ea9b9b3f74b7302df8825aaf4e3d18 (patch) | |
tree | c82ce28b70bf721d5c14079b6f1000f090fe3adf | |
parent | 6c20194f9ac2347c4618f690c0a6b53ce742bbf0 (diff) |
fixed homepage
-rw-r--r-- | app/blog/views.py | 4 | ||||
-rw-r--r-- | design/templates/archives/homepage.html | 31 | ||||
-rw-r--r-- | design/templates/bin/recent_entries.html | 14 |
3 files changed, 24 insertions, 25 deletions
diff --git a/app/blog/views.py b/app/blog/views.py index 02acef4..e23acff 100644 --- a/app/blog/views.py +++ b/app/blog/views.py @@ -12,10 +12,10 @@ from photos.models import Photo, PhotoGallery #from chunks.models import Chunk def home(request): - featured = Entry.objects.filter(status__exact=1).select_related().latest() + qs = Entry.objects.filter(status__exact=1).select_related()[:4] #gallery = PhotoGallery.objects.latest() context = { - 'featured': featured, + 'object_list': qs, #'gallery': gallery } return render_to_response('archives/homepage.html', context, context_instance = RequestContext(request)) diff --git a/design/templates/archives/homepage.html b/design/templates/archives/homepage.html index 56b7f57..1531091 100644 --- a/design/templates/archives/homepage.html +++ b/design/templates/archives/homepage.html @@ -2,20 +2,20 @@ {% load typogrify %} {%block bodyid%}id="home"{%endblock%} -{% block primary %}<section class="archive"> +{% block primary %}<section class="archive">{% for object in object_list %}{% if forloop.counter == 1 %} <article> - <h1><a href="{{featured.get_absolute_url}}" title="{%if featured.title_keywords%}{{featured.title_keywords}}{%else%}{{featured.title}}{%endif%}">{{featured.title|smartypants|widont|safe}}</a></h1> + <h1><a href="{{object.get_absolute_url}}" title="{{object.title}}">{{object.title|smartypants|widont|safe}}</a></h1> <div class="img"> - <a href="{{featured.get_absolute_url}}" title="{{featured.title}}"><img src="{{featured.get_image_url}}" alt="{{ featured.title }}" class="post-image" width="{{featured.image_width}}" height="{{featured.image_height}}" /></a> + <a href="{{object.get_absolute_url}}" title="{{object.title}}"><img src="{{object.get_image_url}}" alt="{{ object.title }}" class="post-image" /></a> </div> <p class="dateline bl"> - <span class="location" itemprop="geo" itemscope itemtype="http://data-vocabulary.org/​Geo">{% if featured.country_name == "United States" %}{{featured.location_name|smartypants|safe}}, <a href="/writing/united-states/1/" title="travel writing from the United States">{{featured.state_name}}</a>{%else%}{{featured.location_name|smartypants|safe}}, <a href="/writing/{{featured.country_name|slugify}}/1/" title="travel writing from {{featured.country_name}}">{{featured.country_name}}</a>{%endif%} - <meta itemprop="latitude" content="{{featured.latitude}}" /> - <meta itemprop="longitude" content="{{featured.longitude}}" /></span> - <time datetime="{{featured.pub_date|date:'c'}}" pubdate>{{featured.pub_date|date:"m/d/y"}}</time> + <span class="location" itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">{% if object.country.name == "United States" %}{{object.location.name|smartypants|safe}}, <a href="/writing/united-states/" title="travel writing from the United States">{{object.location.state.name}}</a>{%else%}{{object.location.name|smartypants|safe}}, <a href="/writing/{{object.location.state.country.name|slugify}}/" title="travel writing from {{object.location.state.country.name}}">{{object.location.state.country.name}}</a>{%endif%} + <meta itemprop="latitude" content="{{object.latitude}}" /> + <meta itemprop="longitude" content="{{object.longitude}}" /></span> + <time datetime="{{object.pub_date|date:'c'}}" pubdate>{{object.pub_date|date:"m/d/y"}}</time> </p> - <p class="hyphenate">{{featured.dek|safe}} <span class="button"><a href="{{featured.get_absolute_url}}" title="{{featured.title}}">More »</a></span> </p> + <p class="hyphenate">{{object.dek|safe}} <span class="button"><a href="{{object.get_absolute_url}}" title="{{object.title}}">More »</a></span> </p> {%endif%}{%endfor%} </article> </section> @@ -24,8 +24,19 @@ </section>{%endcomment%} <section class="home harchive"> <h1 class="sh">From the Archive</h1> - {%comment%} {% include 'includes/recent_entries.html' %}{%endcomment%} - </section> + {% for object in object_list %}{%if forloop.counter > 1 %}<article {%if forloop.last %}class="last"{%endif%}> + <h1><a href="{{object.get_absolute_url}}" title="{{object.title}}">{{object.title|smartypants|widont|safe}}</a></h1> + <p class="dateline bl"> + <span class="location" itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">{% if object.location.state.country.name == "United States" %}{{object.location.name|smartypants|safe}}, <a href="/writing/united-states/1/" title="travel writing from the United States">{{object.location.state.name}}</a>{%else%}{{object.location.name|smartypants|safe}}, <a href="/writing/{{object.location.state.country.slug}}/1/" title="travel writing from {{object.location.state.country.name}}">{{object.location.state.country.name}}</a>{%endif%} + <meta itemprop="latitude" content="{{object.latitude}}" /> + <meta itemprop="longitude" content="{{object.longitude}}" /> + </span> + <time datetime="{{object.pub_date|date:'c'}}" pubdate>{{object.pub_date|date:"m/d/y"}}</time> + </p> + {%if object.thumbnail%}<a class="permalink" href="{{object.get_absolute_url}}" title="{{object.title}}"><img src="{{object.get_thumbnail_url}}" alt="{{ object.title }}" class="post-image" width="{{object.thumb_width}}" height="{{object.thumb_height}}" /></a>{%endif%} + <p class="hyphenate">{{object.dek|safe}}</p> + </article>{%endif%} + {% endfor %} </section> {% endblock %} {% block js %}<script src="{{MEDIA_URL}}js/hyphenate.min.js" type="text/javascript"></script>{% endblock%} diff --git a/design/templates/bin/recent_entries.html b/design/templates/bin/recent_entries.html index f86d6f2..9bf6b28 100644 --- a/design/templates/bin/recent_entries.html +++ b/design/templates/bin/recent_entries.html @@ -1,13 +1 @@ -{% load typogrify %}{% for object in object_list %}<article {%if forloop.last %}class="last"{%endif%}> - <h1><a href="{{object.get_absolute_url}}" title="{%if object.title_keywords%}{{object.title_keywords}}{%else%}{{object.title}}{%endif%}">{{object.title|smartypants|widont|safe}}</a></h1> - <p class="dateline bl"> - <span class="location" itemprop="geo" itemscope itemtype="http://data-vocabulary.org/Geo">{% if object.location.state.country.name == "United States" %}{{object.location.name|smartypants|safe}}, <a href="/writing/united-states/1/" title="travel writing from the United States">{{object.location.state.name}}</a>{%else%}{{object.location.name|smartypants|safe}}, <a href="/writing/{{object.location.state.country.slug}}/1/" title="travel writing from {{object.location.state.country.name}}">{{object.location.state.country.name}}</a>{%endif%} - <meta itemprop="latitude" content="{{object.latitude}}" /> - <meta itemprop="longitude" content="{{object.longitude}}" /> - </span> - <time datetime="{{object.pub_date|date:'c'}}" pubdate>{{object.pub_date|date:"m/d/y"}}</time> - </p> - {%if object.thumbnail%}<a class="permalink" href="{{object.get_absolute_url}}" title="{{object.title}}"><img src="{{object.get_thumbnail_url}}" alt="{{ object.title }}" class="post-image" width="{{object.thumb_width}}" height="{{object.thumb_height}}" /></a>{%endif%} - <p class="hyphenate">{{object.dek|safe}}</p> - </article> - {% endfor %} +{% load typogrify %} |