From b3afad48e7b8ef63bcf24aa7ff5c8c7a0a92d197 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sun, 26 Sep 2010 23:16:37 -0400 Subject: questions page works on jinja, without translations yet --- askbot/conf/site_settings.py | 16 -- askbot/models/question.py | 8 + askbot/setup_templates/settings.py | 1 + askbot/skins/default/templates/base.jinja.html | 8 +- askbot/skins/default/templates/footer.jinja.html | 2 +- askbot/skins/default/templates/header.jinja.html | 4 +- .../skins/default/templates/input_bar.jinja.html | 10 +- askbot/skins/default/templates/macros.html | 40 ++++ .../skins/default/templates/questions.jinja.html | 8 +- .../default/templates/tag_selector.jinja.html | 6 +- askbot/skins/loaders.py | 3 +- askbot/templatetags/extra_filters.py | 25 +-- askbot/templatetags/extra_filters_jinja.py | 214 +++++++++++++++++++++ askbot/templatetags/extra_tags.py | 53 ++++- askbot/utils/slug.py | 4 +- askbot/views/readers.py | 6 +- 16 files changed, 346 insertions(+), 62 deletions(-) create mode 100644 askbot/templatetags/extra_filters_jinja.py diff --git a/askbot/conf/site_settings.py b/askbot/conf/site_settings.py index a206144f..9992b1e3 100644 --- a/askbot/conf/site_settings.py +++ b/askbot/conf/site_settings.py @@ -102,19 +102,3 @@ settings.register( ) ) ) - -settings.register( - livesettings.BooleanValue( - QA_SITE_SETTINGS, - 'USE_ASCII_ONLY_SLUGS', - description=_( - 'Use slugs made only of ASCII characters ' - 'in the page urls' - ), - help_text=_('Slugs are human-readable parts of the url ' - 'consisting of the page keywords, that are ' - 'typically composed from the page title.' - ), - default = True - ) -) diff --git a/askbot/models/question.py b/askbot/models/question.py index c450eed9..993463b0 100644 --- a/askbot/models/question.py +++ b/askbot/models/question.py @@ -180,6 +180,14 @@ class QuestionManager(models.Manager): #relevance will be ignored here qs = qs.order_by(orderby) qs = qs.distinct() + qs = qs.select_related( + 'last_activity_by__id', + 'last_activity_by__username' + 'last_activity_by__reputation' + 'last_activity_by__gold' + 'last_activity_by__silver' + 'last_activity_by__bronze' + ) return qs, meta_data #todo: this function is similar to get_response_receivers diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py index 491d3832..81e5a991 100644 --- a/askbot/setup_templates/settings.py +++ b/askbot/setup_templates/settings.py @@ -203,3 +203,4 @@ LOGIN_URL = '/%s%s%s' % (ASKBOT_URL,_('account/'),_('signin/')) #note - it is important that upload dir url is NOT translated!!! #also, this url must not have the leading slash ASKBOT_UPLOADED_FILES_URL = '%s%s' % (ASKBOT_URL, 'upfiles/') +ALLOW_UNICODE_SLUGS = False diff --git a/askbot/skins/default/templates/base.jinja.html b/askbot/skins/default/templates/base.jinja.html index 3c28fb45..3051f1f7 100644 --- a/askbot/skins/default/templates/base.jinja.html +++ b/askbot/skins/default/templates/base.jinja.html @@ -56,7 +56,7 @@ {% endif %} {% if active_tab != "tags" and active_tab != "users" %} - {% comment %}start asking question with title from search query{% endcomment %} + {# start asking question with title from search query #} - {% comment %}focus input on the search bar{% endcomment %} + {# focus input on the search bar endcomment #}