From: Stephen Burrows Date: Mon, 10 Jan 2011 16:08:45 +0000 (-0500) Subject: Merge branch 'navigation' X-Git-Tag: philo-0.9~22^2~17 X-Git-Url: http://git.ithinksw.org/philo.git/commitdiff_plain/4277b566b93122c8efac805684e423f92e723d1f?hp=0d560fdc9e0351ebe039dcc9d9d14b6b560ba00c Merge branch 'navigation' --- diff --git a/README b/README index 90d12c0..5ce7b93 100644 --- a/README +++ b/README @@ -8,7 +8,7 @@ Prerequisites: * (Optional) recaptcha-django r6 * (Optional) south 0.7.2+ -To contribute, please visit the project website . +To contribute, please visit the project website . 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 index 0000000..0e695c5 --- /dev/null +++ b/README.markdown @@ -0,0 +1,24 @@ +Philo is a foundation for developing web content management systems. + +Prerequisites: + + * [Python 2.5.4+ <http://www.python.org>](http://www.python.org/) + * [Django 1.2+ <http://www.djangoproject.com/>](http://www.djangoproject.com/) + * [django-mptt 0.4+ <https://github.com/django-mptt/django-mptt/>](https://github.com/django-mptt/django-mptt/) + * (Optional) [django-grappelli 2.0+ <http://code.google.com/p/django-grappelli/>](http://code.google.com/p/django-grappelli/) + * (Optional) [south 0.7.2+ <http://south.aeracode.org/)](http://south.aeracode.org/) + * (Optional) [recaptcha-django r6 <http://code.google.com/p/recaptcha-django/>](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 diff --git a/contrib/penfield/admin.py b/contrib/penfield/admin.py index 5faf4ef..c758e67 100644 --- a/contrib/penfield/admin.py +++ b/contrib/penfield/admin.py @@ -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): diff --git a/contrib/penfield/models.py b/contrib/penfield/models.py index d3eea16..9f1b61b 100644 --- a/contrib/penfield/models.py +++ b/contrib/penfield/models.py @@ -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 {}) diff --git a/signals.py b/signals.py index 875039d..3653c54 100644 --- a/signals.py +++ b/signals.py @@ -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 diff --git a/templatetags/embed.py b/templatetags/embed.py index db5cea5..eb4cd68 100644 --- a/templatetags/embed.py +++ b/templatetags/embed.py @@ -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: