summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/blog/admin.py10
-rw-r--r--app/blog/models.py7
-rw-r--r--app/blog/views.py8
-rw-r--r--design/templates/archives/homepage.html12
4 files changed, 24 insertions, 13 deletions
diff --git a/app/blog/admin.py b/app/blog/admin.py
index 7124b1d..de6a838 100644
--- a/app/blog/admin.py
+++ b/app/blog/admin.py
@@ -2,7 +2,7 @@ from django.contrib import admin
from django import forms
from blog.widgets import AdminImageWidget
from django.contrib.gis.admin import OSMGeoAdmin
-from .models import Entry, EntryAside, PostImage
+from .models import Entry, EntryAside, PostImage, HomepageCurrator
class EntryAsideInline(admin.TabularInline):
@@ -33,7 +33,7 @@ class EntryAdmin(OSMGeoAdmin):
field = super(EntryAdmin, self).formfield_for_dbfield(db_field, **kwargs)
return field
- list_display = ('title', 'pub_date', 'home_page_banner', 'template_name', 'status', 'region', 'location', 'photo_gallery')
+ list_display = ('title', 'pub_date', 'template_name', 'status', 'region', 'location', 'photo_gallery')
search_fields = ['title', 'body_markdown']
prepopulated_fields = {"slug": ('title',)}
list_filter = ('pub_date', 'enable_comments', 'status', 'location__state__country__lux_region')
@@ -59,7 +59,6 @@ class EntryAdmin(OSMGeoAdmin):
'meta_description',
('image', 'thumbnail'),
'template_name',
- 'home_page_banner'
),
}),
)
@@ -78,7 +77,12 @@ class EntryAdmin(OSMGeoAdmin):
class PostImageAdmin(admin.ModelAdmin):
list_display = ('title', 'post_image')
+class HomepageCurratorAdmin(admin.ModelAdmin):
+ pass
+
admin.site.register(PostImage, PostImageAdmin)
admin.site.register(EntryAside, EntryAsideAdmin)
admin.site.register(Entry, EntryAdmin)
+admin.site.register(HomepageCurrator, HomepageCurratorAdmin)
+
diff --git a/app/blog/models.py b/app/blog/models.py
index 8ab28b6..4ff1935 100644
--- a/app/blog/models.py
+++ b/app/blog/models.py
@@ -69,7 +69,6 @@ class Entry(models.Model):
(5, 'bigimg-dark'),
)
template_name = models.IntegerField(choices=TEMPLATES, default=0)
- home_page_banner = models.BooleanField(default=False)
class Meta:
ordering = ('-pub_date',)
@@ -157,6 +156,12 @@ class EntryAside(models.Model):
body = models.TextField(null=True, blank=True)
entry = models.ForeignKey(Entry)
+class HomepageCurrator(models.Model):
+ banner = models.ForeignKey(Entry, related_name="banner")
+ entry_list = models.ManyToManyField(Entry)
+ template_name = models.CharField(max_length=200,help_text="full path")
+
+
class BlogSitemap(Sitemap):
changefreq = "never"
diff --git a/app/blog/views.py b/app/blog/views.py
index 93d7488..0e887bd 100644
--- a/app/blog/views.py
+++ b/app/blog/views.py
@@ -4,16 +4,18 @@ from django.http import Http404
from django.conf import settings
# from django.views.generic import ListView
-from blog.models import Entry
+from blog.models import Entry, HomepageCurrator
from locations.models import Region, Country
from photos.models import Photo
def home(request):
+ obj = HomepageCurrator.objects.get(pk=1)
+ template = obj.template_name
context = {
- 'object_list': Entry.objects.filter(status__exact=1,home_page_banner=1).select_related()[:4],
+ 'homepage': obj,
}
- return render_to_response('archives/homepage.html', context, context_instance=RequestContext(request))
+ return render_to_response(template, context, context_instance=RequestContext(request))
def entry_detail(request, year, month, slug):
diff --git a/design/templates/archives/homepage.html b/design/templates/archives/homepage.html
index c423c4c..12968aa 100644
--- a/design/templates/archives/homepage.html
+++ b/design/templates/archives/homepage.html
@@ -3,8 +3,8 @@
{%block htmlclass%}class="black"{%endblock%}
{%block bodyid%}id="home" class="has-hero"{%endblock%}
-{% block primary %}<section class="banner">{% for object in object_list %}{% if forloop.counter == 1 %}
- <article class="h-entry hentry {% cycle 'odd' 'even' %} {% cycle 'first' 'second' 'third' %}">
+{% block primary %}<section class="banner">{% with object=homepage.banner %}
+ <article class="h-entry hentry">
<div class="post--image">
<a href="{{object.get_absolute_url}}" title="{{object.title}}">
<picture>
@@ -28,7 +28,7 @@
</p>
<a href="{{object.get_absolute_url}}" class="u-url btn" title="{%if object.title_keywords%}{{object.title_keywords}}{%else%}{{object.title}}{%endif%}">Read</a>
</div>
- </article> {% endif %} {% endfor %}
+ </article>{% endwith %}
</section>
{%comment%}<section id="currently">
<div class="project-tease"><a href="/projects/5x5/"><h4 id="proj">5<span>x</span>5</h4> Interviews From The Road</a><p>Lorem sit amet, consectetur adipiscing elit. Duis cursus sodales eros <cite>&ndash; William Brandon III</cite></p></div>
@@ -36,12 +36,12 @@
<div class="homepage--about homepage--section">
<h3 class="homepage--arc-header">About Luxagraf</h3>
<p>I like to think of luxagraf as the notebook you might have found, something I might have accidentally dropped between the cushions of a jostling, camel-powered taxi winding its way through the narrow, bumpy, dusty streets of Tangier circa 1910.</p>
- <p>It could just be a website though. Except that I don&#8217;t do lists. And I&#8217;m not trying to make&nbsp;money.</p><p>Luxagraf is a collection of field notes, a bare recording of some of my time on earth. Enjoy.</p>
+ <p>It could just be a website though. Except that I don&#8217;t do lists. And I&#8217;m not trying to make&nbsp;money.</p><p>Luxagraf is a collection of field notes, a record of some of my time on earth. Enjoy.</p>
</div>
<div class="homepage--section">
<section class="archive homepage--archives">
<h1 class="homepage--arc-header">Most Popular</h1>
- {% for object in object_list %}{%if forloop.counter > 1 %}
+ {% for object in homepage.entry_list.all %}
<article class="h-entry hentry">
<div class="post--image">
<a href="{{object.get_absolute_url}}" title="{{object.title}}"><img src="{{object.get_image_wide_url}}" alt="{{ object.title }}" class="u-photo post-image" /></a>
@@ -54,7 +54,7 @@
<data itemprop="latitude" class="p-latitude" value="{{object.latitude}}"></data>
<data itemprop="longitude" class="p-longitude" value="{{object.longitude}}"></data>
</p>
- </article> {% endif %}{% endfor %}
+ </article> {% endfor %}
<p><a href="/" class="homepage--next">Read More</a></p>
</section>
<section class="homepage--bright">