Commits

Marc Tamlyn committed 1c014f4

Convert to be used with application content.

Comments (0)

Files changed (5)

articles/models.py

 from django.conf.urls.defaults import patterns, url
 
 from feincms.admin import editor
+from feincms.content.application import models as app_models
 from feincms.models import Base
 from feincms.utils.managers import ActiveAwareContentManagerMixin
 
     slug = models.SlugField(max_length=255, help_text='This will be automatically generated from the name', unique=True, editable=True)
 
     class Meta:
-        ordering = ['title', ]
+        ordering = ['title']
         unique_together = []
 
     objects = ArticleManager()
     def __unicode__(self):
         return u"%s" % (self.title)
 
-    @models.permalink
+    @app_models.permalink
     def get_absolute_url(self):
-        return ('article_detail', (), { 'article': self.slug, })
+        return ('article_detail', 'articles.urls', (), {'slug': self.slug})
 
     @property
     def is_active(self):

articles/templates/articles/article_detail.html

 
 {% block article-aside %}{% endblock %}
 
-
 {% block article-content %}
     <div class="article full">
 

articles/templates/articles/article_list.html

 {% extends "articles/base.html" %}
 
-{% load feincms_tags i18n pagination_tags %}
+{% load feincms_tags i18n %}
 
 {% block article-title %}
     <h2>{% trans 'Articles' %}</h2>
 
 {% block article-content %}
 
-    {% autopaginate object_list 10 %}
     {% for article in object_list %}  
     <div class="article short">
         <div class="summary">
-            <h3><a href="{{article.get_absolute_url }}">{{ article }}</a></h3>
-            {% feincms_render_region object 'summary' request %}
+            <h3><a href="{{ article.get_absolute_url }}">{{ article }}</a></h3>
+            {% feincms_render_region article 'summary' request %}
         </div>
     </div>
     {% endfor %}
-    {% paginate %}
 
 {% endblock %}

articles/templates/articles/base.html

 {% extends "base.html" %}
 
-
-{% block content %}
+{% block page_content %}
 
 {% block article-title %}{% endblock %}
 

articles/views.py

 from models import Article
 
 
-class ArticleDetail(DetailView):
+class AppContentMixin(object):
+    def render_to_response(self, context, **response_kwargs):
+        """
+        Returns the template tuple needed for FeinCMS App Content.
+        """
+        return (self.get_template_names(), context)
+
+
+class ArticleDetail(AppContentMixin, DetailView):
     model = Article
 
     def get_queryset(self):
         return Article.objects.active()
 
 
-class ArticleDetail(ListView):
+class ArticleList(AppContentMixin, ListView):
     model = Article
 
     def get_queryset(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.