diff options
-rw-r--r-- | app/pages/admin.py | 2 | ||||
-rw-r--r-- | app/pages/build.py | 2 | ||||
-rw-r--r-- | app/pages/models.py | 2 | ||||
-rw-r--r-- | app/pages/views.py | 11 |
4 files changed, 5 insertions, 12 deletions
diff --git a/app/pages/admin.py b/app/pages/admin.py index e96bf5a..abe903d 100644 --- a/app/pages/admin.py +++ b/app/pages/admin.py @@ -16,7 +16,7 @@ class PageEntryForm(forms.ModelForm): class PageAdmin(admin.ModelAdmin): form = PageEntryForm - list_display = ('title', 'slug', 'path', 'build') + list_display = ('title', 'slug', 'path', 'app', 'build') search_fields = ['title', 'body_markdown'] prepopulated_fields = {"slug": ('title',)} fieldsets = ( diff --git a/app/pages/build.py b/app/pages/build.py index f898833..be4369e 100644 --- a/app/pages/build.py +++ b/app/pages/build.py @@ -13,7 +13,7 @@ class BuildPages(BuildNew): print("building pages") def build_essays(self): - qs = self.model.objects.filter(path="essays",build=True) + qs = self.model.objects.filter(path="essays", build=True) c = {'object_list': qs, 'MEDIA_URL': settings.BAKED_MEDIA_URL, 'IMAGES_URL': settings.BAKED_IMAGES_URL} t = render_to_string('archives/essays.html', c).encode('utf-8') self.write_file('essays/', t) diff --git a/app/pages/models.py b/app/pages/models.py index 707892c..73c33dd 100644 --- a/app/pages/models.py +++ b/app/pages/models.py @@ -15,7 +15,7 @@ class Page(models.Model): app = models.CharField(max_length=50, null=True, blank=True) build = models.BooleanField(default=True) - def __unicode__(self): + def __str__(self): return self.title def get_absolute_url(self): diff --git a/app/pages/views.py b/app/pages/views.py index 026ab36..cccc4fb 100644 --- a/app/pages/views.py +++ b/app/pages/views.py @@ -1,14 +1,7 @@ -from django.shortcuts import render_to_response, get_object_or_404 -from django.template import RequestContext -from pages.models import Page - -def page(request, slug): - obj = get_object_or_404(Page, slug__exact=slug) - context = {'object': obj, } - return render_to_response(["details/%s.html" % obj.slug, 'details/page.html'], context, context_instance=RequestContext(request)) - from django.views.generic.detail import DetailView +from pages.models import Page + class PageDetailView(DetailView): model = Page |