Commits

Anonymous committed e57c1e0

absolute_url fail fixed, start new footer mechanism

Comments (0)

Files changed (4)

pages/models/__init__.py

 from django.db import models
 from django.db.models.signals import class_prepared
 from django.contrib.auth.models import User
-from django.core.urlresolvers import set_script_prefix, reverse as urlresolve
+from django.core.urlresolvers import reverse as urlresolve
 from django.conf import settings
 from limited.utils import thumbnail
 from limited import markup
-from settings import BLOG_URL
 
 def apply_filter_method(**kwargs):
     model = kwargs.pop('sender')
 
     @property
     def absolute_url(self):
-        ## We want to generate absolute URLs here
-        ## this need to be done in this funktion to work in templates
-        set_script_prefix(BLOG_URL)
-
         return urlresolve('single_post' if self.isblog else 'single_page',
                           kwargs={'single' : self.url})
 

pages/templates/feed.xml

     {% for item in items %}
         <entry>
             <title>{{ item.title }}</title>
-            <link href="{{ item.absolute_url }}" />
+            <link href="{{ BLOG_URL }}/{{ item.absolute_url }}" />
             <id>{{ BLOG_URL }}/{{ item.url }}-{{ item.id}}</id>
             <updated>{{ item.time.isoformat }}</updated>
 

pages/viewutils.py

             parameters['previous_page'] = page-1
         if page < len(paginator.page_range):
             parameters['next_page'] = page+1
+
+        ## footer
+        footer = Page.filter(title='Footer')
+        if footer:
+            parameters['footer'] = footer[0]
+        else:
+            parameters['footer'] = None
+
     else:
         try:
             if len(parameters['items']) == 1:

templates/footer.html

 {% load i18n %}
 <div id="footer">
-    © {{ COPYRIGHT_YEARS|join:"-" }} -
-    {% trans "powered by" %} <a href='http://bitbucket.org/keba/limited/' title='limited'>limited</a>
+    {% if footer %}
+        {{ footer.parsed }}
+    {% else %}
+        © {{ COPYRIGHT_YEARS|join:"-" }} -
+        {% trans "powered by" %} <a href='http://bitbucket.org/keba/limited/' title='limited'>limited</a>
+    {% endif %}
 </div>