summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/conf/login_providers.py6
-rw-r--r--askbot/deployment/__init__.py2
-rw-r--r--askbot/doc/source/changelog.rst1
-rw-r--r--askbot/media/style/style.css1
-rw-r--r--askbot/media/style/style.less1
-rw-r--r--askbot/migrations/0013_add_response_count__to_user.py17
-rw-r--r--askbot/migrations/0014_rename_schema_from_forum_to_askbot.py21
-rw-r--r--askbot/migrations/0018_add___status__field_to_user_model.py16
-rw-r--r--askbot/migrations/0026_add_seen_and_new_response_counts_to_user.py8
-rw-r--r--askbot/migrations/0033_add__consecutive_days_visit_count__to__auth_user.py16
-rw-r--r--askbot/migrations/0035_add_country_fields_to_user.py8
-rw-r--r--askbot/migrations/0037_add_marked_tags_to_user_profile.py12
-rw-r--r--askbot/migrations/0038_add_tag_filter_strategies.py32
-rw-r--r--askbot/migrations/0043_add_temporal_extra_column_for_datamigration.py6
-rw-r--r--askbot/migrations/0122_auth_user__add_subscribed_tag_field.py8
-rw-r--r--askbot/migrations/0124_auto__add_field_post_is_private__add_field_replyaddress_reply_action.py15
-rw-r--r--askbot/migrations/0125_add_show_tags_field_to_user.py18
-rw-r--r--askbot/migrations/0126_add_field__auth_user__is_fake.py11
-rw-r--r--askbot/migrations/__init__.py5
-rw-r--r--askbot/migrations_api/__init__.py21
-rw-r--r--askbot/models/__init__.py11
-rw-r--r--askbot/models/tag.py2
-rw-r--r--askbot/templates/list_suggested_tags.html24
-rw-r--r--askbot/templates/question/sidebar.html8
-rw-r--r--askbot/views/commands.py4
25 files changed, 148 insertions, 126 deletions
diff --git a/askbot/conf/login_providers.py b/askbot/conf/login_providers.py
index 5bd9ceb1..2ee59e2a 100644
--- a/askbot/conf/login_providers.py
+++ b/askbot/conf/login_providers.py
@@ -84,12 +84,16 @@ providers = (
'LaunchPad'
)
+DISABLED_BY_DEFAULT = (
+ 'LaunchPad'
+)
+
need_extra_setup = ('Twitter', 'Facebook', 'LinkedIn', 'identi.ca',)
for provider in providers:
kwargs = {
'description': _('Activate %(provider)s login') % {'provider': provider},
- 'default': True,
+ 'default': not (provider in DISABLED_BY_DEFAULT)
}
if provider in need_extra_setup:
kwargs['help_text'] = _(
diff --git a/askbot/deployment/__init__.py b/askbot/deployment/__init__.py
index 1ba5c202..5477b284 100644
--- a/askbot/deployment/__init__.py
+++ b/askbot/deployment/__init__.py
@@ -217,6 +217,8 @@ def collect_missing_options(options_dict):
print 'name %s cannot be used for the database name' % value
elif value == path_utils.LOG_DIR_NAME:
print 'name %s cannot be used for the database name' % value
+ else:
+ database_file_name = value
if database_file_name:
options_dict['database_name'] = database_file_name
diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst
index 669c48d2..0c54f173 100644
--- a/askbot/doc/source/changelog.rst
+++ b/askbot/doc/source/changelog.rst
@@ -9,6 +9,7 @@ Development version
Portugese, Romanian, Russian, Spanish, Swedish, Turkish.
* repost answer as a comment under the previous (older) answer
* minor edit option for question and answer, to suppress email alerts
+* allowed tags to be created updon marking them as interesting/ignored/subscribed
0.7.48 (Jan 28, 2013)
---------------------
diff --git a/askbot/media/style/style.css b/askbot/media/style/style.css
index a53ebf37..cb5f3801 100644
--- a/askbot/media/style/style.css
+++ b/askbot/media/style/style.css
@@ -688,6 +688,7 @@ body.anon .search-drop-menu {
background: #fff;
padding: 4px 0px 10px 0px;
width: 200px;
+ overflow: hidden;
/* widgets for question template */
/* notify by email box */
diff --git a/askbot/media/style/style.less b/askbot/media/style/style.less
index 0ce1b849..5dce292c 100644
--- a/askbot/media/style/style.less
+++ b/askbot/media/style/style.less
@@ -699,6 +699,7 @@ body.anon {
background: #fff;
padding: 4px 0px 10px 0px;
width:200px;
+ overflow: hidden;
p {
margin-bottom: 4px;
diff --git a/askbot/migrations/0013_add_response_count__to_user.py b/askbot/migrations/0013_add_response_count__to_user.py
index f3d724e3..68ac0c3c 100644
--- a/askbot/migrations/0013_add_response_count__to_user.py
+++ b/askbot/migrations/0013_add_response_count__to_user.py
@@ -3,6 +3,7 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
@@ -13,16 +14,12 @@ class Migration(SchemaMigration):
a bit hacky but we have to do it as long as we keep patching auth models
within the forum application
"""
- try:
- db.add_column(
- u'auth_user',
- 'response_count',
- self.gf('django.db.models.fields.IntegerField')(default=0, ),
- keep_default=False
- )
- except:
- print 'probably already have column User.response_count'
- pass
+ safe_add_column(
+ u'auth_user',
+ 'response_count',
+ self.gf('django.db.models.fields.IntegerField')(default=0, ),
+ keep_default=False
+ )
def backwards(self, orm):
diff --git a/askbot/migrations/0014_rename_schema_from_forum_to_askbot.py b/askbot/migrations/0014_rename_schema_from_forum_to_askbot.py
index f5f913da..f9a5b739 100644
--- a/askbot/migrations/0014_rename_schema_from_forum_to_askbot.py
+++ b/askbot/migrations/0014_rename_schema_from_forum_to_askbot.py
@@ -10,19 +10,20 @@ app_dir_name = os.path.basename(os.path.dirname(os.path.dirname(__file__)))
class Migration(SchemaMigration):
def forwards(self, orm):
- try:
- db.rename_table('forum_anonymousanswer', 'askbot_anonymousanswer')
- db.rename_table('forum_anonymousquestion', 'askbot_anonymousquestion')
- db.rename_table('forum_emailfeedsetting', 'askbot_emailfeedsetting')
- db.rename_table('forum_markedtag', 'askbot_markedtag')
- db.rename_table('forum_questionview', 'askbot_questionview')
- db.rename_table('forum_validationhash', 'askbot_validationhash')
- except:
- pass
+ if app_dir_name == 'forum':
+ try:
+ db.rename_table('forum_anonymousanswer', 'askbot_anonymousanswer')
+ db.rename_table('forum_anonymousquestion', 'askbot_anonymousquestion')
+ db.rename_table('forum_emailfeedsetting', 'askbot_emailfeedsetting')
+ db.rename_table('forum_markedtag', 'askbot_markedtag')
+ db.rename_table('forum_questionview', 'askbot_questionview')
+ db.rename_table('forum_validationhash', 'askbot_validationhash')
+ except:
+ pass
def backwards(self, orm):
- if app_dirname == 'forum':
+ if app_dir_name == 'forum':
db.rename_table('askbot_anonymousanswer', 'forum_anonymousanswer')
db.rename_table('askbot_anonymousquestion', 'forum_anonymousquestion')
db.rename_table('askbot_emailfeedsetting', 'forum_emailfeedsetting')
diff --git a/askbot/migrations/0018_add___status__field_to_user_model.py b/askbot/migrations/0018_add___status__field_to_user_model.py
index 5a713866..b30f30d7 100644
--- a/askbot/migrations/0018_add___status__field_to_user_model.py
+++ b/askbot/migrations/0018_add___status__field_to_user_model.py
@@ -3,21 +3,19 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'User.status'
- try:
- db.add_column(
- u'auth_user',
- 'status',
- self.gf('django.db.models.fields.CharField')(default ='w', max_length = 2),
- keep_default=False
- )
- except:
- pass
+ safe_add_column(
+ u'auth_user',
+ 'status',
+ self.gf('django.db.models.fields.CharField')(default ='w', max_length = 2),
+ keep_default=False
+ )
def backwards(self, orm):
diff --git a/askbot/migrations/0026_add_seen_and_new_response_counts_to_user.py b/askbot/migrations/0026_add_seen_and_new_response_counts_to_user.py
index 4cd05f83..8b6002bf 100644
--- a/askbot/migrations/0026_add_seen_and_new_response_counts_to_user.py
+++ b/askbot/migrations/0026_add_seen_and_new_response_counts_to_user.py
@@ -3,16 +3,14 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding fields
- try:
- db.add_column('auth_user', 'new_response_count', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
- db.add_column('auth_user', 'seen_response_count', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
- except:
- pass
+ safe_add_column('auth_user', 'new_response_count', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
+ safe_add_column('auth_user', 'seen_response_count', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
def backwards(self, orm):
# Deleting fields
diff --git a/askbot/migrations/0033_add__consecutive_days_visit_count__to__auth_user.py b/askbot/migrations/0033_add__consecutive_days_visit_count__to__auth_user.py
index 580c2f25..e5a10faf 100644
--- a/askbot/migrations/0033_add__consecutive_days_visit_count__to__auth_user.py
+++ b/askbot/migrations/0033_add__consecutive_days_visit_count__to__auth_user.py
@@ -3,21 +3,19 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'User.consecutive_days_visit_count'
- try:
- db.add_column(
- u'auth_user',
- 'consecutive_days_visit_count',
- self.gf('django.db.models.fields.IntegerField')(default = 0, max_length = 2),
- keep_default=False
- )
- except:
- pass
+ safe_add_column(
+ u'auth_user',
+ 'consecutive_days_visit_count',
+ self.gf('django.db.models.fields.IntegerField')(default = 0, max_length = 2),
+ keep_default=False
+ )
def backwards(self, orm):
diff --git a/askbot/migrations/0035_add_country_fields_to_user.py b/askbot/migrations/0035_add_country_fields_to_user.py
index 02dd404c..340883ba 100644
--- a/askbot/migrations/0035_add_country_fields_to_user.py
+++ b/askbot/migrations/0035_add_country_fields_to_user.py
@@ -3,17 +3,15 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model country fields to the model auth_user
- try:
- db.add_column(u'auth_user', 'country', self.gf('django_countries.fields.CountryField')(max_length=2, blank=True, null=True))
- db.add_column(u'auth_user', 'show_country', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True))
- except:
- pass
+ safe_add_column(u'auth_user', 'country', self.gf('django_countries.fields.CountryField')(max_length=2, blank=True, null=True))
+ safe_add_column(u'auth_user', 'show_country', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True))
def backwards(self, orm):
diff --git a/askbot/migrations/0037_add_marked_tags_to_user_profile.py b/askbot/migrations/0037_add_marked_tags_to_user_profile.py
index f10f53be..306e16e6 100644
--- a/askbot/migrations/0037_add_marked_tags_to_user_profile.py
+++ b/askbot/migrations/0037_add_marked_tags_to_user_profile.py
@@ -3,18 +3,16 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
- try:
- # Adding field 'User.interesting_tags'
- db.add_column(u'auth_user', 'interesting_tags', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
- # Adding field 'User.ignored_tags'
- db.add_column(u'auth_user', 'ignored_tags', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
- except:
- pass
+ # Adding field 'User.interesting_tags'
+ safe_add_column(u'auth_user', 'interesting_tags', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
+ # Adding field 'User.ignored_tags'
+ safe_add_column(u'auth_user', 'ignored_tags', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
def backwards(self, orm):
diff --git a/askbot/migrations/0038_add_tag_filter_strategies.py b/askbot/migrations/0038_add_tag_filter_strategies.py
index c2596366..a24d12bf 100644
--- a/askbot/migrations/0038_add_tag_filter_strategies.py
+++ b/askbot/migrations/0038_add_tag_filter_strategies.py
@@ -4,29 +4,27 @@ from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from askbot import const
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model country fields to the model auth_user
- try:
- db.add_column(
- u'auth_user',
- 'email_tag_filter_strategy',
- self.gf(
- 'django.db.models.fields.SmallIntegerField'
- )(default = const.EXCLUDE_IGNORED)
- )
- db.add_column(
- u'auth_user',
- 'display_tag_filter_strategy',
- self.gf(
- 'django.db.models.fields.SmallIntegerField'
- )(default = const.INCLUDE_ALL)
- )
- except:
- pass
+ safe_add_column(
+ u'auth_user',
+ 'email_tag_filter_strategy',
+ self.gf(
+ 'django.db.models.fields.SmallIntegerField'
+ )(default = const.EXCLUDE_IGNORED)
+ )
+ safe_add_column(
+ u'auth_user',
+ 'display_tag_filter_strategy',
+ self.gf(
+ 'django.db.models.fields.SmallIntegerField'
+ )(default = const.INCLUDE_ALL)
+ )
def backwards(self, orm):
diff --git a/askbot/migrations/0043_add_temporal_extra_column_for_datamigration.py b/askbot/migrations/0043_add_temporal_extra_column_for_datamigration.py
index 4a8140a4..7582dc04 100644
--- a/askbot/migrations/0043_add_temporal_extra_column_for_datamigration.py
+++ b/askbot/migrations/0043_add_temporal_extra_column_for_datamigration.py
@@ -3,14 +3,12 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
- try:
- db.add_column(u'auth_user', 'avatar_type', self.gf('django.db.models.fields.CharField')(max_length=1, default='n'), keep_default=False)
- except:
- pass
+ safe_add_column(u'auth_user', 'avatar_type', self.gf('django.db.models.fields.CharField')(max_length=1, default='n'), keep_default=False)
def backwards(self, orm):
db.delete_column(u'auth_user', 'avatar_type')
diff --git a/askbot/migrations/0122_auth_user__add_subscribed_tag_field.py b/askbot/migrations/0122_auth_user__add_subscribed_tag_field.py
index d84666fb..7f7ff971 100644
--- a/askbot/migrations/0122_auth_user__add_subscribed_tag_field.py
+++ b/askbot/migrations/0122_auth_user__add_subscribed_tag_field.py
@@ -3,15 +3,13 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
- try:
- # Adding field 'User.interesting_tags'
- db.add_column(u'auth_user', 'subscribed_tags', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
- except:
- pass
+ # Adding field 'User.interesting_tags'
+ safe_add_column(u'auth_user', 'subscribed_tags', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
def backwards(self, orm):
# Deleting field 'User.interesting_tags'
diff --git a/askbot/migrations/0124_auto__add_field_post_is_private__add_field_replyaddress_reply_action.py b/askbot/migrations/0124_auto__add_field_post_is_private__add_field_replyaddress_reply_action.py
index b5a1e0c9..11b891da 100644
--- a/askbot/migrations/0124_auto__add_field_post_is_private__add_field_replyaddress_reply_action.py
+++ b/askbot/migrations/0124_auto__add_field_post_is_private__add_field_replyaddress_reply_action.py
@@ -3,6 +3,7 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
@@ -10,14 +11,14 @@ class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Post.is_private'
db.start_transaction()
- db.add_column('askbot_post', 'is_private',
- self.gf('django.db.models.fields.BooleanField')(default=False),
- keep_default=False)
+ safe_add_column('askbot_post', 'is_private',
+ self.gf('django.db.models.fields.BooleanField')(default=False),
+ keep_default=False)
# Adding field 'ReplyAddress.reply_action'
- db.add_column('askbot_replyaddress', 'reply_action',
- self.gf('django.db.models.fields.CharField')(default='auto_answer_or_comment', max_length=32),
- keep_default=False)
+ safe_add_column('askbot_replyaddress', 'reply_action',
+ self.gf('django.db.models.fields.CharField')(default='auto_answer_or_comment', max_length=32),
+ keep_default=False)
# Changing field 'ReplyAddress.post'
db.alter_column('askbot_replyaddress', 'post_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['askbot.Post']))
@@ -26,7 +27,7 @@ class Migration(SchemaMigration):
try:
db.start_transaction()
# Adding field 'User.interesting_tags'
- db.add_column(u'auth_user', 'email_signature', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
+ safe_add_column(u'auth_user', 'email_signature', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
db.commit_transaction()
except:
db.rollback_transaction()
diff --git a/askbot/migrations/0125_add_show_tags_field_to_user.py b/askbot/migrations/0125_add_show_tags_field_to_user.py
index cb7ab2bd..fc299d18 100644
--- a/askbot/migrations/0125_add_show_tags_field_to_user.py
+++ b/askbot/migrations/0125_add_show_tags_field_to_user.py
@@ -3,6 +3,7 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
@@ -10,16 +11,13 @@ class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model show_marked_tags fields to the model auth_user
- try:
- db.add_column(
- u'auth_user',
- 'show_marked_tags',
- self.gf(
- 'django.db.models.fields.BooleanField'
- )(default=True, blank=True)
- )
- except:
- pass
+ safe_add_column(
+ u'auth_user',
+ 'show_marked_tags',
+ self.gf(
+ 'django.db.models.fields.BooleanField'
+ )(default=True, blank=True)
+ )
def backwards(self, orm):
diff --git a/askbot/migrations/0126_add_field__auth_user__is_fake.py b/askbot/migrations/0126_add_field__auth_user__is_fake.py
index e0928ed7..783d1e27 100644
--- a/askbot/migrations/0126_add_field__auth_user__is_fake.py
+++ b/askbot/migrations/0126_add_field__auth_user__is_fake.py
@@ -1,17 +1,14 @@
# -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
- try:
- # Adding field 'User.is_fake'
- db.add_column(
- u'auth_user', 'is_fake',
- self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)
- except:
- pass
+ safe_add_column(
+ u'auth_user', 'is_fake',
+ self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)
def backwards(self, orm):
db.delete_column('auth_user', 'is_fake')
diff --git a/askbot/migrations/__init__.py b/askbot/migrations/__init__.py
index 86377b7b..b9683daf 100644
--- a/askbot/migrations/__init__.py
+++ b/askbot/migrations/__init__.py
@@ -1,5 +1,9 @@
from south.db import db
from south.utils import ask_for_it_by_name
+from south.v2 import SchemaMigration
+
+if not db.has_ddl_transactions:
+ SchemaMigration.no_dry_run = True
# Terminal ANSI codes for printing colored text:
# - http://code.google.com/p/testoob/source/browse/trunk/src/testoob/reporting/colored.py#20
@@ -67,3 +71,4 @@ def innodb_ready_rename_column(orm, models, table, old_column_name, new_column_n
# INFO: ask_for_it_by_name() if equivalent to self.gf() which is usually used in migrations, e.g.:
# db.alter_column('askbot_badgedata', 'slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50))
db.alter_column(table, new_column_name, field)
+ db.clear_deferred_sql()
diff --git a/askbot/migrations_api/__init__.py b/askbot/migrations_api/__init__.py
index 0260f51b..3ea250f2 100644
--- a/askbot/migrations_api/__init__.py
+++ b/askbot/migrations_api/__init__.py
@@ -13,14 +13,19 @@ def safe_add_column(table, column, column_data, keep_default = False):
so, we need to add these columns here in separate transactions
and roll back if they fail, if we want we could also record - which columns clash
"""
- try:
- db.start_transaction()
- db.add_column(table, column, column_data, keep_default = keep_default)
- db.commit_transaction()
- return True
- except:
- db.rollback_transaction()
- return False
+ if db.backend_name=='mysql':
+ if len(db.execute('select column_name from information_schema.columns where table_name=%s and column_name=%s', params=[table, column])) == 0:
+ db.add_column(table, column, column_data, keep_default = keep_default)
+
+ else:
+ try:
+ db.start_transaction()
+ db.add_column(table, column, column_data, keep_default = keep_default)
+ db.commit_transaction()
+ return True
+ except:
+ db.rollback_transaction()
+ return False
def mysql_table_supports_full_text_search(table_name):
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py
index 8dc81e47..49ce7fae 100644
--- a/askbot/models/__init__.py
+++ b/askbot/models/__init__.py
@@ -1370,6 +1370,17 @@ def user_mark_tags(
if tagnames is None:
tagnames = list()
+ #figure out which tags don't yet exist
+ existing_tagnames = Tag.objects.filter(
+ name__in=tagnames
+ ).values_list(
+ 'name', flat=True
+ )
+ non_existing_tagnames = set(tagnames) - set(existing_tagnames)
+ #create those tags, and if tags are moderated make them suggested
+ if (len(non_existing_tagnames) > 0):
+ Tag.objects.create_in_bulk(tag_names=tagnames, user=self)
+
#below we update normal tag selections
marked_ts = MarkedTag.objects.filter(
user = self,
diff --git a/askbot/models/tag.py b/askbot/models/tag.py
index 7b51e6db..455995e0 100644
--- a/askbot/models/tag.py
+++ b/askbot/models/tag.py
@@ -177,7 +177,7 @@ class TagManager(BaseQuerySetManager):
"""temporary function that filters out the group tags"""
return self.all()
- def create(self, name = None, created_by = None, **kwargs):
+ def create(self, name=None, created_by=None, **kwargs):
"""Creates a new tag"""
if created_by.can_create_tags() or is_preapproved_tag_name(name):
status = Tag.STATUS_ACCEPTED
diff --git a/askbot/templates/list_suggested_tags.html b/askbot/templates/list_suggested_tags.html
index 4eeb0004..31e48c09 100644
--- a/askbot/templates/list_suggested_tags.html
+++ b/askbot/templates/list_suggested_tags.html
@@ -28,19 +28,31 @@
</td>
<td colspan="2">
<table>{# inner table for the list of questions #}
- {% for thread in tag.threads.all() %}
- <tr class="thread-info" data-thread-id="{{ thread.id }}">
+ {% if tag.threads.count() == 0 %}
+ <tr class="thread-info" data-thread-id="0">
<td class="per-thread-controls">
<button class="btn accept">{% trans %}Accept{% endtrans %}</button>
<button class="btn reject">{% trans %}Reject{% endtrans %}</button>
</td>
<td class="thread-links-col">
- <a title="{{ thread._question_post().summary|escape }}"
- href="{{ thread.get_absolute_url() }}"
- >{{ thread.title|escape }}</a>
+ <span>{% trans %}There are no questions with this tag yet{% endtrans %}</span>
</td>
</tr>
- {% endfor %}
+ {% else %}
+ {% for thread in tag.threads.all() %}
+ <tr class="thread-info" data-thread-id="{{ thread.id }}">
+ <td class="per-thread-controls">
+ <button class="btn accept">{% trans %}Accept{% endtrans %}</button>
+ <button class="btn reject">{% trans %}Reject{% endtrans %}</button>
+ </td>
+ <td class="thread-links-col">
+ <a title="{{ thread._question_post().summary|escape }}"
+ href="{{ thread.get_absolute_url() }}"
+ >{{ thread.title|escape }}</a>
+ </td>
+ </tr>
+ {% endfor %}
+ {% endif %}
</table>
</td>
</tr>
diff --git a/askbot/templates/question/sidebar.html b/askbot/templates/question/sidebar.html
index 905ce781..17820096 100644
--- a/askbot/templates/question/sidebar.html
+++ b/askbot/templates/question/sidebar.html
@@ -173,6 +173,8 @@
{#% endcache %#}
{% endif %}
-<div class="box">
- {{ settings.SIDEBAR_QUESTION_FOOTER }}
-</div>
+{% if settings.SIDEBAR_QUESTION_FOOTER %}
+ <div class="box">
+ {{ settings.SIDEBAR_QUESTION_FOOTER }}
+ </div>
+{% endif %}
diff --git a/askbot/views/commands.py b/askbot/views/commands.py
index cd54075e..f810a750 100644
--- a/askbot/views/commands.py
+++ b/askbot/views/commands.py
@@ -1233,9 +1233,9 @@ def moderate_suggested_tag(request):
return
if thread_id:
- threads = models.Thread.objects.filter(id = thread_id)
+ threads = models.Thread.objects.filter(id=thread_id)
else:
- threads = tag.threads.all()
+ threads = tag.threads.none()
if form.cleaned_data['action'] == 'accept':
#todo: here we lose ability to come back