Merge branch 'navigation'
authorStephen Burrows <stephen.r.burrows@gmail.com>
Mon, 10 Jan 2011 16:08:45 +0000 (11:08 -0500)
committerStephen Burrows <stephen.r.burrows@gmail.com>
Mon, 10 Jan 2011 16:08:45 +0000 (11:08 -0500)
README
README.markdown [new file with mode: 0644]
contrib/penfield/admin.py
contrib/penfield/models.py
signals.py
templatetags/embed.py

diff --git a/README b/README
index 90d12c0..5ce7b93 100644 (file)
--- a/README
+++ b/README
@@ -8,7 +8,7 @@ Prerequisites:
        * (Optional) recaptcha-django r6 <http://code.google.com/p/recaptcha-django/>
        * (Optional) south 0.7.2+ <http://south.aeracode.org/>
 
-To contribute, please visit the project website <http://philo.ithinksw.org/>.
+To contribute, please visit the project website <http://philo.ithinksw.org/>. Feel free to join us on IRC at irc://irc.oftc.net/#philo.
 
 ====
 Using philo
diff --git a/README.markdown b/README.markdown
new file mode 100644 (file)
index 0000000..0e695c5
--- /dev/null
@@ -0,0 +1,24 @@
+Philo is a foundation for developing web content management systems.
+
+Prerequisites:
+
+ * [Python 2.5.4+ &lt;http://www.python.org&gt;](http://www.python.org/)
+ * [Django 1.2+ &lt;http://www.djangoproject.com/&gt;](http://www.djangoproject.com/)
+ * [django-mptt 0.4+ &lt;https://github.com/django-mptt/django-mptt/&gt;](https://github.com/django-mptt/django-mptt/)
+ * (Optional) [django-grappelli 2.0+ &lt;http://code.google.com/p/django-grappelli/&gt;](http://code.google.com/p/django-grappelli/)
+ * (Optional) [south 0.7.2+ &lt;http://south.aeracode.org/)](http://south.aeracode.org/)
+ * (Optional) [recaptcha-django r6 &lt;http://code.google.com/p/recaptcha-django/&gt;](http://code.google.com/p/recaptcha-django/)
+
+To contribute, please visit the [project website](http://philo.ithinksw.org/). Feel free to join us on IRC at [irc://irc.oftc.net/#philo](irc://irc.oftc.net/#philo>).
+
+Using philo
+===========
+
+After installing philo and mptt on your python path, make sure to complete the following steps:
+
+1. add 'philo.middleware.RequestNodeMiddleware' to settings.MIDDLEWARE_CLASSES.
+2. add 'philo' and 'mptt' to settings.INSTALLED_APPS.
+3. include 'philo.urls' somewhere in your urls.py file.
+4. Optionally add a root node to your current Site.
+
+Philo should be ready to go!
\ No newline at end of file
index 5faf4ef..c758e67 100644 (file)
@@ -26,6 +26,13 @@ class NewsletterAdmin(TitledAdmin):
 
 class NewsletterArticleAdmin(TitledAdmin, AddTagAdmin):
        filter_horizontal = TitledAdmin.filter_horizontal + ('tags', 'authors')
+       list_display = ['title', 'date', 'author_names']
+       search_fields = ('title', 'authors__name',)
+       date_hierarchy = 'date'
+       
+       def author_names(self, obj):
+               return ', '.join([author.get_full_name() for author in obj.authors.all()])
+       author_names.short_description = "Authors"
 
 
 class NewsletterIssueAdmin(TitledAdmin):
index d3eea16..9f1b61b 100644 (file)
@@ -197,7 +197,7 @@ class BlogView(MultiView, FeedMultiViewMixin):
        def add_item(self, feed, obj, kwargs=None):
                defaults = {
                        'title': obj.title,
-                       'description': obj.excerpt or obj.content,
+                       'description': obj.content,
                        'author_name': obj.author.get_full_name(),
                        'pubdate': obj.date
                }
@@ -429,7 +429,7 @@ class NewsletterView(MultiView, FeedMultiViewMixin):
                        'title': obj.title,
                        'author_name': ', '.join([author.get_full_name() for author in obj.authors.all()]),
                        'pubdate': obj.date,
-                       'description': obj.lede or obj.full_text,
+                       'description': obj.full_text,
                        'categories': [tag.name for tag in obj.tags.all()]
                }
                defaults.update(kwargs or {})
index 875039d..3653c54 100644 (file)
@@ -5,11 +5,4 @@ entity_class_prepared = Signal(providing_args=['class'])
 view_about_to_render = Signal(providing_args=['request', 'extra_context'])
 view_finished_rendering = Signal(providing_args=['response'])
 page_about_to_render_to_string = Signal(providing_args=['request', 'extra_context'])
-page_finished_rendering_to_string = Signal(providing_args=['string'])
-
-
-def replace_sender_response(sender, response):
-       """Helper function to swap in a new response."""
-       def render_to_response(self, *args, **kwargs):
-               return response
-       sender.actually_render_to_response = render_to_response
\ No newline at end of file
+page_finished_rendering_to_string = Signal(providing_args=['string'])
\ No newline at end of file
index db5cea5..eb4cd68 100644 (file)
@@ -146,7 +146,6 @@ class ConstantEmbedNode(template.Node):
                        self.template = None
        
        def compile_instance(self, object_pk):
-               self.object_pk = object_pk
                model = self.content_type.model_class()
                try:
                        return model.objects.get(pk=object_pk)
@@ -275,15 +274,15 @@ def get_embedded(self):
 setattr(ConstantEmbedNode, LOADED_TEMPLATE_ATTR, property(get_embedded))
 
 
-def get_content_type(bit):
+def parse_content_type(bit, tagname):
        try:
                app_label, model = bit.split('.')
        except ValueError:
-               raise template.TemplateSyntaxError('"%s" template tag expects the first argument to be of the form app_label.model' % tag)
+               raise template.TemplateSyntaxError('"%s" template tag expects the first argument to be of the form app_label.model' % tagname)
        try:
                ct = ContentType.objects.get(app_label=app_label, model=model)
        except ContentType.DoesNotExist:
-               raise template.TemplateSyntaxError('"%s" template tag requires an argument of the form app_label.model which refers to an installed content type (see django.contrib.contenttypes)' % tag)
+               raise template.TemplateSyntaxError('"%s" template tag requires an argument of the form app_label.model which refers to an installed content type (see django.contrib.contenttypes)' % tagname)
        return ct
 
 
@@ -300,7 +299,7 @@ def do_embed(parser, token):
                raise template.TemplateSyntaxError('"%s" template tag must have at least two arguments.' % tag)
        
        if len(bits) == 3 and bits[-2] == 'with':
-               ct = get_content_type(bits[0])
+               ct = parse_content_type(bits[0], tag)
                
                if bits[2][0] in ['"', "'"] and bits[2][0] == bits[2][-1]:
                        return ConstantEmbedNode(ct, template_name=bits[2])
@@ -323,7 +322,7 @@ def do_embed(parser, token):
                return InstanceEmbedNode(instance, kwargs)
        elif len(bits) > 2:
                raise template.TemplateSyntaxError('"%s" template tag expects at most 2 non-keyword arguments when embedding instances.')
-       ct = get_content_type(bits[0])
+       ct = parse_content_type(bits[0], tag)
        pk = bits[1]
        
        try: