From 0f74420a76887d1aa079cb158463f174b0398f99 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Tue, 6 Apr 2010 10:43:28 -0400 Subject: intermediate broken commit --- forum/search/README | 5 + forum/views/readers.py | 165 +++++++++++---------------- forum_modules/pgfulltext/DISABLED | 0 forum_modules/pgfulltext/__init__.py | 0 forum_modules/pgfulltext/handlers.py | 0 forum_modules/pgfulltext/management.py | 0 forum_modules/pgfulltext/pg_fts_install.sql | 0 forum_modules/sphinxfulltext/DISABLED | 0 forum_modules/sphinxfulltext/__init__.py | 0 forum_modules/sphinxfulltext/dependencies.py | 0 forum_modules/sphinxfulltext/handlers.py | 0 forum_modules/sphinxfulltext/models.py | 0 forum_modules/sphinxfulltext/settings.py | 0 13 files changed, 73 insertions(+), 97 deletions(-) create mode 100644 forum/search/README mode change 100755 => 100644 forum_modules/pgfulltext/DISABLED mode change 100755 => 100644 forum_modules/pgfulltext/__init__.py mode change 100755 => 100644 forum_modules/pgfulltext/handlers.py mode change 100755 => 100644 forum_modules/pgfulltext/management.py mode change 100755 => 100644 forum_modules/pgfulltext/pg_fts_install.sql mode change 100755 => 100644 forum_modules/sphinxfulltext/DISABLED mode change 100755 => 100644 forum_modules/sphinxfulltext/__init__.py mode change 100755 => 100644 forum_modules/sphinxfulltext/dependencies.py mode change 100755 => 100644 forum_modules/sphinxfulltext/handlers.py mode change 100755 => 100644 forum_modules/sphinxfulltext/models.py mode change 100755 => 100644 forum_modules/sphinxfulltext/settings.py diff --git a/forum/search/README b/forum/search/README new file mode 100644 index 00000000..c15dc221 --- /dev/null +++ b/forum/search/README @@ -0,0 +1,5 @@ +module dealing with search functions +at this time only question and answer search + +that among other things contains +available full text search implementations diff --git a/forum/views/readers.py b/forum/views/readers.py index 3f0bef0f..e9ed6ef5 100644 --- a/forum/views/readers.py +++ b/forum/views/readers.py @@ -81,58 +81,9 @@ def _get_and_remember_questions_sort_method(request, view_dic, default):#service def index(request):#generates front page - shows listing of questions sorted in various ways """index view mapped to the root url of the Q&A site """ - view_dic = { - "latest":"-last_activity_at", - "hottest":"-answer_count", - "mostvoted":"-score", - } - view_id, orderby = _get_and_remember_questions_sort_method(request, view_dic, 'latest') - - pagesize = request.session.get("pagesize",QUESTIONS_PAGE_SIZE) - try: - page = int(request.GET.get('page', '1')) - except ValueError: - page = 1 - - qs = Question.objects.exclude(deleted=True).order_by(orderby) - - objects_list = Paginator(qs, pagesize) - questions = objects_list.page(page) - - # RISK - inner join queries - #questions = questions.select_related() - tags = Tag.objects.get_valid_tags(INDEX_TAGS_SIZE) - - awards = Award.objects.get_recent_awards() - - (interesting_tag_names, ignored_tag_names) = (None, None) - if request.user.is_authenticated(): - pt = MarkedTag.objects.filter(user=request.user) - interesting_tag_names = pt.filter(reason='good').values_list('tag__name', flat=True) - ignored_tag_names = pt.filter(reason='bad').values_list('tag__name', flat=True) - - tags_autocomplete = _get_tags_cache_json() - - return render_to_response('index.html', { - 'interesting_tag_names': interesting_tag_names, - 'tags_autocomplete': tags_autocomplete, - 'ignored_tag_names': ignored_tag_names, - "questions" : questions, - "tab_id" : view_id, - "tags" : tags, - "awards" : awards[:INDEX_AWARD_SIZE], - "context" : { - 'is_paginated' : True, - 'pages': objects_list.num_pages, - 'page': page, - 'has_previous': questions.has_previous(), - 'has_next': questions.has_next(), - 'previous': questions.previous_page_number(), - 'next': questions.next_page_number(), - 'base_url' : request.path + '?sort=%s&' % view_id, - 'pagesize' : pagesize - }}, context_instance=RequestContext(request)) + return HttpResponseRedirect(reverse('questions')) +#todo: eliminate this from urls def unanswered(request):#generates listing of unanswered questions return questions(request, unanswered=True) @@ -146,6 +97,7 @@ def questions(request, tagname=None, unanswered=False):#a view generating listin # Set flag to False by default. If it is equal to True, then need to be saved. pagesize_changed = False # get pagesize from session, if failed then get default value + # there is also user page size in the database, but we should probably delete it pagesize = request.session.get("pagesize",QUESTIONS_PAGE_SIZE) try: page = int(request.GET.get('page', '1')) @@ -158,6 +110,43 @@ def questions(request, tagname=None, unanswered=False):#a view generating listin # check if request is from tagged questions qs = Question.objects.exclude(deleted=True) + #query select input: + tags + user + search query + unanswered (meaning is function of forum size setting) + + #sort methods + newest/oldest +/-added_at + active/inactive +/-last_activity_at + answer count +/-answer_count + votes +/- score + relevance (only if search query is not empty) + + #have this call implemented for sphinx, mysql and pgsql + questions = Question.objects.advanced_search( + tags = tags, + author = user,#???question or answer author or just contributor + request_user = request.user, + search_query = search_query, + scope = scope,#unanswered/all/favorite (for logged in) + sort_method #newest/oldest/active/inactive/+-answers/+-votes/relevance(search only) + #maybe have this inside? + qs = qs.select_related(depth=1).order_by(orderby) + ) + + page = #Paginator(questions) + related_tags = #Tag.objects.get_related_to_questions + contributors = #User.objects.get_related_to_questions + + return render_to_response(template_file, { + related_tags + questions + contributors + incoming request metadata + + #todo: hide this inside the advanced_search call + if tagname is not None: qs = qs.filter(tags__name = unquote(tagname)) @@ -176,6 +165,7 @@ def questions(request, tagname=None, unanswered=False):#a view generating listin if request.user.is_authenticated(): uid_str = str(request.user.id) + #mark questions tagged with interesting tags qs = qs.extra( select = SortedDict([ ( @@ -190,10 +180,12 @@ def questions(request, tagname=None, unanswered=False):#a view generating listin select_params = (uid_str,), ) if request.user.hide_ignored_questions: + #exclude ignored tags if the user wants to ignored_tags = Tag.objects.filter(user_selections__reason='bad', user_selections__user = request.user) qs = qs.exclude(tags__in=ignored_tags) else: + #annotate questions tagged with ignored tags qs = qs.extra( select = SortedDict([ ( @@ -208,6 +200,7 @@ def questions(request, tagname=None, unanswered=False):#a view generating listin select_params = (uid_str, ) ) + #todo: does this help? qs = qs.select_related(depth=1).order_by(orderby) objects_list = Paginator(qs, pagesize) @@ -218,6 +211,7 @@ def questions(request, tagname=None, unanswered=False):#a view generating listin related_tags = Tag.objects.get_tags_by_questions(questions.object_list) else: related_tags = None + tags_autocomplete = _get_tags_cache_json() # get the list of interesting and ignored tags @@ -250,55 +244,10 @@ def questions(request, tagname=None, unanswered=False):#a view generating listin 'pagesize' : pagesize }}, context_instance=RequestContext(request)) -def search(request): #generates listing of questions matching a search query - including tags and just words - """generates listing of questions matching a search query - supports full text search in mysql db using sphinx and internally in postgresql - falls back on simple partial string matching approach if - full text search function is not available - """ +def fulltext(request): if request.method == "GET": keywords = request.GET.get("q") - search_type = request.GET.get("t") - try: - page = int(request.GET.get('page', '1')) - except ValueError: - page = 1 - if keywords is None: - return HttpResponseRedirect(reverse(index)) - if search_type == 'tag': - return HttpResponseRedirect(reverse('tags') + '?q=%s&page=%s' % (keywords.strip(), page)) - elif search_type == "user": - return HttpResponseRedirect(reverse('users') + '?q=%s&page=%s' % (keywords.strip(), page)) - elif search_type == "question": - template_file = "questions.html" - # Set flag to False by default. If it is equal to True, then need to be saved. - pagesize_changed = False - # get pagesize from session, if failed then get default value - user_page_size = request.session.get("pagesize", QUESTIONS_PAGE_SIZE) - # set pagesize equal to logon user specified value in database - if request.user.is_authenticated() and request.user.questions_per_page > 0: - user_page_size = request.user.questions_per_page - - try: - page = int(request.GET.get('page', '1')) - # get new pagesize from UI selection - pagesize = int(request.GET.get('pagesize', user_page_size)) - if pagesize <> user_page_size: - pagesize_changed = True - - except ValueError: - page = 1 - pagesize = user_page_size - - # save this pagesize to user database - if pagesize_changed: - request.session["pagesize"] = pagesize - if request.user.is_authenticated(): - user = request.user - user.questions_per_page = pagesize - user.save() - view_id = request.GET.get('sort', None) view_dic = {"latest":"-added_at", "active":"-last_activity_at", "hottest":"-answer_count", "mostvoted":"-score" } try: @@ -358,6 +307,28 @@ def search(request): #generates listing of questions matching a search query - i else: raise Http404 +def search(request): #generates listing of questions matching a search query - including tags and just words + """redirects to people and tag search pages + todo: eliminate this altogether and instead make + search "tab" sensitive automatically - the radio-buttons + are useless under the search bar + """ + if request.method == "GET": + search_type == request.GET.get('t') + try: + page = int(request.GET.get('page', '1')) + except ValueError: + page = 1 + if search_type == 'tag': + return HttpResponseRedirect(reverse('tags') + '?q=%s&page=%s' % (keywords.strip(), page)) + elif search_type == "user": + return HttpResponseRedirect(reverse('users') + '?q=%s&page=%s' % (keywords.strip(), page)) + else: + raise Http404 + else: + raise Http404 + + def tag(request, tag):#stub generates listing of questions tagged with a single tag return questions(request, tagname=tag) diff --git a/forum_modules/pgfulltext/DISABLED b/forum_modules/pgfulltext/DISABLED old mode 100755 new mode 100644 diff --git a/forum_modules/pgfulltext/__init__.py b/forum_modules/pgfulltext/__init__.py old mode 100755 new mode 100644 diff --git a/forum_modules/pgfulltext/handlers.py b/forum_modules/pgfulltext/handlers.py old mode 100755 new mode 100644 diff --git a/forum_modules/pgfulltext/management.py b/forum_modules/pgfulltext/management.py old mode 100755 new mode 100644 diff --git a/forum_modules/pgfulltext/pg_fts_install.sql b/forum_modules/pgfulltext/pg_fts_install.sql old mode 100755 new mode 100644 diff --git a/forum_modules/sphinxfulltext/DISABLED b/forum_modules/sphinxfulltext/DISABLED old mode 100755 new mode 100644 diff --git a/forum_modules/sphinxfulltext/__init__.py b/forum_modules/sphinxfulltext/__init__.py old mode 100755 new mode 100644 diff --git a/forum_modules/sphinxfulltext/dependencies.py b/forum_modules/sphinxfulltext/dependencies.py old mode 100755 new mode 100644 diff --git a/forum_modules/sphinxfulltext/handlers.py b/forum_modules/sphinxfulltext/handlers.py old mode 100755 new mode 100644 diff --git a/forum_modules/sphinxfulltext/models.py b/forum_modules/sphinxfulltext/models.py old mode 100755 new mode 100644 diff --git a/forum_modules/sphinxfulltext/settings.py b/forum_modules/sphinxfulltext/settings.py old mode 100755 new mode 100644 -- cgit v1.2.3-1-g7c22 From b94fddfb8495960569f6a6c64196a11d76b95fd4 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Tue, 6 Apr 2010 20:25:06 -0400 Subject: another intermediate commit (still broken) --- forum/const.py | 24 + forum/forms.py | 46 +- forum/models/question.py | 91 + forum/views/readers.py | 208 +-- locale/ru/LC_MESSAGES/django.mo | Bin 0 -> 576 bytes locale/ru/LC_MESSAGES/django.po | 3485 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 3699 insertions(+), 155 deletions(-) create mode 100644 locale/ru/LC_MESSAGES/django.mo create mode 100644 locale/ru/LC_MESSAGES/django.po diff --git a/forum/const.py b/forum/const.py index 4c107572..7b78032a 100755 --- a/forum/const.py +++ b/forum/const.py @@ -32,6 +32,30 @@ TYPE_REPUTATION = ( (-8, 'lose_by_upvote_canceled'), ) +POST_SORT_METHODS = ( + _('newest'), _('oldest'),_('active'), + _('inactive'),_('hot'),_('cold'), + _('popular'),_('unpopular'),_('relevance') + ) +#todo: add assertion here that all sort methods are unique +#because they are keys to the hash used in implementations of Q.run_advanced_search + +DEFAULT_POST_SORT_METHOD = _('newest') +POST_SCOPES = (_('all'),_('unanswered'),_('favorite')) +DEFAULT_POST_SCOPE = _('all') + +QUESTIONS_PAGE_SIZE = 30 + +#todo: +#this probably needs to be language-specific +#and selectable/changeable from the admin interface +#however it will be hard to expect that people will type +#correct regexes - plus this must be an anchored regex +#to do full string match +TAG_REGEX = r'^[a-z0-9\+\.\-]+$' +MAX_TAG_LENGTH = 20 #default 20 chars +MAX_TAGS_PER_POST = 5 #no more than five tags + TYPE_ACTIVITY_ASK_QUESTION=1 TYPE_ACTIVITY_ANSWER=2 TYPE_ACTIVITY_COMMENT_QUESTION=3 diff --git a/forum/forms.py b/forum/forms.py index d577e69a..dbdc4e9f 100755 --- a/forum/forms.py +++ b/forum/forms.py @@ -2,8 +2,10 @@ import re from datetime import date from django import forms from models import * -from const import * +from const import * #todo: clean out import * thing +from forum import const from django.utils.translation import ugettext as _ +from django.utils.translation import ungettext from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from forum.utils.forms import NextUrlField, UserNameField, SetPasswordForm @@ -60,21 +62,33 @@ class TagNamesField(forms.CharField): raise forms.ValidationError(_('tags are required')) split_re = re.compile(r'[ ,]+') - list = split_re.split(data) - list_temp = [] - if len(list) > 5: - raise forms.ValidationError(_('please use 5 tags or less')) - for tag in list: - if len(tag) > 20: - raise forms.ValidationError(_('tags must be shorter than 20 characters')) - #take tag regex from settings - tagname_re = re.compile(r'[a-z0-9\w._#-]+',re.UNICODE) - if not tagname_re.match(tag): - raise forms.ValidationError(_('please use letters, numbers, and characters \'.-_#\'')) - # only keep one same tag - if tag not in list_temp and len(tag.strip()) > 0: - list_temp.append(tag) - return u' '.join(list_temp) + tag_strings = split_re.split(data) + out_tag_list = [] + tag_count = len(tag_strings) + if tag_count > const.MAX_TAGS_PER_POST: + msg = ungettext( + 'please use %(tag_count)d tag or less',#odd but have to use to pluralize + 'please use %(tag_count)d tags or less', + tag_count) % {'tag_count':tag_count} + raise forms.ValidationError(msg) + for tag in tag_strings: + tag_length = len(tag) + if tag_length > const.MAX_TAG_LENGTH: + #singular form is odd in english, but required for pluralization + #in other languages + msg = ungettext('each tag must be shorter than %(max_chars)d character',#odd but added for completeness + 'each tag must be shorter than %(max_shars)d characters', + tag_length) % {'max_chars':tag_length} + raise forms.ValidationError(msg)_ + + #todo - this needs to come from settings + tagname_re = re.compile(const.TAG_REGEX, re.UNICODE) + if not tagname_re.search(tag): + raise forms.ValidationError(_('use-these-chars-in-tags')) + #only keep unique tags + if tag not in out_tag_list: + out_tag_list.append(tag) + return u' '.join(out_tag_list) class WikiField(forms.BooleanField): def __init__(self, *args, **kwargs): diff --git a/forum/models/question.py b/forum/models/question.py index 9860eb24..71da0396 100755 --- a/forum/models/question.py +++ b/forum/models/question.py @@ -9,6 +9,18 @@ markdowner = Markdown(html4tags=True) from forum.utils.lists import LazyList +QUESTION_ORDER_BY_MAP = { + _('newest'): '-added_at', + _('oldest'): 'added_at', + _('active'): '-last_activity_at', + _('inactive'): 'last_activity_at', + _('hot'): '-answer_count', + _('cold'): 'answer_count' + _('popular'): '-score', + _('unpopular'): 'score', + _('relevance'):None #this is a special case +} + class QuestionManager(models.Manager): def create_new(self, title=None,author=None,added_at=None, wiki=False,tagnames=None, text=None): html = sanitize_html(markdowner.convert(text)) @@ -39,6 +51,85 @@ class QuestionManager(models.Manager): ) return question + def run_advanced_search( + self, + request_user = None, + scope_selector = scope_selector,#unanswered/all/favorite (for logged in) + search_query = None, + tag_selector = None, + author_selector = None,#???question or answer author or just contributor + sort_method = const.DEFAULT_POST_SORT_METHOD + ): + """all parameters are guaranteed to be clean + however may not relate to database - in that case + a relvant filter will be silently dropped + """ + + #return metadata + meta_data = {} + if tag_selector: + qs = qs.filter(tags__name__in = tag_selector) + + if scope_selector: + + if unanswered: + qs = qs.exclude(answer_accepted=True) + + #user contributed questions & answers + if author_selector: + try: + u = User.objects.get(username=author_selector) + qs = qs.filter(Q(author=u) | Q(answers__author=u)) + meta_data['author_name'] = author_selector + except User.DoesNotExist: + meta_data['author_name'] = None + + #get users tag filters + if request_user and request_user.is_authenticated(): + uid_str = str(request_user.id) + #mark questions tagged with interesting tags + qs = qs.extra( + select = SortedDict([ + ( + 'interesting_score', + 'SELECT COUNT(1) FROM forum_markedtag, question_tags ' + + 'WHERE forum_markedtag.user_id = %s ' + + 'AND forum_markedtag.tag_id = question_tags.tag_id ' + + 'AND forum_markedtag.reason = \'good\' ' + + 'AND question_tags.question_id = question.id' + ), + ]), + select_params = (uid_str,), + ) + if request_user.hide_ignored_questions: + #exclude ignored tags if the user wants to + ignored_tags = Tag.objects.filter(user_selections__reason='bad', + user_selections__user = request_user) + qs = qs.exclude(tags__in=ignored_tags) + else: + #annotate questions tagged with ignored tags + qs = qs.extra( + select = SortedDict([ + ( + 'ignored_score', + 'SELECT COUNT(1) FROM forum_markedtag, question_tags ' + + 'WHERE forum_markedtag.user_id = %s ' + + 'AND forum_markedtag.tag_id = question_tags.tag_id ' + + 'AND forum_markedtag.reason = \'bad\' ' + + 'AND question_tags.question_id = question.id' + ) + ]), + select_params = (uid_str, ) + ) + # get the list of interesting and ignored tags (interesting_tag_names, ignored_tag_names) = (None, None) + pt = MarkedTag.objects.filter(user=request_user) + meta_data['interesting_tag_names'] = pt.filter(reason='good').values_list('tag__name', flat=True) + meta_data['ignored_tag_names'] = pt.filter(reason='bad').values_list('tag__name', flat=True) + + #todo: fix orderby here + qs = qs.select_related(depth=1).order_by(orderby) + return qs, meta_data + def update_tags(self, question, tagnames, user): """ Updates Tag associations for a question to match the given diff --git a/forum/views/readers.py b/forum/views/readers.py index e9ed6ef5..8c15ffe7 100644 --- a/forum/views/readers.py +++ b/forum/views/readers.py @@ -24,6 +24,7 @@ from forum.forms import * from forum.models import * from forum.auth import * from forum.const import * +from forum import const from forum import auth from forum.utils.forms import get_next_url @@ -35,7 +36,6 @@ INDEX_TAGS_SIZE = 25 # used in tags list DEFAULT_PAGE_SIZE = 60 # used in questions -QUESTIONS_PAGE_SIZE = 30 # used in answers ANSWERS_PAGE_SIZE = 10 @@ -54,24 +54,6 @@ def _get_tags_cache_json():#service routine used by views requiring tag list in tags = simplejson.dumps(tags_list) return tags -def _get_and_remember_questions_sort_method(request, view_dic, default):#service routine used by q listing views and question view - """manages persistence of post sort order - it is assumed that when user wants newest question - - then he/she wants newest answers as well, etc. - how far should this assumption actually go - may be a good question - """ - if default not in view_dic: - raise Exception('default value must be in view_dic') - - q_sort_method = request.REQUEST.get('sort', None) - if q_sort_method == None: - q_sort_method = request.session.get('questions_sort_method', default) - - if q_sort_method not in view_dic: - q_sort_method = default - request.session['questions_sort_method'] = q_sort_method - return q_sort_method, view_dic[q_sort_method] - #refactor? - we have these #views that generate a listing of questions in one way or another: #index, unanswered, questions, search, tag @@ -87,141 +69,89 @@ def index(request):#generates front page - shows listing of questions sorted in def unanswered(request):#generates listing of unanswered questions return questions(request, unanswered=True) +def _get_and_stick(key, storage, defaults, data=None): + """storage is request session in this case + if a new value is coming from data, then storage will be updated + this function assumes that data is clean + """ + if key in storage: + value = storage[key] + else: + value = defaults[key] + + if data and key in data: + new_value = data[key] + if new_value != value: + storage[key] = new_value + return new_value + else: + return value + def questions(request, tagname=None, unanswered=False):#a view generating listing of questions, used by 'unanswered' too """ List of Questions, Tagged questions, and Unanswered questions. """ - # template file - # "questions.html" or maybe index.html in the future - template_file = "questions.html" - # Set flag to False by default. If it is equal to True, then need to be saved. - pagesize_changed = False - # get pagesize from session, if failed then get default value - # there is also user page size in the database, but we should probably delete it - pagesize = request.session.get("pagesize",QUESTIONS_PAGE_SIZE) - try: - page = int(request.GET.get('page', '1')) - except ValueError: - page = 1 - - view_dic = {"latest":"-added_at", "active":"-last_activity_at", "hottest":"-answer_count", "mostvoted":"-score" } - view_id, orderby = _get_and_remember_questions_sort_method(request,view_dic,'latest') - - # check if request is from tagged questions - qs = Question.objects.exclude(deleted=True) - #query select input: - tags - user - search query - unanswered (meaning is function of forum size setting) + #don't allow to post to this view + if request.method == 'POST': + raise Http404 - #sort methods - newest/oldest +/-added_at - active/inactive +/-last_activity_at - answer count +/-answer_count - votes +/- score - relevance (only if search query is not empty) + #default values + DV = { + 'scope_selector': const.DEFAULT_POST_SCOPE, + 'search_query': None, + 'tag_selector': None, + 'author_selector': None, + 'question_sort_method': const.DEFAULT_POST_SORT_METHOD, + 'page_size': const.QUESTIONS_PAGE_SIZE, + 'page_number': 1, + } + + form = AdvancedSearchForm(request) + if form.is_valid(): + + d = form.cleaned_data + s = request.session + + scope_selector = _get_and_stick('scope_selector', s, DV, d) + search_query = _get_and_stick('search_query', s, DV, d) + tag_selector = _get_and_stick('tag_selector', s, DV, d) + author_selector = _get_and_stick('author_selector', s, DV, d) + sort_method = _get_and_stick('question_sort_method', s, DV, d) + page_size = _get_and_stick('page_size', s, DV, d) + else: + s = request.session + scope_selector = _get_and_stick('scope_selector', s, DV) + search_query = _get_and_stick('search_query', s, DV) + tag_selector = _get_and_stick('tag_selector', s, DV) + author_selector = _get_and_stick('author_selector', s, DV) + sort_method = _get_and_stick('question_sort_method', s, DV) + page_size = _get_and_stick('page_size', s, DV) #have this call implemented for sphinx, mysql and pgsql - questions = Question.objects.advanced_search( - tags = tags, - author = user,#???question or answer author or just contributor - request_user = request.user, - search_query = search_query, - scope = scope,#unanswered/all/favorite (for logged in) - sort_method #newest/oldest/active/inactive/+-answers/+-votes/relevance(search only) + (questions, meta_data) = Question.objects.run_advanced_search( + request_user = request.user, + scope_selector = scope_selector,#unanswered/all/favorite (for logged in) + search_query = search_query, + tag_selector = tags, + author_selector = author_selector,#???question or answer author or just contributor + sort_method = sort_method# + ) #maybe have this inside? - qs = qs.select_related(depth=1).order_by(orderby) - ) - - page = #Paginator(questions) - related_tags = #Tag.objects.get_related_to_questions - contributors = #User.objects.get_related_to_questions - - return render_to_response(template_file, { - related_tags - questions - contributors - incoming request metadata + questions = questions.select_related(depth=1).order_by(orderby) - #todo: hide this inside the advanced_search call - - if tagname is not None: - qs = qs.filter(tags__name = unquote(tagname)) - - if unanswered: - qs = qs.exclude(answer_accepted=True) - - author_name = None - #user contributed questions & answers - if 'user' in request.GET: - try: - author_name = request.GET['user'] - u = User.objects.get(username=author_name) - qs = qs.filter(Q(author=u) | Q(answers__author=u)) - except User.DoesNotExist: - author_name = None - - if request.user.is_authenticated(): - uid_str = str(request.user.id) - #mark questions tagged with interesting tags - qs = qs.extra( - select = SortedDict([ - ( - 'interesting_score', - 'SELECT COUNT(1) FROM forum_markedtag, question_tags ' - + 'WHERE forum_markedtag.user_id = %s ' - + 'AND forum_markedtag.tag_id = question_tags.tag_id ' - + 'AND forum_markedtag.reason = \'good\' ' - + 'AND question_tags.question_id = question.id' - ), - ]), - select_params = (uid_str,), - ) - if request.user.hide_ignored_questions: - #exclude ignored tags if the user wants to - ignored_tags = Tag.objects.filter(user_selections__reason='bad', - user_selections__user = request.user) - qs = qs.exclude(tags__in=ignored_tags) - else: - #annotate questions tagged with ignored tags - qs = qs.extra( - select = SortedDict([ - ( - 'ignored_score', - 'SELECT COUNT(1) FROM forum_markedtag, question_tags ' - + 'WHERE forum_markedtag.user_id = %s ' - + 'AND forum_markedtag.tag_id = question_tags.tag_id ' - + 'AND forum_markedtag.reason = \'bad\' ' - + 'AND question_tags.question_id = question.id' - ) - ]), - select_params = (uid_str, ) - ) - - #todo: does this help? - qs = qs.select_related(depth=1).order_by(orderby) + page = Paginator(questions).get_page(page_number) + related_tags = Tag.objects.get_tags_by_questions(questions) objects_list = Paginator(qs, pagesize) - questions = objects_list.page(page) - - # Get related tags from this page objects - if questions.object_list.count() > 0: - related_tags = Tag.objects.get_tags_by_questions(questions.object_list) - else: - related_tags = None + questions = objects_list.page(page)#todo: is this right? tags_autocomplete = _get_tags_cache_json() + #contributors = #User.objects.get_related_to_questions - # get the list of interesting and ignored tags - (interesting_tag_names, ignored_tag_names) = (None, None) - if request.user.is_authenticated(): - pt = MarkedTag.objects.filter(user=request.user) - interesting_tag_names = pt.filter(reason='good').values_list('tag__name', flat=True) - ignored_tag_names = pt.filter(reason='bad').values_list('tag__name', flat=True) - - return render_to_response(template_file, { + #todo make above form compatible with the template data + #take whatever is missing from meta_data returned above + return render_to_response('questions.html', { "questions" : questions, "author_name" : author_name, "tab_id" : view_id, diff --git a/locale/ru/LC_MESSAGES/django.mo b/locale/ru/LC_MESSAGES/django.mo new file mode 100644 index 00000000..8ae5ed74 Binary files /dev/null and b/locale/ru/LC_MESSAGES/django.mo differ diff --git a/locale/ru/LC_MESSAGES/django.po b/locale/ru/LC_MESSAGES/django.po new file mode 100644 index 00000000..6b1c857a --- /dev/null +++ b/locale/ru/LC_MESSAGES/django.po @@ -0,0 +1,3485 @@ +# Russian translation of messages for Askbot +# Copyright (C) 2009 Gang Chen +# This file is distributed under the same license as the Askbot package. +# FIRST AUTHOR , 2010. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-04-06 17:11-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2\n" + + +#: django_authopenid/forms.py:71 django_authopenid/views.py:118 +msgid "i-names are not supported" +msgstr "" + +#: django_authopenid/forms.py:134 +msgid "Account with this name already exists on the forum" +msgstr "" + +#: django_authopenid/forms.py:135 +msgid "can't have two logins to the same account yet, sorry." +msgstr "" + +#: django_authopenid/forms.py:157 +msgid "Please enter valid username and password (both are case-sensitive)." +msgstr "" + +#: django_authopenid/forms.py:160 django_authopenid/forms.py:210 +msgid "This account is inactive." +msgstr "" + +#: django_authopenid/forms.py:162 +msgid "Login failed." +msgstr "" + +#: django_authopenid/forms.py:164 +msgid "Please enter username and password" +msgstr "" + +#: django_authopenid/forms.py:166 +msgid "Please enter your password" +msgstr "" + +#: django_authopenid/forms.py:168 +msgid "Please enter user name" +msgstr "" + +#: django_authopenid/forms.py:206 +msgid "" +"Please enter a valid username and password. Note that " +"both fields are case-sensitive." +msgstr "" + +#: django_authopenid/forms.py:229 forum/authentication/forms.py:60 +msgid "Current password" +msgstr "" + +#: django_authopenid/forms.py:240 forum/authentication/forms.py:71 +msgid "" +"Old password is incorrect. Please enter the correct " +"password." +msgstr "" + +#: django_authopenid/forms.py:305 +msgid "Your user name (required)" +msgstr "" + +#: django_authopenid/forms.py:320 +msgid "Incorrect username." +msgstr "" + +#: django_authopenid/urls.py:23 django_authopenid/urls.py:24 +#: django_authopenid/urls.py:25 django_authopenid/urls.py:27 +#: fbconnect/urls.py:12 fbconnect/urls.py:13 fbconnect/urls.py:14 +msgid "signin/" +msgstr "" + +#: django_authopenid/urls.py:24 fbconnect/urls.py:13 fbconnect/urls.py:17 +msgid "newquestion/" +msgstr "" + +#: django_authopenid/urls.py:25 fbconnect/urls.py:14 fbconnect/urls.py:18 +msgid "newanswer/" +msgstr "" + +#: django_authopenid/urls.py:26 +msgid "signout/" +msgstr "" + +#: django_authopenid/urls.py:27 +msgid "complete/" +msgstr "" + +#: django_authopenid/urls.py:29 fbconnect/urls.py:16 fbconnect/urls.py:17 +#: fbconnect/urls.py:18 +msgid "register/" +msgstr "" + +#: django_authopenid/urls.py:30 +msgid "signup/" +msgstr "" + +#: django_authopenid/urls.py:32 +msgid "sendpw/" +msgstr "" + +#: django_authopenid/urls.py:33 django_authopenid/urls.py:37 +msgid "password/" +msgstr "" + +#: django_authopenid/urls.py:33 +msgid "confirm/" +msgstr "" + +#: django_authopenid/urls.py:36 +msgid "account_settings" +msgstr "" + +#: django_authopenid/urls.py:38 django_authopenid/urls.py:39 +#: django_authopenid/urls.py:40 django_authopenid/urls.py:41 +msgid "email/" +msgstr "" + +#: django_authopenid/urls.py:38 +msgid "validate/" +msgstr "" + +#: django_authopenid/urls.py:39 +msgid "change/" +msgstr "" + +#: django_authopenid/urls.py:40 +msgid "sendkey/" +msgstr "" + +#: django_authopenid/urls.py:41 +msgid "verify/" +msgstr "" + +#: django_authopenid/urls.py:42 +msgid "openid/" +msgstr "" + +#: django_authopenid/urls.py:43 forum/urls.py:52 forum/urls.py:56 +msgid "delete/" +msgstr "" + +#: django_authopenid/urls.py:51 +msgid "external-login/forgot-password/" +msgstr "" + +#: django_authopenid/urls.py:54 +msgid "external-login/signup/" +msgstr "" + +#: django_authopenid/views.py:125 +#, python-format +msgid "OpenID %(openid_url)s is invalid" +msgstr "" + +#: django_authopenid/views.py:600 +msgid "Welcome email subject line" +msgstr "" + +#: django_authopenid/views.py:706 +msgid "Password changed." +msgstr "" + +#: django_authopenid/views.py:718 django_authopenid/views.py:724 +#, python-format +msgid "your email needs to be validated see %(details_url)s" +msgstr "" + +#: django_authopenid/views.py:745 +msgid "Email verification subject line" +msgstr "" + +#: django_authopenid/views.py:836 +msgid "your email was not changed" +msgstr "" + +#: django_authopenid/views.py:884 django_authopenid/views.py:1042 +#, python-format +msgid "No OpenID %s found associated in our database" +msgstr "" + +#: django_authopenid/views.py:888 django_authopenid/views.py:1049 +#, python-format +msgid "The OpenID %s isn't associated to current user logged in" +msgstr "" + +#: django_authopenid/views.py:896 +msgid "Email Changed." +msgstr "" + +#: django_authopenid/views.py:974 +msgid "This OpenID is already associated with another account." +msgstr "" + +#: django_authopenid/views.py:979 +#, python-format +msgid "OpenID %s is now associated with your account." +msgstr "" + +#: django_authopenid/views.py:1052 +msgid "Account deleted." +msgstr "" + +#: django_authopenid/views.py:1104 +msgid "Request for new password" +msgstr "" + +#: django_authopenid/views.py:1118 +msgid "A new password and the activation link were sent to your email address." +msgstr "" + +#: django_authopenid/views.py:1150 +#, python-format +msgid "" +"Could not change password. Confirmation key '%s' is not " +"registered." +msgstr "" + +#: django_authopenid/views.py:1160 +msgid "" +"Can not change password. User don't exist anymore in our " +"database." +msgstr "" + +#: django_authopenid/views.py:1170 +#, python-format +msgid "Password changed for %s. You may now sign in." +msgstr "" + +#: forum/auth.py:505 +msgid "Your question and all of it's answers have been deleted" +msgstr "" + +#: forum/auth.py:507 +msgid "Your question has been deleted" +msgstr "" + +#: forum/auth.py:510 +msgid "The question and all of it's answers have been deleted" +msgstr "" + +#: forum/auth.py:512 +msgid "The question has been deleted" +msgstr "" + +#: forum/const.py:8 +msgid "duplicate question" +msgstr "" + +#: forum/const.py:9 +msgid "question is off-topic or not relevant" +msgstr "" + +#: forum/const.py:10 +msgid "too subjective and argumentative" +msgstr "" + +#: forum/const.py:11 +msgid "not a real question" +msgstr "" + +#: forum/const.py:12 +msgid "the question is answered, right answer was accepted" +msgstr "" + +#: forum/const.py:13 +msgid "question is not relevant or outdated" +msgstr "" + +#: forum/const.py:14 +msgid "question contains offensive or malicious remarks" +msgstr "" + +#: forum/const.py:15 +msgid "spam or advertising" +msgstr "" + +#: forum/const.py:16 +msgid "too localized" +msgstr "" + +#: forum/const.py:71 +msgid "question" +msgstr "" + +#: forum/const.py:72 forum/skins/default/templates/book.html:110 +msgid "answer" +msgstr "" + +#: forum/const.py:73 +msgid "commented question" +msgstr "" + +#: forum/const.py:74 +msgid "commented answer" +msgstr "" + +#: forum/const.py:75 +msgid "edited question" +msgstr "" + +#: forum/const.py:76 +msgid "edited answer" +msgstr "" + +#: forum/const.py:77 +msgid "received award" +msgstr "" + +#: forum/const.py:78 +msgid "marked best answer" +msgstr "" + +#: forum/const.py:79 +msgid "upvoted" +msgstr "" + +#: forum/const.py:80 +msgid "downvoted" +msgstr "" + +#: forum/const.py:81 +msgid "canceled vote" +msgstr "" + +#: forum/const.py:82 +msgid "deleted question" +msgstr "" + +#: forum/const.py:83 +msgid "deleted answer" +msgstr "" + +#: forum/const.py:84 +msgid "marked offensive" +msgstr "" + +#: forum/const.py:85 +msgid "updated tags" +msgstr "" + +#: forum/const.py:86 +msgid "selected favorite" +msgstr "" + +#: forum/const.py:87 +msgid "completed user profile" +msgstr "" + +#: forum/const.py:88 +msgid "email update sent to user" +msgstr "" + +#: forum/const.py:92 +msgid "question_answered" +msgstr "" + +#: forum/const.py:93 +msgid "question_commented" +msgstr "" + +#: forum/const.py:94 +msgid "answer_commented" +msgstr "" + +#: forum/const.py:95 +msgid "answer_accepted" +msgstr "" + +#: forum/const.py:99 +msgid "[closed]" +msgstr "" + +#: forum/const.py:100 +msgid "[deleted]" +msgstr "" + +#: forum/const.py:101 forum/views/readers.py:524 forum/views/readers.py:543 +msgid "initial version" +msgstr "" + +#: forum/const.py:102 +msgid "retagged" +msgstr "" + +#: forum/const.py:106 +msgid "exclude ignored tags" +msgstr "" + +#: forum/const.py:106 +msgid "allow only selected tags" +msgstr "" + +#: forum/feed.py:18 +msgid " - " +msgstr "" + +#: forum/feed.py:18 +msgid "latest questions" +msgstr "" + +#: forum/forms.py:23 forum/skins/default/templates/answer_edit_tips.html:35 +#: forum/skins/default/templates/answer_edit_tips.html:39 +#: forum/skins/default/templates/question_edit_tips.html:32 +#: forum/skins/default/templates/question_edit_tips.html:37 +msgid "title" +msgstr "" + +#: forum/forms.py:24 +msgid "please enter a descriptive title for your question" +msgstr "" + +#: forum/forms.py:29 +msgid "title must be > 10 characters" +msgstr "" + +#: forum/forms.py:38 +msgid "content" +msgstr "" + +#: forum/forms.py:44 +msgid "question content must be > 10 characters" +msgstr "" + +#: forum/forms.py:53 forum/skins/default/templates/header.html:28 +#: forum/skins/default/templates/header.html:56 +msgid "tags" +msgstr "" + +#: forum/forms.py:55 +msgid "" +"Tags are short keywords, with no spaces within. Up to five tags can be used." +msgstr "" + +#: forum/forms.py:62 forum/skins/default/templates/question_retag.html:39 +msgid "tags are required" +msgstr "" + +#: forum/forms.py:70 +#, python-format +msgid "please use %(tag_count)d tag or less" +msgid_plural "please use %(tag_count)d tags or less" +msgstr[0] "" +msgstr[1] "" + +#: forum/forms.py:79 +#, python-format +msgid "each tag must be shorter than %(max_chars)d character" +msgid_plural "each tag must be shorter than %(max_shars)d characters" +msgstr[0] "" +msgstr[1] "" + +#: forum/forms.py:87 +msgid "use-these-chars-in-tags" +msgstr "" + +#: forum/forms.py:97 +#: forum/skins/default/templates/post_contributor_info.html:7 +#: forum/skins/default/templates/question_summary_list_roll.html:26 +#: forum/skins/default/templates/question_summary_list_roll.html:38 +msgid "community wiki" +msgstr "" + +#: forum/forms.py:98 +msgid "" +"if you choose community wiki option, the question and answer do not generate " +"points and name of author will not be shown" +msgstr "" + +#: forum/forms.py:114 +msgid "update summary:" +msgstr "" + +#: forum/forms.py:115 +msgid "" +"enter a brief summary of your revision (e.g. fixed spelling, grammar, " +"improved style, this field is optional)" +msgstr "" + +#: forum/forms.py:118 +msgid "Automatically accept user's contributions for the email updates" +msgstr "" + +#: forum/forms.py:134 +msgid "Your name:" +msgstr "" + +#: forum/forms.py:135 +msgid "Email (not shared with anyone):" +msgstr "" + +#: forum/forms.py:136 +msgid "Your message:" +msgstr "" + +#: forum/forms.py:219 +msgid "this email does not have to be linked to gravatar" +msgstr "" + +#: forum/forms.py:221 +msgid "Screen name" +msgstr "" + +#: forum/forms.py:222 +msgid "Real name" +msgstr "" + +#: forum/forms.py:223 +msgid "Website" +msgstr "" + +#: forum/forms.py:224 +msgid "Location" +msgstr "" + +#: forum/forms.py:225 +msgid "Date of birth" +msgstr "" + +#: forum/forms.py:225 +msgid "will not be shown, used to calculate age, format: YYYY-MM-DD" +msgstr "" + +#: forum/forms.py:226 forum/skins/default/templates/account_settings.html:21 +#: forum/skins/default/templates/authopenid/settings.html:21 +msgid "Profile" +msgstr "" + +#: forum/forms.py:257 forum/forms.py:258 +msgid "this email has already been registered, please use another one" +msgstr "" + +#: forum/forms.py:264 +msgid "Choose email tag filter" +msgstr "" + +#: forum/forms.py:280 forum/forms.py:281 +msgid "weekly" +msgstr "" + +#: forum/forms.py:280 forum/forms.py:281 +msgid "no email" +msgstr "" + +#: forum/forms.py:281 +msgid "daily" +msgstr "" + +#: forum/forms.py:296 +msgid "Asked by me" +msgstr "" + +#: forum/forms.py:299 +msgid "Answered by me" +msgstr "" + +#: forum/forms.py:302 +msgid "Individually selected" +msgstr "" + +#: forum/forms.py:305 +msgid "Entire forum (tag filtered)" +msgstr "" + +#: forum/forms.py:359 forum/authentication/forms.py:41 +msgid "okay, let's try!" +msgstr "" + +#: forum/forms.py:360 +msgid "no community email please, thanks" +msgstr "" + +#: forum/forms.py:363 forum/authentication/forms.py:45 +msgid "please choose one of the options above" +msgstr "" + +#: forum/urls.py:28 +msgid "upfiles/" +msgstr "" + +#: forum/urls.py:33 +msgid "about/" +msgstr "" + +#: forum/urls.py:34 +msgid "faq/" +msgstr "" + +#: forum/urls.py:35 +msgid "privacy/" +msgstr "" + +#: forum/urls.py:36 +msgid "logout/" +msgstr "" + +#: forum/urls.py:37 forum/urls.py:38 forum/urls.py:39 forum/urls.py:56 +msgid "answers/" +msgstr "" + +#: forum/urls.py:37 forum/urls.py:49 forum/urls.py:52 forum/urls.py:56 +msgid "comments/" +msgstr "" + +#: forum/urls.py:38 forum/urls.py:43 forum/urls.py:78 +#: forum/skins/default/templates/user_info.html:47 +msgid "edit/" +msgstr "" + +#: forum/urls.py:39 forum/urls.py:48 +msgid "revisions/" +msgstr "" + +#: forum/urls.py:40 forum/urls.py:41 forum/urls.py:42 forum/urls.py:43 +#: forum/urls.py:44 forum/urls.py:45 forum/urls.py:46 forum/urls.py:47 +#: forum/urls.py:48 forum/urls.py:49 forum/urls.py:52 +msgid "questions/" +msgstr "" + +#: forum/urls.py:41 forum_modules/books/urls.py:8 +msgid "ask/" +msgstr "" + +#: forum/urls.py:42 +msgid "unanswered/" +msgstr "" + +#: forum/urls.py:44 +msgid "close/" +msgstr "" + +#: forum/urls.py:45 +msgid "reopen/" +msgstr "" + +#: forum/urls.py:46 +msgid "answer/" +msgstr "" + +#: forum/urls.py:47 +msgid "vote/" +msgstr "" + +#: forum/urls.py:50 +msgid "command/" +msgstr "" + +#: forum/urls.py:60 forum/views/readers.py:395 +msgid "question/" +msgstr "" + +#: forum/urls.py:61 forum/urls.py:62 +msgid "tags/" +msgstr "" + +#: forum/urls.py:64 forum/urls.py:68 +msgid "mark-tag/" +msgstr "" + +#: forum/urls.py:64 +msgid "interesting/" +msgstr "" + +#: forum/urls.py:68 +msgid "ignored/" +msgstr "" + +#: forum/urls.py:72 +msgid "unmark-tag/" +msgstr "" + +#: forum/urls.py:76 forum/urls.py:78 forum/urls.py:79 +msgid "users/" +msgstr "" + +#: forum/urls.py:77 +msgid "moderate-user/" +msgstr "" + +#: forum/urls.py:80 forum/urls.py:81 +msgid "badges/" +msgstr "" + +#: forum/urls.py:82 +msgid "messages/" +msgstr "" + +#: forum/urls.py:82 +msgid "markread/" +msgstr "" + +#: forum/urls.py:84 +msgid "nimda/" +msgstr "" + +#: forum/urls.py:86 +msgid "upload/" +msgstr "" + +#: forum/urls.py:87 +msgid "search/" +msgstr "" + +#: forum/urls.py:88 +msgid "feedback/" +msgstr "" + +#: forum/urls.py:89 forum/urls.py:90 +msgid "account/" +msgstr "" + +#: forum/authentication/forms.py:22 +msgid "Your account email" +msgstr "" + +#: forum/authentication/forms.py:24 +msgid "You cannot leave this field blank" +msgstr "" + +#: forum/authentication/forms.py:25 forum/utils/forms.py:111 +msgid "please enter a valid email address" +msgstr "" + +#: forum/authentication/forms.py:33 +msgid "Sorry, but this email is not on our database." +msgstr "" + +#: forum/authentication/forms.py:42 +msgid "no OSQA community email please, thanks" +msgstr "" + +#: forum/management/commands/send_email_alerts.py:236 +msgid "email update message subject" +msgstr "" + +#: forum/management/commands/send_email_alerts.py:238 +#, python-format +msgid "%(name)s, this is an update message header for a question" +msgid_plural "%(name)s, this is an update message header for %(num)d questions" +msgstr[0] "" +msgstr[1] "" + +#: forum/management/commands/send_email_alerts.py:255 +msgid "new question" +msgstr "" + +#: forum/management/commands/send_email_alerts.py:272 +msgid "" +"Please visit the forum and see what's new! Could you spread the word about " +"it - can somebody you know help answering those questions or benefit from " +"posting one?" +msgstr "" + +#: forum/management/commands/send_email_alerts.py:284 +msgid "" +"Your most frequent subscription setting is 'daily' on selected questions. If " +"you are receiving more than one email per dayplease tell about this issue to " +"the forum administrator." +msgstr "" + +#: forum/management/commands/send_email_alerts.py:290 +msgid "" +"Your most frequent subscription setting is 'weekly' if you are receiving " +"this email more than once a week please report this issue to the forum " +"administrator." +msgstr "" + +#: forum/management/commands/send_email_alerts.py:296 +msgid "" +"There is a chance that you may be receiving links seen before - due to a " +"technicality that will eventually go away. " +msgstr "" + +#: forum/management/commands/send_email_alerts.py:311 +#, python-format +msgid "" +"go to %(link)s to change frequency of email updates or %(email)s " +"administrator" +msgstr "" + +#: forum/middleware/anon_user.py:34 +#, python-format +msgid "First time here? Check out the FAQ!" +msgstr "" + +#: forum/models/question.py:360 +#, python-format +msgid "%(author)s modified the question" +msgstr "" + +#: forum/models/question.py:364 +#, python-format +msgid "%(people)s posted %(new_answer_count)s new answers" +msgstr "" + +#: forum/models/question.py:369 +#, python-format +msgid "%(people)s commented the question" +msgstr "" + +#: forum/models/question.py:374 +#, python-format +msgid "%(people)s commented answers" +msgstr "" + +#: forum/models/question.py:376 +#, python-format +msgid "%(people)s commented an answer" +msgstr "" + +#: forum/models/repute.py:13 forum/skins/default/templates/badges.html:53 +msgid "gold" +msgstr "" + +#: forum/models/repute.py:14 forum/skins/default/templates/badges.html:61 +msgid "silver" +msgstr "" + +#: forum/models/repute.py:15 forum/skins/default/templates/badges.html:68 +msgid "bronze" +msgstr "" + +#: forum/models/tag.py:79 +msgid "interesting" +msgstr "" + +#: forum/models/tag.py:79 +msgid "ignored" +msgstr "" + +#: forum/models/user.py:36 +msgid "Entire forum" +msgstr "" + +#: forum/models/user.py:37 +msgid "Questions that I asked" +msgstr "" + +#: forum/models/user.py:38 +msgid "Questions that I answered" +msgstr "" + +#: forum/models/user.py:39 +msgid "Individually selected questions" +msgstr "" + +#: forum/models/user.py:42 +msgid "Weekly" +msgstr "" + +#: forum/models/user.py:43 +msgid "Daily" +msgstr "" + +#: forum/models/user.py:44 +msgid "No email" +msgstr "" + +#: forum/skins/default/templates/404.html:24 +msgid "Sorry, could not find the page you requested." +msgstr "" + +#: forum/skins/default/templates/404.html:26 +msgid "This might have happened for the following reasons:" +msgstr "" + +#: forum/skins/default/templates/404.html:28 +msgid "this question or answer has been deleted;" +msgstr "" + +#: forum/skins/default/templates/404.html:29 +msgid "url has error - please check it;" +msgstr "" + +#: forum/skins/default/templates/404.html:30 +msgid "" +"the page you tried to visit is protected or you don't have sufficient " +"points, see" +msgstr "" + +#: forum/skins/default/templates/404.html:31 +msgid "if you believe this error 404 should not have occured, please" +msgstr "" + +#: forum/skins/default/templates/404.html:32 +msgid "report this problem" +msgstr "" + +#: forum/skins/default/templates/404.html:41 +#: forum/skins/default/templates/500.html:27 +msgid "back to previous page" +msgstr "" + +#: forum/skins/default/templates/404.html:42 +msgid "see all questions" +msgstr "" + +#: forum/skins/default/templates/404.html:43 +msgid "see all tags" +msgstr "" + +#: forum/skins/default/templates/500.html:22 +msgid "sorry, system error" +msgstr "" + +#: forum/skins/default/templates/500.html:24 +msgid "system error log is recorded, error will be fixed as soon as possible" +msgstr "" + +#: forum/skins/default/templates/500.html:25 +msgid "please report the error to the site administrators if you wish" +msgstr "" + +#: forum/skins/default/templates/500.html:28 +msgid "see latest questions" +msgstr "" + +#: forum/skins/default/templates/500.html:29 +msgid "see tags" +msgstr "" + +#: forum/skins/default/templates/about.html:6 +#: forum/skins/default/templates/about.html:11 +msgid "About" +msgstr "" + +#: forum/skins/default/templates/account_settings.html:4 +#: forum/skins/default/templates/authopenid/settings.html:4 +msgid "Account functions" +msgstr "" + +#: forum/skins/default/templates/account_settings.html:29 +#: forum/skins/default/templates/authopenid/changepw.html:5 +#: forum/skins/default/templates/authopenid/changepw.html:14 +#: forum/skins/default/templates/authopenid/settings.html:29 +msgid "Change password" +msgstr "" + +#: forum/skins/default/templates/account_settings.html:30 +#: forum/skins/default/templates/authopenid/settings.html:30 +msgid "Give your account a new password." +msgstr "" + +#: forum/skins/default/templates/account_settings.html:32 +#: forum/skins/default/templates/authopenid/settings.html:31 +msgid "Change email " +msgstr "" + +#: forum/skins/default/templates/account_settings.html:33 +#: forum/skins/default/templates/authopenid/settings.html:32 +msgid "Add or update the email address associated with your account." +msgstr "" + +#: forum/skins/default/templates/account_settings.html:35 +#: forum/skins/default/templates/authopenid/changeopenid.html:4 +#: forum/skins/default/templates/authopenid/changeopenid.html:30 +#: forum/skins/default/templates/authopenid/settings.html:34 +msgid "Change OpenID" +msgstr "" + +#: forum/skins/default/templates/account_settings.html:36 +#: forum/skins/default/templates/authopenid/settings.html:35 +msgid "Change openid associated to your account" +msgstr "" + +#: forum/skins/default/templates/account_settings.html:39 +#: forum/skins/default/templates/authopenid/delete.html:4 +#: forum/skins/default/templates/authopenid/settings.html:38 +msgid "Delete account" +msgstr "" + +#: forum/skins/default/templates/account_settings.html:40 +#: forum/skins/default/templates/authopenid/settings.html:39 +msgid "Erase your username and all your data from website" +msgstr "" + +#: forum/skins/default/templates/answer_edit.html:5 +#: forum/skins/default/templates/answer_edit.html:48 +msgid "Edit answer" +msgstr "" + +#: forum/skins/default/templates/answer_edit.html:25 +#: forum/skins/default/templates/answer_edit.html:28 +#: forum/skins/default/templates/ask.html:26 +#: forum/skins/default/templates/ask.html:29 +#: forum/skins/default/templates/question.html:46 +#: forum/skins/default/templates/question.html:49 +#: forum/skins/default/templates/question_edit.html:25 +#: forum/skins/default/templates/question_edit.html:28 +msgid "hide preview" +msgstr "" + +#: forum/skins/default/templates/answer_edit.html:28 +#: forum/skins/default/templates/ask.html:29 +#: forum/skins/default/templates/question.html:49 +#: forum/skins/default/templates/question_edit.html:28 +msgid "show preview" +msgstr "" + +#: forum/skins/default/templates/answer_edit.html:48 +#: forum/skins/default/templates/question_edit.html:66 +#: forum/skins/default/templates/question_retag.html:53 +#: forum/skins/default/templates/revisions_answer.html:38 +#: forum/skins/default/templates/revisions_question.html:38 +msgid "back" +msgstr "" + +#: forum/skins/default/templates/answer_edit.html:53 +#: forum/skins/default/templates/question_edit.html:71 +#: forum/skins/default/templates/revisions_answer.html:52 +#: forum/skins/default/templates/revisions_question.html:52 +msgid "revision" +msgstr "" + +#: forum/skins/default/templates/answer_edit.html:56 +#: forum/skins/default/templates/question_edit.html:75 +msgid "select revision" +msgstr "" + +#: forum/skins/default/templates/answer_edit.html:63 +#: forum/skins/default/templates/ask.html:97 +#: forum/skins/default/templates/question.html:431 +#: forum/skins/default/templates/question_edit.html:92 +msgid "Toggle the real time Markdown editor preview" +msgstr "" + +#: forum/skins/default/templates/answer_edit.html:63 +#: forum/skins/default/templates/ask.html:97 +#: forum/skins/default/templates/question.html:432 +#: forum/skins/default/templates/question_edit.html:92 +msgid "toggle preview" +msgstr "" + +#: forum/skins/default/templates/answer_edit.html:72 +#: forum/skins/default/templates/question_edit.html:118 +#: forum/skins/default/templates/question_retag.html:74 +msgid "Save edit" +msgstr "" + +#: forum/skins/default/templates/answer_edit.html:73 +#: forum/skins/default/templates/close.html:29 +#: forum/skins/default/templates/feedback.html:50 +#: forum/skins/default/templates/question_edit.html:119 +#: forum/skins/default/templates/question_retag.html:75 +#: forum/skins/default/templates/reopen.html:30 +#: forum/skins/default/templates/user_edit.html:84 +#: forum/skins/default/templates/authopenid/changeemail.html:40 +msgid "Cancel" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:4 +msgid "answer tips" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:7 +msgid "please make your answer relevant to this community" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:10 +msgid "try to give an answer, rather than engage into a discussion" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:13 +msgid "please try to provide details" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:16 +#: forum/skins/default/templates/question_edit_tips.html:13 +msgid "be clear and concise" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:20 +#: forum/skins/default/templates/question_edit_tips.html:17 +msgid "see frequently asked questions" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:26 +#: forum/skins/default/templates/question_edit_tips.html:23 +msgid "Markdown tips" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:29 +#: forum/skins/default/templates/question_edit_tips.html:26 +msgid "*italic* or __italic__" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:32 +#: forum/skins/default/templates/question_edit_tips.html:29 +msgid "**bold** or __bold__" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:35 +#: forum/skins/default/templates/question_edit_tips.html:32 +msgid "link" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:35 +#: forum/skins/default/templates/answer_edit_tips.html:39 +#: forum/skins/default/templates/question_edit_tips.html:32 +#: forum/skins/default/templates/question_edit_tips.html:37 +msgid "text" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:39 +#: forum/skins/default/templates/question_edit_tips.html:37 +msgid "image" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:43 +#: forum/skins/default/templates/question_edit_tips.html:41 +msgid "numbered list:" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:48 +#: forum/skins/default/templates/question_edit_tips.html:46 +msgid "basic HTML tags are also supported" +msgstr "" + +#: forum/skins/default/templates/answer_edit_tips.html:52 +#: forum/skins/default/templates/question_edit_tips.html:50 +msgid "learn more about Markdown" +msgstr "" + +#: forum/skins/default/templates/ask.html:5 +#: forum/skins/default/templates/ask.html:61 +msgid "Ask a question" +msgstr "" + +#: forum/skins/default/templates/ask.html:68 +msgid "login to post question info" +msgstr "" + +#: forum/skins/default/templates/ask.html:74 +#, python-format +msgid "" +"must have valid %(email)s to post, \n" +" see %(email_validation_faq_url)s\n" +" " +msgstr "" + +#: forum/skins/default/templates/ask.html:112 +msgid "(required)" +msgstr "" + +#: forum/skins/default/templates/ask.html:119 +msgid "Login/signup to post your question" +msgstr "" + +#: forum/skins/default/templates/ask.html:121 +msgid "Ask your question" +msgstr "" + +#: forum/skins/default/templates/badge.html:6 +#: forum/skins/default/templates/badge.html:17 +msgid "Badge" +msgstr "" + +#: forum/skins/default/templates/badge.html:26 +msgid "The users have been awarded with badges:" +msgstr "" + +#: forum/skins/default/templates/badges.html:6 +msgid "Badges summary" +msgstr "" + +#: forum/skins/default/templates/badges.html:17 +msgid "Badges" +msgstr "" + +#: forum/skins/default/templates/badges.html:21 +msgid "Community gives you awards for your questions, answers and votes." +msgstr "" + +#: forum/skins/default/templates/badges.html:22 +#, python-format +msgid "" +"Below is the list of available badges and number \n" +" of times each type of badge has been awarded. Give us feedback at %" +"(feedback_faq_url)s.\n" +" " +msgstr "" + +#: forum/skins/default/templates/badges.html:50 +msgid "Community badges" +msgstr "" + +#: forum/skins/default/templates/badges.html:56 +msgid "gold badge description" +msgstr "" + +#: forum/skins/default/templates/badges.html:64 +msgid "silver badge description" +msgstr "" + +#: forum/skins/default/templates/badges.html:67 +msgid "bronze badge: often given as a special honor" +msgstr "" + +#: forum/skins/default/templates/badges.html:71 +msgid "bronze badge description" +msgstr "" + +#: forum/skins/default/templates/book.html:7 +msgid "reading channel" +msgstr "" + +#: forum/skins/default/templates/book.html:26 +msgid "[author]" +msgstr "" + +#: forum/skins/default/templates/book.html:30 +msgid "[publisher]" +msgstr "" + +#: forum/skins/default/templates/book.html:34 +msgid "[publication date]" +msgstr "" + +#: forum/skins/default/templates/book.html:38 +msgid "[price]" +msgstr "" + +#: forum/skins/default/templates/book.html:39 +msgid "currency unit" +msgstr "" + +#: forum/skins/default/templates/book.html:42 +msgid "[pages]" +msgstr "" + +#: forum/skins/default/templates/book.html:43 +msgid "pages abbreviation" +msgstr "" + +#: forum/skins/default/templates/book.html:46 +msgid "[tags]" +msgstr "" + +#: forum/skins/default/templates/book.html:56 +msgid "author blog" +msgstr "" + +#: forum/skins/default/templates/book.html:62 +msgid "book directory" +msgstr "" + +#: forum/skins/default/templates/book.html:66 +msgid "buy online" +msgstr "" + +#: forum/skins/default/templates/book.html:79 +msgid "reader questions" +msgstr "" + +#: forum/skins/default/templates/book.html:82 +msgid "ask the author" +msgstr "" + +#: forum/skins/default/templates/book.html:88 +#: forum/skins/default/templates/book.html:93 +#: forum/skins/default/templates/users_questions.html:18 +msgid "this question was selected as favorite" +msgstr "" + +#: forum/skins/default/templates/book.html:88 +#: forum/skins/default/templates/book.html:93 +#: forum/skins/default/templates/users_questions.html:11 +#: forum/skins/default/templates/users_questions.html:18 +msgid "number of times" +msgstr "" + +#: forum/skins/default/templates/book.html:105 +#: forum/skins/default/templates/index_.html:40 +#: forum/skins/default/templates/question_summary_list_roll.html:14 +msgid "votes" +msgstr "" + +#: forum/skins/default/templates/book.html:108 +msgid "the answer has been accepted to be correct" +msgstr "" + +#: forum/skins/default/templates/book.html:115 +#: forum/skins/default/templates/index_.html:48 +#: forum/skins/default/templates/question_summary_list_roll.html:15 +msgid "views" +msgstr "" + +#: forum/skins/default/templates/book.html:125 +#: forum/skins/default/templates/index_.html:63 +#: forum/skins/default/templates/question.html:478 +#: forum/skins/default/templates/question_list.html:19 +#: forum/skins/default/templates/question_summary_list_roll.html:52 +#: forum/skins/default/templates/tags.html:49 +#: forum/skins/default/templates/users_questions.html:34 +msgid "using tags" +msgstr "" + +#: forum/skins/default/templates/book.html:147 +msgid "subscribe to book RSS feed" +msgstr "" + +#: forum/skins/default/templates/book.html:147 +#: forum/skins/default/templates/index.html:87 +#: forum/skins/default/templates/index_.html:114 +msgid "subscribe to the questions feed" +msgstr "" + +#: forum/skins/default/templates/close.html:6 +#: forum/skins/default/templates/close.html:16 +msgid "Close question" +msgstr "" + +#: forum/skins/default/templates/close.html:19 +msgid "Close the question" +msgstr "" + +#: forum/skins/default/templates/close.html:25 +msgid "Reasons" +msgstr "" + +#: forum/skins/default/templates/close.html:28 +msgid "OK to close" +msgstr "" + +#: forum/skins/default/templates/email_base.html:11 +msgid "home" +msgstr "" + +#: forum/skins/default/templates/faq.html:11 +msgid "Frequently Asked Questions " +msgstr "" + +#: forum/skins/default/templates/faq.html:16 +msgid "What kinds of questions can I ask here?" +msgstr "" + +#: forum/skins/default/templates/faq.html:17 +msgid "" +"Most importanly - questions should be relevant to this " +"community." +msgstr "" + +#: forum/skins/default/templates/faq.html:18 +msgid "" +"Before asking the question - please make sure to use search to see whether " +"your question has alredy been answered." +msgstr "" + +#: forum/skins/default/templates/faq.html:21 +msgid "What questions should I avoid asking?" +msgstr "" + +#: forum/skins/default/templates/faq.html:22 +msgid "" +"Please avoid asking questions that are not relevant to this community, too " +"subjective and argumentative." +msgstr "" + +#: forum/skins/default/templates/faq.html:27 +msgid "What should I avoid in my answers?" +msgstr "" + +#: forum/skins/default/templates/faq.html:28 +msgid "" +"is a Q&A site, not a discussion group. Therefore - please avoid having " +"discussions in your answers, comment facility allows some space for brief " +"discussions." +msgstr "" + +#: forum/skins/default/templates/faq.html:32 +msgid "Who moderates this community?" +msgstr "" + +#: forum/skins/default/templates/faq.html:33 +msgid "The short answer is: you." +msgstr "" + +#: forum/skins/default/templates/faq.html:34 +msgid "This website is moderated by the users." +msgstr "" + +#: forum/skins/default/templates/faq.html:35 +msgid "" +"The reputation system allows users earn the authorization to perform a " +"variety of moderation tasks." +msgstr "" + +#: forum/skins/default/templates/faq.html:40 +msgid "How does reputation system work?" +msgstr "" + +#: forum/skins/default/templates/faq.html:41 +msgid "Rep system summary" +msgstr "" + +#: forum/skins/default/templates/faq.html:42 +msgid "" +"For example, if you ask an interesting question or give a helpful answer, " +"your input will be upvoted. On the other hand if the answer is misleading - " +"it will be downvoted. Each vote in favor will generate 10 " +"points, each vote against will subtract 2 points. There is " +"a limit of 200 points that can be accumulated per question " +"or answer. The table below explains reputation point requirements for each " +"type of moderation task." +msgstr "" + +#: forum/skins/default/templates/faq.html:53 +#: forum/skins/default/templates/user_votes.html:15 +msgid "upvote" +msgstr "" + +#: forum/skins/default/templates/faq.html:57 +msgid "use tags" +msgstr "" + +#: forum/skins/default/templates/faq.html:62 +msgid "add comments" +msgstr "" + +#: forum/skins/default/templates/faq.html:66 +#: forum/skins/default/templates/user_votes.html:17 +msgid "downvote" +msgstr "" + +#: forum/skins/default/templates/faq.html:69 +msgid "open and close own questions" +msgstr "" + +#: forum/skins/default/templates/faq.html:73 +msgid "retag questions" +msgstr "" + +#: forum/skins/default/templates/faq.html:78 +msgid "edit community wiki questions" +msgstr "" + +#: forum/skins/default/templates/faq.html:83 +msgid "edit any answer" +msgstr "" + +#: forum/skins/default/templates/faq.html:87 +msgid "open any closed question" +msgstr "" + +#: forum/skins/default/templates/faq.html:91 +msgid "delete any comment" +msgstr "" + +#: forum/skins/default/templates/faq.html:95 +msgid "delete any questions and answers and perform other moderation tasks" +msgstr "" + +#: forum/skins/default/templates/faq.html:103 +msgid "how to validate email title" +msgstr "" + +#: forum/skins/default/templates/faq.html:105 +#, python-format +msgid "" +"how to validate email info with %(send_email_key_url)s %(gravatar_faq_url)s" +msgstr "" + +#: forum/skins/default/templates/faq.html:110 +msgid "what is gravatar" +msgstr "" + +#: forum/skins/default/templates/faq.html:111 +msgid "gravatar faq info" +msgstr "" + +#: forum/skins/default/templates/faq.html:114 +msgid "To register, do I need to create new password?" +msgstr "" + +#: forum/skins/default/templates/faq.html:115 +msgid "" +"No, you don't have to. You can login through any service that supports " +"OpenID, e.g. Google, Yahoo, AOL, etc." +msgstr "" + +#: forum/skins/default/templates/faq.html:116 +msgid "Login now!" +msgstr "" + +#: forum/skins/default/templates/faq.html:121 +msgid "Why other people can edit my questions/answers?" +msgstr "" + +#: forum/skins/default/templates/faq.html:122 +msgid "Goal of this site is..." +msgstr "" + +#: forum/skins/default/templates/faq.html:122 +msgid "" +"So questions and answers can be edited like wiki pages by experienced users " +"of this site and this improves the overall quality of the knowledge base " +"content." +msgstr "" + +#: forum/skins/default/templates/faq.html:123 +msgid "If this approach is not for you, we respect your choice." +msgstr "" + +#: forum/skins/default/templates/faq.html:127 +msgid "Still have questions?" +msgstr "" + +#: forum/skins/default/templates/faq.html:128 +#, python-format +msgid "" +"Please ask your question at %(ask_question_url)s, help make our community " +"better!" +msgstr "" + +#: forum/skins/default/templates/faq.html:130 +#: forum/skins/default/templates/header.html:27 +#: forum/skins/default/templates/header.html:55 +msgid "questions" +msgstr "" + +#: forum/skins/default/templates/faq.html:130 +#: forum/skins/default/templates/index.html:94 +#: forum/skins/default/templates/index_.html:121 +msgid "." +msgstr "" + +#: forum/skins/default/templates/feedback.html:6 +msgid "Feedback" +msgstr "" + +#: forum/skins/default/templates/feedback.html:11 +msgid "Give us your feedback!" +msgstr "" + +#: forum/skins/default/templates/feedback.html:17 +#, python-format +msgid "" +"\n" +" Dear %(user_name)s, we look " +"forward to hearing your feedback. \n" +" Please type and send us your message below.\n" +" " +msgstr "" + +#: forum/skins/default/templates/feedback.html:24 +msgid "" +"\n" +" Dear visitor, we look forward to " +"hearing your feedback.\n" +" Please type and send us your message below.\n" +" " +msgstr "" + +#: forum/skins/default/templates/feedback.html:41 +msgid "(this field is required)" +msgstr "" + +#: forum/skins/default/templates/feedback.html:49 +msgid "Send Feedback" +msgstr "" + +#: forum/skins/default/templates/feedback_email.txt:3 +#, python-format +msgid "" +"\n" +"Hello, this is a %(site_title)s forum feedback message\n" +msgstr "" + +#: forum/skins/default/templates/feedback_email.txt:9 +msgid "Sender is" +msgstr "" + +#: forum/skins/default/templates/feedback_email.txt:11 +#: forum/skins/default/templates/feedback_email.txt:14 +msgid "email" +msgstr "" + +#: forum/skins/default/templates/feedback_email.txt:13 +msgid "anonymous" +msgstr "" + +#: forum/skins/default/templates/feedback_email.txt:19 +msgid "Message body:" +msgstr "" + +#: forum/skins/default/templates/footer.html:8 +#: forum/skins/default/templates/header.html:13 +#: forum/skins/default/templates/index.html:46 +#: forum/skins/default/templates/index_.html:77 +msgid "about" +msgstr "" + +#: forum/skins/default/templates/footer.html:9 +#: forum/skins/default/templates/header.html:14 +#: forum/skins/default/templates/index.html:47 +#: forum/skins/default/templates/index_.html:78 +#: forum/skins/default/templates/question_edit_tips.html:17 +msgid "faq" +msgstr "" + +#: forum/skins/default/templates/footer.html:10 +msgid "privacy policy" +msgstr "" + +#: forum/skins/default/templates/footer.html:19 +msgid "give feedback" +msgstr "" + +#: forum/skins/default/templates/header.html:9 +msgid "logout" +msgstr "" + +#: forum/skins/default/templates/header.html:11 +msgid "login" +msgstr "" + +#: forum/skins/default/templates/header.html:21 +msgid "back to home page" +msgstr "" + +#: forum/skins/default/templates/header.html:29 +#: forum/skins/default/templates/header.html:57 +msgid "users" +msgstr "" + +#: forum/skins/default/templates/header.html:31 +msgid "books" +msgstr "" + +#: forum/skins/default/templates/header.html:33 +#: forum/templatetags/extra_tags.py:174 forum/templatetags/extra_tags.py:203 +msgid "badges" +msgstr "" + +#: forum/skins/default/templates/header.html:34 +msgid "unanswered questions" +msgstr "" + +#: forum/skins/default/templates/header.html:36 +msgid "ask a question" +msgstr "" + +#: forum/skins/default/templates/header.html:51 +msgid "search" +msgstr "" + +#: forum/skins/default/templates/index.html:9 +#: forum/skins/default/templates/index_.html:8 +msgid "Home" +msgstr "" + +#: forum/skins/default/templates/index.html:26 +#: forum/skins/default/templates/index_.html:25 +#: forum/skins/default/templates/questions.html:8 +msgid "Questions" +msgstr "" + +#: forum/skins/default/templates/index.html:28 +#: forum/skins/default/templates/index_.html:27 +msgid "last updated questions" +msgstr "" + +#: forum/skins/default/templates/index.html:28 +#: forum/skins/default/templates/index_.html:27 +#: forum/skins/default/templates/questions.html:47 +msgid "newest" +msgstr "" + +#: forum/skins/default/templates/index.html:29 +#: forum/skins/default/templates/index_.html:28 +#: forum/skins/default/templates/questions.html:49 +msgid "hottest questions" +msgstr "" + +#: forum/skins/default/templates/index.html:29 +#: forum/skins/default/templates/index_.html:28 +#: forum/skins/default/templates/questions.html:49 +msgid "hottest" +msgstr "" + +#: forum/skins/default/templates/index.html:30 +#: forum/skins/default/templates/index_.html:29 +#: forum/skins/default/templates/questions.html:50 +msgid "most voted questions" +msgstr "" + +#: forum/skins/default/templates/index.html:30 +#: forum/skins/default/templates/index_.html:29 +#: forum/skins/default/templates/questions.html:50 +msgid "most voted" +msgstr "" + +#: forum/skins/default/templates/index.html:31 +#: forum/skins/default/templates/index_.html:30 +msgid "all questions" +msgstr "" + +#: forum/skins/default/templates/index.html:43 +#: forum/skins/default/templates/index_.html:74 +msgid "welcome to website" +msgstr "" + +#: forum/skins/default/templates/index.html:54 +#: forum/skins/default/templates/index_.html:85 +msgid "Recent tags" +msgstr "" + +#: forum/skins/default/templates/index.html:60 +#: forum/skins/default/templates/index_.html:90 +#: forum/skins/default/templates/question.html:134 +#, python-format +msgid "see questions tagged '%(tagname)s'" +msgstr "" + +#: forum/skins/default/templates/index.html:64 +#: forum/skins/default/templates/index.html:94 +#: forum/skins/default/templates/index_.html:93 +#: forum/skins/default/templates/index_.html:121 +msgid "popular tags" +msgstr "" + +#: forum/skins/default/templates/index.html:69 +#: forum/skins/default/templates/index_.html:98 +msgid "Recent awards" +msgstr "" + +#: forum/skins/default/templates/index.html:82 +#: forum/skins/default/templates/index_.html:109 +msgid "all awards" +msgstr "" + +#: forum/skins/default/templates/index.html:87 +#: forum/skins/default/templates/index_.html:114 +msgid "subscribe to last 30 questions by RSS" +msgstr "" + +#: forum/skins/default/templates/index.html:94 +#: forum/skins/default/templates/index_.html:121 +msgid "Still looking for more? See" +msgstr "" + +#: forum/skins/default/templates/index.html:94 +#: forum/skins/default/templates/index_.html:121 +msgid "complete list of questions" +msgstr "" + +#: forum/skins/default/templates/index.html:94 +#: forum/skins/default/templates/index_.html:121 +#: forum/skins/default/templates/authopenid/signup.html:28 +msgid "or" +msgstr "" + +#: forum/skins/default/templates/index.html:94 +#: forum/skins/default/templates/index_.html:121 +msgid "Please help us answer" +msgstr "" + +#: forum/skins/default/templates/index.html:94 +#: forum/skins/default/templates/index_.html:121 +msgid "list of unanswered questions" +msgstr "" + +#: forum/skins/default/templates/index_.html:42 +#: forum/skins/default/templates/question_counter_widget.html:21 +msgid "this answer has been accepted to be correct" +msgstr "" + +#: forum/skins/default/templates/index_.html:44 +#: forum/skins/default/templates/question_summary_list_roll.html:13 +msgid "answers" +msgstr "" + +#: forum/skins/default/templates/index_.html:63 +#: forum/skins/default/templates/question.html:478 +#: forum/skins/default/templates/question_list.html:19 +#: forum/skins/default/templates/question_summary_list_roll.html:52 +#: forum/skins/default/templates/tags.html:49 +#: forum/skins/default/templates/users_questions.html:34 +msgid "see questions tagged" +msgstr "" + +#: forum/skins/default/templates/logout.html:6 +#: forum/skins/default/templates/logout.html:16 +msgid "Logout" +msgstr "" + +#: forum/skins/default/templates/logout.html:19 +msgid "" +"As a registered user you can login with your OpenID, log out of the site or " +"permanently remove your account." +msgstr "" + +#: forum/skins/default/templates/logout.html:20 +msgid "Logout now" +msgstr "" + +#: forum/skins/default/templates/notarobot.html:3 +msgid "Please prove that you are a Human Being" +msgstr "" + +#: forum/skins/default/templates/notarobot.html:10 +msgid "I am a Human Being" +msgstr "" + +#: forum/skins/default/templates/pagesize.html:6 +msgid "posts per page" +msgstr "" + +#: forum/skins/default/templates/paginator.html:6 +#: forum/skins/default/templates/paginator.html:7 +msgid "previous" +msgstr "" + +#: forum/skins/default/templates/paginator.html:19 +msgid "current page" +msgstr "" + +#: forum/skins/default/templates/paginator.html:22 +#: forum/skins/default/templates/paginator.html:29 +msgid "page number " +msgstr "" + +#: forum/skins/default/templates/paginator.html:22 +#: forum/skins/default/templates/paginator.html:29 +msgid "number - make blank in english" +msgstr "" + +#: forum/skins/default/templates/paginator.html:33 +msgid "next page" +msgstr "" + +#: forum/skins/default/templates/post_contributor_info.html:9 +#, python-format +msgid "" +"\n" +" one revision\n" +" " +msgid_plural "" +"\n" +" %(rev_count)s revisions\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/post_contributor_info.html:19 +msgid "asked" +msgstr "" + +#: forum/skins/default/templates/post_contributor_info.html:22 +msgid "answered" +msgstr "" + +#: forum/skins/default/templates/post_contributor_info.html:24 +msgid "posted" +msgstr "" + +#: forum/skins/default/templates/post_contributor_info.html:45 +msgid "updated" +msgstr "" + +#: forum/skins/default/templates/privacy.html:6 +#: forum/skins/default/templates/privacy.html:11 +msgid "Privacy policy" +msgstr "" + +#: forum/skins/default/templates/privacy.html:15 +msgid "general message about privacy" +msgstr "" + +#: forum/skins/default/templates/privacy.html:18 +msgid "Site Visitors" +msgstr "" + +#: forum/skins/default/templates/privacy.html:20 +msgid "what technical information is collected about visitors" +msgstr "" + +#: forum/skins/default/templates/privacy.html:23 +msgid "Personal Information" +msgstr "" + +#: forum/skins/default/templates/privacy.html:25 +msgid "details on personal information policies" +msgstr "" + +#: forum/skins/default/templates/privacy.html:28 +msgid "Other Services" +msgstr "" + +#: forum/skins/default/templates/privacy.html:30 +msgid "details on sharing data with third parties" +msgstr "" + +#: forum/skins/default/templates/privacy.html:35 +msgid "cookie policy details" +msgstr "" + +#: forum/skins/default/templates/privacy.html:37 +msgid "Policy Changes" +msgstr "" + +#: forum/skins/default/templates/privacy.html:38 +msgid "how privacy policies can be changed" +msgstr "" + +#: forum/skins/default/templates/question.html:78 +#: forum/skins/default/templates/question.html:79 +#: forum/skins/default/templates/question.html:95 +#: forum/skins/default/templates/question.html:97 +msgid "i like this post (click again to cancel)" +msgstr "" + +#: forum/skins/default/templates/question.html:81 +#: forum/skins/default/templates/question.html:99 +#: forum/skins/default/templates/question.html:256 +msgid "current number of votes" +msgstr "" + +#: forum/skins/default/templates/question.html:90 +#: forum/skins/default/templates/question.html:91 +#: forum/skins/default/templates/question.html:104 +#: forum/skins/default/templates/question.html:105 +msgid "i dont like this post (click again to cancel)" +msgstr "" + +#: forum/skins/default/templates/question.html:109 +#: forum/skins/default/templates/question.html:110 +msgid "mark this question as favorite (click again to cancel)" +msgstr "" + +#: forum/skins/default/templates/question.html:116 +#: forum/skins/default/templates/question.html:117 +msgid "remove favorite mark from this question (click again to restore mark)" +msgstr "" + +#: forum/skins/default/templates/question.html:139 +#: forum/skins/default/templates/question.html:293 +#: forum/skins/default/templates/revisions_answer.html:58 +#: forum/skins/default/templates/revisions_question.html:58 +msgid "edit" +msgstr "" + +#: forum/skins/default/templates/question.html:144 +msgid "reopen" +msgstr "" + +#: forum/skins/default/templates/question.html:148 +msgid "close" +msgstr "" + +#: forum/skins/default/templates/question.html:154 +#: forum/skins/default/templates/question.html:298 +msgid "" +"report as offensive (i.e containing spam, advertising, malicious text, etc.)" +msgstr "" + +#: forum/skins/default/templates/question.html:155 +#: forum/skins/default/templates/question.html:299 +msgid "flag offensive" +msgstr "" + +#: forum/skins/default/templates/question.html:163 +#: forum/skins/default/templates/question.html:310 +msgid "delete" +msgstr "" + +#: forum/skins/default/templates/question.html:181 +#: forum/skins/default/templates/question.html:330 +msgid "delete this comment" +msgstr "" + +#: forum/skins/default/templates/question.html:192 +#: forum/skins/default/templates/question.html:341 +msgid "add comment" +msgstr "" + +#: forum/skins/default/templates/question.html:196 +#, python-format +msgid "" +"\n" +" see one more \n" +" " +msgid_plural "" +"\n" +" see %(counter)s " +"more\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/question.html:202 +#, python-format +msgid "" +"\n" +" see one more " +"comment\n" +" " +msgid_plural "" +"\n" +" see %(counter)s " +"more comments\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/question.html:218 +#, python-format +msgid "" +"The question has been closed for the following reason \"%(close_reason)s\" by" +msgstr "" + +#: forum/skins/default/templates/question.html:220 +#, python-format +msgid "close date %(closed_at)s" +msgstr "" + +#: forum/skins/default/templates/question.html:228 +#, python-format +msgid "" +"\n" +" One Answer:\n" +" " +msgid_plural "" +"\n" +" %(counter)s Answers:\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/question.html:236 +msgid "oldest answers will be shown first" +msgstr "" + +#: forum/skins/default/templates/question.html:236 +msgid "oldest answers" +msgstr "" + +#: forum/skins/default/templates/question.html:238 +msgid "newest answers will be shown first" +msgstr "" + +#: forum/skins/default/templates/question.html:238 +msgid "newest answers" +msgstr "" + +#: forum/skins/default/templates/question.html:240 +msgid "most voted answers will be shown first" +msgstr "" + +#: forum/skins/default/templates/question.html:240 +msgid "popular answers" +msgstr "" + +#: forum/skins/default/templates/question.html:254 +#: forum/skins/default/templates/question.html:255 +msgid "i like this answer (click again to cancel)" +msgstr "" + +#: forum/skins/default/templates/question.html:261 +#: forum/skins/default/templates/question.html:262 +msgid "i dont like this answer (click again to cancel)" +msgstr "" + +#: forum/skins/default/templates/question.html:267 +#: forum/skins/default/templates/question.html:268 +msgid "mark this answer as favorite (click again to undo)" +msgstr "" + +#: forum/skins/default/templates/question.html:273 +#: forum/skins/default/templates/question.html:274 +msgid "the author of the question has selected this answer as correct" +msgstr "" + +#: forum/skins/default/templates/question.html:287 +msgid "answer permanent link" +msgstr "" + +#: forum/skins/default/templates/question.html:288 +msgid "permanent link" +msgstr "" + +#: forum/skins/default/templates/question.html:310 +msgid "undelete" +msgstr "" + +#: forum/skins/default/templates/question.html:345 +#, python-format +msgid "" +"\n" +" see one more \n" +" " +msgid_plural "" +"\n" +" see %" +"(counter)s more\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/question.html:351 +#, python-format +msgid "" +"\n" +" see one more comment\n" +" " +msgid_plural "" +"\n" +" see %" +"(counter)s more comments\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/question.html:377 +#: forum/skins/default/templates/question.html:380 +msgid "Notify me once a day when there are any new answers" +msgstr "" + +#: forum/skins/default/templates/question.html:383 +msgid "Notify me weekly when there are any new answers" +msgstr "" + +#: forum/skins/default/templates/question.html:388 +#, python-format +msgid "" +"You can always adjust frequency of email updates from your %(profile_url)s" +msgstr "" + +#: forum/skins/default/templates/question.html:393 +msgid "once you sign in you will be able to subscribe for any updates here" +msgstr "" + +#: forum/skins/default/templates/question.html:404 +msgid "Your answer" +msgstr "" + +#: forum/skins/default/templates/question.html:406 +msgid "Be the first one to answer this question!" +msgstr "" + +#: forum/skins/default/templates/question.html:412 +msgid "you can answer anonymously and then login" +msgstr "" + +#: forum/skins/default/templates/question.html:416 +msgid "answer your own question only to give an answer" +msgstr "" + +#: forum/skins/default/templates/question.html:418 +msgid "please only give an answer, no discussions" +msgstr "" + +#: forum/skins/default/templates/question.html:454 +msgid "Login/Signup to Post Your Answer" +msgstr "" + +#: forum/skins/default/templates/question.html:457 +msgid "Answer Your Own Question" +msgstr "" + +#: forum/skins/default/templates/question.html:459 +msgid "Answer the question" +msgstr "" + +#: forum/skins/default/templates/question.html:473 +msgid "Question tags" +msgstr "" + +#: forum/skins/default/templates/question.html:483 +msgid "question asked" +msgstr "" + +#: forum/skins/default/templates/question.html:486 +msgid "question was seen" +msgstr "" + +#: forum/skins/default/templates/question.html:486 +msgid "times" +msgstr "" + +#: forum/skins/default/templates/question.html:489 +msgid "last updated" +msgstr "" + +#: forum/skins/default/templates/question.html:495 +msgid "Related questions" +msgstr "" + +#: forum/skins/default/templates/question_counter_widget.html:6 +msgid "Please decide if you like this question or not by voting" +msgstr "" + +#: forum/skins/default/templates/question_counter_widget.html:12 +msgid "" +"\n" +" vote\n" +" " +msgid_plural "" +"\n" +" votes\n" +" " +msgstr[0] "" +"\n" +"golos" +msgstr[1] "" +"\n" +"golosa" +msgstr[2] "" +"\n" +"golosov" + +#: forum/skins/default/templates/question_counter_widget.html:27 +msgid "" +"\n" +" answer \n" +" " +msgid_plural "" +"\n" +" answers \n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/question_counter_widget.html:39 +msgid "" +"\n" +" view\n" +" " +msgid_plural "" +"\n" +" views\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/question_edit.html:5 +#: forum/skins/default/templates/question_edit.html:66 +msgid "Edit question" +msgstr "" + +#: forum/skins/default/templates/question_edit_tips.html:4 +msgid "question tips" +msgstr "" + +#: forum/skins/default/templates/question_edit_tips.html:7 +msgid "please ask a relevant question" +msgstr "" + +#: forum/skins/default/templates/question_edit_tips.html:10 +msgid "please try provide enough details" +msgstr "" + +#: forum/skins/default/templates/question_retag.html:4 +#: forum/skins/default/templates/question_retag.html:53 +msgid "Change tags" +msgstr "" + +#: forum/skins/default/templates/question_retag.html:40 +msgid "up to 5 tags, less than 20 characters each" +msgstr "" + +#: forum/skins/default/templates/question_retag.html:83 +msgid "Why use and modify tags?" +msgstr "" + +#: forum/skins/default/templates/question_retag.html:86 +msgid "tags help us keep Questions organized" +msgstr "" + +#: forum/skins/default/templates/question_retag.html:94 +msgid "tag editors receive special awards from the community" +msgstr "" + +#: forum/skins/default/templates/questions.html:29 +msgid "Found by tags" +msgstr "" + +#: forum/skins/default/templates/questions.html:33 +msgid "Search results" +msgstr "" + +#: forum/skins/default/templates/questions.html:35 +msgid "Found by title" +msgstr "" + +#: forum/skins/default/templates/questions.html:39 +msgid "Unanswered questions" +msgstr "" + +#: forum/skins/default/templates/questions.html:41 +msgid "All questions" +msgstr "" + +#: forum/skins/default/templates/questions.html:47 +msgid "most recently asked questions" +msgstr "" + +#: forum/skins/default/templates/questions.html:48 +msgid "most recently updated questions" +msgstr "" + +#: forum/skins/default/templates/questions.html:48 +msgid "active" +msgstr "" + +#: forum/skins/default/templates/questions.html:58 +msgid "Did not find anything?" +msgstr "" + +#: forum/skins/default/templates/questions.html:61 +msgid "Did not find what you were looking for?" +msgstr "" + +#: forum/skins/default/templates/questions.html:63 +msgid "Please, post your question!" +msgstr "" + +#: forum/skins/default/templates/questions.html:77 +#, python-format +msgid "have total %(q_num)s questions tagged %(tagname)s" +msgid_plural "have total %(q_num)s questions tagged %(tagname)s" +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/questions.html:81 +#, python-format +msgid "" +" have total %(q_num)s questions containing %(searchtitle)s in full text " +msgid_plural "" +" have total %(q_num)s questions containing %(searchtitle)s in full text " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/questions.html:83 +#, python-format +msgid " have total %(q_num)s questions containing %(searchtitle)s " +msgid_plural " have total %(q_num)s questions containing %(searchtitle)s " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/questions.html:87 +#, python-format +msgid " have total %(q_num)s unanswered questions " +msgid_plural " have total %(q_num)s unanswered questions " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/questions.html:89 +#, python-format +msgid " have total %(q_num)s questions " +msgid_plural " have total %(q_num)s questions " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/questions.html:95 +msgid "latest questions info" +msgstr "" + +#: forum/skins/default/templates/questions.html:99 +msgid "Questions are sorted by the time of last update." +msgstr "" + +#: forum/skins/default/templates/questions.html:100 +msgid "Most recently answered ones are shown first." +msgstr "" + +#: forum/skins/default/templates/questions.html:104 +msgid "Questions sorted by number of responses." +msgstr "" + +#: forum/skins/default/templates/questions.html:105 +msgid "Most answered questions are shown first." +msgstr "" + +#: forum/skins/default/templates/questions.html:109 +msgid "Questions are sorted by the number of votes." +msgstr "" + +#: forum/skins/default/templates/questions.html:110 +msgid "Most voted questions are shown first." +msgstr "" + +#: forum/skins/default/templates/questions.html:118 +msgid "Related tags" +msgstr "" + +#: forum/skins/default/templates/questions.html:121 +#: forum/skins/default/templates/tag_selector.html:10 +#: forum/skins/default/templates/tag_selector.html:27 +#, python-format +msgid "see questions tagged '%(tag_name)s'" +msgstr "" + +#: forum/skins/default/templates/reopen.html:6 +#: forum/skins/default/templates/reopen.html:16 +msgid "Reopen question" +msgstr "" + +#: forum/skins/default/templates/reopen.html:19 +msgid "Open the previously closed question" +msgstr "" + +#: forum/skins/default/templates/reopen.html:22 +msgid "The question was closed for the following reason " +msgstr "" + +#: forum/skins/default/templates/reopen.html:22 +msgid "reason - leave blank in english" +msgstr "" + +#: forum/skins/default/templates/reopen.html:22 +msgid "on " +msgstr "" + +#: forum/skins/default/templates/reopen.html:22 +msgid "date closed" +msgstr "" + +#: forum/skins/default/templates/reopen.html:29 +msgid "Reopen this question" +msgstr "" + +#: forum/skins/default/templates/revisions_answer.html:7 +#: forum/skins/default/templates/revisions_answer.html:38 +#: forum/skins/default/templates/revisions_question.html:8 +#: forum/skins/default/templates/revisions_question.html:38 +msgid "Revision history" +msgstr "" + +#: forum/skins/default/templates/revisions_answer.html:50 +#: forum/skins/default/templates/revisions_question.html:50 +msgid "click to hide/show revision" +msgstr "" + +#: forum/skins/default/templates/tag_selector.html:4 +msgid "Interesting tags" +msgstr "" + +#: forum/skins/default/templates/tag_selector.html:14 +#, python-format +msgid "remove '%(tag_name)s' from the list of interesting tags" +msgstr "" + +#: forum/skins/default/templates/tag_selector.html:20 +#: forum/skins/default/templates/tag_selector.html:37 +msgid "Add" +msgstr "" + +#: forum/skins/default/templates/tag_selector.html:21 +msgid "Ignored tags" +msgstr "" + +#: forum/skins/default/templates/tag_selector.html:31 +#, python-format +msgid "remove '%(tag_name)s' from the list of ignored tags" +msgstr "" + +#: forum/skins/default/templates/tag_selector.html:40 +msgid "keep ignored questions hidden" +msgstr "" + +#: forum/skins/default/templates/tags.html:6 +#: forum/skins/default/templates/tags.html:30 +msgid "Tag list" +msgstr "" + +#: forum/skins/default/templates/tags.html:32 +msgid "sorted alphabetically" +msgstr "" + +#: forum/skins/default/templates/tags.html:32 +msgid "by name" +msgstr "" + +#: forum/skins/default/templates/tags.html:33 +msgid "sorted by frequency of tag use" +msgstr "" + +#: forum/skins/default/templates/tags.html:33 +msgid "by popularity" +msgstr "" + +#: forum/skins/default/templates/tags.html:39 +msgid "All tags matching query" +msgstr "" + +#: forum/skins/default/templates/tags.html:39 +msgid "all tags - make this empty in english" +msgstr "" + +#: forum/skins/default/templates/tags.html:42 +msgid "Nothing found" +msgstr "" + +#: forum/skins/default/templates/user_edit.html:6 +msgid "Edit user profile" +msgstr "" + +#: forum/skins/default/templates/user_edit.html:19 +msgid "edit profile" +msgstr "" + +#: forum/skins/default/templates/user_edit.html:33 +#: forum/skins/default/templates/user_info.html:53 +msgid "Registered user" +msgstr "" + +#: forum/skins/default/templates/user_edit.html:40 +msgid "Screen Name" +msgstr "" + +#: forum/skins/default/templates/user_edit.html:83 +#: forum/skins/default/templates/user_email_subscriptions.html:20 +msgid "Update" +msgstr "" + +#: forum/skins/default/templates/user_email_subscriptions.html:8 +msgid "Email subscription settings" +msgstr "" + +#: forum/skins/default/templates/user_email_subscriptions.html:9 +msgid "email subscription settings info" +msgstr "" + +#: forum/skins/default/templates/user_email_subscriptions.html:21 +msgid "Stop sending email" +msgstr "" + +#: forum/skins/default/templates/user_info.html:18 +msgid "change picture" +msgstr "" + +#: forum/skins/default/templates/user_info.html:25 +#: forum/skins/default/templates/users.html:26 forum/views/users.py:920 +msgid "reputation" +msgstr "" + +#: forum/skins/default/templates/user_info.html:35 +msgid "Moderate this user" +msgstr "" + +#: forum/skins/default/templates/user_info.html:47 +msgid "update profile" +msgstr "" + +#: forum/skins/default/templates/user_info.html:57 +msgid "real name" +msgstr "" + +#: forum/skins/default/templates/user_info.html:62 +msgid "member for" +msgstr "" + +#: forum/skins/default/templates/user_info.html:67 +msgid "last seen" +msgstr "" + +#: forum/skins/default/templates/user_info.html:73 +msgid "user website" +msgstr "" + +#: forum/skins/default/templates/user_info.html:79 +msgid "location" +msgstr "" + +#: forum/skins/default/templates/user_info.html:86 +msgid "age" +msgstr "" + +#: forum/skins/default/templates/user_info.html:87 +msgid "age unit" +msgstr "" + +#: forum/skins/default/templates/user_info.html:93 +msgid "todays unused votes" +msgstr "" + +#: forum/skins/default/templates/user_info.html:94 +msgid "votes left" +msgstr "" + +#: forum/skins/default/templates/user_reputation.html:27 +msgid "Change in karma per question or answer" +msgstr "" + +#: forum/skins/default/templates/user_stats.html:12 +#, python-format +msgid "" +"\n" +" 1 Question\n" +" " +msgid_plural "" +"\n" +" %(counter)s Questions\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/user_stats.html:23 +#, python-format +msgid "" +"\n" +" 1 Answer\n" +" " +msgid_plural "" +"\n" +" %(counter)s Answers\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/user_stats.html:36 +#, python-format +msgid "the answer has been voted for %(answer_score)s times" +msgstr "" + +#: forum/skins/default/templates/user_stats.html:36 +msgid "this answer has been selected as correct" +msgstr "" + +#: forum/skins/default/templates/user_stats.html:46 +#, python-format +msgid "" +"\n" +" (one comment)\n" +" " +msgid_plural "" +"\n" +" the answer has been commented %(comment_count)s times\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/user_stats.html:61 +#, python-format +msgid "" +"\n" +" 1 Vote\n" +" " +msgid_plural "" +"\n" +" %(cnt)s Votes\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/user_stats.html:72 +msgid "thumb up" +msgstr "" + +#: forum/skins/default/templates/user_stats.html:73 +msgid "user has voted up this many times" +msgstr "" + +#: forum/skins/default/templates/user_stats.html:77 +msgid "thumb down" +msgstr "" + +#: forum/skins/default/templates/user_stats.html:78 +msgid "user voted down this many times" +msgstr "" + +#: forum/skins/default/templates/user_stats.html:87 +#, python-format +msgid "" +"\n" +" 1 Tag\n" +" " +msgid_plural "" +"\n" +" %(counter)s Tags\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/user_stats.html:100 +#, python-format +msgid "" +"see other questions with %(view_user)s's contributions tagged '%(tag_name)s' " +msgstr "" + +#: forum/skins/default/templates/user_stats.html:115 +#, python-format +msgid "" +"\n" +" 1 Badge\n" +" " +msgid_plural "" +"\n" +" %(counter)s Badges\n" +" " +msgstr[0] "" +msgstr[1] "" + +#: forum/skins/default/templates/user_tabs.html:7 +msgid "User profile" +msgstr "" + +#: forum/skins/default/templates/user_tabs.html:7 forum/views/users.py:894 +msgid "overview" +msgstr "" + +#: forum/skins/default/templates/user_tabs.html:9 forum/views/users.py:902 +msgid "recent activity" +msgstr "" + +#: forum/skins/default/templates/user_tabs.html:12 forum/views/users.py:912 +msgid "comments and answers to others questions" +msgstr "" + +#: forum/skins/default/templates/user_tabs.html:13 forum/views/users.py:911 +msgid "responses" +msgstr "" + +#: forum/skins/default/templates/user_tabs.html:16 +msgid "graph of user reputation" +msgstr "" + +#: forum/skins/default/templates/user_tabs.html:17 +msgid "reputation history" +msgstr "" + +#: forum/skins/default/templates/user_tabs.html:20 forum/views/users.py:938 +msgid "user vote record" +msgstr "" + +#: forum/skins/default/templates/user_tabs.html:20 forum/views/users.py:937 +msgid "casted votes" +msgstr "" + +#: forum/skins/default/templates/user_tabs.html:23 +msgid "questions that user selected as his/her favorite" +msgstr "" + +#: forum/skins/default/templates/user_tabs.html:24 +msgid "favorites" +msgstr "" + +#: forum/skins/default/templates/user_tabs.html:27 forum/views/users.py:947 +msgid "email subscription settings" +msgstr "" + +#: forum/skins/default/templates/user_tabs.html:28 forum/views/users.py:946 +msgid "email subscriptions" +msgstr "" + +#: forum/skins/default/templates/users.html:6 +#: forum/skins/default/templates/users.html:24 +msgid "Users" +msgstr "" + +#: forum/skins/default/templates/users.html:27 +msgid "recent" +msgstr "" + +#: forum/skins/default/templates/users.html:28 +msgid "oldest" +msgstr "" + +#: forum/skins/default/templates/users.html:29 +msgid "by username" +msgstr "" + +#: forum/skins/default/templates/users.html:35 +#, python-format +msgid "users matching query %(suser)s:" +msgstr "" + +#: forum/skins/default/templates/users.html:39 +msgid "Nothing found." +msgstr "" + +#: forum/skins/default/templates/users_questions.html:11 +msgid "this questions was selected as favorite" +msgstr "" + +#: forum/skins/default/templates/users_questions.html:12 +msgid "thumb-up on" +msgstr "" + +#: forum/skins/default/templates/users_questions.html:19 +msgid "thumb-up off" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:3 +#: forum/skins/default/templates/authopenid/changeemail.html:9 +#: forum/skins/default/templates/authopenid/changeemail.html:38 +msgid "Change email" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:11 +msgid "Save your email address" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:16 +#, python-format +msgid "change %(email)s info" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:18 +#, python-format +msgid "here is why email is required, see %(gravatar_faq_url)s" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:31 +msgid "Your new Email" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:31 +msgid "Your Email" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:38 +msgid "Save Email" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:49 +msgid "Validate email" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:52 +#, python-format +msgid "validate %(email)s info or go to %(change_email_url)s" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:57 +msgid "Email not changed" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:60 +#, python-format +msgid "old %(email)s kept, if you like go to %(change_email_url)s" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:65 +msgid "Email changed" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:68 +#, python-format +msgid "your current %(email)s can be used for this" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:73 +msgid "Email verified" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:76 +msgid "thanks for verifying email" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:81 +msgid "email key not sent" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeemail.html:84 +#, python-format +msgid "email key not sent %(email)s change email here %(change_link)s" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeopenid.html:8 +msgid "Account: change OpenID URL" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeopenid.html:12 +msgid "" +"This is where you can change your OpenID URL. Make sure you remember it!" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeopenid.html:14 +#: forum/skins/default/templates/authopenid/delete.html:14 +#: forum/skins/default/templates/authopenid/delete.html:24 +msgid "Please correct errors below:" +msgstr "" + +#: forum/skins/default/templates/authopenid/changeopenid.html:29 +msgid "OpenID URL:" +msgstr "" + +#: forum/skins/default/templates/authopenid/changepw.html:7 +msgid "Account: change password" +msgstr "" + +#: forum/skins/default/templates/authopenid/changepw.html:8 +msgid "This is where you can change your password. Make sure you remember it!" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:19 +msgid "Connect your OpenID with this site" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:22 +msgid "Connect your OpenID with your account on this site" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:27 +#, python-format +msgid "register new %(provider)s account info, see %(gravatar_faq_url)s" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:31 +#, python-format +msgid "" +"%(username)s already exists, choose another name for \n" +" %(provider)s. Email is required too, see %" +"(gravatar_faq_url)s\n" +" " +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:35 +#, python-format +msgid "" +"register new external %(provider)s account info, see %(gravatar_faq_url)s" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:38 +#, python-format +msgid "register new Facebook connect account info, see %(gravatar_faq_url)s" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:42 +msgid "This account already exists, please use another." +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:57 +msgid "Sorry, looks like we have some errors:" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:82 +msgid "Screen name label" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:89 +msgid "Email address label" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:95 +#: forum/skins/default/templates/authopenid/signup.html:18 +msgid "receive updates motivational blurb" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:99 +#: forum/skins/default/templates/authopenid/signup.html:22 +msgid "please select one of the options above" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:102 +msgid "Tag filter tool will be your right panel, once you log in." +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:103 +msgid "create account" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:112 +msgid "Existing account" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:113 +msgid "user name" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:114 +msgid "password" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:121 +msgid "Register" +msgstr "" + +#: forum/skins/default/templates/authopenid/complete.html:122 +#: forum/skins/default/templates/authopenid/signin.html:168 +msgid "Forgot your password?" +msgstr "" + +#: forum/skins/default/templates/authopenid/confirm_email.txt:2 +msgid "Thank you for registering at our Q&A forum!" +msgstr "" + +#: forum/skins/default/templates/authopenid/confirm_email.txt:4 +msgid "Your account details are:" +msgstr "" + +#: forum/skins/default/templates/authopenid/confirm_email.txt:6 +msgid "Username:" +msgstr "" + +#: forum/skins/default/templates/authopenid/confirm_email.txt:7 +#: forum/skins/default/templates/authopenid/delete.html:19 +msgid "Password:" +msgstr "" + +#: forum/skins/default/templates/authopenid/confirm_email.txt:9 +msgid "Please sign in here:" +msgstr "" + +#: forum/skins/default/templates/authopenid/confirm_email.txt:12 +#: forum/skins/default/templates/authopenid/email_validation.txt:14 +#: forum/skins/default/templates/authopenid/sendpw_email.txt:8 +msgid "" +"Sincerely,\n" +"Forum Administrator" +msgstr "" + +#: forum/skins/default/templates/authopenid/delete.html:8 +msgid "Account: delete account" +msgstr "" + +#: forum/skins/default/templates/authopenid/delete.html:12 +msgid "" +"Note: After deleting your account, anyone will be able to register this " +"username." +msgstr "" + +#: forum/skins/default/templates/authopenid/delete.html:16 +msgid "Check confirm box, if you want delete your account." +msgstr "" + +#: forum/skins/default/templates/authopenid/delete.html:31 +msgid "I am sure I want to delete my account." +msgstr "" + +#: forum/skins/default/templates/authopenid/delete.html:32 +msgid "Password/OpenID URL" +msgstr "" + +#: forum/skins/default/templates/authopenid/delete.html:32 +msgid "(required for your security)" +msgstr "" + +#: forum/skins/default/templates/authopenid/delete.html:34 +msgid "Delete account permanently" +msgstr "" + +#: forum/skins/default/templates/authopenid/email_validation.txt:2 +msgid "Greetings from the Q&A forum" +msgstr "" + +#: forum/skins/default/templates/authopenid/email_validation.txt:4 +msgid "To make use of the Forum, please follow the link below:" +msgstr "" + +#: forum/skins/default/templates/authopenid/email_validation.txt:8 +msgid "Following the link above will help us verify your email address." +msgstr "" + +#: forum/skins/default/templates/authopenid/email_validation.txt:10 +msgid "" +"If you beleive that this message was sent in mistake - \n" +"no further action is needed. Just ingore this email, we apologize\n" +"for any inconvenience" +msgstr "" + +#: forum/skins/default/templates/authopenid/external_legacy_login_info.html:4 +#: forum/skins/default/templates/authopenid/external_legacy_login_info.html:7 +msgid "Traditional login information" +msgstr "" + +#: forum/skins/default/templates/authopenid/external_legacy_login_info.html:12 +#, python-format +msgid "" +"how to login with password through external login website or use %" +"(feedback_url)s" +msgstr "" + +#: forum/skins/default/templates/authopenid/sendpw.html:4 +#: forum/skins/default/templates/authopenid/sendpw.html:7 +msgid "Send new password" +msgstr "" + +#: forum/skins/default/templates/authopenid/sendpw.html:10 +msgid "password recovery information" +msgstr "" + +#: forum/skins/default/templates/authopenid/sendpw.html:21 +msgid "Reset password" +msgstr "" + +#: forum/skins/default/templates/authopenid/sendpw.html:22 +msgid "return to login" +msgstr "" + +#: forum/skins/default/templates/authopenid/sendpw_email.txt:2 +#, python-format +msgid "" +"Someone has requested to reset your password on %(site_url)s.\n" +"If it were not you, it is safe to ignore this email." +msgstr "" + +#: forum/skins/default/templates/authopenid/sendpw_email.txt:5 +#, python-format +msgid "" +"email explanation how to use new %(password)s for %(username)s\n" +"with the %(key_link)s" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:5 +#: forum/skins/default/templates/authopenid/signin.html:21 +msgid "User login" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:28 +#, python-format +msgid "" +"\n" +" Your answer to %(title)s %(summary)s will be posted once you " +"log in\n" +" " +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:35 +#, python-format +msgid "" +"Your question \n" +" %(title)s %(summary)s will be posted once you log in\n" +" " +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:42 +msgid "Click to sign in through any of these services." +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:144 +msgid "Enter your Provider user name" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:151 +msgid "" +"Enter your OpenID " +"web address" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:153 +#: forum/skins/default/templates/authopenid/signin.html:166 +msgid "Login" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:157 +msgid "Enter your login name and password" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:161 +msgid "Login name" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:163 +msgid "Password" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:167 +msgid "Create account" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:178 +msgid "Why use OpenID?" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:181 +msgid "with openid it is easier" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:184 +msgid "reuse openid" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:187 +msgid "openid is widely adopted" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:190 +msgid "openid is supported open standard" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:195 +msgid "Find out more" +msgstr "" + +#: forum/skins/default/templates/authopenid/signin.html:196 +msgid "Get OpenID" +msgstr "" + +#: forum/skins/default/templates/authopenid/signup.html:4 +msgid "Signup" +msgstr "" + +#: forum/skins/default/templates/authopenid/signup.html:8 +msgid "Create login name and password" +msgstr "" + +#: forum/skins/default/templates/authopenid/signup.html:10 +msgid "Traditional signup info" +msgstr "" + +#: forum/skins/default/templates/authopenid/signup.html:25 +msgid "" +"Please read and type in the two words below to help us prevent automated " +"account creation." +msgstr "" + +#: forum/skins/default/templates/authopenid/signup.html:27 +msgid "Create Account" +msgstr "" + +#: forum/skins/default/templates/authopenid/signup.html:29 +msgid "return to OpenID login" +msgstr "" + +#: forum/skins/default/templates/fbconnect/xd_receiver.html:5 +#, python-format +msgid "Connect to %(APP_SHORT_NAME)s with Facebook!" +msgstr "" + +#: forum/templatetags/extra_tags.py:175 forum/templatetags/extra_tags.py:202 +msgid "reputation points" +msgstr "" + +#: forum/templatetags/extra_tags.py:262 +msgid "2 days ago" +msgstr "" + +#: forum/templatetags/extra_tags.py:264 +msgid "yesterday" +msgstr "" + +#: forum/templatetags/extra_tags.py:266 +#, python-format +msgid "%(hr)d hour ago" +msgid_plural "%(hr)d hours ago" +msgstr[0] "" +msgstr[1] "" + +#: forum/templatetags/extra_tags.py:268 +#, python-format +msgid "%(min)d min ago" +msgid_plural "%(min)d mins ago" +msgstr[0] "" +msgstr[1] "" + +#: forum/utils/forms.py:30 +msgid "this field is required" +msgstr "" + +#: forum/utils/forms.py:45 +msgid "choose a username" +msgstr "" + +#: forum/utils/forms.py:50 +msgid "user name is required" +msgstr "" + +#: forum/utils/forms.py:51 +msgid "sorry, this name is taken, please choose another" +msgstr "" + +#: forum/utils/forms.py:52 +msgid "sorry, this name is not allowed, please choose another" +msgstr "" + +#: forum/utils/forms.py:53 +msgid "sorry, there is no user with this name" +msgstr "" + +#: forum/utils/forms.py:54 +msgid "sorry, we have a serious error - user name is taken by several users" +msgstr "" + +#: forum/utils/forms.py:55 +msgid "user name can only consist of letters, empty space and underscore" +msgstr "" + +#: forum/utils/forms.py:109 +msgid "your email address" +msgstr "" + +#: forum/utils/forms.py:110 +msgid "email address is required" +msgstr "" + +#: forum/utils/forms.py:112 +msgid "this email is already used by someone else, please choose another" +msgstr "" + +#: forum/utils/forms.py:140 +msgid "choose password" +msgstr "" + +#: forum/utils/forms.py:141 +msgid "password is required" +msgstr "" + +#: forum/utils/forms.py:144 +msgid "retype password" +msgstr "" + +#: forum/utils/forms.py:145 +msgid "please, retype your password" +msgstr "" + +#: forum/utils/forms.py:146 +msgid "sorry, entered passwords did not match, please try again" +msgstr "" + +#: forum/views/auth.py:104 forum/views/auth.py:113 +msgid "" +"Sorry, these login credentials belong to anoother user. Plese terminate your " +"current session and try again." +msgstr "" + +#: forum/views/auth.py:106 +msgid "You are already logged in with that user." +msgstr "" + +#: forum/views/auth.py:111 +msgid "These login credentials are already associated with your account." +msgstr "" + +#: forum/views/auth.py:117 +msgid "The new credentials are now associated with your account" +msgstr "" + +#: forum/views/auth.py:155 +msgid "" +"Oops, something went wrong in the middle of this process. Please try again." +msgstr "" + +#: forum/views/auth.py:215 +msgid "Temporary login link" +msgstr "" + +#: forum/views/auth.py:220 +msgid "An email has been sent with your temporary login key" +msgstr "" + +#: forum/views/auth.py:235 +msgid "" +"You are logged in with a temporary access key, please take the time to fix " +"your issue with authentication." +msgstr "" + +#: forum/views/auth.py:241 +msgid "Email Validation" +msgstr "" + +#: forum/views/auth.py:252 +msgid "Thank you, your email is now validated." +msgstr "" + +#: forum/views/auth.py:276 +msgid "Your password was changed" +msgstr "" + +#: forum/views/auth.py:278 +msgid "New password set" +msgstr "" + +#: forum/views/auth.py:311 +#, python-format +msgid "You removed the association with %s" +msgstr "" + +#: forum/views/auth.py:350 +#, python-format +msgid "Welcome back %s, you are now logged in" +msgstr "" + +#: forum/views/commands.py:209 +#, python-format +msgid "subscription saved, %(email)s needs validation, see %(details_url)s" +msgstr "" + +#: forum/views/commands.py:217 +msgid "email update frequency has been set to daily" +msgstr "" + +#: forum/views/meta.py:34 +msgid "Q&A forum feedback" +msgstr "" + +#: forum/views/meta.py:35 +msgid "Thanks for the feedback!" +msgstr "" + +#: forum/views/meta.py:43 +msgid "We look forward to hearing your feedback! Please, give it next time :)" +msgstr "" + +#: forum/views/users.py:855 forum/views/users.py:859 +msgid "changes saved" +msgstr "" + +#: forum/views/users.py:865 +msgid "email updates canceled" +msgstr "" + +#: forum/views/users.py:895 +msgid "user profile" +msgstr "" + +#: forum/views/users.py:896 +msgid "user profile overview" +msgstr "" + +#: forum/views/users.py:903 +msgid "recent user activity" +msgstr "" + +#: forum/views/users.py:904 +msgid "profile - recent activity" +msgstr "" + +#: forum/views/users.py:913 +msgid "profile - responses" +msgstr "" + +#: forum/views/users.py:921 +msgid "user reputation in the community" +msgstr "" + +#: forum/views/users.py:922 +msgid "profile - user reputation" +msgstr "" + +#: forum/views/users.py:928 +msgid "favorite questions" +msgstr "" + +#: forum/views/users.py:929 +msgid "users favorite questions" +msgstr "" + +#: forum/views/users.py:930 +msgid "profile - favorite questions" +msgstr "" + +#: forum/views/users.py:939 +msgid "profile - votes" +msgstr "" + +#: forum/views/users.py:948 +msgid "profile - email subscriptions" +msgstr "" + +#: forum/views/writers.py:70 +msgid "uploading images is limited to users with >60 reputation points" +msgstr "" + +#: forum/views/writers.py:72 +msgid "allowed file types are 'jpg', 'jpeg', 'gif', 'bmp', 'png', 'tiff'" +msgstr "" + +#: forum/views/writers.py:74 +#, python-format +msgid "maximum upload file size is %sK" +msgstr "" + +#: forum/views/writers.py:76 +#, python-format +msgid "" +"Error uploading file. Please contact the site administrator. Thank you. %s" +msgstr "" + +#: forum_modules/books/urls.py:7 forum_modules/books/urls.py:8 +#: forum_modules/books/urls.py:9 +msgid "books/" +msgstr "" + +#: stackexchange/management/commands/load_stackexchange.py:124 +msgid "Congratulations, you are now an Administrator" +msgstr "" -- cgit v1.2.3-1-g7c22 From 72c356b993771063e080c7cb47b8fc23a964dc1a Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Thu, 8 Apr 2010 01:48:56 -0400 Subject: kind of merged question views, still have debugging to to --- django_authopenid/views.py | 18 ++- forum/const.py | 30 +++- forum/forms.py | 73 +++++++++- forum/middleware/view_log.py | 63 +++++++++ forum/models/question.py | 61 +++++--- forum/models/tag.py | 4 +- forum/search/__init__.py | 0 forum/search/state_manager.py | 127 +++++++++++++++++ forum/skins/default/media/style/style.css | 20 ++- forum/skins/default/templates/header.html | 2 + forum/skins/default/templates/questions.html | 126 ++++++++++++++--- forum/views/readers.py | 202 ++++++++------------------- locale/en/LC_MESSAGES/django.mo | Bin 27146 -> 27175 bytes locale/en/LC_MESSAGES/django.po | 2 +- settings.py | 1 + 15 files changed, 537 insertions(+), 192 deletions(-) create mode 100644 forum/middleware/view_log.py create mode 100644 forum/search/__init__.py create mode 100644 forum/search/state_manager.py diff --git a/django_authopenid/views.py b/django_authopenid/views.py index 3c794a0d..e2d8b67c 100755 --- a/django_authopenid/views.py +++ b/django_authopenid/views.py @@ -71,6 +71,7 @@ from forum.utils.forms import get_next_url EXTERNAL_LOGIN_APP = settings.LOAD_EXTERNAL_LOGIN_APP() +#todo: decouple from forum def login(request,user): from django.contrib.auth import login as _login from forum.models import user_logged_in #custom signal @@ -80,14 +81,27 @@ def login(request,user): #1) get old session key session_key = request.session.session_key - #2) login and get new session key + #2) get old search state + search_state = None + if 'search_state' in request.session: + search_state = request.session['search_state'] + + #3) login and get new session key _login(request,user) - #3) send signal with old session key as argument + #4) transfer search_state to new session if found + if search_state: + search_session.set_logged_in() + request.session['search_state'] = search_state + #5) send signal with old session key as argument logging.debug('logged in user %s with session key %s' % (user.username, session_key)) user_logged_in.send(user=user,session_key=session_key,sender=None) +#todo: uncouple this from forum def logout(request): from django.contrib.auth import logout as _logout#for login I've added wrapper below - called login + if 'search_state' in request.session: + request.session['search_state'].set_logged_out() + request.session.modified = True _logout(request) if settings.USE_EXTERNAL_LEGACY_LOGIN == True: EXTERNAL_LOGIN_APP.api.logout(request) diff --git a/forum/const.py b/forum/const.py index 7b78032a..6f6086f0 100755 --- a/forum/const.py +++ b/forum/const.py @@ -32,19 +32,34 @@ TYPE_REPUTATION = ( (-8, 'lose_by_upvote_canceled'), ) +#do not translate these!!! POST_SORT_METHODS = ( - _('newest'), _('oldest'),_('active'), - _('inactive'),_('hot'),_('cold'), - _('popular'),_('unpopular'),_('relevance') + ('latest', _('newest')), + ('oldest', _('oldest')), + ('active', _('active')), + ('inactive', _('inactive')), + ('hottest', _('hottest')), + ('coldest', _('coldest')), + ('mostvoted', _('most voted')), + ('leastvoted', _('least voted')), + ('relevant', _('relevance')), ) #todo: add assertion here that all sort methods are unique #because they are keys to the hash used in implementations of Q.run_advanced_search -DEFAULT_POST_SORT_METHOD = _('newest') -POST_SCOPES = (_('all'),_('unanswered'),_('favorite')) -DEFAULT_POST_SCOPE = _('all') +DEFAULT_POST_SORT_METHOD = 'latest' +POST_SCOPE_LIST = ( + ('all', _('all')), + ('unanswered', _('unanswered')), + ('favorite', _('favorite')), + ) +DEFAULT_POST_SCOPE = 'all' +DEFAULT_QUESTIONS_PAGE_SIZE = 30 +PAGE_SIZES = (10,30,50) -QUESTIONS_PAGE_SIZE = 30 +UNANSWERED_MEANING_LIST = ('NO_ANSWERS','NO_UPVOTED_ANSWERS','NO_ACCEPTED_ANSWERS') +UNANSWERED_MEANING = 'NO_ANSWERS' +assert(UNANSWERED_MEANING in UNANSWERED_MEANING_LIST) #todo: #this probably needs to be language-specific @@ -53,6 +68,7 @@ QUESTIONS_PAGE_SIZE = 30 #correct regexes - plus this must be an anchored regex #to do full string match TAG_REGEX = r'^[a-z0-9\+\.\-]+$' +TAG_SPLIT_REGEX = r'[ ,]+' MAX_TAG_LENGTH = 20 #default 20 chars MAX_TAGS_PER_POST = 5 #no more than five tags diff --git a/forum/forms.py b/forum/forms.py index dbdc4e9f..c32ce6c0 100755 --- a/forum/forms.py +++ b/forum/forms.py @@ -61,7 +61,7 @@ class TagNamesField(forms.CharField): if len(data) < 1: raise forms.ValidationError(_('tags are required')) - split_re = re.compile(r'[ ,]+') + split_re = re.compile(const.TAG_SPLIT_REGEX) tag_strings = split_re.split(data) out_tag_list = [] tag_count = len(tag_strings) @@ -79,7 +79,7 @@ class TagNamesField(forms.CharField): msg = ungettext('each tag must be shorter than %(max_chars)d character',#odd but added for completeness 'each tag must be shorter than %(max_shars)d characters', tag_length) % {'max_chars':tag_length} - raise forms.ValidationError(msg)_ + raise forms.ValidationError(msg) #todo - this needs to come from settings tagname_re = re.compile(const.TAG_REGEX, re.UNICODE) @@ -127,6 +127,75 @@ class ModerateUserForm(forms.ModelForm): model = User fields = ('is_approved',) +class AdvancedSearchForm(forms.Form): + #nothing must be required in this form + #it is used by the main questions view + scope = forms.ChoiceField(choices=const.POST_SCOPE_LIST, required=False) + sort = forms.ChoiceField(choices=const.POST_SORT_METHODS, required=False) + query = forms.CharField(max_length=256, required=False) + reset_tags = forms.BooleanField(required=False) + reset_author = forms.BooleanField(required=False) + reset_query = forms.BooleanField(required=False) + tags = forms.CharField(max_length=256,required=False) + author = forms.IntegerField(required=False) + page_size = forms.ChoiceField(choices=const.PAGE_SIZES, required=False) + page = forms.IntegerField(required=False) + + def clean_tags(self): + if 'tags' in self.cleaned_data: + tags_input = self.cleaned_data['tags'].strip() + split_re = re.compile(TAG_SPLIT_REGEX) + tag_strings = split_re.split(tags_input) + tagname_re = re.compile(const.TAG_REGEX, re.UNICODE) + out = set() + for s in tag_strings: + if tagname_re.search(s): + out.add(s) + if len(out) > 0: + self.cleaned_data['tags'] = out + else: + self.cleaned_data['tags'] = None + return self.cleaned_data['tags'] + + def clean_query(self): + if 'query' in self.cleaned_data: + q = self.cleaned_data['query'].strip() + if q == '': + q = None + self.cleaned_data['query'] = q + return self.cleaned_data['query'] + + def clean_page_size(self): + if 'page_size' in self.cleaned_data: + if self.cleaned_data['page_size'] == '': + self.cleaned_data['page_size'] = None + return self.cleaned_data['page_size'] + + def clean(self): + #todo rewrite + print self.cleaned_data + if self.cleaned_data['scope'] == '': + del self.cleaned_data['scope'] + if self.cleaned_data['tags'] is None: + del self.cleaned_data['tags'] + if self.cleaned_data['sort'] == '': + del self.cleaned_data['sort'] + if self.cleaned_data['query'] == None: + del self.cleaned_data['query'] + if self.cleaned_data['reset_tags'] == False: + del self.cleaned_data['reset_tags'] + if self.cleaned_data['reset_author'] == False: + del self.cleaned_data['reset_author'] + if self.cleaned_data['reset_query'] == False: + del self.cleaned_data['reset_query'] + if self.cleaned_data['author'] is None: + del self.cleaned_data['author'] + if self.cleaned_data['page'] is None: + del self.cleaned_data['page'] + if self.cleaned_data['page_size'] is None: + del self.cleaned_data['page_size'] + return self.cleaned_data + class NotARobotForm(forms.Form): recaptcha = ReCaptchaField() diff --git a/forum/middleware/view_log.py b/forum/middleware/view_log.py new file mode 100644 index 00000000..6f59568a --- /dev/null +++ b/forum/middleware/view_log.py @@ -0,0 +1,63 @@ +import logging +from django.conf import settings +from forum.views.readers import questions as questions_view +from forum.views.commands import vote as vote_view +from django.views.static import serve as django_serve_view + +class ViewLog(object): + """must be modified only in this middlware + however, can be read anywhere else + """ + def __init__(self): + self.views = [] + self.depth = 3 #todo maybe move this to const.py + def set_current(self, view_name): + thi + + def get_previous(self, num): + if num > self.depth - 1: + raise Exception("view log depth exceeded") + elif num < 0: + raise Exception("num must be positive"); + elif num <= len(self.views) - 1: + return self.views[num] + else: + return None + + def set_current(self, view_name): + self.views.insert(0, view_name) + if len(self.views) > self.depth: + self.views.pop() + + def __str__(self): + return str(self.views) + ' depth=%d' % self.depth + +class ViewLogMiddleware(object): + def process_view(self, request, view_func, view_args, view_kwargs): + if view_func == questions_view: + view_str = 'questions' + elif view_func in (django_serve_view, vote_view): + return + elif settings.DEBUG == True: + #todo: dependency! + from debug_toolbar.views import debug_media_view + if view_func == debug_media_view: + return + else: + view_str = view_func.__name__ + else: + view_str = view_func.__name__ + + if request.user.is_authenticated(): + user_name = request.user.username + else: + user_name = request.META['REMOTE_ADDR'] + logging.debug('user %s, view %s' % (request.user.username, view_str)) + + if 'view_log' in request.session: + view_log = request.session['view_log'] + else: + view_log = ViewLog() + + view_log.set_current(view_str) + request.session['view_log'] = view_log diff --git a/forum/models/question.py b/forum/models/question.py index 71da0396..98b50490 100755 --- a/forum/models/question.py +++ b/forum/models/question.py @@ -1,24 +1,31 @@ -from base import * +from base import * #todo maybe remove * from tag import Tag +#todo: make uniform import for consts from forum.const import CONST +from forum import const from forum.utils.html import sanitize_html from markdown2 import Markdown from django.utils.html import strip_tags import datetime +from django.conf import settings +from django.utils.datastructures import SortedDict +from forum.models.tag import MarkedTag + markdowner = Markdown(html4tags=True) from forum.utils.lists import LazyList +#todo: too bad keys are duplicated see const sort methods QUESTION_ORDER_BY_MAP = { - _('newest'): '-added_at', - _('oldest'): 'added_at', - _('active'): '-last_activity_at', - _('inactive'): 'last_activity_at', - _('hot'): '-answer_count', - _('cold'): 'answer_count' - _('popular'): '-score', - _('unpopular'): 'score', - _('relevance'):None #this is a special case + 'latest': '-added_at', + 'oldest': 'added_at', + 'active': '-last_activity_at', + 'inactive': 'last_activity_at', + 'hottest': '-answer_count', + 'coldest': 'answer_count', + 'mostvoted': '-score', + 'leastvoted': 'score', + 'relevant': None #this is a special case } class QuestionManager(models.Manager): @@ -54,7 +61,7 @@ class QuestionManager(models.Manager): def run_advanced_search( self, request_user = None, - scope_selector = scope_selector,#unanswered/all/favorite (for logged in) + scope_selector = const.DEFAULT_POST_SCOPE,#unanswered/all/favorite (for logged in) search_query = None, tag_selector = None, author_selector = None,#???question or answer author or just contributor @@ -65,16 +72,32 @@ class QuestionManager(models.Manager): a relvant filter will be silently dropped """ + qs = self.filter(deleted=False)#todo - add a possibility to see deleted questions + #return metadata meta_data = {} if tag_selector: qs = qs.filter(tags__name__in = tag_selector) + if search_query: + qs = qs.filter(deleted=False).extra( + where=['title like %s'], + params=['%' + search_query + '%'] + ) + if scope_selector: + if scope_selector == 'unanswered': + if const.UNANSWERED_MEANING == 'NO_ANSWERS': + qs = qs.filter(answer_count=0)#todo: expand for different meanings of this + elif const.UNANSWERED_MEANING == 'NO_ACCEPTED_ANSWERS': + qs = qs.filter(answer_accepted=False) + elif const.UNANSWERED_MEANING == 'NO_UPVOTED_ANSWERS': + raise NotImplementedError() + else: + raise Exception('UNANSWERED_MEANING setting is wrong') + elif scope_selector == 'favorite': + qs = qs.filter(favorited_by = request_user) - if unanswered: - qs = qs.exclude(answer_accepted=True) - #user contributed questions & answers if author_selector: try: @@ -126,9 +149,13 @@ class QuestionManager(models.Manager): meta_data['interesting_tag_names'] = pt.filter(reason='good').values_list('tag__name', flat=True) meta_data['ignored_tag_names'] = pt.filter(reason='bad').values_list('tag__name', flat=True) - #todo: fix orderby here - qs = qs.select_related(depth=1).order_by(orderby) - return qs, meta_data + qs = qs.select_related(depth=1) + #todo: fix orderby here + orderby = QUESTION_ORDER_BY_MAP[sort_method] + if orderby: + #relevance will be ignored here + qs = qs.order_by(orderby) + return qs, meta_data def update_tags(self, question, tagnames, user): """ diff --git a/forum/models/tag.py b/forum/models/tag.py index 8d26d6f4..e13baf9b 100755 --- a/forum/models/tag.py +++ b/forum/models/tag.py @@ -49,6 +49,8 @@ class TagManager(models.Manager): def get_tags_by_questions(self, questions): question_ids = [] + if len(questions) == 0: + return [] for question in questions: question_ids.append(question.id) @@ -82,4 +84,4 @@ class MarkedTag(models.Model): reason = models.CharField(max_length=16, choices=TAG_MARK_REASONS) class Meta: - app_label = 'forum' \ No newline at end of file + app_label = 'forum' diff --git a/forum/search/__init__.py b/forum/search/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/forum/search/state_manager.py b/forum/search/state_manager.py new file mode 100644 index 00000000..b36c5e53 --- /dev/null +++ b/forum/search/state_manager.py @@ -0,0 +1,127 @@ +#search state manager object +#that lives in the session and takes care of the state +#persistece during the search session +from forum import const +import logging + +class SearchState(object): + def __init__(self): + self.scope= const.DEFAULT_POST_SCOPE + self.query = None + self.tags = None + self.author = None + self.sort = const.DEFAULT_POST_SORT_METHOD + self.page_size = const.DEFAULT_QUESTIONS_PAGE_SIZE + self.page = 1 + self.logged_in = False + logging.debug('new search state initialized') + print 'new search state' + + def __str__(self): + out = 'scope=%s\n' % self.scope + out += 'query=%s\n' % self.query + if self.tags: + out += 'tags=%s\n' % ','.join(self.tags) + out += 'author=%s\n' % self.author + out += 'sort=%s\n' % self.sort + out += 'page_size=%d\n' % self.page_size + out += 'page=%d\n' % self.page + out += 'logged_in=%s\n' % str(self.logged_in) + return out + + def set_logged_out(self): + if self.scope == 'favorite': + self.scope = None + self.logged_in = False + + def set_logged_in(self): + self.logged_in = True + + def reset(self): + #re-initialize, but keep login state + is_logged_in = self.logged_in + self.__init__() + self.logged_in = is_logged_in + + def update_value(self, key, store): + if key in store: + old_value = getattr(self, key) + new_value = store[key] + if new_value != old_value: + setattr(self, key, new_value) + self.reset_page() + + def update_from_user_input(self,input): + #todo: this function will probably not + #fit the case of multiple parameters entered at the same tiem + print ','.join(input.keys()) + if 'page' in input: + print input['page'] + self.page = input['page'] + #special case - on page flip no other input is accepted + return + + if 'page_size' in input: + self.update_value('page_size',input) + self.reset_page()#todo may be smarter here - start with ~same q + #same as with page - return right away + return + + if 'scope' in input: + if input['scope'] == 'favorite' and self.logged_in == False: + self.reset_scope() + else: + self.update_value('scope',input) + + if 'tags' in input: + if self.tags: + old_tags = self.tags.copy() + self.tags.union(input['tags']) + if self.tags != old_tags: + self.reset_page() + else: + self.tags = input['tags'] + + #all resets just return + if 'reset_tags' in input: + if self.tags: + self.tags = None + self.reset_page() + return + + #todo: handle case of deleting tags one-by-one + if 'reset_author' in input: + if self.author: + self.author = None + self.reset_page() + return + + if 'reset_query' in input: + if self.query: + self.query = None + self.reset_page() + if self.sort == 'relevant': + self.reset_sort() + return + + self.update_value('author',input) + + if 'query' in input: + self.update_value('query',input) + self.sort = 'relevant' + + + if 'sort' in input: + if input['sort'] == 'relevant' and self.query is None: + self.reset_sort() + else: + self.update_value('sort',input) + + def reset_page(self): + self.page = 1 + + def reset_sort(self): + self.sort = const.DEFAULT_POST_SORT_METHOD + + def reset_scope(self): + self.scope = const.DEFAULT_POST_SCOPE diff --git a/forum/skins/default/media/style/style.css b/forum/skins/default/media/style/style.css index 93c979ce..8315839d 100755 --- a/forum/skins/default/media/style/style.css +++ b/forum/skins/default/media/style/style.css @@ -866,7 +866,16 @@ a:hover.medal { height: 20px; } -.tabsA a.on, .tabsA a:hover, .tabsB a.on, .tabsB a:hover { +.tabsC { + background-color: #FFF; + float: left; + position: relative; + display: block; + font-weight: bold; + height: 20px; +} + +.tabsA a.on, .tabsA a:hover, .tabsB a.on, .tabsB a:hover , .tabsC a.on, tabsC a:hover { background: #fff; color: #a40000; border-top: 1px solid #babdb6; @@ -879,7 +888,7 @@ a:hover.medal { padding: 0px 11px 0px 11px; } -.tabsA a { +.tabsA a, .tabsC a{ background: #f9f7eb; border-top: 1px solid #eeeeec; border-left: 1px solid #eeeeec; @@ -895,6 +904,12 @@ a:hover.medal { text-decoration: none; } +.tabsA .label, .tabsC .label { + float: left; + font-weight: bold; + margin: 8px 4px 0 4px; +} + .tabsB a { background: #eee; border: 1px solid #eee; @@ -920,7 +935,6 @@ a:hover.medal { } .headQuestions { - float: left; height: 23px; line-height: 23px; margin: 5px 0 0 5px; diff --git a/forum/skins/default/templates/header.html b/forum/skins/default/templates/header.html index 099bfb85..aaf19874 100644 --- a/forum/skins/default/templates/header.html +++ b/forum/skins/default/templates/header.html @@ -31,7 +31,9 @@ {% trans "books" %} {% endif %} {% trans "badges" %} + {% comment %} {% trans "unanswered questions" %} + {% endcomment %} diff --git a/forum/skins/default/templates/questions.html b/forum/skins/default/templates/questions.html index 366727d1..0a7c0c96 100644 --- a/forum/skins/default/templates/questions.html +++ b/forum/skins/default/templates/questions.html @@ -10,9 +10,11 @@ {% endif %} - + {% if active_tab != "tags" and active_tab != "users" %} + + {% endif %} {% block forejs %} {% endblock %} diff --git a/forum/skins/default/templates/book.html b/forum/skins/default/templates/book.html index 8574fa73..528b800d 100644 --- a/forum/skins/default/templates/book.html +++ b/forum/skins/default/templates/book.html @@ -122,7 +122,7 @@
{% for tag in question.tagname_list %} - + {% endfor %}
diff --git a/forum/skins/default/templates/header.html b/forum/skins/default/templates/header.html index aaf19874..efc0d8f2 100644 --- a/forum/skins/default/templates/header.html +++ b/forum/skins/default/templates/header.html @@ -1,5 +1,6 @@ {% load extra_tags %} +{% load smart_if %} {% load i18n %}
- - + + {% endcomment %} + +
- - - + + +
+ {% if active_tab != "ask" %} + {% else %} +
+ {% endif %}
diff --git a/forum/skins/default/templates/index.html b/forum/skins/default/templates/index.html index 8a885dd4..b90d788a 100644 --- a/forum/skins/default/templates/index.html +++ b/forum/skins/default/templates/index.html @@ -57,11 +57,12 @@ {% cache 60 recent_tags %} {% for tag in tags %} + title="{% blocktrans with tag.name as tagname %}see questions tagged '{{tagname}}'{% endblocktrans %}" + href="{% url questions %}?tags={{tag.name|urlencode}}">{{ tag.name }} {% endfor %} {% endcache %} - + {% if awards %} diff --git a/forum/skins/default/templates/index_.html b/forum/skins/default/templates/index_.html index 5e4cf533..8ba169a7 100644 --- a/forum/skins/default/templates/index_.html +++ b/forum/skins/default/templates/index_.html @@ -60,7 +60,7 @@
{% for tag in question.tagname_list %} - + {% endfor %}
@@ -87,7 +87,8 @@
{% for tag in tags %} + title="{% blocktrans with tag.name as tagname %}see questions tagged '{{tagname}}'{% endblocktrans %}" + href="{% url questions %}?tags={{tag.name|urlencode}}">{{ tag.name }} {% endfor %}
diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html index 1c542c8b..c3564a34 100644 --- a/forum/skins/default/templates/question.html +++ b/forum/skins/default/templates/question.html @@ -128,10 +128,12 @@ {{ question.html|safe }}
+ {% comment %}todo: here we have important case to reset search state{% endcomment %}
{% for tag in question.tagname_list %} - + {% endfor %}
{% joinitems using '|' %} @@ -474,9 +476,10 @@

{% for tag in tags %} - ×{{ tag.used_count|intcomma }}
+ + ×{{ tag.used_count|intcomma }}
{% endfor %}

diff --git a/forum/skins/default/templates/question_list.html b/forum/skins/default/templates/question_list.html index 53633691..38ac254a 100644 --- a/forum/skins/default/templates/question_list.html +++ b/forum/skins/default/templates/question_list.html @@ -16,7 +16,7 @@

{% for tag in question.tagname_list %} - + {% endfor %}
diff --git a/forum/skins/default/templates/question_summary_list_roll.html b/forum/skins/default/templates/question_summary_list_roll.html index 57685d6d..f2432a24 100644 --- a/forum/skins/default/templates/question_summary_list_roll.html +++ b/forum/skins/default/templates/question_summary_list_roll.html @@ -49,7 +49,7 @@
{% for tag in question.tagname_list %} - + {% endfor %}
diff --git a/forum/skins/default/templates/questions.html b/forum/skins/default/templates/questions.html index 0a7c0c96..03ccc324 100644 --- a/forum/skins/default/templates/questions.html +++ b/forum/skins/default/templates/questions.html @@ -48,7 +48,7 @@
{% endcomment %}
- {% trans "Pick:" %} + {% trans "In:" %} {% trans "all" %} {% trans "unanswered" %} {% if request.user.is_authenticated %} @@ -134,20 +134,90 @@ {% endif %}
+{% if questions_count > 0 %} +
+

+ {% if author_name or search_tags or query %} + {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num %} One question found{% plural %}{{q_num}} questions found{% endblocktrans %} + {% else %} + {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num %} {{q_num}} question{% plural %}{{q_num}} questions{% endblocktrans %} + {% endif %} + {% joinitems using ', ' %} + {% if author_name %} + {% blocktrans %}with {{author_name}}'s contributions{% endblocktrans %} + {% endif %} + {% separator %} + {% if search_tags %} + {% trans "tagged" %} + "{{ search_tags|join:"\", \"" }}" + {% endif %} + {% endjoinitems %} +

+ {% if author_name or search_tags or query %} +

{% trans "Search tips:" %} + {% ifmany query search_tags author_name %} + {% joinitems using ', ' ' or ' %} + {% if author_name %} + {% trans "reset author" %} + {% endif %} + {% separator %} + {% if search_tags %} + {% trans "reset tags" %} + {% endif %} + {% separator %} + {% ifmany query search_tags author_name %} + {% trans "start over" %} + {% endifmany %} + {% endjoinitems %} + {% else %} + {% trans "start over" %} + {% endifmany %} + {% trans " - to expand, or dig in by adding more tags and revising the query." %} +

+ {% else %} +

{% trans "Search tip:" %} {% trans "add tags and a query to focus your search" %}

+ {% endif %} + +
+{% endif %}
{% include "question_list.html" %} + {% comment %}todo: fix css here{% endcomment %} {% if questions_count == 0 %} + {% comment %}todo: add tips to widen selection{% endcomment%}

{% if scope == "unanswered" %} - {% trans "There are no unanswered questions in this selection" %} + {% trans "There are no unanswered questions here" %} {% endif %} {% if scope == "favorite" %} {% trans "No favorite questions here. " %} - {% trans "Please bookmark some questions with a star and find them here later." %} + {% trans "Please start (bookmark) some questions when you visit them" %} {% endif %} - {% if scope == "all" %} - {% trans "Did not find anything? Please feel free to ask your question!" %} +

+ {% if query or search_tags or author_name %} +

+ {% trans "You can expand your search by " %} + {% ifmany query search_tags author_name %} + {% joinitems using ', ' ' or ' %} + {% if author_name %} + {% trans "resetting author" %} + {% endif %} + {% separator %} + {% if search_tags %} + {% trans "resetting tags" %} + {% endif %} + {% separator %} + {% ifmany query search_tags author_name %} + {% trans "starting over" %} + {% endifmany %} + {% endjoinitems %} + {% else %} + {% trans "starting over" %} + {% endifmany %} +

{% endif %} +

+ {% trans "Please always feel free to ask your question!" %}

{% else %}

@@ -158,51 +228,14 @@

{% endblock %} -{% block tail %} -
{% cnprog_paginator context %}
-
{% cnprog_pagesize context %}
-{% endblock %} + {% block tail %} + {% if questions_count > 10 %}{%comment%}todo: remove magic number{%endcomment%} +
{% cnprog_paginator context %}
+
{% cnprog_pagesize context %}
+ {% endif %} + {% endblock %} {% block sidebar %} -
- {% if searchtag %} - {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num and searchtag as tagname %}have total {{q_num}} questions tagged {{tagname}}{% plural %}have total {{q_num}} questions tagged {{tagname}}{% endblocktrans %} - {% else %} - {% if searchtitle %} - {% if settings.USE_SPHINX_SEARCH %} - {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num %} have total {{q_num}} questions containing {{searchtitle}} in full text {% plural %} have total {{q_num}} questions containing {{searchtitle}} in full text {% endblocktrans %} - {% else %} - {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num %} have total {{q_num}} questions containing {{searchtitle}} {% plural %} have total {{q_num}} questions containing {{searchtitle}} {% endblocktrans %} - {% endif %} - {% else %} - {% if is_unanswered %} - {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num %} have total {{q_num}} unanswered questions {% plural %} have total {{q_num}} unanswered questions {% endblocktrans %} - {% else %} - {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num %} have total {{q_num}} questions {% plural %} have total {{q_num}} questions {% endblocktrans %} - {% endif %} - {% endif %} - {% endif %} -

- {% ifequal tab_id "latest" %} - {% trans "latest questions info" %} - {% endifequal %} - - {% ifequal tab_id "active" %} - {% trans "Questions are sorted by the time of last update." %} - {% trans "Most recently answered ones are shown first." %} - {% endifequal %} - - {% ifequal tab_id "hottest" %} - {% trans "Questions sorted by number of responses." %} - {% trans "Most answered questions are shown first." %} - {% endifequal %} - - {% ifequal tab_id "mostvoted" %} - {% trans "Questions are sorted by the number of votes." %} - {% trans "Most voted questions are shown first." %} - {% endifequal %} -

-
{% if request.user.is_authenticated %} {% include "tag_selector.html" %} {% endif %} @@ -210,7 +243,7 @@

{% trans "Related tags" %}

{% for tag in tags %} - + × {{ tag.used_count|intcomma }}
{% endfor %} diff --git a/forum/skins/default/templates/tag_selector.html b/forum/skins/default/templates/tag_selector.html index 5e3e2ad8..85b858d2 100644 --- a/forum/skins/default/templates/tag_selector.html +++ b/forum/skins/default/templates/tag_selector.html @@ -1,5 +1,6 @@ {% load i18n %} {% load extra_tags %} +{% comment %}todo - maybe disable navigation from ignored tags here when "hide" is on - with js?{%endcomment%}

{% trans "Interesting tags" %}

@@ -7,8 +8,8 @@ {% spaceless %} + title="{% blocktrans %}see questions tagged '{{ tag_name }}'{% endblocktrans %}" + href="{% url questions %}?tags={{tag_name|urlencode}}">{{tag_name}} @@ -24,8 +25,8 @@ {% spaceless %} + title="{% blocktrans %}see questions tagged '{{ tag_name }}'{% endblocktrans %}" + href="{% url questions %}?tags={{tag_name|urlencode}}">{{tag_name}} diff --git a/forum/skins/default/templates/tags.html b/forum/skins/default/templates/tags.html index 50f90fb1..2bc01070 100644 --- a/forum/skins/default/templates/tags.html +++ b/forum/skins/default/templates/tags.html @@ -46,7 +46,8 @@
    {% for tag in tags.object_list %}
  • -   × {{ tag.used_count|intcomma }} diff --git a/forum/skins/default/templates/user_stats.html b/forum/skins/default/templates/user_stats.html index 1f462581..482b1228 100644 --- a/forum/skins/default/templates/user_stats.html +++ b/forum/skins/default/templates/user_stats.html @@ -98,7 +98,7 @@ {% for tag in user_tags%} + href="{% url questions %}?tags={{tag|urlencode}}&author={{view_user.id}}&start_over=true">{{tag.name}} × {{ tag.user_tag_usage_count|intcomma }}
    {% if forloop.counter|divisibleby:"10" %} diff --git a/forum/skins/default/templates/users_questions.html b/forum/skins/default/templates/users_questions.html index be6aaf7d..99a7f90c 100644 --- a/forum/skins/default/templates/users_questions.html +++ b/forum/skins/default/templates/users_questions.html @@ -31,7 +31,7 @@ {% convert2tagname_list question %} {% for tag in question.tagnames %} - + {% endfor %}
diff --git a/forum/templatetags/extra_tags.py b/forum/templatetags/extra_tags.py index 382d19f0..a10c473b 100755 --- a/forum/templatetags/extra_tags.py +++ b/forum/templatetags/extra_tags.py @@ -304,8 +304,12 @@ class ItemSeparatorNode(template.Node): return self.content class JoinItemListNode(template.Node): - def __init__(self,separator=ItemSeparatorNode("''"), items=()): + def __init__(self,separator=ItemSeparatorNode("''"), last_separator=None, items=()): self.separator = separator + if last_separator: + self.last_separator = last_separator + else: + self.last_separator = separator self.items = items def render(self,context): out = [] @@ -314,16 +318,34 @@ class JoinItemListNode(template.Node): bit = item.render(context) if not empty_re.search(bit): out.append(bit) - return self.separator.render(context).join(out) + if len(out) == 1: + return out[0] + if len(out) > 1: + last = out.pop() + all_but_last = self.separator.render(context).join(out) + return self.last_separator.render(context).join((all_but_last,last)) + else: + assert(len(out)==0) + return '' @register.tag(name="joinitems") def joinitems(parser,token): try: - tagname,junk,sep_token = token.split_contents() - except ValueError: - raise template.TemplateSyntaxError("joinitems tag requires 'using \"separator html\"' parameters") + tagname, junk, sep_token = token.split_contents() + last_sep_token = None + except: + try: + tagname, junk, sep_token, last_sep_token = token.split_contents() + except: + raise template.TemplateSyntaxError('incorrect usage of joinitems tag first param ' + 'must be \'using\' second - separator and ' + 'optional third - last item separator') if junk == 'using': sep_node = ItemSeparatorNode(sep_token) + if last_sep_token: + last_sep_node = ItemSeparatorNode(last_sep_token) + else: + last_sep_node = None else: raise template.TemplateSyntaxError("joinitems tag requires 'using \"separator html\"' parameters") nodelist = [] @@ -333,7 +355,7 @@ def joinitems(parser,token): if next.contents == 'endjoinitems': break - return JoinItemListNode(separator=sep_node,items=nodelist) + return JoinItemListNode(separator=sep_node,last_separator=last_sep_node,items=nodelist) class BlockMediaUrlNode(template.Node): def __init__(self,nodelist): @@ -436,3 +458,50 @@ def question_counter_widget(question): #returns a dictionary with keys like 'votes_bg', etc return locals() +class IsManyNode(template.Node): + def __init__(self, test_items, true_nodelist, false_nodelist): + self.true_nodelist = true_nodelist + self.false_nodelist = false_nodelist + self.test_items = test_items + def render(self, context): + maybe = False + for item in self.test_items: + is_good = item.resolve(context) + print item, is_good + if maybe == True and is_good: + print 'have many!' + return self.true_nodelist.render(context) + if is_good: + maybe = True + print 'have one item' + return self.false_nodelist.render(context) + +@register.tag(name='ifmany') +def ifmany(parser,token): + """usage {% ifmany item1 item2 item3 ... itemN %} stuff {% endifmany %} + returns content included into the tag if more than one + item evaluates to Tru'ish value - that's the idea + {% else %} is not supported yet + """ + + bits = list(token.split_contents()) + start_tag = bits.pop(0) + + test_items = [] + for bit in bits: + item = parser.compile_filter(bit) + test_items.append(item) + + end_tag = 'end' + start_tag + else_tag = 'else' + true_nodelist = parser.parse((end_tag,else_tag,)) + token = parser.next_token() + if token.contents == else_tag: + print 'have else clause' + false_nodelist = parser.parse((end_tag,)) + token = parser.next_token() + else: + false_nodelist = template.NodeList() + + + return IsManyNode(test_items, true_nodelist, false_nodelist) diff --git a/forum/utils/decorators.py b/forum/utils/decorators.py index e4e7acb3..440e8312 100755 --- a/forum/utils/decorators.py +++ b/forum/utils/decorators.py @@ -22,4 +22,3 @@ def ajax_method(view_func): json = simplejson.dumps(retval) return HttpResponse(json,mimetype='application/json') return wrap - diff --git a/forum/views/readers.py b/forum/views/readers.py index 9e9662dd..01dfc035 100644 --- a/forum/views/readers.py +++ b/forum/views/readers.py @@ -90,18 +90,15 @@ def questions(request):#a view generating listing of questions, used by 'unanswe if request.user.is_authenticated(): search_state.set_logged_in() - print 'before: ', search_state - form = AdvancedSearchForm(request.GET) if form.is_valid(): - print 'form is valid' - search_state.update_from_user_input(form.cleaned_data) + search_state.update_from_user_input(form.cleaned_data, request.GET) request.session['search_state'] = search_state request.session.modified = True - print 'after: ', search_state - - print 'going into the search' + #force reset for debugging + #search_state.reset() + #request.session.modified = True #have this call implemented for sphinx, mysql and pgsql (qs, meta_data) = Question.objects.run_advanced_search( @@ -113,10 +110,6 @@ def questions(request):#a view generating listing of questions, used by 'unanswe sort_method = search_state.sort ) - print 'got out of the search' - - logging.debug('search state is %s' % search_state) - objects_list = Paginator(qs, search_state.page_size) questions = objects_list.page(search_state.page) @@ -128,17 +121,16 @@ def questions(request):#a view generating listing of questions, used by 'unanswe #todo!!!! #contributors = #User.objects.get_related_to_questions - print 'rendering template!!!' - print 'have %d' % objects_list.count - + #todo: organize variables by type return render_to_response('questions.html', { 'questions' : questions, 'author_name' : meta_data.get('author_name',None), 'tab_id' : search_state.sort, 'questions_count' : objects_list.count, 'tags' : related_tags, + 'query': search_state.query, + 'search_tags' : search_state.tags, 'tags_autocomplete' : tags_autocomplete, - 'searchtag' : search_state.tags, 'is_unanswered' : False,#remove this from template 'interesting_tag_names': meta_data.get('interesting_tag_names',None), 'ignored_tag_names': meta_data.get('ignored_tag_names',None), @@ -163,15 +155,16 @@ def search(request): #generates listing of questions matching a search query - i are useless under the search bar """ if request.method == "GET": - search_type == request.GET.get('t') + search_type = request.GET.get('t') + query = request.GET.get('query') try: page = int(request.GET.get('page', '1')) except ValueError: page = 1 if search_type == 'tag': - return HttpResponseRedirect(reverse('tags') + '?q=%s&page=%s' % (keywords.strip(), page)) - elif search_type == "user": - return HttpResponseRedirect(reverse('users') + '?q=%s&page=%s' % (keywords.strip(), page)) + return HttpResponseRedirect(reverse('tags') + '?q=%s&page=%s' % (query.strip(), page)) + elif search_type == 'user': + return HttpResponseRedirect(reverse('users') + '?q=%s&page=%s' % (query.strip(), page)) else: raise Http404 else: @@ -205,6 +198,7 @@ def tags(request):#view showing a listing of available tags - plain list tags = objects_list.page(objects_list.num_pages) return render_to_response('tags.html', { + "active_tab": "tags", "tags" : tags, "stag" : stag, "tab_id" : sortby, diff --git a/forum/views/users.py b/forum/views/users.py index 245a1f85..2356bf38 100755 --- a/forum/views/users.py +++ b/forum/views/users.py @@ -63,11 +63,12 @@ def users(request): users = objects_list.page(objects_list.num_pages) return render_to_response('users.html', { - "users" : users, - "suser" : suser, - "keywords" : suser, - "tab_id" : sortby, - "context" : { + 'active_tab': 'users', + 'users' : users, + 'suser' : suser, + 'keywords' : suser, + 'tab_id' : sortby, + 'context' : { 'is_paginated' : is_paginated, 'pages': objects_list.num_pages, 'page': page, diff --git a/forum/views/writers.py b/forum/views/writers.py index b9b1aad5..57c8e043 100755 --- a/forum/views/writers.py +++ b/forum/views/writers.py @@ -132,9 +132,18 @@ def ask(request):#view used to ask a new question return HttpResponseRedirect(reverse('user_signin_new_question')) else: form = AskForm() + if 'title' in request.GET: + raw_title = request.GET['title'] + form.initial['title'] = strip_tags(strip_entities(raw_title)) + else: + search_state = request.session.get('search_state',None) + if search_state: + query = search_state.query + form.initial['title'] = query tags = _get_tags_cache_json() return render_to_response('ask.html', { + 'active_tab': 'ask', 'form' : form, 'tags' : tags, 'email_validation_faq_url':reverse('faq') + '#validate', @@ -318,7 +327,6 @@ def __generate_comments_json(obj, type, user):#non-view generates json data for data = simplejson.dumps(json_comments) return HttpResponse(data, mimetype="application/json") - def question_comments(request, id):#ajax handler for loading comments to question question = get_object_or_404(Question, id=id) user = request.user diff --git a/settings.py b/settings.py index 4d799a13..b80eb4f2 100644 --- a/settings.py +++ b/settings.py @@ -75,6 +75,7 @@ INSTALLED_APPS = ( 'django_authopenid', 'debug_toolbar' , #'stackexchange', #se loader + 'south', ) AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',) -- cgit v1.2.3-1-g7c22 From d2f242282cc00b8ab6aac94fbb30d6e55a7b87ec Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sat, 10 Apr 2010 12:19:53 -0400 Subject: minor --- forum/models/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forum/models/__init__.py b/forum/models/__init__.py index 191f66d3..d0d2d4a7 100755 --- a/forum/models/__init__.py +++ b/forum/models/__init__.py @@ -442,7 +442,7 @@ tags_updated.connect(record_update_tags, sender=Question) post_save.connect(record_favorite_question, sender=FavoriteQuestion) user_updated.connect(record_user_full_updated, sender=User) user_logged_in.connect(post_stored_anonymous_content) -post_syncdb.connect(create_fulltext_indexes) +#post_syncdb.connect(create_fulltext_indexes) Question = Question QuestionRevision = QuestionRevision -- cgit v1.2.3-1-g7c22 From 0762b79da73cb02e1be04c2de4aaa55eda221901 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sun, 11 Apr 2010 17:14:25 -0400 Subject: question views merged, changed UI a bit, full text search broken --- django_authopenid/views.py | 2 +- forum/const.py | 1 + forum/forms.py | 1 - forum/middleware/view_log.py | 1 - forum/search/state_manager.py | 4 - forum/skins/default/media/style/style.css | 85 +++++++++++++++------- forum/skins/default/templates/about.html | 2 +- forum/skins/default/templates/ask.html | 2 + forum/skins/default/templates/ask_form.html | 66 +++++++++++++++++ forum/skins/default/templates/base.html | 1 + forum/skins/default/templates/base_content.html | 1 + forum/skins/default/templates/faq.html | 2 +- forum/skins/default/templates/feedback.html | 2 +- forum/skins/default/templates/header.html | 49 +------------ forum/skins/default/templates/index.html | 2 +- forum/skins/default/templates/index_.html | 2 +- forum/skins/default/templates/input_bar.html | 45 ++++++++++++ forum/skins/default/templates/question.html | 2 +- forum/skins/default/templates/questions.html | 10 +-- forum/skins/default/templates/tags.html | 6 +- forum/skins/default/templates/user.html | 2 +- forum/skins/default/templates/user_reputation.html | 7 +- forum/skins/default/templates/users.html | 2 +- forum/templatetags/extra_tags.py | 4 - forum/views/readers.py | 4 +- forum/views/users.py | 3 +- 26 files changed, 204 insertions(+), 104 deletions(-) create mode 100644 forum/skins/default/templates/ask_form.html create mode 100644 forum/skins/default/templates/input_bar.html diff --git a/django_authopenid/views.py b/django_authopenid/views.py index e2d8b67c..4f7d3efa 100755 --- a/django_authopenid/views.py +++ b/django_authopenid/views.py @@ -90,7 +90,7 @@ def login(request,user): _login(request,user) #4) transfer search_state to new session if found if search_state: - search_session.set_logged_in() + search_state.set_logged_in() request.session['search_state'] = search_state #5) send signal with old session key as argument logging.debug('logged in user %s with session key %s' % (user.username, session_key)) diff --git a/forum/const.py b/forum/const.py index dd85bb2e..11c833ea 100755 --- a/forum/const.py +++ b/forum/const.py @@ -131,3 +131,4 @@ CONST = { #how to filter questions by tags in email digests? TAG_EMAIL_FILTER_CHOICES = (('ignored', _('exclude ignored tags')),('interesting',_('allow only selected tags'))) MAX_ALERTS_PER_EMAIL = 7 +USERS_PAGE_SIZE = 28 diff --git a/forum/forms.py b/forum/forms.py index 2c2df738..b205c6e1 100755 --- a/forum/forms.py +++ b/forum/forms.py @@ -174,7 +174,6 @@ class AdvancedSearchForm(forms.Form): def clean(self): #todo rewrite - print self.cleaned_data if self.cleaned_data['scope'] == '': del self.cleaned_data['scope'] if self.cleaned_data['tags'] is None: diff --git a/forum/middleware/view_log.py b/forum/middleware/view_log.py index 213292fe..6472322b 100644 --- a/forum/middleware/view_log.py +++ b/forum/middleware/view_log.py @@ -49,7 +49,6 @@ class ViewLogMiddleware(object): else: view_str = view_func.__name__ if view_str == 'wrap': - print str(view_func.__module__)# == 'forum.utils.decorators': return if settings.DEBUG == True: diff --git a/forum/search/state_manager.py b/forum/search/state_manager.py index 4b3772b6..8a66deb3 100644 --- a/forum/search/state_manager.py +++ b/forum/search/state_manager.py @@ -15,7 +15,6 @@ class SearchState(object): self.page = 1 self.logged_in = False logging.debug('new search state initialized') - print 'new search state' def __str__(self): out = 'scope=%s\n' % self.scope @@ -77,10 +76,7 @@ class SearchState(object): if 'tags' in input: if self.tags: old_tags = self.tags.copy() - print 'old tags %s' % str(old_tags) - print 'new tags %s' % str(input['tags']) self.tags = self.tags.union(input['tags']) - print 'combined %s' % str(self.tags) if self.tags != old_tags: self.reset_page() else: diff --git a/forum/skins/default/media/style/style.css b/forum/skins/default/media/style/style.css index 81c6965e..f96e9d67 100755 --- a/forum/skins/default/media/style/style.css +++ b/forum/skins/default/media/style/style.css @@ -217,7 +217,7 @@ blockquote { } #room { - padding: 10px 0 10px 0; + padding: 0 0 10px 0; background-color: #FFF; border-bottom: 1px solid #777; } @@ -250,16 +250,15 @@ blockquote { /*#licenseLogo {position:absolute;top:10px;right:10px;}*/ -/*顶部及导航栏*/ +/* why is this called top? - this contains links like login, faq, etc */ #top { position: absolute; top: 0px; - right: 0px; + right: 250px; height: 20px; text-align: right; padding: 3px; background-color: #ffffff; - width: 500px; } /*#header {width:960px;}*/ @@ -269,13 +268,21 @@ blockquote { margin-left: 20px; text-decoration: underline; font-size: 12px; - color: #333333; + color: #555555; } #logo { padding: 5px 0px 0px 0px; } +#logoContainer { +} +#navTabContainer { + width: 500px; + text-align: left; +} + +/* navBar includes logo, main tabs and links like logout, about, faq */ #navBar { float: clear; position: relative; @@ -284,7 +291,7 @@ blockquote { } #navBar .nav { - margin: 20px 0px 0px 16px; /*letter-spacing:1px; */ + margin: 20px 0px 0px 0px; /*letter-spacing:1px; */ } #navBar .nav a { @@ -334,29 +341,24 @@ blockquote { text-decoration: underline; } +/* todo: this is probably not used any more */ #navBar .nav div.focus { float: right; padding-right: 0px; } #searchBar { - width: 958px; - background-color: #888a85; /*#e9b96e;*/ - border: 1px solid #aaaaaa; - padding: 4px 0 5px 5px; -} -#fakeSearchBar { - width: 958px; - height: 4px; - background-color: #888a85; /*#e9b96e;*/ + display:inline-block; + background-color: #cccccc;/*888a85; /*#e9b96e;*/ border: 1px solid #aaaaaa; + padding: 4px 7px 5px 5px; } #searchBar .searchInput { font-size: 24px; line-height: 24px; height: 36px; - width: 620px; + width: 598px; margin: 0px; padding: 5px 0 0 5px; } @@ -365,7 +367,7 @@ blockquote { font-size: 24px; line-height: 24px; height: 36px; - width: 570px; + width: 552px; padding: 5px 0 0 5px; margin: 0px; } @@ -391,6 +393,26 @@ blockquote { text-align: center; } +#askFormBar { + display:inline-block; + background-color: #e3e3e3;/*888a85; /*#e9b96e;*/ + border: 1px solid #aaaaaa; + padding: 4px 7px 5px 5px; +} +#askFormBar p { + width: 685px; + margin:0 0 5px 0; +} +#askFormBar .questionTitleInput { + font-size: 24px; + line-height: 24px; + height: 36px; + width: 680px; + margin: 0px; + padding: 5px 0 0 5px; +} + + #searchBar .options { padding: 3px 0 3px 0; font-size: 100%; @@ -654,13 +676,16 @@ blockquote { } .boxC { - background: #cacdc6; /*f9f7ed;*/ + background: white /*#cacdc6; /*f9f7ed;*/ padding: 10px; margin-bottom: 8px; + margin-left: 10px; + /* border-top: 1px solid #eeeeec; border-left: 1px solid #eeeeec; border-right: 1px solid #a9aca5; border-bottom: 1px solid #babdb6; + */ } .boxC p { @@ -877,6 +902,7 @@ a:hover.medal { width: 100%; clear: both; margin-bottom: 3px; + margin-top: 3px; } .tabsA { @@ -996,6 +1022,7 @@ a:hover.medal { padding-left: 24px; } +/* todo: make this class applicable to all headers it is actually uses in tags.html too */ .headUsers { float: left; height: 23px; @@ -1531,7 +1558,8 @@ span.form-error { font-size: 100%; min-height: 200px; line-height: 18px; - width: 100%; + width: 697px; + margin:0; } #id_title { @@ -1539,9 +1567,9 @@ span.form-error { } .wmd-preview { - margin-top: 10px; + margin: 10px 0 0 0; padding: 6px; - width: 100%; + width: 691px; background-color: #F5F5F5; min-height: 20px; } @@ -1729,7 +1757,6 @@ ins .post-tag { } .narrow .stats { - background: transparent none repeat scroll 0 0; float: left; height: 48px; margin: 0 0 0 7px; @@ -1738,6 +1765,11 @@ ins .post-tag { font-family: Arial; } +/* todo: remove this hack? */ +.user-stats-table .narrow { + width: 660px; +} + .stats div { font-size: 11px; text-align: center; @@ -2546,15 +2578,16 @@ p.signup_p { } .karma-diagram { - width:550px; - height:250px; + width:390px; + height:300px; float:left; + margin-right:10px; } .karma-details { float:right; - width:385px; - height:300px; + width:300px; + height:250px; overflow-y:auto; word-wrap:break-word; } diff --git a/forum/skins/default/templates/about.html b/forum/skins/default/templates/about.html index 66dcc3fd..686141b3 100644 --- a/forum/skins/default/templates/about.html +++ b/forum/skins/default/templates/about.html @@ -1,4 +1,4 @@ -{% extends "base_content.html" %} +{% extends "base.html" %} {% load i18n %} {% load extra_tags %} diff --git a/forum/skins/default/templates/ask.html b/forum/skins/default/templates/ask.html index 083b01d9..4278f4cb 100644 --- a/forum/skins/default/templates/ask.html +++ b/forum/skins/default/templates/ask.html @@ -56,6 +56,7 @@ {% endblock %} +{% comment %} {% block content %}
{% trans "Ask a question" %} @@ -124,6 +125,7 @@
{% endblock %} +{% endcomment %} {% block sidebar %} {% include "question_edit_tips.html" %} diff --git a/forum/skins/default/templates/ask_form.html b/forum/skins/default/templates/ask_form.html new file mode 100644 index 00000000..25e9fe6c --- /dev/null +++ b/forum/skins/default/templates/ask_form.html @@ -0,0 +1,66 @@ +{% load i18n %} +{% load smart_if %} +
+
+
+ {% comment %} + + {% endcomment %} +
+ {% if not request.user.is_authenticated %} +

{% trans "login to post question info" %}

+ {% else %} + {% ifequal settings.EMAIL_VALIDATION 'on' %} + {% if not request.user.email_isvalid %} + {% blocktrans with request.user.email as email %}must have valid {{email}} to post, + see {{email_validation_faq_url}} + {% endblocktrans %} + {% endif %} + {% endifequal %} + {% endif %} + +
+ {{ form.title.errors }} +
+
+ {{ form.title.help_text }} +
+
+ +
+
+ {{ form.text }} + +
+ + + + {% if settings.WIKI_ON %} + + {% endif %} + + +
+ {% trans "toggle preview" %} + + {{ form.wiki }} {{ form.wiki.label_tag }} +
+
+
+ +
+
+ {{ form.tags.label_tag }}: {% trans "(required)" %}
+ {{ form.tags }} {{ form.tags.errors }} +
+

+ {{ form.tags.help_text }} +

+ {% if not request.user.is_authenticated %} + + {% else %} + + {% endif %} +
+
diff --git a/forum/skins/default/templates/base.html b/forum/skins/default/templates/base.html index fe5a95a3..0b85e7fb 100644 --- a/forum/skins/default/templates/base.html +++ b/forum/skins/default/templates/base.html @@ -68,6 +68,7 @@
+ {% include "input_bar.html" %} {% block content%} {% endblock%} diff --git a/forum/skins/default/templates/base_content.html b/forum/skins/default/templates/base_content.html index c98e1f67..fff7838d 100644 --- a/forum/skins/default/templates/base_content.html +++ b/forum/skins/default/templates/base_content.html @@ -55,6 +55,7 @@
+ {% include "input_bar.html" %} {% block content%} {% endblock%} diff --git a/forum/skins/default/templates/faq.html b/forum/skins/default/templates/faq.html index ca963237..cc790ccc 100644 --- a/forum/skins/default/templates/faq.html +++ b/forum/skins/default/templates/faq.html @@ -1,4 +1,4 @@ -{% extends "base_content.html" %} +{% extends "base.html" %} {% load extra_tags %} {% load humanize %} diff --git a/forum/skins/default/templates/feedback.html b/forum/skins/default/templates/feedback.html index 38bb48ff..af4f635f 100644 --- a/forum/skins/default/templates/feedback.html +++ b/forum/skins/default/templates/feedback.html @@ -1,4 +1,4 @@ -{% extends "base_content.html" %} +{% extends "base.html" %} {% load i18n %} {% load extra_tags %} diff --git a/forum/skins/default/templates/header.html b/forum/skins/default/templates/header.html index efc0d8f2..5d634dd7 100644 --- a/forum/skins/default/templates/header.html +++ b/forum/skins/default/templates/header.html @@ -14,15 +14,15 @@ {% trans "about" %} {% trans "faq" %}
- +
- -
+ +
- {% if active_tab != "ask" %} - - {% else %} -
- {% endif %}
diff --git a/forum/skins/default/templates/index.html b/forum/skins/default/templates/index.html index b90d788a..f94f84fc 100644 --- a/forum/skins/default/templates/index.html +++ b/forum/skins/default/templates/index.html @@ -23,7 +23,7 @@ {% endblock %} {% block content %}
-
{% trans "Questions" %}
+
{% trans "Questions" %}
{% trans "newest" %} {% trans "hottest" %} diff --git a/forum/skins/default/templates/index_.html b/forum/skins/default/templates/index_.html index 8ba169a7..36531f62 100644 --- a/forum/skins/default/templates/index_.html +++ b/forum/skins/default/templates/index_.html @@ -22,7 +22,7 @@ {% endblock %} {% block content %}
-
{% trans "Questions" %}
+
{% trans "Questions" %}
{% trans "newest" %} {% trans "hottest" %} diff --git a/forum/skins/default/templates/input_bar.html b/forum/skins/default/templates/input_bar.html new file mode 100644 index 00000000..59236350 --- /dev/null +++ b/forum/skins/default/templates/input_bar.html @@ -0,0 +1,45 @@ +{% load i18n %} +{% load smart_if %} +{% if active_tab != "ask" %} + +{% else %} + {% include "ask_form.html" %} +{% endif %} diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html index c3564a34..79ff9a5b 100644 --- a/forum/skins/default/templates/question.html +++ b/forum/skins/default/templates/question.html @@ -226,7 +226,7 @@
-
+
{% blocktrans count answers|length as counter %} One Answer: {% plural %} diff --git a/forum/skins/default/templates/questions.html b/forum/skins/default/templates/questions.html index 03ccc324..f864180f 100644 --- a/forum/skins/default/templates/questions.html +++ b/forum/skins/default/templates/questions.html @@ -27,7 +27,7 @@ {% block content %}
{% comment %} -
+
{% if searchtag %} {% trans "Found by tags" %} {% else %} @@ -50,7 +50,7 @@
{% trans "In:" %} {% trans "all" %} - {% trans "unanswered" %} + {% trans "unanswered" %} {% if request.user.is_authenticated %} {% trans "favorite" %} {% endif %} @@ -99,18 +99,18 @@ {% trans "coldest" %} + title="{% trans "click to see hottest questions" %}">{% trans "less answers" %} {% else %} {% if sort == "hottest" %} {% trans "hottest" %} + title="{% trans "click to see coldest questions" %}">{% trans "more answers" %} {% else %} {% trans "hottest" %} + title="{% trans "click to see hottest questions" %}">{% trans "more answers" %} {% endif %} {% endif %} diff --git a/forum/skins/default/templates/tags.html b/forum/skins/default/templates/tags.html index 2bc01070..6627db32 100644 --- a/forum/skins/default/templates/tags.html +++ b/forum/skins/default/templates/tags.html @@ -1,4 +1,4 @@ -{% extends "base_content.html" %} +{% extends "base.html" %} {% load i18n %} {% load extra_tags %} @@ -27,7 +27,7 @@ {% block content %}
-
{% trans "Tag list" %}
+
{% trans "Tag list" %}
{% trans "by name" %} {% trans "by popularity" %} @@ -36,7 +36,7 @@

{% if stag %} - {% trans "All tags matching query" %} '{{ stag }}' {% trans "all tags - make this empty in english" %}: + {% blocktrans %}All tags matching '{{ stag }}'{% endblocktrans %}: {% endif %} {% if not tags.object_list %} {% trans "Nothing found" %} diff --git a/forum/skins/default/templates/user.html b/forum/skins/default/templates/user.html index 5931f31c..8fd9e267 100644 --- a/forum/skins/default/templates/user.html +++ b/forum/skins/default/templates/user.html @@ -1,4 +1,4 @@ -{% extends "base_content.html" %} +{% extends "base.html" %} {% load extra_tags %} {% load extra_filters %} diff --git a/forum/skins/default/templates/user_reputation.html b/forum/skins/default/templates/user_reputation.html index 954fb44d..f6a33d93 100644 --- a/forum/skins/default/templates/user_reputation.html +++ b/forum/skins/default/templates/user_reputation.html @@ -4,6 +4,7 @@ {% load extra_filters %} {% load humanize %} {% load i18n %} +{% load smart_if %} {% block userjs %} @@ -24,7 +25,11 @@ {% block usercontent %}

-

{% trans "Change in karma per question or answer" %}

+ {% if view_user.id == user.id %} +

{% trans "Your karma change log." %}

+ {% else %} +

{% blocktrans with view_user.username as user_name %}{{user_name}}'s karma change log{% endblocktrans %}

+ {% endif %}
{% for rep in reputation %}

diff --git a/forum/skins/default/templates/users.html b/forum/skins/default/templates/users.html index 78715e05..f3ccd6e9 100644 --- a/forum/skins/default/templates/users.html +++ b/forum/skins/default/templates/users.html @@ -1,4 +1,4 @@ -{% extends "base_content.html" %} +{% extends "base.html" %} {% load extra_tags %} {% load humanize %} diff --git a/forum/templatetags/extra_tags.py b/forum/templatetags/extra_tags.py index a10c473b..83aeb4c7 100755 --- a/forum/templatetags/extra_tags.py +++ b/forum/templatetags/extra_tags.py @@ -467,13 +467,10 @@ class IsManyNode(template.Node): maybe = False for item in self.test_items: is_good = item.resolve(context) - print item, is_good if maybe == True and is_good: - print 'have many!' return self.true_nodelist.render(context) if is_good: maybe = True - print 'have one item' return self.false_nodelist.render(context) @register.tag(name='ifmany') @@ -497,7 +494,6 @@ def ifmany(parser,token): true_nodelist = parser.parse((end_tag,else_tag,)) token = parser.next_token() if token.contents == else_tag: - print 'have else clause' false_nodelist = parser.parse((end_tag,)) token = parser.next_token() else: diff --git a/forum/views/readers.py b/forum/views/readers.py index 01dfc035..7fd30a25 100644 --- a/forum/views/readers.py +++ b/forum/views/readers.py @@ -81,10 +81,10 @@ def questions(request):#a view generating listing of questions, used by 'unanswe search_state = request.session.get('search_state', SearchState()) view_log = request.session['view_log'] - print view_log + #print view_log if view_log.get_previous(1) != 'questions': if view_log.get_previous(2) != 'questions': - print 'user stepped too far, resetting search state' + #print 'user stepped too far, resetting search state' search_state.reset() if request.user.is_authenticated(): diff --git a/forum/views/users.py b/forum/views/users.py index 2356bf38..8af5a1e8 100755 --- a/forum/views/users.py +++ b/forum/views/users.py @@ -16,6 +16,7 @@ from forum.utils.html import sanitize_html from forum import auth import calendar from django.contrib.contenttypes.models import ContentType +from forum.const import USERS_PAGE_SIZE question_type = ContentType.objects.get_for_model(Question) answer_type = ContentType.objects.get_for_model(Answer) @@ -30,8 +31,6 @@ question_revision_type_id = question_revision_type.id answer_revision_type_id = answer_revision_type.id repute_type_id = repute_type.id -USERS_PAGE_SIZE = 35# refactor - move to some constants file - def users(request): is_paginated = True sortby = request.GET.get('sort', 'reputation') -- cgit v1.2.3-1-g7c22 From 8bdbbba0359d7626c721a2862f1fce48cb79b905 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sat, 17 Apr 2010 17:46:00 -0400 Subject: minor style fixes --- INSTALL | 188 +++++++++++------------------- askbot.wsgi.dist | 7 -- django.wsgi | 12 ++ forum/const.py | 2 +- forum/skins/default/media/images/logo.gif | Bin 1496 -> 2272 bytes forum/skins/default/media/style/style.css | 15 ++- forum/skins/default/templates/header.html | 2 +- 7 files changed, 94 insertions(+), 132 deletions(-) delete mode 100644 askbot.wsgi.dist create mode 100644 django.wsgi diff --git a/INSTALL b/INSTALL index bd3ac60d..fbc9c7b4 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ A. PREREQUISITES B. INSTALLATION 1. Settings file 2. Database - 3. Running OSQA in the development server + 3. Running Askbot in the development server 4. Installation under Apache/WSGI 5. Full text search 6. Email subscriptions @@ -16,27 +16,32 @@ D. CUSTOMIZATION A. PREREQUISITES ----------------------------------------------- +Note: by default all installation activity is made in the superuser 'root' account. +This can be achieved either by logging in as root (su root), +or - if you have program sudo installed - prefix all commands with sudo. +So sodo will be listed below as optional. + 0. We recommend you to use python-setuptools to install pre-requirement libraries. If you haven't installed it, please try to install it first. -e.g, sudo apt-get install python-setuptools +e.g, [sudo] apt-get install python-setuptools + +1. Python2.5/2.6, Django v1.1.1 -1. Python2.5/2.6, MySQL, Django v1.0/1.1 -Note: email subscription sender job requires Django 1.1, everything else works with 1.0 -Make sure mysql for python provider has been installed. -sudo easy_install mysql-python +1A If you are using MySQL, mysql client for python must be installed +[sudo] easy_install mysql-python 2. Python-openid v2.2 http://openidenabled.com/python-openid/ -sudo easy_install python-openid +[sudo] easy_install python-openid 4. html5lib http://code.google.com/p/html5lib/ Used for HTML sanitizer -sudo easy_install html5lib +[sudo] easy_install html5lib 5. Markdown2 http://code.google.com/p/python-markdown2/ -sudo easy_install markdown2 +[sudo] easy_install markdown2 6. Django Debug Toolbar http://github.com/robhudson/django-debug-toolbar/tree/master @@ -56,7 +61,12 @@ Notice that you will need to register with recaptcha.net and receive recaptcha public and private keys that need to be saved in your settings_local.py file -NOTES: django_authopenid is included into OSQA code +11. South +http://south.aeracode.org/docs/installation.html +Used for database schema and data migrations +[sudo] easy_install South + +NOTES: django_authopenid is included into Askbot code and is significantly modified. http://code.google.com/p/django-authopenid/ no need to install this library @@ -64,14 +74,20 @@ B. INSTALLATION ----------------------------------------------- 0. Make sure you have all above python libraries installed. - make osqa installation server-readable on Linux command might be: - chown -R yourlogin:apache /path/to/OSQA + DO NOT name the main directory 'askbot' - this name is reserved + for the future name of the app file itself. + + make askbot installation server-readable on Linux command might be: + chown -R yourlogin:apache /path/to/askbot-site - directories templates/upfiles and log must be server writable + directories: + /path/to/askbot-site/forum/upfiles + /path/to/askbot-site/log + must be server writable on Linux type chmod - chmod -R g+w /path/to/OSQA/upfiles - chmod -R g+w /path/to/log + chmod -R g+w /path/to/askbot-site/forum/upfiles + chmod -R g+w /path/to/askbot-site/log above it is assumed that webserver runs under group named "apache" @@ -82,16 +98,32 @@ update all your settings. Check settings.py and update it as well if necessory. Section C explains configuration paramaters. +Minimally required modification of settings_local.py are +DATABASE_NAME +DATABASE_USER +DATABASE_PASSWORD +DATABASE_ENGINE + +If you set these up, and your database is ready (see section 2), +run: + +python manage.py syncdb +python manage.py runserver `hostname -i`:8000 +(choose another port number if you wish) + +and askbot should be running - if you have any issues at this point (or later:) +please post them at http://askbot.org/meta + 2. Database Prepare your database by using the same database/account configuration from above. e.g, -create database osqa DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci; -grant all on osqa.* to 'osqa'@'localhost'; +create database askbot DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci; +grant all on askbot.* to 'askbot'@'localhost'; And then run "python manage.py syncdb" to synchronize your database. -3. Running OSQA on the development server +3. Running Askbot on the development server Run "python manage.py runserver" to startup django development environment. @@ -103,29 +135,10 @@ when using the test server 4. Installation under Apache/WSGI -4.1 Prepare wsgi script - -Make a file readable by your webserver with the following content: - ---------- -import os -import sys - -sys.path.insert(0,'/one/level/above') #insert to make sure that forum will be found -sys.path.append('/one/level/above/OSQA') #maybe this is not necessary -os.environ['DJANGO_SETTINGS_MODULE'] = 'OSQA.settings' -import django.core.handlers.wsgi -application = django.core.handlers.wsgi.WSGIHandler() ------------ - -insert method is used for path because if the forum directory name -is by accident the same as some other python module -you wull see strange errors - forum won't be found even though -it's in the python path. for example using name "test" is -not a good idea - as there is a module with such name - +The main wsgi script is in the file django.wsgi +it does not need to be modified -4.2 Configure webserver +4.1 Configure webserver Settings below are not perfect but may be a good starting point --------- @@ -138,26 +151,26 @@ WSGIPythonEggs /var/python/eggs #must be readable and writable by apache #this allows "rooting" forum at http://example.com/forum, if you like ServerAdmin forum@example.com - DocumentRoot /path/to/osqa-site + DocumentRoot /path/to/askbot-site ServerName example.com #run mod_wsgi process for django in daemon mode #this allows avoiding confused timezone settings when #another application runs in the same virtual host - WSGIDaemonProcess OSQA - WSGIProcessGroup OSQA + WSGIDaemonProcess askbot + WSGIProcessGroup askbot #force all content to be served as static files #otherwise django will be crunching images through itself wasting time - Alias /m/ /path/to/osqa-site/forum/skins/ - Alias /upfiles/ /path/to/osqa-site/forum/upfiles/ - + Alias /m/ /path/to/askbot-site/forum/skins/ + Alias /upfiles/ /path/to/askbot-site/forum/upfiles/ + Order deny,allow Allow from all #this is your wsgi script described in the prev section - WSGIScriptAlias / /path/to/osqa-site/osqa.wsgi + WSGIScriptAlias / /path/to/askbot-site/django.wsgi #this will force admin interface to work only #through https (optional) @@ -166,20 +179,20 @@ WSGIPythonEggs /var/python/eggs #must be readable and writable by apache RewriteEngine on RewriteRule /nimda(.*)$ https://example.com/nimda$1 [L,R=301] - CustomLog /var/log/httpd/OSQA/access_log common - ErrorLog /var/log/httpd/OSQA/error_log + CustomLog /var/log/httpd/askbot/access_log common + ErrorLog /var/log/httpd/askbot/error_log #(optional) run admin interface under https ServerAdmin forum@example.com - DocumentRoot /path/to/osqa-site + DocumentRoot /path/to/askbot-site ServerName example.com SSLEngine on SSLCertificateFile /path/to/ssl-certificate/server.crt SSLCertificateKeyFile /path/to/ssl-certificate/server.key - WSGIScriptAlias / /path/to/osqa-site/osqa.wsgi - CustomLog /var/log/httpd/OSQA/access_log common - ErrorLog /var/log/httpd/OSQA/error_log + WSGIScriptAlias / /path/to/askbot-site/django.wsgi + CustomLog /var/log/httpd/askbot/access_log common + ErrorLog /var/log/httpd/askbot/error_log DirectoryIndex index.html ------------- @@ -196,9 +209,9 @@ WSGIPythonEggs /var/python/eggs #must be readable and writable by apache configure sphinx, sample configuration can be found in sphinx/sphinx.conf file usually goes somewhere in /etc tree - build osqa index first time manually + build askbot index first time manually - % indexer --config /path/to/sphinx.conf --index osqa + % indexer --config /path/to/sphinx.conf --index askbot setup cron job to rebuild index periodically with command your crontab entry may be something like @@ -246,69 +259,10 @@ There are some demo scripts under sql_scripts folder, including badges and test accounts for CNProg.com. You don't need them to run your sample. -C. CONFIGURATION PARAMETERS - -#the only parameter that needs to be touched in settings.py is -DEBUG=False #set to True to enable debug mode - -#all forum parameters are set in file settings_local.py - -LOG_FILENAME = 'osqa.log' #where logging messages should go -DATABASE_NAME = 'osqa' # Or path to database file if using sqlite3. -DATABASE_USER = '' # Not used with sqlite3. -DATABASE_PASSWORD = '' # Not used with sqlite3. -DATABASE_ENGINE = 'mysql' #mysql, etc -SERVER_EMAIL = '' -DEFAULT_FROM_EMAIL = '' -EMAIL_HOST_USER = '' -EMAIL_HOST_PASSWORD = '' #not necessary if mailserver is run on local machine -EMAIL_SUBJECT_PREFIX = '[OSQA] ' -EMAIL_HOST='osqa.com' -EMAIL_PORT='25' -EMAIL_USE_TLS=False -TIME_ZONE = 'America/Tijuana' -APP_TITLE = u'OSQA Q&A Forum' #title of your forum -APP_KEYWORDS = u'OSQA,forum,community' #keywords for search engines -APP_DESCRIPTION = u'Ask and answer questions.' #site description for searche engines -APP_INTRO = u'

Ask and answer questions, make the world better!

' #slogan that goes to front page in logged out mode -APP_COPYRIGHT = '' #copyright message - -#if you set FORUM_SCRIPT_ALIAS= 'forum/' -#then OSQA will run at url http://example.com/forum -#FORUM_SCRIPT_ALIAS cannot have leading slash, otherwise it can be set to anything -FORUM_SCRIPT_ALIAS = '' #no leading slash, default = '' empty string - -LANGUAGE_CODE = 'en' #forum language (see language instructions on the wiki) -EMAIL_VALIDATION = 'off' #string - on|off -MIN_USERNAME_LENGTH = 1 -EMAIL_UNIQUE = False #if True, email addresses must be unique in all accounts -APP_URL = 'http://osqa.com' #used by email notif system and RSS -GOOGLE_SITEMAP_CODE = '' #code for google site crawler (look up google webmaster tools) -GOOGLE_ANALYTICS_KEY = '' #key to enable google analytics on this site -BOOKS_ON = False #if True - books tab will be on -WIKI_ON = True #if False - community wiki feature is disabled - -#experimental - allow password login through external site -#must implement django_authopenid/external_login.py -#included prototype external_login works with Mediawiki -USE_EXTERNAL_LEGACY_LOGIN = True #if false OSQA uses it's own login/password -EXTERNAL_LEGACY_LOGIN_HOST = 'login.osqa.com' -EXTERNAL_LEGACY_LOGIN_PORT = 80 -EXTERNAL_LEGACY_LOGIN_PROVIDER_NAME = 'OSQA' - -FEEDBACK_SITE_URL = None #None or url -LOGIN_URL = '/%s%s%s' % (FORUM_SCRIPT_ALIAS,'account/','signin/') - -DJANGO_VERSION = 1.1 #must be either 1.0 or 1.1 -RESOURCE_REVISION=4 #increment when you update media files - clients will be forced to load new version - -D. Customization +C. Customization Other than settings_local.py the following will most likely need customization: * locale/*/django.po - language files that may also contain your site-specific messages if you want to start with english messages file - look for words like "forum" and - "OSQA" in the msgstr lines -* templates/header.html and templates/footer.html may contain extra links -* templates/about.html - a place to explain for is your forum for -* templates/faq.html - put answers to users frequent questions -* templates/content/style/style.css - modify style sheet to add disctinctive look to your forum + "Askbot" in the msgstr lines +* skins diff --git a/askbot.wsgi.dist b/askbot.wsgi.dist deleted file mode 100644 index c3a269da..00000000 --- a/askbot.wsgi.dist +++ /dev/null @@ -1,7 +0,0 @@ -import os -import sys -sys.path.append('/path/to_dir_above') -sys.path.append('/path/to_dir_above/osqa') -os.environ['DJANGO_SETTINGS_MODULE'] = 'osqa.settings' -import django.core.handlers.wsgi -application = django.core.handlers.wsgi.WSGIHandler() diff --git a/django.wsgi b/django.wsgi new file mode 100644 index 00000000..83274865 --- /dev/null +++ b/django.wsgi @@ -0,0 +1,12 @@ +import os +import sys + +current_directory = os.path.dirname(__file__) +parent_directory = os.path.dirname(current_directory) +module_name = os.path.basename(current_directory) + +sys.path.append(parent_directory) +sys.path.append(current_directory) +os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % module_name +import django.core.handlers.wsgi +application = django.core.handlers.wsgi.WSGIHandler() diff --git a/forum/const.py b/forum/const.py index 11c833ea..bc9a7a8f 100755 --- a/forum/const.py +++ b/forum/const.py @@ -47,7 +47,7 @@ POST_SORT_METHODS = ( #todo: add assertion here that all sort methods are unique #because they are keys to the hash used in implementations of Q.run_advanced_search -DEFAULT_POST_SORT_METHOD = 'latest' +DEFAULT_POST_SORT_METHOD = 'active' POST_SCOPE_LIST = ( ('all', _('all')), ('unanswered', _('unanswered')), diff --git a/forum/skins/default/media/images/logo.gif b/forum/skins/default/media/images/logo.gif index e4d2b957..03eb79f4 100644 Binary files a/forum/skins/default/media/images/logo.gif and b/forum/skins/default/media/images/logo.gif differ diff --git a/forum/skins/default/media/style/style.css b/forum/skins/default/media/style/style.css index f96e9d67..3f51e619 100755 --- a/forum/skins/default/media/style/style.css +++ b/forum/skins/default/media/style/style.css @@ -272,13 +272,16 @@ blockquote { } #logo { - padding: 5px 0px 0px 0px; + padding: 0px 0px 0px 10px; + height: 90px; + width: 70px; } #logoContainer { } #navTabContainer { - width: 500px; + width: 600px; + padding-left: 10px; text-align: left; } @@ -306,8 +309,8 @@ blockquote { height: 25px; line-height: 30px; margin-left: 10px; - font-size: 14px; - font-weight: 400; + font-size: 18px; + font-weight: 100; text-decoration: none; display: block; float: left; @@ -331,7 +334,7 @@ blockquote { } #navBar .nav a.special { - font-size: 14px; + font-size: 18px; color: #B02B2C; font-weight: bold; text-decoration: none; @@ -548,7 +551,7 @@ blockquote { .short-summary { position: relative; padding: 3px 5px 5px 10px; - border-top: 1px dotted #ccccce; + border-top: 1px dashed #ccccce; overflow: hidden; width: 700px; float: left; diff --git a/forum/skins/default/templates/header.html b/forum/skins/default/templates/header.html index 5d634dd7..0a1a3296 100644 --- a/forum/skins/default/templates/header.html +++ b/forum/skins/default/templates/header.html @@ -19,7 +19,7 @@ -- cgit v1.2.3-1-g7c22 From bfe490e8ffcc6a84330aab3b2a1b856ce277c0ca Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sat, 17 Apr 2010 18:08:08 -0400 Subject: fixed bug on completion of user profile --- forum/views/users.py | 1 + 1 file changed, 1 insertion(+) diff --git a/forum/views/users.py b/forum/views/users.py index 8af5a1e8..7f2fcf84 100755 --- a/forum/views/users.py +++ b/forum/views/users.py @@ -16,6 +16,7 @@ from forum.utils.html import sanitize_html from forum import auth import calendar from django.contrib.contenttypes.models import ContentType +from forum.models import user_updated from forum.const import USERS_PAGE_SIZE question_type = ContentType.objects.get_for_model(Question) -- cgit v1.2.3-1-g7c22 From 3cb6d424e8995a43d0cf5ba1e2d997712ca82d49 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sun, 18 Apr 2010 15:18:35 -0400 Subject: small python 2.4 compat fix and documentation --- INSTALL | 3 +++ TODO.rst | 2 ++ forum_modules/pgfulltext/management.py | 11 ++++++----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/INSTALL b/INSTALL index fbc9c7b4..1eb9607c 100644 --- a/INSTALL +++ b/INSTALL @@ -66,6 +66,9 @@ http://south.aeracode.org/docs/installation.html Used for database schema and data migrations [sudo] easy_install South +EXTRA DEPENDENCIES FOR PYTHON 2.4 +* hashlib (made standard in python 2.5) + NOTES: django_authopenid is included into Askbot code and is significantly modified. http://code.google.com/p/django-authopenid/ no need to install this library diff --git a/TODO.rst b/TODO.rst index ba6dbdd2..f202a3f7 100644 --- a/TODO.rst +++ b/TODO.rst @@ -14,6 +14,8 @@ Code Cleanups inside forum app directory * one-by one convert "auto-discovery" modules into regular explicit python imports +* python2.4 incompatibilities + * datatime.datetime.strptime Bugs ====== diff --git a/forum_modules/pgfulltext/management.py b/forum_modules/pgfulltext/management.py index 487580ff..15ba3bd7 100644 --- a/forum_modules/pgfulltext/management.py +++ b/forum_modules/pgfulltext/management.py @@ -18,11 +18,12 @@ def install_pg_fts(): f = open(os.path.join(os.path.dirname(__file__), 'pg_fts_install.sql'), 'r') try: - cursor = connection.cursor() - cursor.execute(f.read()) - transaction.commit_unless_managed() - except: - pass + try: + cursor = connection.cursor() + cursor.execute(f.read()) + transaction.commit_unless_managed() + except: + pass finally: cursor.close() -- cgit v1.2.3-1-g7c22 From 1ca11a43c74af6c895ed330d9b115dcc335d6160 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Fri, 23 Apr 2010 12:58:35 -0400 Subject: fixed second bug in edit user profile --- forum/context.py | 1 + forum/forms.py | 2 +- forum/skins/default/templates/user_edit.html | 8 +- forum/views/users.py | 5 +- locale/ru/LC_MESSAGES/django.mo | Bin 576 -> 674 bytes locale/ru/LC_MESSAGES/django.po | 775 +++++++++++++++------------ 6 files changed, 458 insertions(+), 333 deletions(-) diff --git a/forum/context.py b/forum/context.py index d8f1d838..043af81d 100644 --- a/forum/context.py +++ b/forum/context.py @@ -16,6 +16,7 @@ def application_settings(context): 'WIKI_ON':settings.WIKI_ON, 'RESOURCE_REVISION':settings.RESOURCE_REVISION, 'ASKBOT_SKIN':settings.ASKBOT_DEFAULT_SKIN, + 'EDITABLE_SCREEN_NAME':settings.EDITABLE_SCREEN_NAME, } return {'settings':my_settings} diff --git a/forum/forms.py b/forum/forms.py index b205c6e1..4139abb8 100755 --- a/forum/forms.py +++ b/forum/forms.py @@ -289,7 +289,7 @@ class EditAnswerForm(forms.Form): class EditUserForm(forms.Form): email = forms.EmailField(label=u'Email', help_text=_('this email does not have to be linked to gravatar'), required=True, max_length=255, widget=forms.TextInput(attrs={'size' : 35})) if settings.EDITABLE_SCREEN_NAME: - username = UserNameField(label=_('Screen name')) + username = UserNameField(label=_('Screen name')) realname = forms.CharField(label=_('Real name'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35})) website = forms.URLField(label=_('Website'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35})) city = forms.CharField(label=_('Location'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35})) diff --git a/forum/skins/default/templates/user_edit.html b/forum/skins/default/templates/user_edit.html index 8109949f..abbce58a 100644 --- a/forum/skins/default/templates/user_edit.html +++ b/forum/skins/default/templates/user_edit.html @@ -38,7 +38,13 @@ {% trans "Screen Name" %}: - {{ request.user.username }} {{ form.username.errors }} + + {% if settings.EDITABLE_SCREEN_NAME %} + {{ form.username }} + {% else %} + {{ request.user.username }} + {% endif %} + {{ form.username.errors }} diff --git a/forum/views/users.py b/forum/views/users.py index 7f2fcf84..113c46e6 100755 --- a/forum/views/users.py +++ b/forum/views/users.py @@ -18,6 +18,7 @@ import calendar from django.contrib.contenttypes.models import ContentType from forum.models import user_updated from forum.const import USERS_PAGE_SIZE +from django.conf import settings question_type = ContentType.objects.get_for_model(Question) answer_type = ContentType.objects.get_for_model(Answer) @@ -121,7 +122,9 @@ def edit_user(request, id): set_new_email(user, new_email) - #user.username = sanitize_html(form.cleaned_data['username']) + if settings.EDITABLE_SCREEN_NAME: + user.username = sanitize_html(form.cleaned_data['username']) + user.real_name = sanitize_html(form.cleaned_data['realname']) user.website = sanitize_html(form.cleaned_data['website']) user.location = sanitize_html(form.cleaned_data['city']) diff --git a/locale/ru/LC_MESSAGES/django.mo b/locale/ru/LC_MESSAGES/django.mo index 8ae5ed74..c2241644 100644 Binary files a/locale/ru/LC_MESSAGES/django.mo and b/locale/ru/LC_MESSAGES/django.mo differ diff --git a/locale/ru/LC_MESSAGES/django.po b/locale/ru/LC_MESSAGES/django.po index 6b1c857a..8fc6c6c0 100644 --- a/locale/ru/LC_MESSAGES/django.po +++ b/locale/ru/LC_MESSAGES/django.po @@ -8,17 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-04-06 17:11-0400\n" +"POT-Creation-Date: 2010-04-22 03:56-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" +"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2\n" - -#: django_authopenid/forms.py:71 django_authopenid/views.py:118 +#: django_authopenid/forms.py:71 django_authopenid/views.py:132 msgid "i-names are not supported" msgstr "" @@ -162,81 +162,81 @@ msgstr "" msgid "external-login/signup/" msgstr "" -#: django_authopenid/views.py:125 +#: django_authopenid/views.py:139 #, python-format msgid "OpenID %(openid_url)s is invalid" msgstr "" -#: django_authopenid/views.py:600 +#: django_authopenid/views.py:614 msgid "Welcome email subject line" msgstr "" -#: django_authopenid/views.py:706 +#: django_authopenid/views.py:720 msgid "Password changed." msgstr "" -#: django_authopenid/views.py:718 django_authopenid/views.py:724 +#: django_authopenid/views.py:732 django_authopenid/views.py:738 #, python-format msgid "your email needs to be validated see %(details_url)s" msgstr "" -#: django_authopenid/views.py:745 +#: django_authopenid/views.py:759 msgid "Email verification subject line" msgstr "" -#: django_authopenid/views.py:836 +#: django_authopenid/views.py:850 msgid "your email was not changed" msgstr "" -#: django_authopenid/views.py:884 django_authopenid/views.py:1042 +#: django_authopenid/views.py:898 django_authopenid/views.py:1056 #, python-format msgid "No OpenID %s found associated in our database" msgstr "" -#: django_authopenid/views.py:888 django_authopenid/views.py:1049 +#: django_authopenid/views.py:902 django_authopenid/views.py:1063 #, python-format msgid "The OpenID %s isn't associated to current user logged in" msgstr "" -#: django_authopenid/views.py:896 +#: django_authopenid/views.py:910 msgid "Email Changed." msgstr "" -#: django_authopenid/views.py:974 +#: django_authopenid/views.py:988 msgid "This OpenID is already associated with another account." msgstr "" -#: django_authopenid/views.py:979 +#: django_authopenid/views.py:993 #, python-format msgid "OpenID %s is now associated with your account." msgstr "" -#: django_authopenid/views.py:1052 +#: django_authopenid/views.py:1066 msgid "Account deleted." msgstr "" -#: django_authopenid/views.py:1104 +#: django_authopenid/views.py:1118 msgid "Request for new password" msgstr "" -#: django_authopenid/views.py:1118 +#: django_authopenid/views.py:1132 msgid "A new password and the activation link were sent to your email address." msgstr "" -#: django_authopenid/views.py:1150 +#: django_authopenid/views.py:1164 #, python-format msgid "" "Could not change password. Confirmation key '%s' is not " "registered." msgstr "" -#: django_authopenid/views.py:1160 +#: django_authopenid/views.py:1174 msgid "" "Can not change password. User don't exist anymore in our " "database." msgstr "" -#: django_authopenid/views.py:1170 +#: django_authopenid/views.py:1184 #, python-format msgid "Password changed for %s. You may now sign in." msgstr "" @@ -293,115 +293,170 @@ msgstr "" msgid "too localized" msgstr "" -#: forum/const.py:71 +#: forum/const.py:37 forum/skins/default/templates/index.html:28 +#: forum/skins/default/templates/index_.html:27 +#: forum/skins/default/templates/questions.html:70 +#: forum/skins/default/templates/questions.html:75 +msgid "newest" +msgstr "" + +#: forum/const.py:38 forum/skins/default/templates/questions.html:64 +#: forum/skins/default/templates/users.html:28 +msgid "oldest" +msgstr "" + +#: forum/const.py:39 forum/skins/default/templates/questions.html:89 +#: forum/skins/default/templates/questions.html:94 +msgid "active" +msgstr "" + +#: forum/const.py:40 forum/skins/default/templates/questions.html:83 +msgid "inactive" +msgstr "" + +#: forum/const.py:41 forum/skins/default/templates/index.html:29 +#: forum/skins/default/templates/index_.html:28 +msgid "hottest" +msgstr "" + +#: forum/const.py:42 +msgid "coldest" +msgstr "" + +#: forum/const.py:43 forum/skins/default/templates/index.html:30 +#: forum/skins/default/templates/index_.html:29 +msgid "most voted" +msgstr "" + +#: forum/const.py:44 +msgid "least voted" +msgstr "" + +#: forum/const.py:45 +msgid "relevance" +msgstr "" + +#: forum/const.py:52 forum/skins/default/templates/questions.html:52 +msgid "all" +msgstr "" + +#: forum/const.py:53 forum/skins/default/templates/questions.html:53 +msgid "unanswered" +msgstr "" + +#: forum/const.py:54 forum/skins/default/templates/questions.html:55 +msgid "favorite" +msgstr "" + +#: forum/const.py:97 msgid "question" msgstr "" -#: forum/const.py:72 forum/skins/default/templates/book.html:110 +#: forum/const.py:98 forum/skins/default/templates/book.html:110 msgid "answer" msgstr "" -#: forum/const.py:73 +#: forum/const.py:99 msgid "commented question" msgstr "" -#: forum/const.py:74 +#: forum/const.py:100 msgid "commented answer" msgstr "" -#: forum/const.py:75 +#: forum/const.py:101 msgid "edited question" msgstr "" -#: forum/const.py:76 +#: forum/const.py:102 msgid "edited answer" msgstr "" -#: forum/const.py:77 +#: forum/const.py:103 msgid "received award" msgstr "" -#: forum/const.py:78 +#: forum/const.py:104 msgid "marked best answer" msgstr "" -#: forum/const.py:79 +#: forum/const.py:105 msgid "upvoted" msgstr "" -#: forum/const.py:80 +#: forum/const.py:106 msgid "downvoted" msgstr "" -#: forum/const.py:81 +#: forum/const.py:107 msgid "canceled vote" msgstr "" -#: forum/const.py:82 +#: forum/const.py:108 msgid "deleted question" msgstr "" -#: forum/const.py:83 +#: forum/const.py:109 msgid "deleted answer" msgstr "" -#: forum/const.py:84 +#: forum/const.py:110 msgid "marked offensive" msgstr "" -#: forum/const.py:85 +#: forum/const.py:111 msgid "updated tags" msgstr "" -#: forum/const.py:86 +#: forum/const.py:112 msgid "selected favorite" msgstr "" -#: forum/const.py:87 +#: forum/const.py:113 msgid "completed user profile" msgstr "" -#: forum/const.py:88 +#: forum/const.py:114 msgid "email update sent to user" msgstr "" -#: forum/const.py:92 +#: forum/const.py:118 msgid "question_answered" msgstr "" -#: forum/const.py:93 +#: forum/const.py:119 msgid "question_commented" msgstr "" -#: forum/const.py:94 +#: forum/const.py:120 msgid "answer_commented" msgstr "" -#: forum/const.py:95 +#: forum/const.py:121 msgid "answer_accepted" msgstr "" -#: forum/const.py:99 +#: forum/const.py:125 msgid "[closed]" msgstr "" -#: forum/const.py:100 +#: forum/const.py:126 msgid "[deleted]" msgstr "" -#: forum/const.py:101 forum/views/readers.py:524 forum/views/readers.py:543 +#: forum/const.py:127 forum/views/readers.py:378 forum/views/readers.py:397 msgid "initial version" msgstr "" -#: forum/const.py:102 +#: forum/const.py:128 msgid "retagged" msgstr "" -#: forum/const.py:106 +#: forum/const.py:132 msgid "exclude ignored tags" msgstr "" -#: forum/const.py:106 +#: forum/const.py:132 msgid "allow only selected tags" msgstr "" @@ -436,8 +491,7 @@ msgstr "" msgid "question content must be > 10 characters" msgstr "" -#: forum/forms.py:53 forum/skins/default/templates/header.html:28 -#: forum/skins/default/templates/header.html:56 +#: forum/forms.py:53 forum/skins/default/templates/header.html:31 msgid "tags" msgstr "" @@ -495,96 +549,96 @@ msgstr "" msgid "Automatically accept user's contributions for the email updates" msgstr "" -#: forum/forms.py:134 +#: forum/forms.py:205 msgid "Your name:" msgstr "" -#: forum/forms.py:135 +#: forum/forms.py:206 msgid "Email (not shared with anyone):" msgstr "" -#: forum/forms.py:136 +#: forum/forms.py:207 msgid "Your message:" msgstr "" -#: forum/forms.py:219 +#: forum/forms.py:290 msgid "this email does not have to be linked to gravatar" msgstr "" -#: forum/forms.py:221 +#: forum/forms.py:292 msgid "Screen name" msgstr "" -#: forum/forms.py:222 +#: forum/forms.py:293 msgid "Real name" msgstr "" -#: forum/forms.py:223 +#: forum/forms.py:294 msgid "Website" msgstr "" -#: forum/forms.py:224 +#: forum/forms.py:295 msgid "Location" msgstr "" -#: forum/forms.py:225 +#: forum/forms.py:296 msgid "Date of birth" msgstr "" -#: forum/forms.py:225 +#: forum/forms.py:296 msgid "will not be shown, used to calculate age, format: YYYY-MM-DD" msgstr "" -#: forum/forms.py:226 forum/skins/default/templates/account_settings.html:21 +#: forum/forms.py:297 forum/skins/default/templates/account_settings.html:21 #: forum/skins/default/templates/authopenid/settings.html:21 msgid "Profile" msgstr "" -#: forum/forms.py:257 forum/forms.py:258 +#: forum/forms.py:328 forum/forms.py:329 msgid "this email has already been registered, please use another one" msgstr "" -#: forum/forms.py:264 +#: forum/forms.py:335 msgid "Choose email tag filter" msgstr "" -#: forum/forms.py:280 forum/forms.py:281 +#: forum/forms.py:351 forum/forms.py:352 msgid "weekly" msgstr "" -#: forum/forms.py:280 forum/forms.py:281 +#: forum/forms.py:351 forum/forms.py:352 msgid "no email" msgstr "" -#: forum/forms.py:281 +#: forum/forms.py:352 msgid "daily" msgstr "" -#: forum/forms.py:296 +#: forum/forms.py:367 msgid "Asked by me" msgstr "" -#: forum/forms.py:299 +#: forum/forms.py:370 msgid "Answered by me" msgstr "" -#: forum/forms.py:302 +#: forum/forms.py:373 msgid "Individually selected" msgstr "" -#: forum/forms.py:305 +#: forum/forms.py:376 msgid "Entire forum (tag filtered)" msgstr "" -#: forum/forms.py:359 forum/authentication/forms.py:41 +#: forum/forms.py:430 forum/authentication/forms.py:41 msgid "okay, let's try!" msgstr "" -#: forum/forms.py:360 +#: forum/forms.py:431 msgid "no community email please, thanks" msgstr "" -#: forum/forms.py:363 forum/authentication/forms.py:45 +#: forum/forms.py:434 forum/authentication/forms.py:45 msgid "please choose one of the options above" msgstr "" @@ -659,7 +713,7 @@ msgstr "" msgid "command/" msgstr "" -#: forum/urls.py:60 forum/views/readers.py:395 +#: forum/urls.py:60 forum/views/readers.py:249 msgid "question/" msgstr "" @@ -797,27 +851,27 @@ msgstr "" msgid "First time here? Check out the FAQ!" msgstr "" -#: forum/models/question.py:360 +#: forum/models/question.py:481 #, python-format msgid "%(author)s modified the question" msgstr "" -#: forum/models/question.py:364 +#: forum/models/question.py:485 #, python-format msgid "%(people)s posted %(new_answer_count)s new answers" msgstr "" -#: forum/models/question.py:369 +#: forum/models/question.py:490 #, python-format msgid "%(people)s commented the question" msgstr "" -#: forum/models/question.py:374 +#: forum/models/question.py:495 #, python-format msgid "%(people)s commented answers" msgstr "" -#: forum/models/question.py:376 +#: forum/models/question.py:497 #, python-format msgid "%(people)s commented an answer" msgstr "" @@ -834,11 +888,11 @@ msgstr "" msgid "bronze" msgstr "" -#: forum/models/tag.py:79 +#: forum/models/tag.py:81 msgid "interesting" msgstr "" -#: forum/models/tag.py:79 +#: forum/models/tag.py:81 msgid "ignored" msgstr "" @@ -906,10 +960,12 @@ msgid "back to previous page" msgstr "" #: forum/skins/default/templates/404.html:42 +#: forum/skins/default/templates/questions.html:52 msgid "see all questions" msgstr "" #: forum/skins/default/templates/404.html:43 +#: forum/skins/default/templates/index.html:65 msgid "see all tags" msgstr "" @@ -1032,15 +1088,17 @@ msgid "select revision" msgstr "" #: forum/skins/default/templates/answer_edit.html:63 -#: forum/skins/default/templates/ask.html:97 -#: forum/skins/default/templates/question.html:431 +#: forum/skins/default/templates/ask.html:98 +#: forum/skins/default/templates/ask_form.html:39 +#: forum/skins/default/templates/question.html:433 #: forum/skins/default/templates/question_edit.html:92 msgid "Toggle the real time Markdown editor preview" msgstr "" #: forum/skins/default/templates/answer_edit.html:63 -#: forum/skins/default/templates/ask.html:97 -#: forum/skins/default/templates/question.html:432 +#: forum/skins/default/templates/ask.html:98 +#: forum/skins/default/templates/ask_form.html:39 +#: forum/skins/default/templates/question.html:434 #: forum/skins/default/templates/question_edit.html:92 msgid "toggle preview" msgstr "" @@ -1136,15 +1194,16 @@ msgid "learn more about Markdown" msgstr "" #: forum/skins/default/templates/ask.html:5 -#: forum/skins/default/templates/ask.html:61 +#: forum/skins/default/templates/ask.html:62 msgid "Ask a question" msgstr "" -#: forum/skins/default/templates/ask.html:68 +#: forum/skins/default/templates/ask.html:69 +#: forum/skins/default/templates/ask_form.html:11 msgid "login to post question info" msgstr "" -#: forum/skins/default/templates/ask.html:74 +#: forum/skins/default/templates/ask.html:75 #, python-format msgid "" "must have valid %(email)s to post, \n" @@ -1152,18 +1211,29 @@ msgid "" " " msgstr "" -#: forum/skins/default/templates/ask.html:112 +#: forum/skins/default/templates/ask.html:113 +#: forum/skins/default/templates/ask_form.html:54 msgid "(required)" msgstr "" -#: forum/skins/default/templates/ask.html:119 +#: forum/skins/default/templates/ask.html:120 +#: forum/skins/default/templates/ask_form.html:61 msgid "Login/signup to post your question" msgstr "" -#: forum/skins/default/templates/ask.html:121 +#: forum/skins/default/templates/ask.html:122 +#: forum/skins/default/templates/ask_form.html:63 msgid "Ask your question" msgstr "" +#: forum/skins/default/templates/ask_form.html:15 +#, python-format +msgid "" +"must have valid %(email)s to post, \n" +" see %(email_validation_faq_url)s\n" +" " +msgstr "" + #: forum/skins/default/templates/badge.html:6 #: forum/skins/default/templates/badge.html:17 msgid "Badge" @@ -1301,12 +1371,13 @@ msgstr "" #: forum/skins/default/templates/book.html:125 #: forum/skins/default/templates/index_.html:63 -#: forum/skins/default/templates/question.html:478 +#: forum/skins/default/templates/question.html:136 #: forum/skins/default/templates/question_list.html:19 #: forum/skins/default/templates/question_summary_list_roll.html:52 -#: forum/skins/default/templates/tags.html:49 +#: forum/skins/default/templates/tags.html:50 #: forum/skins/default/templates/users_questions.html:34 -msgid "using tags" +#, python-format +msgid "see questions tagged '%(tag)s'" msgstr "" #: forum/skins/default/templates/book.html:147 @@ -1314,8 +1385,8 @@ msgid "subscribe to book RSS feed" msgstr "" #: forum/skins/default/templates/book.html:147 -#: forum/skins/default/templates/index.html:87 -#: forum/skins/default/templates/index_.html:114 +#: forum/skins/default/templates/index.html:88 +#: forum/skins/default/templates/index_.html:115 msgid "subscribe to the questions feed" msgstr "" @@ -1527,14 +1598,13 @@ msgid "" msgstr "" #: forum/skins/default/templates/faq.html:130 -#: forum/skins/default/templates/header.html:27 -#: forum/skins/default/templates/header.html:55 +#: forum/skins/default/templates/header.html:30 msgid "questions" msgstr "" #: forum/skins/default/templates/faq.html:130 -#: forum/skins/default/templates/index.html:94 -#: forum/skins/default/templates/index_.html:121 +#: forum/skins/default/templates/index.html:95 +#: forum/skins/default/templates/index_.html:122 msgid "." msgstr "" @@ -1598,14 +1668,14 @@ msgid "Message body:" msgstr "" #: forum/skins/default/templates/footer.html:8 -#: forum/skins/default/templates/header.html:13 +#: forum/skins/default/templates/header.html:17 #: forum/skins/default/templates/index.html:46 #: forum/skins/default/templates/index_.html:77 msgid "about" msgstr "" #: forum/skins/default/templates/footer.html:9 -#: forum/skins/default/templates/header.html:14 +#: forum/skins/default/templates/header.html:18 #: forum/skins/default/templates/index.html:47 #: forum/skins/default/templates/index_.html:78 #: forum/skins/default/templates/question_edit_tips.html:17 @@ -1620,42 +1690,38 @@ msgstr "" msgid "give feedback" msgstr "" -#: forum/skins/default/templates/header.html:9 +#: forum/skins/default/templates/header.html:13 msgid "logout" msgstr "" -#: forum/skins/default/templates/header.html:11 +#: forum/skins/default/templates/header.html:15 msgid "login" msgstr "" -#: forum/skins/default/templates/header.html:21 +#: forum/skins/default/templates/header.html:25 msgid "back to home page" msgstr "" -#: forum/skins/default/templates/header.html:29 -#: forum/skins/default/templates/header.html:57 +#: forum/skins/default/templates/header.html:32 msgid "users" msgstr "" -#: forum/skins/default/templates/header.html:31 +#: forum/skins/default/templates/header.html:34 msgid "books" msgstr "" -#: forum/skins/default/templates/header.html:33 +#: forum/skins/default/templates/header.html:36 #: forum/templatetags/extra_tags.py:174 forum/templatetags/extra_tags.py:203 msgid "badges" msgstr "" -#: forum/skins/default/templates/header.html:34 -msgid "unanswered questions" -msgstr "" - -#: forum/skins/default/templates/header.html:36 +#: forum/skins/default/templates/header.html:37 +#: forum/skins/default/templates/header.html:41 msgid "ask a question" msgstr "" -#: forum/skins/default/templates/header.html:51 -msgid "search" +#: forum/skins/default/templates/header.html:39 +msgid "unanswered questions" msgstr "" #: forum/skins/default/templates/index.html:9 @@ -1674,36 +1740,16 @@ msgstr "" msgid "last updated questions" msgstr "" -#: forum/skins/default/templates/index.html:28 -#: forum/skins/default/templates/index_.html:27 -#: forum/skins/default/templates/questions.html:47 -msgid "newest" -msgstr "" - #: forum/skins/default/templates/index.html:29 #: forum/skins/default/templates/index_.html:28 -#: forum/skins/default/templates/questions.html:49 msgid "hottest questions" msgstr "" -#: forum/skins/default/templates/index.html:29 -#: forum/skins/default/templates/index_.html:28 -#: forum/skins/default/templates/questions.html:49 -msgid "hottest" -msgstr "" - #: forum/skins/default/templates/index.html:30 #: forum/skins/default/templates/index_.html:29 -#: forum/skins/default/templates/questions.html:50 msgid "most voted questions" msgstr "" -#: forum/skins/default/templates/index.html:30 -#: forum/skins/default/templates/index_.html:29 -#: forum/skins/default/templates/questions.html:50 -msgid "most voted" -msgstr "" - #: forum/skins/default/templates/index.html:31 #: forum/skins/default/templates/index_.html:30 msgid "all questions" @@ -1721,56 +1767,54 @@ msgstr "" #: forum/skins/default/templates/index.html:60 #: forum/skins/default/templates/index_.html:90 -#: forum/skins/default/templates/question.html:134 #, python-format msgid "see questions tagged '%(tagname)s'" msgstr "" -#: forum/skins/default/templates/index.html:64 -#: forum/skins/default/templates/index.html:94 -#: forum/skins/default/templates/index_.html:93 -#: forum/skins/default/templates/index_.html:121 -msgid "popular tags" -msgstr "" - -#: forum/skins/default/templates/index.html:69 -#: forum/skins/default/templates/index_.html:98 +#: forum/skins/default/templates/index.html:70 +#: forum/skins/default/templates/index_.html:99 msgid "Recent awards" msgstr "" -#: forum/skins/default/templates/index.html:82 -#: forum/skins/default/templates/index_.html:109 +#: forum/skins/default/templates/index.html:83 +#: forum/skins/default/templates/index_.html:110 msgid "all awards" msgstr "" -#: forum/skins/default/templates/index.html:87 -#: forum/skins/default/templates/index_.html:114 +#: forum/skins/default/templates/index.html:88 +#: forum/skins/default/templates/index_.html:115 msgid "subscribe to last 30 questions by RSS" msgstr "" -#: forum/skins/default/templates/index.html:94 -#: forum/skins/default/templates/index_.html:121 +#: forum/skins/default/templates/index.html:95 +#: forum/skins/default/templates/index_.html:122 msgid "Still looking for more? See" msgstr "" -#: forum/skins/default/templates/index.html:94 -#: forum/skins/default/templates/index_.html:121 +#: forum/skins/default/templates/index.html:95 +#: forum/skins/default/templates/index_.html:122 msgid "complete list of questions" msgstr "" -#: forum/skins/default/templates/index.html:94 -#: forum/skins/default/templates/index_.html:121 +#: forum/skins/default/templates/index.html:95 +#: forum/skins/default/templates/index_.html:122 #: forum/skins/default/templates/authopenid/signup.html:28 msgid "or" msgstr "" -#: forum/skins/default/templates/index.html:94 -#: forum/skins/default/templates/index_.html:121 +#: forum/skins/default/templates/index.html:95 +#: forum/skins/default/templates/index_.html:94 +#: forum/skins/default/templates/index_.html:122 +msgid "popular tags" +msgstr "" + +#: forum/skins/default/templates/index.html:95 +#: forum/skins/default/templates/index_.html:122 msgid "Please help us answer" msgstr "" -#: forum/skins/default/templates/index.html:94 -#: forum/skins/default/templates/index_.html:121 +#: forum/skins/default/templates/index.html:95 +#: forum/skins/default/templates/index_.html:122 msgid "list of unanswered questions" msgstr "" @@ -1784,13 +1828,8 @@ msgstr "" msgid "answers" msgstr "" -#: forum/skins/default/templates/index_.html:63 -#: forum/skins/default/templates/question.html:478 -#: forum/skins/default/templates/question_list.html:19 -#: forum/skins/default/templates/question_summary_list_roll.html:52 -#: forum/skins/default/templates/tags.html:49 -#: forum/skins/default/templates/users_questions.html:34 -msgid "see questions tagged" +#: forum/skins/default/templates/input_bar.html:33 +msgid "search" msgstr "" #: forum/skins/default/templates/logout.html:6 @@ -1926,7 +1965,7 @@ msgstr "" #: forum/skins/default/templates/question.html:81 #: forum/skins/default/templates/question.html:99 -#: forum/skins/default/templates/question.html:256 +#: forum/skins/default/templates/question.html:258 msgid "current number of votes" msgstr "" @@ -1947,48 +1986,48 @@ msgstr "" msgid "remove favorite mark from this question (click again to restore mark)" msgstr "" -#: forum/skins/default/templates/question.html:139 -#: forum/skins/default/templates/question.html:293 +#: forum/skins/default/templates/question.html:141 +#: forum/skins/default/templates/question.html:295 #: forum/skins/default/templates/revisions_answer.html:58 #: forum/skins/default/templates/revisions_question.html:58 msgid "edit" msgstr "" -#: forum/skins/default/templates/question.html:144 +#: forum/skins/default/templates/question.html:146 msgid "reopen" msgstr "" -#: forum/skins/default/templates/question.html:148 +#: forum/skins/default/templates/question.html:150 msgid "close" msgstr "" -#: forum/skins/default/templates/question.html:154 -#: forum/skins/default/templates/question.html:298 +#: forum/skins/default/templates/question.html:156 +#: forum/skins/default/templates/question.html:300 msgid "" "report as offensive (i.e containing spam, advertising, malicious text, etc.)" msgstr "" -#: forum/skins/default/templates/question.html:155 -#: forum/skins/default/templates/question.html:299 +#: forum/skins/default/templates/question.html:157 +#: forum/skins/default/templates/question.html:301 msgid "flag offensive" msgstr "" -#: forum/skins/default/templates/question.html:163 -#: forum/skins/default/templates/question.html:310 +#: forum/skins/default/templates/question.html:165 +#: forum/skins/default/templates/question.html:312 msgid "delete" msgstr "" -#: forum/skins/default/templates/question.html:181 -#: forum/skins/default/templates/question.html:330 +#: forum/skins/default/templates/question.html:183 +#: forum/skins/default/templates/question.html:332 msgid "delete this comment" msgstr "" -#: forum/skins/default/templates/question.html:192 -#: forum/skins/default/templates/question.html:341 +#: forum/skins/default/templates/question.html:194 +#: forum/skins/default/templates/question.html:343 msgid "add comment" msgstr "" -#: forum/skins/default/templates/question.html:196 +#: forum/skins/default/templates/question.html:198 #, python-format msgid "" "\n" @@ -2002,7 +2041,7 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: forum/skins/default/templates/question.html:202 +#: forum/skins/default/templates/question.html:204 #, python-format msgid "" "\n" @@ -2017,18 +2056,18 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: forum/skins/default/templates/question.html:218 +#: forum/skins/default/templates/question.html:220 #, python-format msgid "" "The question has been closed for the following reason \"%(close_reason)s\" by" msgstr "" -#: forum/skins/default/templates/question.html:220 +#: forum/skins/default/templates/question.html:222 #, python-format msgid "close date %(closed_at)s" msgstr "" -#: forum/skins/default/templates/question.html:228 +#: forum/skins/default/templates/question.html:230 #, python-format msgid "" "\n" @@ -2041,63 +2080,63 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: forum/skins/default/templates/question.html:236 +#: forum/skins/default/templates/question.html:238 msgid "oldest answers will be shown first" msgstr "" -#: forum/skins/default/templates/question.html:236 +#: forum/skins/default/templates/question.html:238 msgid "oldest answers" msgstr "" -#: forum/skins/default/templates/question.html:238 +#: forum/skins/default/templates/question.html:240 msgid "newest answers will be shown first" msgstr "" -#: forum/skins/default/templates/question.html:238 +#: forum/skins/default/templates/question.html:240 msgid "newest answers" msgstr "" -#: forum/skins/default/templates/question.html:240 +#: forum/skins/default/templates/question.html:242 msgid "most voted answers will be shown first" msgstr "" -#: forum/skins/default/templates/question.html:240 +#: forum/skins/default/templates/question.html:242 msgid "popular answers" msgstr "" -#: forum/skins/default/templates/question.html:254 -#: forum/skins/default/templates/question.html:255 +#: forum/skins/default/templates/question.html:256 +#: forum/skins/default/templates/question.html:257 msgid "i like this answer (click again to cancel)" msgstr "" -#: forum/skins/default/templates/question.html:261 -#: forum/skins/default/templates/question.html:262 +#: forum/skins/default/templates/question.html:263 +#: forum/skins/default/templates/question.html:264 msgid "i dont like this answer (click again to cancel)" msgstr "" -#: forum/skins/default/templates/question.html:267 -#: forum/skins/default/templates/question.html:268 +#: forum/skins/default/templates/question.html:269 +#: forum/skins/default/templates/question.html:270 msgid "mark this answer as favorite (click again to undo)" msgstr "" -#: forum/skins/default/templates/question.html:273 -#: forum/skins/default/templates/question.html:274 +#: forum/skins/default/templates/question.html:275 +#: forum/skins/default/templates/question.html:276 msgid "the author of the question has selected this answer as correct" msgstr "" -#: forum/skins/default/templates/question.html:287 +#: forum/skins/default/templates/question.html:289 msgid "answer permanent link" msgstr "" -#: forum/skins/default/templates/question.html:288 +#: forum/skins/default/templates/question.html:290 msgid "permanent link" msgstr "" -#: forum/skins/default/templates/question.html:310 +#: forum/skins/default/templates/question.html:312 msgid "undelete" msgstr "" -#: forum/skins/default/templates/question.html:345 +#: forum/skins/default/templates/question.html:347 #, python-format msgid "" "\n" @@ -2112,7 +2151,7 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: forum/skins/default/templates/question.html:351 +#: forum/skins/default/templates/question.html:353 #, python-format msgid "" "\n" @@ -2127,78 +2166,86 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: forum/skins/default/templates/question.html:377 -#: forum/skins/default/templates/question.html:380 +#: forum/skins/default/templates/question.html:379 +#: forum/skins/default/templates/question.html:382 msgid "Notify me once a day when there are any new answers" msgstr "" -#: forum/skins/default/templates/question.html:383 +#: forum/skins/default/templates/question.html:385 msgid "Notify me weekly when there are any new answers" msgstr "" -#: forum/skins/default/templates/question.html:388 +#: forum/skins/default/templates/question.html:390 #, python-format msgid "" "You can always adjust frequency of email updates from your %(profile_url)s" msgstr "" -#: forum/skins/default/templates/question.html:393 +#: forum/skins/default/templates/question.html:395 msgid "once you sign in you will be able to subscribe for any updates here" msgstr "" -#: forum/skins/default/templates/question.html:404 +#: forum/skins/default/templates/question.html:406 msgid "Your answer" msgstr "" -#: forum/skins/default/templates/question.html:406 +#: forum/skins/default/templates/question.html:408 msgid "Be the first one to answer this question!" msgstr "" -#: forum/skins/default/templates/question.html:412 +#: forum/skins/default/templates/question.html:414 msgid "you can answer anonymously and then login" msgstr "" -#: forum/skins/default/templates/question.html:416 +#: forum/skins/default/templates/question.html:418 msgid "answer your own question only to give an answer" msgstr "" -#: forum/skins/default/templates/question.html:418 +#: forum/skins/default/templates/question.html:420 msgid "please only give an answer, no discussions" msgstr "" -#: forum/skins/default/templates/question.html:454 +#: forum/skins/default/templates/question.html:456 msgid "Login/Signup to Post Your Answer" msgstr "" -#: forum/skins/default/templates/question.html:457 +#: forum/skins/default/templates/question.html:459 msgid "Answer Your Own Question" msgstr "" -#: forum/skins/default/templates/question.html:459 +#: forum/skins/default/templates/question.html:461 msgid "Answer the question" msgstr "" -#: forum/skins/default/templates/question.html:473 +#: forum/skins/default/templates/question.html:475 msgid "Question tags" msgstr "" -#: forum/skins/default/templates/question.html:483 -msgid "question asked" +#: forum/skins/default/templates/question.html:480 +#: forum/skins/default/templates/questions.html:246 +#: forum/skins/default/templates/tag_selector.html:11 +#: forum/skins/default/templates/tag_selector.html:28 +#, python-format +msgid "see questions tagged '%(tag_name)s'" msgstr "" #: forum/skins/default/templates/question.html:486 +msgid "question asked" +msgstr "" + +#: forum/skins/default/templates/question.html:489 msgid "question was seen" msgstr "" -#: forum/skins/default/templates/question.html:486 +#: forum/skins/default/templates/question.html:489 msgid "times" msgstr "" -#: forum/skins/default/templates/question.html:489 +#: forum/skins/default/templates/question.html:492 msgid "last updated" msgstr "" -#: forum/skins/default/templates/question.html:495 +#: forum/skins/default/templates/question.html:498 msgid "Related questions" msgstr "" @@ -2287,124 +2334,193 @@ msgstr "" msgid "tag editors receive special awards from the community" msgstr "" -#: forum/skins/default/templates/questions.html:29 +#: forum/skins/default/templates/questions.html:32 msgid "Found by tags" msgstr "" -#: forum/skins/default/templates/questions.html:33 +#: forum/skins/default/templates/questions.html:36 msgid "Search results" msgstr "" -#: forum/skins/default/templates/questions.html:35 +#: forum/skins/default/templates/questions.html:38 msgid "Found by title" msgstr "" -#: forum/skins/default/templates/questions.html:39 +#: forum/skins/default/templates/questions.html:42 msgid "Unanswered questions" msgstr "" -#: forum/skins/default/templates/questions.html:41 +#: forum/skins/default/templates/questions.html:44 msgid "All questions" msgstr "" -#: forum/skins/default/templates/questions.html:47 -msgid "most recently asked questions" +#: forum/skins/default/templates/questions.html:51 +msgid "In:" msgstr "" -#: forum/skins/default/templates/questions.html:48 -msgid "most recently updated questions" +#: forum/skins/default/templates/questions.html:53 +msgid "see unanswered questions" msgstr "" -#: forum/skins/default/templates/questions.html:48 -msgid "active" +#: forum/skins/default/templates/questions.html:55 +msgid "see your favorite questions" msgstr "" -#: forum/skins/default/templates/questions.html:58 -msgid "Did not find anything?" +#: forum/skins/default/templates/questions.html:59 +msgid "Sort by:" msgstr "" -#: forum/skins/default/templates/questions.html:61 -msgid "Did not find what you were looking for?" +#: forum/skins/default/templates/questions.html:64 +#: forum/skins/default/templates/questions.html:75 +msgid "click to see the newest questions" msgstr "" -#: forum/skins/default/templates/questions.html:63 -msgid "Please, post your question!" +#: forum/skins/default/templates/questions.html:70 +msgid "click to see the oldest questions" msgstr "" -#: forum/skins/default/templates/questions.html:77 -#, python-format -msgid "have total %(q_num)s questions tagged %(tagname)s" -msgid_plural "have total %(q_num)s questions tagged %(tagname)s" -msgstr[0] "" -msgstr[1] "" +#: forum/skins/default/templates/questions.html:83 +#: forum/skins/default/templates/questions.html:94 +msgid "click to see the most recently updated questions" +msgstr "" -#: forum/skins/default/templates/questions.html:81 -#, python-format -msgid "" -" have total %(q_num)s questions containing %(searchtitle)s in full text " -msgid_plural "" -" have total %(q_num)s questions containing %(searchtitle)s in full text " -msgstr[0] "" -msgstr[1] "" +#: forum/skins/default/templates/questions.html:89 +msgid "click to see the least recently updated questions" +msgstr "" -#: forum/skins/default/templates/questions.html:83 +#: forum/skins/default/templates/questions.html:102 +#: forum/skins/default/templates/questions.html:113 +msgid "click to see hottest questions" +msgstr "" + +#: forum/skins/default/templates/questions.html:102 +msgid "less answers" +msgstr "" + +#: forum/skins/default/templates/questions.html:108 +msgid "click to see coldest questions" +msgstr "" + +#: forum/skins/default/templates/questions.html:108 +#: forum/skins/default/templates/questions.html:113 +msgid "more answers" +msgstr "" + +#: forum/skins/default/templates/questions.html:121 +#: forum/skins/default/templates/questions.html:132 +msgid "click to see most voted questions" +msgstr "" + +#: forum/skins/default/templates/questions.html:121 +msgid "unpopular" +msgstr "" + +#: forum/skins/default/templates/questions.html:127 +msgid "click to see least voted questions" +msgstr "" + +#: forum/skins/default/templates/questions.html:127 +#: forum/skins/default/templates/questions.html:132 +msgid "popular" +msgstr "" + +#: forum/skins/default/templates/questions.html:141 #, python-format -msgid " have total %(q_num)s questions containing %(searchtitle)s " -msgid_plural " have total %(q_num)s questions containing %(searchtitle)s " +msgid " One question found" +msgid_plural "%(q_num)s questions found" msgstr[0] "" msgstr[1] "" +msgstr[2] "" -#: forum/skins/default/templates/questions.html:87 +#: forum/skins/default/templates/questions.html:143 #, python-format -msgid " have total %(q_num)s unanswered questions " -msgid_plural " have total %(q_num)s unanswered questions " +msgid " %(q_num)s question" +msgid_plural "%(q_num)s questions" msgstr[0] "" msgstr[1] "" +msgstr[2] "" -#: forum/skins/default/templates/questions.html:89 +#: forum/skins/default/templates/questions.html:147 #, python-format -msgid " have total %(q_num)s questions " -msgid_plural " have total %(q_num)s questions " -msgstr[0] "" -msgstr[1] "" +msgid "with %(author_name)s's contributions" +msgstr "" -#: forum/skins/default/templates/questions.html:95 -msgid "latest questions info" +#: forum/skins/default/templates/questions.html:151 +msgid "tagged" msgstr "" -#: forum/skins/default/templates/questions.html:99 -msgid "Questions are sorted by the time of last update." +#: forum/skins/default/templates/questions.html:157 +msgid "Search tips:" msgstr "" -#: forum/skins/default/templates/questions.html:100 -msgid "Most recently answered ones are shown first." +#: forum/skins/default/templates/questions.html:161 +msgid "reset author" msgstr "" -#: forum/skins/default/templates/questions.html:104 -msgid "Questions sorted by number of responses." +#: forum/skins/default/templates/questions.html:165 +msgid "reset tags" msgstr "" -#: forum/skins/default/templates/questions.html:105 -msgid "Most answered questions are shown first." +#: forum/skins/default/templates/questions.html:169 +#: forum/skins/default/templates/questions.html:173 +msgid "start over" msgstr "" -#: forum/skins/default/templates/questions.html:109 -msgid "Questions are sorted by the number of votes." +#: forum/skins/default/templates/questions.html:175 +msgid " - to expand, or dig in by adding more tags and revising the query." msgstr "" -#: forum/skins/default/templates/questions.html:110 -msgid "Most voted questions are shown first." +#: forum/skins/default/templates/questions.html:178 +msgid "Search tip:" msgstr "" -#: forum/skins/default/templates/questions.html:118 -msgid "Related tags" +#: forum/skins/default/templates/questions.html:178 +msgid "add tags and a query to focus your search" msgstr "" -#: forum/skins/default/templates/questions.html:121 -#: forum/skins/default/templates/tag_selector.html:10 -#: forum/skins/default/templates/tag_selector.html:27 -#, python-format -msgid "see questions tagged '%(tag_name)s'" +#: forum/skins/default/templates/questions.html:190 +msgid "There are no unanswered questions here" +msgstr "" + +#: forum/skins/default/templates/questions.html:193 +msgid "No favorite questions here. " +msgstr "" + +#: forum/skins/default/templates/questions.html:194 +msgid "Please start (bookmark) some questions when you visit them" +msgstr "" + +#: forum/skins/default/templates/questions.html:199 +msgid "You can expand your search by " +msgstr "" + +#: forum/skins/default/templates/questions.html:203 +msgid "resetting author" +msgstr "" + +#: forum/skins/default/templates/questions.html:207 +msgid "resetting tags" +msgstr "" + +#: forum/skins/default/templates/questions.html:211 +#: forum/skins/default/templates/questions.html:215 +msgid "starting over" +msgstr "" + +#: forum/skins/default/templates/questions.html:220 +msgid "Please always feel free to ask your question!" +msgstr "" + +#: forum/skins/default/templates/questions.html:224 +msgid "Did not find what you were looking for?" +msgstr "" + +#: forum/skins/default/templates/questions.html:225 +msgid "Please, post your question!" +msgstr "" + +#: forum/skins/default/templates/questions.html:243 +msgid "Related tags" msgstr "" #: forum/skins/default/templates/reopen.html:6 @@ -2448,30 +2564,30 @@ msgstr "" msgid "click to hide/show revision" msgstr "" -#: forum/skins/default/templates/tag_selector.html:4 +#: forum/skins/default/templates/tag_selector.html:5 msgid "Interesting tags" msgstr "" -#: forum/skins/default/templates/tag_selector.html:14 +#: forum/skins/default/templates/tag_selector.html:15 #, python-format msgid "remove '%(tag_name)s' from the list of interesting tags" msgstr "" -#: forum/skins/default/templates/tag_selector.html:20 -#: forum/skins/default/templates/tag_selector.html:37 +#: forum/skins/default/templates/tag_selector.html:21 +#: forum/skins/default/templates/tag_selector.html:38 msgid "Add" msgstr "" -#: forum/skins/default/templates/tag_selector.html:21 +#: forum/skins/default/templates/tag_selector.html:22 msgid "Ignored tags" msgstr "" -#: forum/skins/default/templates/tag_selector.html:31 +#: forum/skins/default/templates/tag_selector.html:32 #, python-format msgid "remove '%(tag_name)s' from the list of ignored tags" msgstr "" -#: forum/skins/default/templates/tag_selector.html:40 +#: forum/skins/default/templates/tag_selector.html:41 msgid "keep ignored questions hidden" msgstr "" @@ -2497,11 +2613,9 @@ msgid "by popularity" msgstr "" #: forum/skins/default/templates/tags.html:39 -msgid "All tags matching query" -msgstr "" - -#: forum/skins/default/templates/tags.html:39 -msgid "all tags - make this empty in english" +#, python-format +msgid "" +"All tags matching '%(stag)s'" msgstr "" #: forum/skins/default/templates/tags.html:42 @@ -2547,7 +2661,7 @@ msgid "change picture" msgstr "" #: forum/skins/default/templates/user_info.html:25 -#: forum/skins/default/templates/users.html:26 forum/views/users.py:920 +#: forum/skins/default/templates/users.html:26 forum/views/users.py:921 msgid "reputation" msgstr "" @@ -2595,8 +2709,13 @@ msgstr "" msgid "votes left" msgstr "" -#: forum/skins/default/templates/user_reputation.html:27 -msgid "Change in karma per question or answer" +#: forum/skins/default/templates/user_reputation.html:29 +msgid "Your karma change log." +msgstr "" + +#: forum/skins/default/templates/user_reputation.html:31 +#, python-format +msgid "%(user_name)s's karma change log" msgstr "" #: forum/skins/default/templates/user_stats.html:12 @@ -2712,19 +2831,19 @@ msgstr[1] "" msgid "User profile" msgstr "" -#: forum/skins/default/templates/user_tabs.html:7 forum/views/users.py:894 +#: forum/skins/default/templates/user_tabs.html:7 forum/views/users.py:895 msgid "overview" msgstr "" -#: forum/skins/default/templates/user_tabs.html:9 forum/views/users.py:902 +#: forum/skins/default/templates/user_tabs.html:9 forum/views/users.py:903 msgid "recent activity" msgstr "" -#: forum/skins/default/templates/user_tabs.html:12 forum/views/users.py:912 +#: forum/skins/default/templates/user_tabs.html:12 forum/views/users.py:913 msgid "comments and answers to others questions" msgstr "" -#: forum/skins/default/templates/user_tabs.html:13 forum/views/users.py:911 +#: forum/skins/default/templates/user_tabs.html:13 forum/views/users.py:912 msgid "responses" msgstr "" @@ -2736,11 +2855,11 @@ msgstr "" msgid "reputation history" msgstr "" -#: forum/skins/default/templates/user_tabs.html:20 forum/views/users.py:938 +#: forum/skins/default/templates/user_tabs.html:20 forum/views/users.py:939 msgid "user vote record" msgstr "" -#: forum/skins/default/templates/user_tabs.html:20 forum/views/users.py:937 +#: forum/skins/default/templates/user_tabs.html:20 forum/views/users.py:938 msgid "casted votes" msgstr "" @@ -2752,11 +2871,11 @@ msgstr "" msgid "favorites" msgstr "" -#: forum/skins/default/templates/user_tabs.html:27 forum/views/users.py:947 +#: forum/skins/default/templates/user_tabs.html:27 forum/views/users.py:948 msgid "email subscription settings" msgstr "" -#: forum/skins/default/templates/user_tabs.html:28 forum/views/users.py:946 +#: forum/skins/default/templates/user_tabs.html:28 forum/views/users.py:947 msgid "email subscriptions" msgstr "" @@ -2769,10 +2888,6 @@ msgstr "" msgid "recent" msgstr "" -#: forum/skins/default/templates/users.html:28 -msgid "oldest" -msgstr "" - #: forum/skins/default/templates/users.html:29 msgid "by username" msgstr "" @@ -3400,59 +3515,59 @@ msgstr "" msgid "We look forward to hearing your feedback! Please, give it next time :)" msgstr "" -#: forum/views/users.py:855 forum/views/users.py:859 +#: forum/views/users.py:856 forum/views/users.py:860 msgid "changes saved" msgstr "" -#: forum/views/users.py:865 +#: forum/views/users.py:866 msgid "email updates canceled" msgstr "" -#: forum/views/users.py:895 +#: forum/views/users.py:896 msgid "user profile" msgstr "" -#: forum/views/users.py:896 +#: forum/views/users.py:897 msgid "user profile overview" msgstr "" -#: forum/views/users.py:903 +#: forum/views/users.py:904 msgid "recent user activity" msgstr "" -#: forum/views/users.py:904 +#: forum/views/users.py:905 msgid "profile - recent activity" msgstr "" -#: forum/views/users.py:913 +#: forum/views/users.py:914 msgid "profile - responses" msgstr "" -#: forum/views/users.py:921 +#: forum/views/users.py:922 msgid "user reputation in the community" msgstr "" -#: forum/views/users.py:922 +#: forum/views/users.py:923 msgid "profile - user reputation" msgstr "" -#: forum/views/users.py:928 +#: forum/views/users.py:929 msgid "favorite questions" msgstr "" -#: forum/views/users.py:929 +#: forum/views/users.py:930 msgid "users favorite questions" msgstr "" -#: forum/views/users.py:930 +#: forum/views/users.py:931 msgid "profile - favorite questions" msgstr "" -#: forum/views/users.py:939 +#: forum/views/users.py:940 msgid "profile - votes" msgstr "" -#: forum/views/users.py:948 +#: forum/views/users.py:949 msgid "profile - email subscriptions" msgstr "" -- cgit v1.2.3-1-g7c22 From 9dac785a3416e3472a69155247ad5d5af58636db Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sat, 24 Apr 2010 16:59:29 -0400 Subject: preparing to fix fulltext search - some simple migrations --- forum/migrations/0001_initial.py | 780 +++++++++++++++++++++ ...t__chg_field_answer_html__add_field_question.py | 368 ++++++++++ ...orm_text_record_to_posts_for_fulltext_search.py | 354 ++++++++++ forum/migrations/__init__.py | 0 forum/models/answer.py | 4 +- forum/models/base.py | 40 +- forum/models/question.py | 4 +- 7 files changed, 1526 insertions(+), 24 deletions(-) create mode 100644 forum/migrations/0001_initial.py create mode 100644 forum/migrations/0002_auto__add_field_answer_text__chg_field_answer_html__add_field_question.py create mode 100644 forum/migrations/0003_copy_denorm_text_record_to_posts_for_fulltext_search.py create mode 100644 forum/migrations/__init__.py diff --git a/forum/migrations/0001_initial.py b/forum/migrations/0001_initial.py new file mode 100644 index 00000000..e6350446 --- /dev/null +++ b/forum/migrations/0001_initial.py @@ -0,0 +1,780 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding model 'Vote' + db.create_table(u'vote', ( + ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()), + ('voted_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='votes', to=orm['auth.User'])), + ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])), + ('vote', self.gf('django.db.models.fields.SmallIntegerField')()), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + )) + db.send_create_signal('forum', ['Vote']) + + # Adding unique constraint on 'Vote', fields ['content_type', 'object_id', 'user'] + db.create_unique(u'vote', ['content_type_id', 'object_id', 'user_id']) + + # Adding model 'FlaggedItem' + db.create_table(u'flagged_item', ( + ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()), + ('flagged_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='flaggeditems', to=orm['auth.User'])), + )) + db.send_create_signal('forum', ['FlaggedItem']) + + # Adding unique constraint on 'FlaggedItem', fields ['content_type', 'object_id', 'user'] + db.create_unique(u'flagged_item', ['content_type_id', 'object_id', 'user_id']) + + # Adding model 'Comment' + db.create_table(u'comment', ( + ('comment', self.gf('django.db.models.fields.CharField')(max_length=300)), + ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()), + ('added_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='comments', to=orm['auth.User'])), + )) + db.send_create_signal('forum', ['Comment']) + + # Adding model 'Tag' + db.create_table(u'tag', ( + ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), + ('deleted', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('created_by', self.gf('django.db.models.fields.related.ForeignKey')(related_name='created_tags', to=orm['auth.User'])), + ('deleted_by', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='deleted_tags', null=True, to=orm['auth.User'])), + ('used_count', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)), + ('deleted_at', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + )) + db.send_create_signal('forum', ['Tag']) + + # Adding model 'MarkedTag' + db.create_table('forum_markedtag', ( + ('reason', self.gf('django.db.models.fields.CharField')(max_length=16)), + ('tag', self.gf('django.db.models.fields.related.ForeignKey')(related_name='user_selections', to=orm['forum.Tag'])), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='tag_selections', to=orm['auth.User'])), + )) + db.send_create_signal('forum', ['MarkedTag']) + + # Adding model 'Question' + db.create_table(u'question', ( + ('wiki', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('vote_up_count', self.gf('django.db.models.fields.IntegerField')(default=0)), + ('answer_accepted', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('offensive_flag_count', self.gf('django.db.models.fields.SmallIntegerField')(default=0)), + ('closed_at', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + ('deleted_at', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('last_activity_by', self.gf('django.db.models.fields.related.ForeignKey')(related_name='last_active_in_questions', to=orm['auth.User'])), + ('view_count', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)), + ('locked_at', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + ('score', self.gf('django.db.models.fields.IntegerField')(default=0)), + ('author', self.gf('django.db.models.fields.related.ForeignKey')(related_name='questions', to=orm['auth.User'])), + ('comment_count', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)), + ('html', self.gf('django.db.models.fields.TextField')()), + ('vote_down_count', self.gf('django.db.models.fields.IntegerField')(default=0)), + ('closed', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('last_edited_by', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='last_edited_questions', null=True, to=orm['auth.User'])), + ('favourite_count', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)), + ('deleted', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('summary', self.gf('django.db.models.fields.CharField')(max_length=180)), + ('answer_count', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)), + ('last_activity_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('closed_by', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='closed_questions', null=True, to=orm['auth.User'])), + ('close_reason', self.gf('django.db.models.fields.SmallIntegerField')(null=True, blank=True)), + ('locked', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('tagnames', self.gf('django.db.models.fields.CharField')(max_length=125)), + ('locked_by', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='locked_questions', null=True, to=orm['auth.User'])), + ('added_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('deleted_by', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='deleted_questions', null=True, to=orm['auth.User'])), + ('wikified_at', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + ('title', self.gf('django.db.models.fields.CharField')(max_length=300)), + ('last_edited_at', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + )) + db.send_create_signal('forum', ['Question']) + + # Adding M2M table for field followed_by on 'Question' + db.create_table(u'question_followed_by', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('question', models.ForeignKey(orm['forum.question'], null=False)), + ('user', models.ForeignKey(orm['auth.user'], null=False)) + )) + db.create_unique(u'question_followed_by', ['question_id', 'user_id']) + + # Adding M2M table for field tags on 'Question' + db.create_table(u'question_tags', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('question', models.ForeignKey(orm['forum.question'], null=False)), + ('tag', models.ForeignKey(orm['forum.tag'], null=False)) + )) + db.create_unique(u'question_tags', ['question_id', 'tag_id']) + + # Adding model 'QuestionView' + db.create_table('forum_questionview', ( + ('when', self.gf('django.db.models.fields.DateTimeField')()), + ('who', self.gf('django.db.models.fields.related.ForeignKey')(related_name='question_views', to=orm['auth.User'])), + ('question', self.gf('django.db.models.fields.related.ForeignKey')(related_name='viewed', to=orm['forum.Question'])), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + )) + db.send_create_signal('forum', ['QuestionView']) + + # Adding model 'FavoriteQuestion' + db.create_table(u'favorite_question', ( + ('question', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['forum.Question'])), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('added_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='user_favorite_questions', to=orm['auth.User'])), + )) + db.send_create_signal('forum', ['FavoriteQuestion']) + + # Adding model 'QuestionRevision' + db.create_table(u'question_revision', ( + ('author', self.gf('django.db.models.fields.related.ForeignKey')(related_name='questionrevisions', to=orm['auth.User'])), + ('tagnames', self.gf('django.db.models.fields.CharField')(max_length=125)), + ('text', self.gf('django.db.models.fields.TextField')()), + ('title', self.gf('django.db.models.fields.CharField')(max_length=300)), + ('question', self.gf('django.db.models.fields.related.ForeignKey')(related_name='revisions', to=orm['forum.Question'])), + ('revised_at', self.gf('django.db.models.fields.DateTimeField')()), + ('summary', self.gf('django.db.models.fields.CharField')(max_length=300, blank=True)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('revision', self.gf('django.db.models.fields.PositiveIntegerField')()), + )) + db.send_create_signal('forum', ['QuestionRevision']) + + # Adding model 'AnonymousQuestion' + db.create_table('forum_anonymousquestion', ( + ('wiki', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('ip_addr', self.gf('django.db.models.fields.IPAddressField')(max_length=15)), + ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True)), + ('tagnames', self.gf('django.db.models.fields.CharField')(max_length=125)), + ('text', self.gf('django.db.models.fields.TextField')()), + ('title', self.gf('django.db.models.fields.CharField')(max_length=300)), + ('added_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('summary', self.gf('django.db.models.fields.CharField')(max_length=180)), + ('session_key', self.gf('django.db.models.fields.CharField')(max_length=40)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + )) + db.send_create_signal('forum', ['AnonymousQuestion']) + + # Adding model 'Answer' + db.create_table(u'answer', ( + ('wiki', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('vote_up_count', self.gf('django.db.models.fields.IntegerField')(default=0)), + ('offensive_flag_count', self.gf('django.db.models.fields.SmallIntegerField')(default=0)), + ('deleted_at', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('locked_at', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + ('score', self.gf('django.db.models.fields.IntegerField')(default=0)), + ('author', self.gf('django.db.models.fields.related.ForeignKey')(related_name='answers', to=orm['auth.User'])), + ('question', self.gf('django.db.models.fields.related.ForeignKey')(related_name='answers', to=orm['forum.Question'])), + ('comment_count', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)), + ('html', self.gf('django.db.models.fields.TextField')()), + ('vote_down_count', self.gf('django.db.models.fields.IntegerField')(default=0)), + ('last_edited_by', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='last_edited_answers', null=True, to=orm['auth.User'])), + ('accepted_at', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + ('deleted', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('accepted', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('locked', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('locked_by', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='locked_answers', null=True, to=orm['auth.User'])), + ('added_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('deleted_by', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='deleted_answers', null=True, to=orm['auth.User'])), + ('wikified_at', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + ('last_edited_at', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + )) + db.send_create_signal('forum', ['Answer']) + + # Adding model 'AnswerRevision' + db.create_table(u'answer_revision', ( + ('author', self.gf('django.db.models.fields.related.ForeignKey')(related_name='answerrevisions', to=orm['auth.User'])), + ('text', self.gf('django.db.models.fields.TextField')()), + ('revised_at', self.gf('django.db.models.fields.DateTimeField')()), + ('summary', self.gf('django.db.models.fields.CharField')(max_length=300, blank=True)), + ('answer', self.gf('django.db.models.fields.related.ForeignKey')(related_name='revisions', to=orm['forum.Answer'])), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('revision', self.gf('django.db.models.fields.PositiveIntegerField')()), + )) + db.send_create_signal('forum', ['AnswerRevision']) + + # Adding model 'AnonymousAnswer' + db.create_table('forum_anonymousanswer', ( + ('wiki', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('ip_addr', self.gf('django.db.models.fields.IPAddressField')(max_length=15)), + ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True)), + ('text', self.gf('django.db.models.fields.TextField')()), + ('question', self.gf('django.db.models.fields.related.ForeignKey')(related_name='anonymous_answers', to=orm['forum.Question'])), + ('added_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('summary', self.gf('django.db.models.fields.CharField')(max_length=180)), + ('session_key', self.gf('django.db.models.fields.CharField')(max_length=40)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + )) + db.send_create_signal('forum', ['AnonymousAnswer']) + + # Adding model 'Activity' + db.create_table(u'activity', ( + ('is_auditted', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), + ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])), + ('active_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('activity_type', self.gf('django.db.models.fields.SmallIntegerField')()), + )) + db.send_create_signal('forum', ['Activity']) + + # Adding model 'EmailFeedSetting' + db.create_table('forum_emailfeedsetting', ( + ('reported_at', self.gf('django.db.models.fields.DateTimeField')(null=True)), + ('added_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), + ('subscriber', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), + ('feed_type', self.gf('django.db.models.fields.CharField')(max_length=16)), + ('frequency', self.gf('django.db.models.fields.CharField')(default='n', max_length=8)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + )) + db.send_create_signal('forum', ['EmailFeedSetting']) + + # Adding model 'ValidationHash' + db.create_table('forum_validationhash', ( + ('hash_code', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), + ('seed', self.gf('django.db.models.fields.CharField')(max_length=12)), + ('expiration', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2010, 4, 25, 13, 14, 41, 581000))), + ('type', self.gf('django.db.models.fields.CharField')(max_length=12)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), + )) + db.send_create_signal('forum', ['ValidationHash']) + + # Adding unique constraint on 'ValidationHash', fields ['user', 'type'] + db.create_unique('forum_validationhash', ['user_id', 'type']) + + # Adding model 'AuthKeyUserAssociation' + db.create_table('forum_authkeyuserassociation', ( + ('added_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='auth_keys', to=orm['auth.User'])), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('key', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), + ('provider', self.gf('django.db.models.fields.CharField')(max_length=64)), + )) + db.send_create_signal('forum', ['AuthKeyUserAssociation']) + + # Adding model 'Badge' + db.create_table(u'badge', ( + ('multiple', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('description', self.gf('django.db.models.fields.CharField')(max_length=300)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('awarded_count', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)), + ('type', self.gf('django.db.models.fields.SmallIntegerField')()), + ('slug', self.gf('django.db.models.fields.SlugField')(db_index=True, max_length=50, blank=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=50)), + )) + db.send_create_signal('forum', ['Badge']) + + # Adding unique constraint on 'Badge', fields ['name', 'type'] + db.create_unique(u'badge', ['name', 'type']) + + # Adding model 'Award' + db.create_table(u'award', ( + ('awarded_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('notified', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), + ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='award_user', to=orm['auth.User'])), + ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])), + ('badge', self.gf('django.db.models.fields.related.ForeignKey')(related_name='award_badge', to=orm['forum.Badge'])), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + )) + db.send_create_signal('forum', ['Award']) + + # Adding model 'Repute' + db.create_table(u'repute', ( + ('positive', self.gf('django.db.models.fields.SmallIntegerField')(default=0)), + ('question', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['forum.Question'])), + ('negative', self.gf('django.db.models.fields.SmallIntegerField')(default=0)), + ('reputation_type', self.gf('django.db.models.fields.SmallIntegerField')()), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), + ('reputed_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('reputation', self.gf('django.db.models.fields.IntegerField')(default=1)), + )) + db.send_create_signal('forum', ['Repute']) + + # Adding model 'Book' + db.create_table(u'book', ( + ('publication', self.gf('django.db.models.fields.CharField')(max_length=255)), + ('short_name', self.gf('django.db.models.fields.CharField')(max_length=255)), + ('author', self.gf('django.db.models.fields.CharField')(max_length=255)), + ('cover_img', self.gf('django.db.models.fields.CharField')(max_length=255)), + ('price', self.gf('django.db.models.fields.DecimalField')(max_digits=6, decimal_places=2)), + ('title', self.gf('django.db.models.fields.CharField')(max_length=255)), + ('added_at', self.gf('django.db.models.fields.DateTimeField')()), + ('pages', self.gf('django.db.models.fields.SmallIntegerField')()), + ('tagnames', self.gf('django.db.models.fields.CharField')(max_length=125)), + ('published_at', self.gf('django.db.models.fields.DateTimeField')()), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('last_edited_at', self.gf('django.db.models.fields.DateTimeField')()), + )) + db.send_create_signal('forum', ['Book']) + + # Adding M2M table for field questions on 'Book' + db.create_table('book_question', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('book', models.ForeignKey(orm['forum.book'], null=False)), + ('question', models.ForeignKey(orm['forum.question'], null=False)) + )) + db.create_unique('book_question', ['book_id', 'question_id']) + + # Adding model 'BookAuthorInfo' + db.create_table(u'book_author_info', ( + ('added_at', self.gf('django.db.models.fields.DateTimeField')()), + ('book', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['forum.Book'])), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), + ('blog_url', self.gf('django.db.models.fields.CharField')(max_length=255)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('last_edited_at', self.gf('django.db.models.fields.DateTimeField')()), + )) + db.send_create_signal('forum', ['BookAuthorInfo']) + + # Adding model 'BookAuthorRss' + db.create_table(u'book_author_rss', ( + ('title', self.gf('django.db.models.fields.CharField')(max_length=255)), + ('url', self.gf('django.db.models.fields.CharField')(max_length=255)), + ('added_at', self.gf('django.db.models.fields.DateTimeField')()), + ('book', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['forum.Book'])), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), + ('rss_created_at', self.gf('django.db.models.fields.DateTimeField')()), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + )) + db.send_create_signal('forum', ['BookAuthorRss']) + + + def backwards(self, orm): + + # Deleting model 'Vote' + db.delete_table(u'vote') + + # Removing unique constraint on 'Vote', fields ['content_type', 'object_id', 'user'] + db.delete_unique(u'vote', ['content_type_id', 'object_id', 'user_id']) + + # Deleting model 'FlaggedItem' + db.delete_table(u'flagged_item') + + # Removing unique constraint on 'FlaggedItem', fields ['content_type', 'object_id', 'user'] + db.delete_unique(u'flagged_item', ['content_type_id', 'object_id', 'user_id']) + + # Deleting model 'Comment' + db.delete_table(u'comment') + + # Deleting model 'Tag' + db.delete_table(u'tag') + + # Deleting model 'MarkedTag' + db.delete_table('forum_markedtag') + + # Deleting model 'Question' + db.delete_table(u'question') + + # Removing M2M table for field followed_by on 'Question' + db.delete_table('question_followed_by') + + # Removing M2M table for field tags on 'Question' + db.delete_table('question_tags') + + # Deleting model 'QuestionView' + db.delete_table('forum_questionview') + + # Deleting model 'FavoriteQuestion' + db.delete_table(u'favorite_question') + + # Deleting model 'QuestionRevision' + db.delete_table(u'question_revision') + + # Deleting model 'AnonymousQuestion' + db.delete_table('forum_anonymousquestion') + + # Deleting model 'Answer' + db.delete_table(u'answer') + + # Deleting model 'AnswerRevision' + db.delete_table(u'answer_revision') + + # Deleting model 'AnonymousAnswer' + db.delete_table('forum_anonymousanswer') + + # Deleting model 'Activity' + db.delete_table(u'activity') + + # Deleting model 'EmailFeedSetting' + db.delete_table('forum_emailfeedsetting') + + # Deleting model 'ValidationHash' + db.delete_table('forum_validationhash') + + # Removing unique constraint on 'ValidationHash', fields ['user', 'type'] + db.delete_unique('forum_validationhash', ['user_id', 'type']) + + # Deleting model 'AuthKeyUserAssociation' + db.delete_table('forum_authkeyuserassociation') + + # Deleting model 'Badge' + db.delete_table(u'badge') + + # Removing unique constraint on 'Badge', fields ['name', 'type'] + db.delete_unique(u'badge', ['name', 'type']) + + # Deleting model 'Award' + db.delete_table(u'award') + + # Deleting model 'Repute' + db.delete_table(u'repute') + + # Deleting model 'Book' + db.delete_table(u'book') + + # Removing M2M table for field questions on 'Book' + db.delete_table('book_question') + + # Deleting model 'BookAuthorInfo' + db.delete_table(u'book_author_info') + + # Deleting model 'BookAuthorRss' + db.delete_table(u'book_author_rss') + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'about': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'bronze': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'date_of_birth': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'email_isvalid': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'email_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'gold': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'gravatar': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), + 'hide_ignored_questions': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), + 'is_approved': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'location': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'questions_per_page': ('django.db.models.fields.SmallIntegerField', [], {'default': '10'}), + 'real_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), + 'reputation': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}), + 'silver': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'tag_filter_setting': ('django.db.models.fields.CharField', [], {'default': "'ignored'", 'max_length': '16'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}), + 'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'forum.activity': { + 'Meta': {'object_name': 'Activity', 'db_table': "u'activity'"}, + 'active_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'activity_type': ('django.db.models.fields.SmallIntegerField', [], {}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_auditted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.anonymousanswer': { + 'Meta': {'object_name': 'AnonymousAnswer'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'ip_addr': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'anonymous_answers'", 'to': "orm['forum.Question']"}), + 'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), + 'text': ('django.db.models.fields.TextField', [], {}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}) + }, + 'forum.anonymousquestion': { + 'Meta': {'object_name': 'AnonymousQuestion'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'ip_addr': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}), + 'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'text': ('django.db.models.fields.TextField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}) + }, + 'forum.answer': { + 'Meta': {'object_name': 'Answer', 'db_table': "u'answer'"}, + 'accepted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'accepted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['auth.User']"}), + 'comment_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_answers'", 'null': 'True', 'to': "orm['auth.User']"}), + 'html': ('django.db.models.fields.TextField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'last_edited_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_edited_answers'", 'null': 'True', 'to': "orm['auth.User']"}), + 'locked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'locked_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'locked_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'locked_answers'", 'null': 'True', 'to': "orm['auth.User']"}), + 'offensive_flag_count': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['forum.Question']"}), + 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'vote_down_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'vote_up_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'wikified_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) + }, + 'forum.answerrevision': { + 'Meta': {'object_name': 'AnswerRevision', 'db_table': "u'answer_revision'"}, + 'answer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'revisions'", 'to': "orm['forum.Answer']"}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answerrevisions'", 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'revised_at': ('django.db.models.fields.DateTimeField', [], {}), + 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}), + 'text': ('django.db.models.fields.TextField', [], {}) + }, + 'forum.authkeyuserassociation': { + 'Meta': {'object_name': 'AuthKeyUserAssociation'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'provider': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'auth_keys'", 'to': "orm['auth.User']"}) + }, + 'forum.award': { + 'Meta': {'object_name': 'Award', 'db_table': "u'award'"}, + 'awarded_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'badge': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'award_badge'", 'to': "orm['forum.Badge']"}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'notified': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'award_user'", 'to': "orm['auth.User']"}) + }, + 'forum.badge': { + 'Meta': {'unique_together': "(('name', 'type'),)", 'object_name': 'Badge', 'db_table': "u'badge'"}, + 'awarded_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'awarded_to': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'badges'", 'through': "'Award'", 'to': "orm['auth.User']"}), + 'description': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'multiple': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), + 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '50', 'blank': 'True'}), + 'type': ('django.db.models.fields.SmallIntegerField', [], {}) + }, + 'forum.book': { + 'Meta': {'object_name': 'Book', 'db_table': "u'book'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {}), + 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'cover_img': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {}), + 'pages': ('django.db.models.fields.SmallIntegerField', [], {}), + 'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}), + 'publication': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'published_at': ('django.db.models.fields.DateTimeField', [], {}), + 'questions': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'book'", 'db_table': "'book_question'", 'to': "orm['forum.Question']"}), + 'short_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.bookauthorinfo': { + 'Meta': {'object_name': 'BookAuthorInfo', 'db_table': "u'book_author_info'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {}), + 'blog_url': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Book']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.bookauthorrss': { + 'Meta': {'object_name': 'BookAuthorRss', 'db_table': "u'book_author_rss'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {}), + 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Book']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'rss_created_at': ('django.db.models.fields.DateTimeField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'url': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.comment': { + 'Meta': {'object_name': 'Comment', 'db_table': "u'comment'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'comment': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'comments'", 'to': "orm['auth.User']"}) + }, + 'forum.emailfeedsetting': { + 'Meta': {'object_name': 'EmailFeedSetting'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'feed_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'frequency': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '8'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'reported_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), + 'subscriber': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.favoritequestion': { + 'Meta': {'object_name': 'FavoriteQuestion', 'db_table': "u'favorite_question'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Question']"}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_favorite_questions'", 'to': "orm['auth.User']"}) + }, + 'forum.flaggeditem': { + 'Meta': {'unique_together': "(('content_type', 'object_id', 'user'),)", 'object_name': 'FlaggedItem', 'db_table': "u'flagged_item'"}, + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'flagged_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'flaggeditems'", 'to': "orm['auth.User']"}) + }, + 'forum.markedtag': { + 'Meta': {'object_name': 'MarkedTag'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'reason': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_selections'", 'to': "orm['forum.Tag']"}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tag_selections'", 'to': "orm['auth.User']"}) + }, + 'forum.question': { + 'Meta': {'object_name': 'Question', 'db_table': "u'question'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'answer_accepted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'answer_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'questions'", 'to': "orm['auth.User']"}), + 'close_reason': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'}), + 'closed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'closed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'closed_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'closed_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'comment_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'favorited_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'favorite_questions'", 'through': "'FavoriteQuestion'", 'to': "orm['auth.User']"}), + 'favourite_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'followed_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'followed_questions'", 'to': "orm['auth.User']"}), + 'html': ('django.db.models.fields.TextField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_activity_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_activity_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'last_active_in_questions'", 'to': "orm['auth.User']"}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'last_edited_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_edited_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'locked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'locked_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'locked_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'locked_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'offensive_flag_count': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'questions'", 'to': "orm['forum.Tag']"}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'vote_down_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'vote_up_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'wikified_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) + }, + 'forum.questionrevision': { + 'Meta': {'object_name': 'QuestionRevision', 'db_table': "u'question_revision'"}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'questionrevisions'", 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'revisions'", 'to': "orm['forum.Question']"}), + 'revised_at': ('django.db.models.fields.DateTimeField', [], {}), + 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'text': ('django.db.models.fields.TextField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}) + }, + 'forum.questionview': { + 'Meta': {'object_name': 'QuestionView'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'viewed'", 'to': "orm['forum.Question']"}), + 'when': ('django.db.models.fields.DateTimeField', [], {}), + 'who': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'question_views'", 'to': "orm['auth.User']"}) + }, + 'forum.repute': { + 'Meta': {'object_name': 'Repute', 'db_table': "u'repute'"}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'negative': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'positive': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Question']"}), + 'reputation': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'reputation_type': ('django.db.models.fields.SmallIntegerField', [], {}), + 'reputed_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.tag': { + 'Meta': {'object_name': 'Tag', 'db_table': "u'tag'"}, + 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'created_tags'", 'to': "orm['auth.User']"}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_tags'", 'null': 'True', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'used_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}) + }, + 'forum.validationhash': { + 'Meta': {'unique_together': "(('user', 'type'),)", 'object_name': 'ValidationHash'}, + 'expiration': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2010, 4, 25, 13, 14, 41, 714642)'}), + 'hash_code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'seed': ('django.db.models.fields.CharField', [], {'max_length': '12'}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '12'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.vote': { + 'Meta': {'unique_together': "(('content_type', 'object_id', 'user'),)", 'object_name': 'Vote', 'db_table': "u'vote'"}, + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'votes'", 'to': "orm['auth.User']"}), + 'vote': ('django.db.models.fields.SmallIntegerField', [], {}), + 'voted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}) + } + } + + complete_apps = ['forum'] diff --git a/forum/migrations/0002_auto__add_field_answer_text__chg_field_answer_html__add_field_question.py b/forum/migrations/0002_auto__add_field_answer_text__chg_field_answer_html__add_field_question.py new file mode 100644 index 00000000..d703c161 --- /dev/null +++ b/forum/migrations/0002_auto__add_field_answer_text__chg_field_answer_html__add_field_question.py @@ -0,0 +1,368 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding field 'Answer.text' + db.add_column(u'answer', 'text', self.gf('django.db.models.fields.TextField')(null=True), keep_default=False) + + # Changing field 'Answer.html' + db.alter_column(u'answer', 'html', self.gf('django.db.models.fields.TextField')(null=True)) + + # Adding field 'Question.text' + db.add_column(u'question', 'text', self.gf('django.db.models.fields.TextField')(null=True), keep_default=False) + + # Changing field 'Question.html' + db.alter_column(u'question', 'html', self.gf('django.db.models.fields.TextField')(null=True)) + + + def backwards(self, orm): + + # Deleting field 'Answer.text' + db.delete_column(u'answer', 'text') + + # Changing field 'Answer.html' + db.alter_column(u'answer', 'html', self.gf('django.db.models.fields.TextField')()) + + # Deleting field 'Question.text' + db.delete_column(u'question', 'text') + + # Changing field 'Question.html' + db.alter_column(u'question', 'html', self.gf('django.db.models.fields.TextField')()) + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'about': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'bronze': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'date_of_birth': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'email_isvalid': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'email_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'gold': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'gravatar': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), + 'hide_ignored_questions': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), + 'is_approved': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'location': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'questions_per_page': ('django.db.models.fields.SmallIntegerField', [], {'default': '10'}), + 'real_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), + 'reputation': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}), + 'silver': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'tag_filter_setting': ('django.db.models.fields.CharField', [], {'default': "'ignored'", 'max_length': '16'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}), + 'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'forum.activity': { + 'Meta': {'object_name': 'Activity', 'db_table': "u'activity'"}, + 'active_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'activity_type': ('django.db.models.fields.SmallIntegerField', [], {}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_auditted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.anonymousanswer': { + 'Meta': {'object_name': 'AnonymousAnswer'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'ip_addr': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'anonymous_answers'", 'to': "orm['forum.Question']"}), + 'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), + 'text': ('django.db.models.fields.TextField', [], {}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}) + }, + 'forum.anonymousquestion': { + 'Meta': {'object_name': 'AnonymousQuestion'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'ip_addr': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}), + 'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'text': ('django.db.models.fields.TextField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}) + }, + 'forum.answer': { + 'Meta': {'object_name': 'Answer', 'db_table': "u'answer'"}, + 'accepted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'accepted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['auth.User']"}), + 'comment_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_answers'", 'null': 'True', 'to': "orm['auth.User']"}), + 'html': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'last_edited_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_edited_answers'", 'null': 'True', 'to': "orm['auth.User']"}), + 'locked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'locked_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'locked_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'locked_answers'", 'null': 'True', 'to': "orm['auth.User']"}), + 'offensive_flag_count': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['forum.Question']"}), + 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'text': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'vote_down_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'vote_up_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'wikified_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) + }, + 'forum.answerrevision': { + 'Meta': {'object_name': 'AnswerRevision', 'db_table': "u'answer_revision'"}, + 'answer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'revisions'", 'to': "orm['forum.Answer']"}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answerrevisions'", 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'revised_at': ('django.db.models.fields.DateTimeField', [], {}), + 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}), + 'text': ('django.db.models.fields.TextField', [], {}) + }, + 'forum.authkeyuserassociation': { + 'Meta': {'object_name': 'AuthKeyUserAssociation'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'provider': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'auth_keys'", 'to': "orm['auth.User']"}) + }, + 'forum.award': { + 'Meta': {'object_name': 'Award', 'db_table': "u'award'"}, + 'awarded_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'badge': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'award_badge'", 'to': "orm['forum.Badge']"}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'notified': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'award_user'", 'to': "orm['auth.User']"}) + }, + 'forum.badge': { + 'Meta': {'unique_together': "(('name', 'type'),)", 'object_name': 'Badge', 'db_table': "u'badge'"}, + 'awarded_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'awarded_to': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'badges'", 'through': "'Award'", 'to': "orm['auth.User']"}), + 'description': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'multiple': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), + 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '50', 'blank': 'True'}), + 'type': ('django.db.models.fields.SmallIntegerField', [], {}) + }, + 'forum.book': { + 'Meta': {'object_name': 'Book', 'db_table': "u'book'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {}), + 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'cover_img': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {}), + 'pages': ('django.db.models.fields.SmallIntegerField', [], {}), + 'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}), + 'publication': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'published_at': ('django.db.models.fields.DateTimeField', [], {}), + 'questions': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'book'", 'db_table': "'book_question'", 'to': "orm['forum.Question']"}), + 'short_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.bookauthorinfo': { + 'Meta': {'object_name': 'BookAuthorInfo', 'db_table': "u'book_author_info'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {}), + 'blog_url': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Book']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.bookauthorrss': { + 'Meta': {'object_name': 'BookAuthorRss', 'db_table': "u'book_author_rss'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {}), + 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Book']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'rss_created_at': ('django.db.models.fields.DateTimeField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'url': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.comment': { + 'Meta': {'object_name': 'Comment', 'db_table': "u'comment'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'comment': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'comments'", 'to': "orm['auth.User']"}) + }, + 'forum.emailfeedsetting': { + 'Meta': {'object_name': 'EmailFeedSetting'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'feed_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'frequency': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '8'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'reported_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), + 'subscriber': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.favoritequestion': { + 'Meta': {'object_name': 'FavoriteQuestion', 'db_table': "u'favorite_question'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Question']"}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_favorite_questions'", 'to': "orm['auth.User']"}) + }, + 'forum.flaggeditem': { + 'Meta': {'unique_together': "(('content_type', 'object_id', 'user'),)", 'object_name': 'FlaggedItem', 'db_table': "u'flagged_item'"}, + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'flagged_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'flaggeditems'", 'to': "orm['auth.User']"}) + }, + 'forum.markedtag': { + 'Meta': {'object_name': 'MarkedTag'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'reason': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_selections'", 'to': "orm['forum.Tag']"}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tag_selections'", 'to': "orm['auth.User']"}) + }, + 'forum.question': { + 'Meta': {'object_name': 'Question', 'db_table': "u'question'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'answer_accepted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'answer_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'questions'", 'to': "orm['auth.User']"}), + 'close_reason': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'}), + 'closed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'closed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'closed_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'closed_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'comment_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'favorited_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'favorite_questions'", 'through': "'FavoriteQuestion'", 'to': "orm['auth.User']"}), + 'favourite_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'followed_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'followed_questions'", 'to': "orm['auth.User']"}), + 'html': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_activity_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_activity_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'last_active_in_questions'", 'to': "orm['auth.User']"}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'last_edited_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_edited_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'locked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'locked_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'locked_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'locked_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'offensive_flag_count': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'questions'", 'to': "orm['forum.Tag']"}), + 'text': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'vote_down_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'vote_up_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'wikified_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) + }, + 'forum.questionrevision': { + 'Meta': {'object_name': 'QuestionRevision', 'db_table': "u'question_revision'"}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'questionrevisions'", 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'revisions'", 'to': "orm['forum.Question']"}), + 'revised_at': ('django.db.models.fields.DateTimeField', [], {}), + 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'text': ('django.db.models.fields.TextField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}) + }, + 'forum.questionview': { + 'Meta': {'object_name': 'QuestionView'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'viewed'", 'to': "orm['forum.Question']"}), + 'when': ('django.db.models.fields.DateTimeField', [], {}), + 'who': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'question_views'", 'to': "orm['auth.User']"}) + }, + 'forum.repute': { + 'Meta': {'object_name': 'Repute', 'db_table': "u'repute'"}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'negative': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'positive': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Question']"}), + 'reputation': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'reputation_type': ('django.db.models.fields.SmallIntegerField', [], {}), + 'reputed_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.tag': { + 'Meta': {'object_name': 'Tag', 'db_table': "u'tag'"}, + 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'created_tags'", 'to': "orm['auth.User']"}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_tags'", 'null': 'True', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'used_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}) + }, + 'forum.validationhash': { + 'Meta': {'unique_together': "(('user', 'type'),)", 'object_name': 'ValidationHash'}, + 'expiration': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2010, 4, 25, 16, 21, 32, 856067)'}), + 'hash_code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'seed': ('django.db.models.fields.CharField', [], {'max_length': '12'}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '12'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.vote': { + 'Meta': {'unique_together': "(('content_type', 'object_id', 'user'),)", 'object_name': 'Vote', 'db_table': "u'vote'"}, + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'votes'", 'to': "orm['auth.User']"}), + 'vote': ('django.db.models.fields.SmallIntegerField', [], {}), + 'voted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}) + } + } + + complete_apps = ['forum'] diff --git a/forum/migrations/0003_copy_denorm_text_record_to_posts_for_fulltext_search.py b/forum/migrations/0003_copy_denorm_text_record_to_posts_for_fulltext_search.py new file mode 100644 index 00000000..3e79b9d2 --- /dev/null +++ b/forum/migrations/0003_copy_denorm_text_record_to_posts_for_fulltext_search.py @@ -0,0 +1,354 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import DataMigration +from django.db import models +from forum.models import Question, Answer + +class Migration(DataMigration): + + def forwards(self, orm): + "Write your forwards methods here." + for q in orm.Question.objects.all(): + r = q.revisions.all()[0] #cannot use get_latest_revision() + q.text = r.text + q.save() + for a in orm.Answer.objects.all(): + r = a.revisions.all()[0] + a.text = r.text + a.save() + + def backwards(self, orm): + "Write your backwards methods here." + pass#there's no need to clean data here, just delete columns + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'about': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'bronze': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'date_of_birth': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'email_isvalid': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'email_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'gold': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'gravatar': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), + 'hide_ignored_questions': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), + 'is_approved': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'location': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'questions_per_page': ('django.db.models.fields.SmallIntegerField', [], {'default': '10'}), + 'real_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), + 'reputation': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}), + 'silver': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'tag_filter_setting': ('django.db.models.fields.CharField', [], {'default': "'ignored'", 'max_length': '16'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}), + 'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'forum.activity': { + 'Meta': {'object_name': 'Activity', 'db_table': "u'activity'"}, + 'active_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'activity_type': ('django.db.models.fields.SmallIntegerField', [], {}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_auditted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.anonymousanswer': { + 'Meta': {'object_name': 'AnonymousAnswer'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'ip_addr': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'anonymous_answers'", 'to': "orm['forum.Question']"}), + 'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), + 'text': ('django.db.models.fields.TextField', [], {}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}) + }, + 'forum.anonymousquestion': { + 'Meta': {'object_name': 'AnonymousQuestion'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'ip_addr': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}), + 'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'text': ('django.db.models.fields.TextField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}) + }, + 'forum.answer': { + 'Meta': {'object_name': 'Answer', 'db_table': "u'answer'"}, + 'accepted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'accepted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['auth.User']"}), + 'comment_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_answers'", 'null': 'True', 'to': "orm['auth.User']"}), + 'html': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'last_edited_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_edited_answers'", 'null': 'True', 'to': "orm['auth.User']"}), + 'locked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'locked_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'locked_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'locked_answers'", 'null': 'True', 'to': "orm['auth.User']"}), + 'offensive_flag_count': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['forum.Question']"}), + 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'text': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'vote_down_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'vote_up_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'wikified_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) + }, + 'forum.answerrevision': { + 'Meta': {'object_name': 'AnswerRevision', 'db_table': "u'answer_revision'"}, + 'answer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'revisions'", 'to': "orm['forum.Answer']"}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answerrevisions'", 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'revised_at': ('django.db.models.fields.DateTimeField', [], {}), + 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}), + 'text': ('django.db.models.fields.TextField', [], {}) + }, + 'forum.authkeyuserassociation': { + 'Meta': {'object_name': 'AuthKeyUserAssociation'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'provider': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'auth_keys'", 'to': "orm['auth.User']"}) + }, + 'forum.award': { + 'Meta': {'object_name': 'Award', 'db_table': "u'award'"}, + 'awarded_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'badge': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'award_badge'", 'to': "orm['forum.Badge']"}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'notified': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'award_user'", 'to': "orm['auth.User']"}) + }, + 'forum.badge': { + 'Meta': {'unique_together': "(('name', 'type'),)", 'object_name': 'Badge', 'db_table': "u'badge'"}, + 'awarded_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'awarded_to': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'badges'", 'through': "'Award'", 'to': "orm['auth.User']"}), + 'description': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'multiple': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), + 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '50', 'blank': 'True'}), + 'type': ('django.db.models.fields.SmallIntegerField', [], {}) + }, + 'forum.book': { + 'Meta': {'object_name': 'Book', 'db_table': "u'book'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {}), + 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'cover_img': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {}), + 'pages': ('django.db.models.fields.SmallIntegerField', [], {}), + 'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}), + 'publication': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'published_at': ('django.db.models.fields.DateTimeField', [], {}), + 'questions': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'book'", 'db_table': "'book_question'", 'to': "orm['forum.Question']"}), + 'short_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.bookauthorinfo': { + 'Meta': {'object_name': 'BookAuthorInfo', 'db_table': "u'book_author_info'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {}), + 'blog_url': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Book']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.bookauthorrss': { + 'Meta': {'object_name': 'BookAuthorRss', 'db_table': "u'book_author_rss'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {}), + 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Book']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'rss_created_at': ('django.db.models.fields.DateTimeField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'url': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.comment': { + 'Meta': {'object_name': 'Comment', 'db_table': "u'comment'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'comment': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'comments'", 'to': "orm['auth.User']"}) + }, + 'forum.emailfeedsetting': { + 'Meta': {'object_name': 'EmailFeedSetting'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'feed_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'frequency': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '8'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'reported_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), + 'subscriber': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.favoritequestion': { + 'Meta': {'object_name': 'FavoriteQuestion', 'db_table': "u'favorite_question'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Question']"}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_favorite_questions'", 'to': "orm['auth.User']"}) + }, + 'forum.flaggeditem': { + 'Meta': {'unique_together': "(('content_type', 'object_id', 'user'),)", 'object_name': 'FlaggedItem', 'db_table': "u'flagged_item'"}, + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'flagged_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'flaggeditems'", 'to': "orm['auth.User']"}) + }, + 'forum.markedtag': { + 'Meta': {'object_name': 'MarkedTag'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'reason': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_selections'", 'to': "orm['forum.Tag']"}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tag_selections'", 'to': "orm['auth.User']"}) + }, + 'forum.question': { + 'Meta': {'object_name': 'Question', 'db_table': "u'question'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'answer_accepted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'answer_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'questions'", 'to': "orm['auth.User']"}), + 'close_reason': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'}), + 'closed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'closed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'closed_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'closed_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'comment_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'favorited_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'favorite_questions'", 'through': "'FavoriteQuestion'", 'to': "orm['auth.User']"}), + 'favourite_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'followed_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'followed_questions'", 'to': "orm['auth.User']"}), + 'html': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_activity_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_activity_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'last_active_in_questions'", 'to': "orm['auth.User']"}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'last_edited_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_edited_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'locked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'locked_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'locked_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'locked_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'offensive_flag_count': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'questions'", 'to': "orm['forum.Tag']"}), + 'text': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'vote_down_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'vote_up_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'wikified_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) + }, + 'forum.questionrevision': { + 'Meta': {'object_name': 'QuestionRevision', 'db_table': "u'question_revision'"}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'questionrevisions'", 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'revisions'", 'to': "orm['forum.Question']"}), + 'revised_at': ('django.db.models.fields.DateTimeField', [], {}), + 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'text': ('django.db.models.fields.TextField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}) + }, + 'forum.questionview': { + 'Meta': {'object_name': 'QuestionView'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'viewed'", 'to': "orm['forum.Question']"}), + 'when': ('django.db.models.fields.DateTimeField', [], {}), + 'who': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'question_views'", 'to': "orm['auth.User']"}) + }, + 'forum.repute': { + 'Meta': {'object_name': 'Repute', 'db_table': "u'repute'"}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'negative': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'positive': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Question']"}), + 'reputation': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'reputation_type': ('django.db.models.fields.SmallIntegerField', [], {}), + 'reputed_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.tag': { + 'Meta': {'object_name': 'Tag', 'db_table': "u'tag'"}, + 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'created_tags'", 'to': "orm['auth.User']"}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_tags'", 'null': 'True', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'used_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}) + }, + 'forum.validationhash': { + 'Meta': {'unique_together': "(('user', 'type'),)", 'object_name': 'ValidationHash'}, + 'expiration': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2010, 4, 25, 16, 24, 24, 604164)'}), + 'hash_code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'seed': ('django.db.models.fields.CharField', [], {'max_length': '12'}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '12'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.vote': { + 'Meta': {'unique_together': "(('content_type', 'object_id', 'user'),)", 'object_name': 'Vote', 'db_table': "u'vote'"}, + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'votes'", 'to': "orm['auth.User']"}), + 'vote': ('django.db.models.fields.SmallIntegerField', [], {}), + 'voted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}) + } + } + + complete_apps = ['forum'] diff --git a/forum/migrations/__init__.py b/forum/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/forum/models/answer.py b/forum/models/answer.py index 25a885ee..8910ea39 100755 --- a/forum/models/answer.py +++ b/forum/models/answer.py @@ -94,6 +94,7 @@ class Answer(Content, DeletableContent): self.last_edited_at = edited_at self.last_edited_by = edited_by self.html = sanitize_html(markdowner.convert(text)) + self.text = text #todo: bug wiki has no effect here self.save() @@ -136,9 +137,6 @@ class Answer(Content, DeletableContent): else: return None - def get_latest_revision(self): - return self.revisions.all()[0] - def get_question_title(self): return self.question.title diff --git a/forum/models/base.py b/forum/models/base.py index 52fc8522..fcec47b4 100755 --- a/forum/models/base.py +++ b/forum/models/base.py @@ -89,30 +89,31 @@ class Content(models.Model): """ Base class for Question and Answer """ - author = models.ForeignKey(User, related_name='%(class)ss') - added_at = models.DateTimeField(default=datetime.datetime.now) + author = models.ForeignKey(User, related_name='%(class)ss') + added_at = models.DateTimeField(default=datetime.datetime.now) - wiki = models.BooleanField(default=False) - wikified_at = models.DateTimeField(null=True, blank=True) + wiki = models.BooleanField(default=False) + wikified_at = models.DateTimeField(null=True, blank=True) - locked = models.BooleanField(default=False) - locked_by = models.ForeignKey(User, null=True, blank=True, related_name='locked_%(class)ss') - locked_at = models.DateTimeField(null=True, blank=True) + locked = models.BooleanField(default=False) + locked_by = models.ForeignKey(User, null=True, blank=True, related_name='locked_%(class)ss') + locked_at = models.DateTimeField(null=True, blank=True) - score = models.IntegerField(default=0) - vote_up_count = models.IntegerField(default=0) - vote_down_count = models.IntegerField(default=0) + score = models.IntegerField(default=0) + vote_up_count = models.IntegerField(default=0) + vote_down_count = models.IntegerField(default=0) - comment_count = models.PositiveIntegerField(default=0) + comment_count = models.PositiveIntegerField(default=0) offensive_flag_count = models.SmallIntegerField(default=0) - last_edited_at = models.DateTimeField(null=True, blank=True) - last_edited_by = models.ForeignKey(User, null=True, blank=True, related_name='last_edited_%(class)ss') + last_edited_at = models.DateTimeField(null=True, blank=True) + last_edited_by = models.ForeignKey(User, null=True, blank=True, related_name='last_edited_%(class)ss') - html = models.TextField() - comments = generic.GenericRelation(Comment) - votes = generic.GenericRelation(Vote) - flagged_items = generic.GenericRelation(FlaggedItem) + html = models.TextField(null=True) + text = models.TextField(null=True) #denormalized copy of latest revision + comments = generic.GenericRelation(Comment) + votes = generic.GenericRelation(Vote) + flagged_items = generic.GenericRelation(FlaggedItem) class Meta: abstract = True @@ -141,7 +142,10 @@ class Content(models.Model): self.comment_count = self.comment_count + 1 self.save() - def post_get_last_update_info(self): + def get_latest_revision(self): + return self.revisions.all()[0] + + def post_get_last_update_info(self):#todo: rename this subroutine when = self.added_at who = self.author if self.last_edited_at and self.last_edited_at > when: diff --git a/forum/models/question.py b/forum/models/question.py index aae99da2..fa1dd257 100755 --- a/forum/models/question.py +++ b/forum/models/question.py @@ -337,6 +337,7 @@ class Question(Content, DeletableContent): self.tagnames = tags self.summary = question_summary self.html = html + self.text = text #wiki is an eternal trap whence there is no exit if self.wiki == False and wiki == True: @@ -431,9 +432,6 @@ class Question(Content, DeletableContent): def get_revision_url(self): return reverse('question_revisions', args=[self.id]) - def get_latest_revision(self): - return self.revisions.all()[0] - def get_last_update_info(self): when, who = self.post_get_last_update_info() -- cgit v1.2.3-1-g7c22 From 3b8821b7e6c00a34fe71b22f011841786bb9d7e5 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sat, 24 Apr 2010 19:11:05 -0400 Subject: moved some files and directories inside forum from root --- HOW_TO_DEBUG | 39 - INSTALL | 271 ---- INSTALL.pip | 31 - INSTALL.webfaction | 346 ----- LICENSE | 14 - README | 2 + ROADMAP.rst | 88 -- TODO.rst | 63 - WISH_LIST | 55 - askbot-requirements.txt | 9 - cron/README | 5 - cron/multi_award_badges | 5 - cron/multi_award_badges_virtualenv | 10 - cron/once_award_badges | 14 - cron/once_award_badges_virtualenv | 10 - cron/send_email_alerts | 5 - cron/send_email_alerts_virtualenv | 10 - forum/LICENSE | 14 + forum/cron/README | 5 + forum/cron/multi_award_badges | 5 + forum/cron/multi_award_badges_virtualenv | 10 + forum/cron/once_award_badges | 14 + forum/cron/once_award_badges_virtualenv | 10 + forum/cron/send_email_alerts | 5 + forum/cron/send_email_alerts_virtualenv | 10 + forum/documentation/HOW_TO_DEBUG | 39 + forum/documentation/INSTALL | 284 ++++ forum/documentation/INSTALL.pip | 31 + forum/documentation/INSTALL.webfaction | 346 +++++ forum/documentation/ROADMAP.rst | 88 ++ forum/documentation/TODO.rst | 63 + forum/documentation/WISH_LIST | 55 + forum/documentation/askbot-requirements.txt | 9 + forum/importers/__init__.py | 0 forum/importers/stackexchange/ANOMALIES | 14 + forum/importers/stackexchange/README | 62 + forum/importers/stackexchange/__init__.py | 0 .../importers/stackexchange/management/__init__.py | 0 .../stackexchange/management/commands/__init__.py | 0 .../management/commands/load_stackexchange.py | 804 +++++++++++ forum/importers/stackexchange/models.py | 266 ++++ forum/importers/stackexchange/parse_models.py | 225 +++ forum/search/sphinx/README | 4 + forum/search/sphinx/sphinx.conf | 127 ++ forum/sql_scripts/091111_upgrade_evgeny.sql | 1 + forum/sql_scripts/091208_upgrade_evgeny.sql | 1 + forum/sql_scripts/091208_upgrade_evgeny_1.sql | 1 + forum/sql_scripts/100108_upgrade_ef.sql | 4 + forum/sql_scripts/badges.sql | 37 + forum/sql_scripts/cnprog.xml | 1498 ++++++++++++++++++++ forum/sql_scripts/cnprog_new_install.sql | 811 +++++++++++ .../sql_scripts/cnprog_new_install_2009_02_28.sql | 456 ++++++ .../sql_scripts/cnprog_new_install_2009_03_31.sql | 891 ++++++++++++ .../sql_scripts/cnprog_new_install_2009_04_07.sql | 24 + .../sql_scripts/cnprog_new_install_2009_04_09.sql | 904 ++++++++++++ forum/sql_scripts/drop-all-tables.sh | 4 + forum/sql_scripts/drop-auth.sql | 8 + forum/sql_scripts/pg_fts_install.sql | 38 + forum/sql_scripts/update_2009_01_13_001.sql | 62 + forum/sql_scripts/update_2009_01_13_002.sql | 1 + forum/sql_scripts/update_2009_01_18_001.sql | 62 + forum/sql_scripts/update_2009_01_24.sql | 2 + forum/sql_scripts/update_2009_01_25_001.sql | 2 + forum/sql_scripts/update_2009_02_26_001.sql | 19 + forum/sql_scripts/update_2009_04_10_001.sql | 3 + forum/sql_scripts/update_2009_07_05_EF.sql | 3 + forum/sql_scripts/update_2009_12_24_001.sql | 5 + forum/sql_scripts/update_2009_12_27_001.sql | 3 + forum/sql_scripts/update_2009_12_27_002.sql | 1 + forum/sql_scripts/update_2010_01_23.sql | 9 + forum/sql_scripts/update_2010_02_22.sql | 1 + settings.py | 2 +- sphinx/sphinx.conf | 127 -- sql_scripts/091111_upgrade_evgeny.sql | 1 - sql_scripts/091208_upgrade_evgeny.sql | 1 - sql_scripts/091208_upgrade_evgeny_1.sql | 1 - sql_scripts/100108_upgrade_ef.sql | 4 - sql_scripts/badges.sql | 37 - sql_scripts/cnprog.xml | 1498 -------------------- sql_scripts/cnprog_new_install.sql | 811 ----------- sql_scripts/cnprog_new_install_2009_02_28.sql | 456 ------ sql_scripts/cnprog_new_install_2009_03_31.sql | 891 ------------ sql_scripts/cnprog_new_install_2009_04_07.sql | 24 - sql_scripts/cnprog_new_install_2009_04_09.sql | 904 ------------ sql_scripts/drop-all-tables.sh | 4 - sql_scripts/drop-auth.sql | 8 - sql_scripts/pg_fts_install.sql | 38 - sql_scripts/update_2009_01_13_001.sql | 62 - sql_scripts/update_2009_01_13_002.sql | 1 - sql_scripts/update_2009_01_18_001.sql | 62 - sql_scripts/update_2009_01_24.sql | 2 - sql_scripts/update_2009_01_25_001.sql | 2 - sql_scripts/update_2009_02_26_001.sql | 19 - sql_scripts/update_2009_04_10_001.sql | 3 - sql_scripts/update_2009_07_05_EF.sql | 3 - sql_scripts/update_2009_12_24_001.sql | 5 - sql_scripts/update_2009_12_27_001.sql | 3 - sql_scripts/update_2009_12_27_002.sql | 1 - sql_scripts/update_2010_01_23.sql | 9 - sql_scripts/update_2010_02_22.sql | 1 - stackexchange/ANOMALIES | 14 - stackexchange/README | 62 - stackexchange/__init__.py | 0 stackexchange/management/__init__.py | 0 stackexchange/management/commands/__init__.py | 0 .../management/commands/load_stackexchange.py | 804 ----------- stackexchange/models.py | 266 ---- stackexchange/parse_models.py | 225 --- 108 files changed, 7344 insertions(+), 7325 deletions(-) delete mode 100644 HOW_TO_DEBUG delete mode 100644 INSTALL delete mode 100644 INSTALL.pip delete mode 100644 INSTALL.webfaction delete mode 100644 LICENSE delete mode 100644 ROADMAP.rst delete mode 100644 TODO.rst delete mode 100644 WISH_LIST delete mode 100644 askbot-requirements.txt delete mode 100644 cron/README delete mode 100755 cron/multi_award_badges delete mode 100755 cron/multi_award_badges_virtualenv delete mode 100755 cron/once_award_badges delete mode 100755 cron/once_award_badges_virtualenv delete mode 100644 cron/send_email_alerts delete mode 100644 cron/send_email_alerts_virtualenv create mode 100644 forum/LICENSE create mode 100644 forum/cron/README create mode 100755 forum/cron/multi_award_badges create mode 100755 forum/cron/multi_award_badges_virtualenv create mode 100755 forum/cron/once_award_badges create mode 100755 forum/cron/once_award_badges_virtualenv create mode 100644 forum/cron/send_email_alerts create mode 100644 forum/cron/send_email_alerts_virtualenv create mode 100644 forum/documentation/HOW_TO_DEBUG create mode 100644 forum/documentation/INSTALL create mode 100644 forum/documentation/INSTALL.pip create mode 100644 forum/documentation/INSTALL.webfaction create mode 100644 forum/documentation/ROADMAP.rst create mode 100644 forum/documentation/TODO.rst create mode 100644 forum/documentation/WISH_LIST create mode 100644 forum/documentation/askbot-requirements.txt create mode 100644 forum/importers/__init__.py create mode 100644 forum/importers/stackexchange/ANOMALIES create mode 100644 forum/importers/stackexchange/README create mode 100644 forum/importers/stackexchange/__init__.py create mode 100644 forum/importers/stackexchange/management/__init__.py create mode 100644 forum/importers/stackexchange/management/commands/__init__.py create mode 100644 forum/importers/stackexchange/management/commands/load_stackexchange.py create mode 100644 forum/importers/stackexchange/models.py create mode 100644 forum/importers/stackexchange/parse_models.py create mode 100644 forum/search/sphinx/README create mode 100644 forum/search/sphinx/sphinx.conf create mode 100644 forum/sql_scripts/091111_upgrade_evgeny.sql create mode 100644 forum/sql_scripts/091208_upgrade_evgeny.sql create mode 100644 forum/sql_scripts/091208_upgrade_evgeny_1.sql create mode 100644 forum/sql_scripts/100108_upgrade_ef.sql create mode 100644 forum/sql_scripts/badges.sql create mode 100644 forum/sql_scripts/cnprog.xml create mode 100644 forum/sql_scripts/cnprog_new_install.sql create mode 100644 forum/sql_scripts/cnprog_new_install_2009_02_28.sql create mode 100644 forum/sql_scripts/cnprog_new_install_2009_03_31.sql create mode 100644 forum/sql_scripts/cnprog_new_install_2009_04_07.sql create mode 100644 forum/sql_scripts/cnprog_new_install_2009_04_09.sql create mode 100644 forum/sql_scripts/drop-all-tables.sh create mode 100644 forum/sql_scripts/drop-auth.sql create mode 100644 forum/sql_scripts/pg_fts_install.sql create mode 100644 forum/sql_scripts/update_2009_01_13_001.sql create mode 100644 forum/sql_scripts/update_2009_01_13_002.sql create mode 100644 forum/sql_scripts/update_2009_01_18_001.sql create mode 100644 forum/sql_scripts/update_2009_01_24.sql create mode 100644 forum/sql_scripts/update_2009_01_25_001.sql create mode 100644 forum/sql_scripts/update_2009_02_26_001.sql create mode 100644 forum/sql_scripts/update_2009_04_10_001.sql create mode 100644 forum/sql_scripts/update_2009_07_05_EF.sql create mode 100644 forum/sql_scripts/update_2009_12_24_001.sql create mode 100644 forum/sql_scripts/update_2009_12_27_001.sql create mode 100644 forum/sql_scripts/update_2009_12_27_002.sql create mode 100755 forum/sql_scripts/update_2010_01_23.sql create mode 100644 forum/sql_scripts/update_2010_02_22.sql delete mode 100644 sphinx/sphinx.conf delete mode 100644 sql_scripts/091111_upgrade_evgeny.sql delete mode 100644 sql_scripts/091208_upgrade_evgeny.sql delete mode 100644 sql_scripts/091208_upgrade_evgeny_1.sql delete mode 100644 sql_scripts/100108_upgrade_ef.sql delete mode 100644 sql_scripts/badges.sql delete mode 100644 sql_scripts/cnprog.xml delete mode 100644 sql_scripts/cnprog_new_install.sql delete mode 100644 sql_scripts/cnprog_new_install_2009_02_28.sql delete mode 100644 sql_scripts/cnprog_new_install_2009_03_31.sql delete mode 100644 sql_scripts/cnprog_new_install_2009_04_07.sql delete mode 100644 sql_scripts/cnprog_new_install_2009_04_09.sql delete mode 100644 sql_scripts/drop-all-tables.sh delete mode 100644 sql_scripts/drop-auth.sql delete mode 100644 sql_scripts/pg_fts_install.sql delete mode 100644 sql_scripts/update_2009_01_13_001.sql delete mode 100644 sql_scripts/update_2009_01_13_002.sql delete mode 100644 sql_scripts/update_2009_01_18_001.sql delete mode 100644 sql_scripts/update_2009_01_24.sql delete mode 100644 sql_scripts/update_2009_01_25_001.sql delete mode 100644 sql_scripts/update_2009_02_26_001.sql delete mode 100644 sql_scripts/update_2009_04_10_001.sql delete mode 100644 sql_scripts/update_2009_07_05_EF.sql delete mode 100644 sql_scripts/update_2009_12_24_001.sql delete mode 100644 sql_scripts/update_2009_12_27_001.sql delete mode 100644 sql_scripts/update_2009_12_27_002.sql delete mode 100755 sql_scripts/update_2010_01_23.sql delete mode 100644 sql_scripts/update_2010_02_22.sql delete mode 100644 stackexchange/ANOMALIES delete mode 100644 stackexchange/README delete mode 100644 stackexchange/__init__.py delete mode 100644 stackexchange/management/__init__.py delete mode 100644 stackexchange/management/commands/__init__.py delete mode 100644 stackexchange/management/commands/load_stackexchange.py delete mode 100644 stackexchange/models.py delete mode 100644 stackexchange/parse_models.py diff --git a/HOW_TO_DEBUG b/HOW_TO_DEBUG deleted file mode 100644 index ba36198a..00000000 --- a/HOW_TO_DEBUG +++ /dev/null @@ -1,39 +0,0 @@ -1) LOGGING -Please remember that log files may contain plaintext passwords, etc. - -Please do not add print statements - at least do not commit them to git -because in some environments printing to stdout causes errors - -Instead use python logging this way: --------------------------------- -#somewere on top of file -import logging - -#anywhere below -logging.debug('this maybe works') -logging.error('have big error!') -#or even -logging.debug('') #this will add time, line number, function and file record -#sometimes useful record for call tracing on its own -#etc - take a look at http://docs.python.org/library/logging.html -------------------------------- - -in OSQA logging is currently set up in settings_local.py.dist -please update it if you need - in older revs logging strings have less info - -messages of interest can be grepped out of the log file by module/file/function name -e.g. to take out all django_authopenid logs run: ->grep 'osqa\/django_authopenid' log/django.osqa.log | sed 's/^.*MSG: //' -in the example above 'sed' call truncates out a long prefix -and makes output look more meaningful - -2) DJANGO DEBUG TOOLBAR -osqa works with django debug toolbar -if debugging under apache server, check -that debug toolbar media is loaded correctly -if toolbar is enabled but you do not see it, possibly some Alias statement -in apache config is wrong in your VirtualHost or elsewhere - -3) If you discover new debugging techniques, please add here. -Possible areas to improve - at this point there is no SQL query logging, -as well as request data and http header. diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 1eb9607c..00000000 --- a/INSTALL +++ /dev/null @@ -1,271 +0,0 @@ -CONTENTS ------------------- -A. PREREQUISITES -B. INSTALLATION - 1. Settings file - 2. Database - 3. Running Askbot in the development server - 4. Installation under Apache/WSGI - 5. Full text search - 6. Email subscriptions - 7. Sitemap - 8. Miscellaneous -C. CONFIGURATION PARAMETERS (settings_local.py) -D. CUSTOMIZATION - - -A. PREREQUISITES ------------------------------------------------ -Note: by default all installation activity is made in the superuser 'root' account. -This can be achieved either by logging in as root (su root), -or - if you have program sudo installed - prefix all commands with sudo. -So sodo will be listed below as optional. - -0. We recommend you to use python-setuptools to install pre-requirement libraries. -If you haven't installed it, please try to install it first. -e.g, [sudo] apt-get install python-setuptools - -1. Python2.5/2.6, Django v1.1.1 - -1A If you are using MySQL, mysql client for python must be installed -[sudo] easy_install mysql-python - -2. Python-openid v2.2 -http://openidenabled.com/python-openid/ -[sudo] easy_install python-openid - -4. html5lib -http://code.google.com/p/html5lib/ -Used for HTML sanitizer -[sudo] easy_install html5lib - -5. Markdown2 -http://code.google.com/p/python-markdown2/ -[sudo] easy_install markdown2 - -6. Django Debug Toolbar -http://github.com/robhudson/django-debug-toolbar/tree/master - -7. djangosphinx (optional - for full text questions+answer+tag) -http://github.com/dcramer/django-sphinx/tree/master/djangosphinx - -8. sphinx search engine (optional, works together with djangosphinx) -http://sphinxsearch.com/downloads.html - -9. recaptcha_django -http://code.google.com/p/recaptcha-django/ - -10. python recaptcha module -http://code.google.com/p/recaptcha/ -Notice that you will need to register with recaptcha.net and receive -recaptcha public and private keys that need to be saved in your -settings_local.py file - -11. South -http://south.aeracode.org/docs/installation.html -Used for database schema and data migrations -[sudo] easy_install South - -EXTRA DEPENDENCIES FOR PYTHON 2.4 -* hashlib (made standard in python 2.5) - -NOTES: django_authopenid is included into Askbot code -and is significantly modified. http://code.google.com/p/django-authopenid/ -no need to install this library - -B. INSTALLATION ------------------------------------------------ -0. Make sure you have all above python libraries installed. - - DO NOT name the main directory 'askbot' - this name is reserved - for the future name of the app file itself. - - make askbot installation server-readable on Linux command might be: - chown -R yourlogin:apache /path/to/askbot-site - - directories: - /path/to/askbot-site/forum/upfiles - /path/to/askbot-site/log - must be server writable - - on Linux type chmod - chmod -R g+w /path/to/askbot-site/forum/upfiles - chmod -R g+w /path/to/askbot-site/log - - above it is assumed that webserver runs under group named "apache" - -1. Settings file - -Copy settings_local.py.dist to settings_local.py and -update all your settings. Check settings.py and update -it as well if necessory. -Section C explains configuration paramaters. - -Minimally required modification of settings_local.py are -DATABASE_NAME -DATABASE_USER -DATABASE_PASSWORD -DATABASE_ENGINE - -If you set these up, and your database is ready (see section 2), -run: - -python manage.py syncdb -python manage.py runserver `hostname -i`:8000 -(choose another port number if you wish) - -and askbot should be running - if you have any issues at this point (or later:) -please post them at http://askbot.org/meta - -2. Database - -Prepare your database by using the same database/account -configuration from above. -e.g, -create database askbot DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci; -grant all on askbot.* to 'askbot'@'localhost'; -And then run "python manage.py syncdb" to synchronize your database. - -3. Running Askbot on the development server - -Run "python manage.py runserver" to startup django -development environment. -(Under Linux you can use command "python manage.py runserver `hostname -i`:8000", -where you can use any other available number for the port) - -you might want to have DEBUG=True in the beginning of settings.py -when using the test server - -4. Installation under Apache/WSGI - -The main wsgi script is in the file django.wsgi -it does not need to be modified - -4.1 Configure webserver -Settings below are not perfect but may be a good starting point - ---------- -WSGISocketPrefix /path/to/socket/sock #must be readable and writable by apache -WSGIPythonHome /usr/local #must be readable by apache -WSGIPythonEggs /var/python/eggs #must be readable and writable by apache - -#NOTE: all urs below will need to be adjusted if -#settings.FORUM_SCRIPT_ALIAS !='' (e.g. = 'forum/') -#this allows "rooting" forum at http://example.com/forum, if you like - - ServerAdmin forum@example.com - DocumentRoot /path/to/askbot-site - ServerName example.com - - #run mod_wsgi process for django in daemon mode - #this allows avoiding confused timezone settings when - #another application runs in the same virtual host - WSGIDaemonProcess askbot - WSGIProcessGroup askbot - - #force all content to be served as static files - #otherwise django will be crunching images through itself wasting time - Alias /m/ /path/to/askbot-site/forum/skins/ - Alias /upfiles/ /path/to/askbot-site/forum/upfiles/ - - Order deny,allow - Allow from all - - - #this is your wsgi script described in the prev section - WSGIScriptAlias / /path/to/askbot-site/django.wsgi - - #this will force admin interface to work only - #through https (optional) - #"nimda" is the secret spelling of "admin" ;) - - RewriteEngine on - RewriteRule /nimda(.*)$ https://example.com/nimda$1 [L,R=301] - - CustomLog /var/log/httpd/askbot/access_log common - ErrorLog /var/log/httpd/askbot/error_log - -#(optional) run admin interface under https - - ServerAdmin forum@example.com - DocumentRoot /path/to/askbot-site - ServerName example.com - SSLEngine on - SSLCertificateFile /path/to/ssl-certificate/server.crt - SSLCertificateKeyFile /path/to/ssl-certificate/server.key - WSGIScriptAlias / /path/to/askbot-site/django.wsgi - CustomLog /var/log/httpd/askbot/access_log common - ErrorLog /var/log/httpd/askbot/error_log - DirectoryIndex index.html - -------------- - -5. Full text search (using sphinx search) - - Currently full text search works only with sphinx search engine - And builtin PostgreSQL (postgres only >= 8.3???) - - 5.1 Instructions for Sphinx search setup - Sphinx at this time supports only MySQL and PostgreSQL databases - to enable this, install sphinx search engine and djangosphinx - - configure sphinx, sample configuration can be found in - sphinx/sphinx.conf file usually goes somewhere in /etc tree - - build askbot index first time manually - - % indexer --config /path/to/sphinx.conf --index askbot - - setup cron job to rebuild index periodically with command - your crontab entry may be something like - - 0 9,15,21 * * * /usr/local/bin/indexer --config /etc/sphinx/sphinx.conf --all --rotate >/dev/null 2>&1 - adjust it as necessary this one will reindex three times a day at 9am 3pm and 9pm - - if your forum grows very big ( good luck with that :) you'll - need to two search indices one diff index and one main - please refer to online sphinx search documentation for the information - on the subject http://sphinxsearch.com/docs/ - - in settings_local.py set - USE_SPHINX_SEARCH=True - adjust other settings that have SPHINX_* prefix accordingly - remember that there must be trailing comma in parentheses for - SHPINX_SEARCH_INDICES tuple - particlarly with just one item! - - in settings.py look for INSTALLED_APPS - and uncomment #'djangosphinx', - - -6. Email subscriptions - - This function at the moment requires Django 1.1 - - edit paths in the file cron/send_email_alerts - set up a cron job to call cron/send_email_alerts once or twice a day - subscription sender may be tested manually in shell - by calling cron/send_email_alerts - -7. Sitemap -Sitemap will be available at /sitemap.xml -e.g yoursite.com/forum/sitemap.xml - -google will be pinged each time question, answer or -comment is saved or a question deleted - -for this to be useful - do register you sitemap with Google at -https://www.google.com/webmasters/tools/ - -8. Miscellaneous - -There are some demo scripts under sql_scripts folder, -including badges and test accounts for CNProg.com. You -don't need them to run your sample. - -C. Customization - -Other than settings_local.py the following will most likely need customization: -* locale/*/django.po - language files that may also contain your site-specific messages - if you want to start with english messages file - look for words like "forum" and - "Askbot" in the msgstr lines -* skins diff --git a/INSTALL.pip b/INSTALL.pip deleted file mode 100644 index 92b1c7fa..00000000 --- a/INSTALL.pip +++ /dev/null @@ -1,31 +0,0 @@ -* Install virtualenv and pip: - easy_install virtualenv - easy_install pip - -* Install MySQL: - sudo apt-get install mysql-client mysql-server - -* Install sphinxsearch. See: - [optional] - http://sphinxsearch.com/downloads.html - http://www.hackido.com/2009/01/install-sphinx-search-on-ubuntu.html - git://github.com/johnl/deb-sphinx-search.git - -* Install a virtual environment OUTSIDE of this directory: - pip install -E ~/env -r osqa-requirements.txt -[there is discussion on the pinax forums about what it should be outside -the source directory] - -* Notice that you will need to register with recaptcha.net and receive - recaptcha public and private keys that need to be saved in your - settings_local.py file - -* Start your environment: - source ~/env/bin/activate - -* Install mysql-python into your virtualenv, because we can't -automagically install it with pip: - easy_install --prefix ~/env/ mysql-python - -For more information about why pip can't automatically install the -MySQL driver, see this message: http://groups.google.com/group/python-virtualenv/msg/ea988085951c92b3 diff --git a/INSTALL.webfaction b/INSTALL.webfaction deleted file mode 100644 index 401971a0..00000000 --- a/INSTALL.webfaction +++ /dev/null @@ -1,346 +0,0 @@ -Detailed instructions for installing OSQA on WebFaction - -Adapted from http://code.pinaxproject.com/wiki/DetailedPinaxWebfaction/ - -Please email turian at gmail with any updates or corrections. - - -Installing OSQA on Webfaction ------------------------------------- - -Details the steps for setting up OSQA on a Webfaction shared-hosting -account, including email setup, using Apache2, mod_wsgi, psycopg2. - -If you want to search-and-replace through this file, you will need to replace: - osqa_server [name of Webfaction application, which will be in ~/webapps/] - osqa_static [name of Webfaction application for static media serving] - DOMAIN.com [domain name for OSQA site] - PORT [port number assigned by WebFaction to your mod_wsgi application] - SITENAME [name you give the OSQA site, which will contain the apache logs] - MYOSQA [name of the OSQA project] - MAILBOX_USERNAME [username you give the email address] - MAILBOX_PASSWORD [password that webfaction gives to this email username] - OSQADATABASE_NAME [username you give the database] - OSQADATABASE_PASSWORD [password that webfaction gives to this database] - ~/envs/osqa [directory for the OSQA python environment, grep for 'env'] - USERNAME [your WebFaction username] - -Some things I'm not sure about: - -Here's what I don't know how to do: - * Set up a nginx server for static media. - * Configure sphinx search - * Use PostgreSQL, not MySQL: http://osqa.net/question/13/can-i-use-osqa-with-postgresql - - -Webfaction Control Panel --------------------------- - -(Note: if you sign up and pick django it will create the application -for you, website/subdomain and associate the two for you.) - - If necessary, add or create any domains or subdomains you may need. - - https://panel.webfaction.com/domain/list/ - - Let's call the domain DOMAIN.com. - - Create a new Webfaction application with a "Type:" of "mod_wsgi - 2.5/Python2.5", naming it "osqa_server". (These instructions - might also work with mod_wsgi 2.0, if you like.) - - https://panel.webfaction.com/app_/list - - Note the port number assigned to the mod_wsgi application. Call - it PORT. - - Create a new Webfaction website which will associate the subdomain - with the new osqa_server application. Give it name SITENAME, at least one - domain, and set it to use the osqa_server application for the site's - root location, "/". - - https://panel.webfaction.com/site/list - - You will need to create a database, typically one for each project - you create. Change the type to PostgreSql and modify the name (it - defaults to your webfaction account name) by adding an underscore - and a project-specific identifier such as "_osqa". Before - leaving this section of the control panel, you may wish to change - the password. - - https://panel.webfaction.com/database/create - - Call these OSQADATABASE_NAME and OSQADATABASE_PASSWORD. - - Save the database password for later. - - [The following I haven't figured out yet] - You will probably want to add a static media server. This is a - Webfaction application. I created one of type "Static only (no - .htaccess)" and with the name of "osqa_static". - - https://panel.webfaction.com/app_/create - - To configure email, you need an email mailbox. Add one here. Note - that your mailbox password shouldn't be the same password you use - to SSH to webfaction. - - https://panel.webfaction.com/mailbox/list - - Save the mail password for later. - We will call the username and password MAILBOX_USERNAME and - MAILBOX_PASSWORD, respectively. - You might also consider adding an email address like admin@DOMAIN.com, - here: - - https://panel.webfaction.com/email/list - - -OSQA Software --------------- - - Log onto webfaction and get the code. I use my fork because I have - a simple pip installation: - git://github.com/turian/osqa.git - In my situation, I keep source code in ~/utils/src, create - virtual environments in ~/envs/osqa, and create Pinax projects in - ~/webapps/osqa_server/projects. - - You will need pip + virtualenv installed: - - easy_install --prefix=~/utils/ pip - easy_install --prefix=~/utils/ virtualenv - - cd ~/utils/src/ - git clone git://github.com/turian/osqa.git - cd osqa - - # We need python2.5 to be compatible with WSGI - python2.5 ~/utils/bin/pip install -E ~/envs/osqa -r osqa-requirements.txt - source ~/envs/osqa/bin/activate - - # [Optional] If you want a MySQL database - easy_install-2.5 --prefix ~/envs/osqa/ mysql-python - -Additional Software -------------------- - - [Note that PostgreSQL installation doesn't work for me.] - - You will need to install psycopg2 separately for PostgreSQL. - Psycopg2 requires a little fiddling. Continuing to - work in the ~/utils/src/ directory: - - cd ~/utils/src/ - wget http://initd.org/pub/software/psycopg/psycopg2-2.0.13.tar.gz - tar zxf psycopg2-2.0.13.tar.gz - cd psycopg2-2.0.13 - nano setup.cfg - - # edit the line reading "#pg_config=" so that it reads: - "pg_config=/usr/local/pgsql/bin/pg_config" - - python2.5 setup.py build - python2.5 setup.py install - - -Create a Project ----------------- - - In Pinax, you clone a project from OSQA. - However, OSQA we just copy it. - - cd ~/webapps/osqa_server - mkdir projects - cd projects - cp -R ~/utils/src/osqa MYOSQA - cd MYOSQA - export OSQAPROJECT=`pwd` - - Make some directories, as described in the OSQA INSTALL file: - [okay I haven't actually done this yet] - -# mkdir -p $OSQASITE/upfiles/ -# mkdir -p $OSQALOG -# sudo chown -R `whoami`:www-data $OSQASITE -# sudo chown -R `whoami`:www-data $OSQALOG -# chmod -R g+w $OSQASITE/upfiles -# chmod -R g+w $OSQALOG - - - Edit the settings files: - - cd $OSQAPROJECT - cp settings_local.py.dist settings_local.py - vi settings_local.py settings.py - - Pay attention to the following settings: - - DATABASE_ENGINE = 'mysql' - DATABASE_NAME = 'OSQADATABASE_NAME' - DATABASE_USER = 'OSQADATABASE_NAME' - DATABASE_PASSWORD = 'OSQADATABASE_PASSWORD' - - EMAIL_HOST='smtp.webfaction.com' - EMAIL_HOST_USER='MAILBOX_USERNAME' - EMAIL_HOST_PASSWORD='MAILBOX_PASSWORD' - EMAIL_PORT='25' - DEFAULT_FROM_EMAIL = 'MAILBOX_USERNAME@DOMAIN.com' - SERVER_EMAIL = 'MAILBOX_USERNAME@DOMAIN.com' - # The following setting might not be necessary, it's used in Pinax tho - CONTACT_EMAIL = "MAILBOX_USERNAME@DOMAIN.com" - - APP_URL = 'http://DOMAIN.com' #used by email notif system and RSS - - [Later on, the install instructions should talk about] - SERVE_MEDIA = False # [Not present, not ready yet] - - Create a directory for logs: - - cd $OSQAPROJECT - mkdir log - - Modify mail cron scripts "cron/send_email_alerts" as follows: - [Pinax has cron/emit_notices.sh, cron/retry_deferred.sh, - cron/send_mail.sh, are these also necessary?] - - #!/bin/sh - - WORKON_HOME=~/envs/osqa - PROJECT_ROOT=~/webapps/osqa_server/projects/MYOSQA/ - - # activate virtual environment - . $WORKON_HOME/bin/activate - - cd $PROJECT_ROOT - python manage.py send_email_alerts >> $PROJECT_ROOT/log/cron_mail.log 2>&1 - - Use command "crontab -e" to add this script to your cron file, to run twice a day:: - - 1 0,12 * * * ~/webapps/osqa_server/projects/MYOSQA/cron/send_email_alerts - - [Configure sphinx] - - Create the database tables, indices, and so forth: - - python manage.py syncdb - - [Ignore the following static media steps, I haven't tried them] - Build media directory links within the project and create symbolic - links on the static media server. - python manage.py build_media -all - mkdir ~/webapps/OSQA_STATIC/MYOSQA - ln -sd ~/webapps/osqa_server/projects/MYOSQA/site_media ~/webapps/OSQA_STATIC/MYOSQA/site_media - - - Set up the badges: - - 1. You should run the SQL commands in: - - sql_scripts/badges.sql - - 2. Edit paths in the file `cron/multi_award_badges`. (This - file doesn't yet exist in the git repositories, so just - copy `cron/send_email_alerts` and make sure the command - `multi_award_badges` is executed.) - - 3. Run `cron/multi_award_badges` to make sure it works okay. - - 4. Use `crontab -e` to call `cron/multi_award_badges` maybe - four times an hour. - - 4,19,34,49 * * * * ~/webapps/osqa_server/projects/MYOSQA/cron/multi_award_badges - - 5. Repeat steps 1-4 for `cron/once_award_badges`. - - -Configure Apache2 ----------------- - - Edit ~/webapps/osqa_server/apache2/conf/httpd.conf as follows:: - - ServerAdmin "MAILBOX_USERNAME@DOMAIN.com" - ServerRoot "/home/USERNAME/webapps/osqa_server/apache2" - ServerName DOMAIN.com - - LoadModule dir_module modules/mod_dir.so - LoadModule env_module modules/mod_env.so - #LoadModule setenvif_module modules/mod_setenvif.so - LoadModule log_config_module modules/mod_log_config.so - LoadModule mime_module modules/mod_mime.so - LoadModule rewrite_module modules/mod_rewrite.so - LoadModule wsgi_module modules/mod_wsgi.so - - KeepAlive Off - Listen PORT - LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - CustomLog /home/USERNAME/logs/user/access_osqa_server_log combined - ErrorLog /home/USERNAME/logs/user/error_osqa_server_log - ServerLimit 2 - - #SetEnvIf X-Forwarded-SSL on HTTPS=1 - - WSGIPythonPath /home/USERNAME/envs/osqa/lib/python2.5/site-packages/ - WSGIScriptAlias / /home/USERNAME/webapps/osqa_server/projects/MYOSQA/osqa.wsgi - - LoadModule alias_module modules/mod_alias.so - WSGIDaemonProcess osqaWSGI user=USERNAME group=USERNAME threads=25 python-path=/home/USERNAME/envs/osqa/lib/python2.5/site-packages - WSGIProcessGroup osqaWSGI - - NameVirtualHost 127.0.0.1:PORT - - #ErrorLog "logs/MYOSQA_2009_05_06.log" - SetHandler none - #Alias /site_media /home/USERNAME/webapps/static/MYOSQA/site_media - - #force all content to be served as static files - #otherwise django will be crunching images through itself wasting time - Alias /content/ /home/USERNAME/webapps/osqa_server/projects/MYOSQA/templates/content/ - Alias /forum/admin/media/ /home/turian/envs/osqa/lib/python2.5/site-packages/django/contrib/admin/media/ - #AliasMatch /([^/]*\.css) /home/USERNAME/webapps/osqa_server/projects/MYOSQA/templates/content/style/$1 - - # Order deny,allow - # Allow from all - - - If you want virtual hosts of the admin interface under HTTPS, please - look at OSQA's install file. - - Create osqa.wsgi and edit it: - cp osqa.wsgi.dist osqa.wsgi - - Edit ~/webapps/osqa_server/projects/MYOSQA/deploy/osqa.wsgi as follows:: - - import os - import sys - - # redirect sys.stdout to sys.stderr for bad libraries like geopy that uses - # print statements for optional import exceptions. - sys.stdout = sys.stderr - - from os.path import abspath, dirname, join - from site import addsitedir - - # add the virtual environment site-packages to the path - from site import addsitedir - addsitedir('/home/USERNAME/envs/osqa/lib/python2.5/site-packages') - - sys.path.insert(0, abspath(join(dirname(__file__), "../"))) - sys.path.append(abspath(dirname(__file__))) - - from django.conf import settings - os.environ["DJANGO_SETTINGS_MODULE"] = "MYOSQA.settings" - - #print sys.path - - from django.core.handlers.wsgi import WSGIHandler - application = WSGIHandler() - -And then you're up and running with: - - ~/webapps/osqa_server/apache2/bin/stop - ~/webapps/osqa_server/apache2/bin/start - -You should log in to the admin interface (http://DOMAIN.com/admin/), -and go to "Sites > Sites", and change the domain name that is used in -all emails. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 803781c5..00000000 --- a/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (C) 2009. Chen Gang - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . diff --git a/README b/README index 62064c76..56da61c5 100644 --- a/README +++ b/README @@ -2,6 +2,8 @@ This is Askbot project - open source Q&A system Demo site is http://askbot.org/meta +All documentation is in the directory forum/documentation + askbot-devel repository is open to anyone who wants to help develop Askbot - just drop us a note Askbot is based on code of CNPROG, originally created by Mike Chen and Sailing Cai and some code written for OSQA diff --git a/ROADMAP.rst b/ROADMAP.rst deleted file mode 100644 index c79e0ae4..00000000 --- a/ROADMAP.rst +++ /dev/null @@ -1,88 +0,0 @@ -Intro -========= -ROADMAP aims to streamline activities of the Askbot open source project and -to minimize ad-hoc approaches of "big-picture" level. - -Aksbot is a Question and Asnwer system for the normal people! - -Let's discuss stuff that goes into this file on -http://groups.google.com/group/askbot - -Bacic principles of the project -================================== -Here they are: - -* our rule #1 is that all developers have commit right to the project - repository, but they must follow this ROADMAP and TODO - - to keep up with our own sanity. -* we welcome contributions by other people and show tolerance - and patience - especially to the new team members. -* when users who might not be tech-savvy ask questions - - we try to answer to the point and using their language - (i.e. not programmer jargon:) -* we favor plain and minimalistic style of programming, but pay - attention to detail - especially details of user experience. - -We try do develop using the following workflow: - -* specify problem that we try to solve -* create requirements that will guarantee a solution, once met -* dream up some implementation ideas (maybe even some sketches on the paper) -* discuss and decide on the best one -* write and test code - -The process doesn't have to be this formal all the time, but trying to stick -to some subset of this almost always helps! -Especially it helps to iron out disagreements between -individual programmers (which if you are one - you know are qute common -- and they don't all end well :). - -Ad-hoc programming - i.e. simply go and add code - is not really encouraged. -This works fine in the one person team or when the team consists of -best friends, but is almost sure to fail in a heterogenous group. - -Architecture and Requirements -===================================== -Obviously Django and Python are pre-made choices - so this -is not going to change any time soon. At this point all of -the client side Javascript is written using jQuery library. - -Our basic principle is that Askbot should be a mashable Q&A component. -Askbot is an application written in Python/Django. So it should be -distributable as a Django App alone or as a whole site (by option). - -If we develop sub-systems that can be used in the broader scope - -we package that thing as a separate django application (login system is one example). - -We will start using Google Closure library soon! - -Sub-systems ------------------ -* authentication system -* Q&A system -* admin interface -* full text search -* skins (directory forum/skins) - -Authentication system -------------------------- -Authentication system will be a separate django application - -Here is the discussion thread: -* http://groups.google.com/group/askbot/browse_thread/thread/1916dfcf666dd56c - -Most of the requirements are listed in the first message - -Skins ------------ -Skins eventually must be upgrade-stable - that is people who created custom -skins should not need to change anything if something changes in the code - -Admin interface ------------------------ -* extend forum/settings.py to list default settings of various groups -* create Registry database table the will store setting values -* leave only essential settings that go to the main django settings.py -Create key-value storage -* should some settings be accessible to admins and some to staff??? - for example-secret keys probably should not be shared with staff members diff --git a/TODO.rst b/TODO.rst deleted file mode 100644 index f202a3f7..00000000 --- a/TODO.rst +++ /dev/null @@ -1,63 +0,0 @@ -note: there is also WISH_LIST. Here is only stuff that will be done soon. - -Site looks -=========== -* make links within posts blue so that they are visible - -Code Cleanups -============== -* remove usage of EXTERNAL_LEGACY_LOGIN -* clean up forum_modules: - * keep this directory for dependency modules that can be shared - by multiple apps, - * but move other things that are not shared - inside forum app directory - * one-by one convert "auto-discovery" modules into - regular explicit python imports -* python2.4 incompatibilities - * datatime.datetime.strptime - -Bugs -====== -* make sure that search feature covers questions and answers - (title, body, tags) - -Refactoring -============= -* merge search, question and index view functions into one - -Skins -======= -* organize templates and document them so that - skins could be more easily created by others - who are savvy enough -* identify and maybe create snippet-type templates - and put them into a separate directory - for example: - * gravatar (currently a string in - forum/templatetags/extra_tags.py - try inclusion template - and see if it slows things down a lot) - * question body - * answer body - * datetime widget??? -* there is a separator line between posts - but it shows either before the post or after - it is nice that separator is lightweight - - based on css alone - but we need to fix it so that - it shows only between the posts as a joining item - -Features -=========== -* new login system, please see - http://groups.google.com/group/askbot/browse_thread/thread/1916dfcf666dd56c - on a separate branch multi-auth-app, then merge -* forum admin interface, some badge configuration - -Development environment -========================== -* set up environment for closure development - -Project website -==================== -* Logo!!! Ideas? -* Adopt Jekyll for project site and transition from Dango diff --git a/WISH_LIST b/WISH_LIST deleted file mode 100644 index 3e383d3e..00000000 --- a/WISH_LIST +++ /dev/null @@ -1,55 +0,0 @@ -* smarter debug mode -* The wonder bar (integrated the search / ask functionality) -* The authentication system ??? -* allow multiple logins to the same account -* allow multiple logins to the same account -* more advanced templating/skinning system -* per-tag email subscriptions -* view for personalized news on the site -* a little flag popping when there are news -* drill-down mode for navigation by tags -* improved admin console -* sort out mess with profile - currently we patch django User - -* Some functionality should be moved out of the forums app, in the case -that the forum app is restricted only to authenticated users: - - (r'^%s/$' % _('signin/'), 'django_authopenid.views.signin'), - url(r'^%s$' % _('about/'), app.about, name='about'), - url(r'^%s$' % _('faq/'), app.faq, name='faq'), - url(r'^%s$' % _('privacy/'), app.privacy, name='privacy'), - url(r'^%s$' % _('logout/'), app.logout, name='logout'), - url(r'^%s$' % _('feedback/'), app.feedback, name='feedback'), - (r'^%sfb/' % _('account/'), include('fbconnect.urls')), - (r'^%s' % _('account/'), include('django_authopenid.urls')), - -Copied from old todo list: - -There are two kinds of things that can be done: -refactorings (think of jogging in the morning, going to a spa, well make the code better :) -new features (go to law school, get a job, do something real) -Just a joke - pick yourself a task and work on it. - -==Refactoring== -* validate HTML -* set up loading of default settings from inside the /forum dir -* automatic dependency checking for modules -* propose how to rename directory forum --> osqa - without breaking things and keeping name of the project root - named the same way - osqa - -==New features== -Whoever wants - pick a feature from the WISH_LIST -add it here and start working on it -If you are not starting immediately - leave it on the wishlist :) - -==Notes== -1)after this is done most new suggested features - may be worked on easily since most of them - only require editing view functions and templates - - However, anyone can work on new features anyway - you'll - just have to probably copy-paste your code into - the branch undergoing refactoring which involves - splitting the files. Auto merging across split points - is harder or impossible. diff --git a/askbot-requirements.txt b/askbot-requirements.txt deleted file mode 100644 index 66a37fbe..00000000 --- a/askbot-requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -django>=1.1 # Note: email subscription sender job requires Django 1.1, everything else works with 1.0 -#mysql-python # Can't use with pip, see http://groups.google.com/group/python-virtualenv/msg/ea988085951c92b3 -python-openid -html5lib -markdown2 -git+git://github.com/robhudson/django-debug-toolbar.git -git+git://github.com/dcramer/django-sphinx.git -svn+http://recaptcha-django.googlecode.com/svn/trunk/ -svn+http://recaptcha.googlecode.com/svn/trunk/recaptcha-plugins/python/ diff --git a/cron/README b/cron/README deleted file mode 100644 index d5573150..00000000 --- a/cron/README +++ /dev/null @@ -1,5 +0,0 @@ -this directory contains sample commands to be executed -by cron - -files with names ending "virtuanenv" should work under Python virtualenv system -other files - with standard unix setup diff --git a/cron/multi_award_badges b/cron/multi_award_badges deleted file mode 100755 index 3d768772..00000000 --- a/cron/multi_award_badges +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -PYTHONPATH=/path/to/dir_above_askbot_site -export PYTHONPATH -PROJECT_ROOT=$PYTHONPATH/askbot_site -python manage.py multi_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 diff --git a/cron/multi_award_badges_virtualenv b/cron/multi_award_badges_virtualenv deleted file mode 100755 index 4230fb22..00000000 --- a/cron/multi_award_badges_virtualenv +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -WORKON_HOME=~/envs/askbot -PROJECT_ROOT=~/webapps/askbot_server/projects/askbot/ - -# activate virtual environment -. $WORKON_HOME/bin/activate - -cd $PROJECT_ROOT -python manage.py multi_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 diff --git a/cron/once_award_badges b/cron/once_award_badges deleted file mode 100755 index 069656ca..00000000 --- a/cron/once_award_badges +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -PYTHONPATH=/path/to/dir_above_askbot_site -export PYTHONPATH -PROJECT_ROOT=$PYTHONPATH/askbot_site -python manage.py once_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 - - -#!/bin/sh -PYTHONPATH=/usr/local/sites/askbot_production -export PYTHONPATH -PROJECT_ROOT=$PYTHONPATH/robofaqs -python $PROJECT_ROOT/manage.py once_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 -python $PROJECT_ROOT/manage.py multi_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 -python $PROJECT_ROOT/manage.py send_email_alerts >> $PROJECT_ROOT/log/cron_email.log 2>&1 \ No newline at end of file diff --git a/cron/once_award_badges_virtualenv b/cron/once_award_badges_virtualenv deleted file mode 100755 index 0011981c..00000000 --- a/cron/once_award_badges_virtualenv +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -WORKON_HOME=~/envs/askbot -PROJECT_ROOT=~/webapps/askbot_server/projects/askbot/ - -# activate virtual environment -. $WORKON_HOME/bin/activate - -cd $PROJECT_ROOT -python manage.py once_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 diff --git a/cron/send_email_alerts b/cron/send_email_alerts deleted file mode 100644 index 7581a88c..00000000 --- a/cron/send_email_alerts +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -PYTHONPATH=/path/to/dir_above_askbot_site -export PYTHONPATH -PROJECT_ROOT=$PYTHONPATH/askbot_site -/path/to/python $PROJECT_ROOT/manage.py send_email_alerts diff --git a/cron/send_email_alerts_virtualenv b/cron/send_email_alerts_virtualenv deleted file mode 100644 index 2f1b64d0..00000000 --- a/cron/send_email_alerts_virtualenv +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -WORKON_HOME=~/envs/askbot -PROJECT_ROOT=~/webapps/askbot_server/projects/askbot/ - -# activate virtual environment -. $WORKON_HOME/bin/activate - -cd $PROJECT_ROOT -python manage.py send_email_alerts >> $PROJECT_ROOT/log/cron_mail.log 2>&1 diff --git a/forum/LICENSE b/forum/LICENSE new file mode 100644 index 00000000..803781c5 --- /dev/null +++ b/forum/LICENSE @@ -0,0 +1,14 @@ +Copyright (C) 2009. Chen Gang + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . diff --git a/forum/cron/README b/forum/cron/README new file mode 100644 index 00000000..d5573150 --- /dev/null +++ b/forum/cron/README @@ -0,0 +1,5 @@ +this directory contains sample commands to be executed +by cron + +files with names ending "virtuanenv" should work under Python virtualenv system +other files - with standard unix setup diff --git a/forum/cron/multi_award_badges b/forum/cron/multi_award_badges new file mode 100755 index 00000000..3d768772 --- /dev/null +++ b/forum/cron/multi_award_badges @@ -0,0 +1,5 @@ +#!/bin/sh +PYTHONPATH=/path/to/dir_above_askbot_site +export PYTHONPATH +PROJECT_ROOT=$PYTHONPATH/askbot_site +python manage.py multi_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 diff --git a/forum/cron/multi_award_badges_virtualenv b/forum/cron/multi_award_badges_virtualenv new file mode 100755 index 00000000..4230fb22 --- /dev/null +++ b/forum/cron/multi_award_badges_virtualenv @@ -0,0 +1,10 @@ +#!/bin/sh + +WORKON_HOME=~/envs/askbot +PROJECT_ROOT=~/webapps/askbot_server/projects/askbot/ + +# activate virtual environment +. $WORKON_HOME/bin/activate + +cd $PROJECT_ROOT +python manage.py multi_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 diff --git a/forum/cron/once_award_badges b/forum/cron/once_award_badges new file mode 100755 index 00000000..069656ca --- /dev/null +++ b/forum/cron/once_award_badges @@ -0,0 +1,14 @@ +#!/bin/sh +PYTHONPATH=/path/to/dir_above_askbot_site +export PYTHONPATH +PROJECT_ROOT=$PYTHONPATH/askbot_site +python manage.py once_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 + + +#!/bin/sh +PYTHONPATH=/usr/local/sites/askbot_production +export PYTHONPATH +PROJECT_ROOT=$PYTHONPATH/robofaqs +python $PROJECT_ROOT/manage.py once_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 +python $PROJECT_ROOT/manage.py multi_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 +python $PROJECT_ROOT/manage.py send_email_alerts >> $PROJECT_ROOT/log/cron_email.log 2>&1 \ No newline at end of file diff --git a/forum/cron/once_award_badges_virtualenv b/forum/cron/once_award_badges_virtualenv new file mode 100755 index 00000000..0011981c --- /dev/null +++ b/forum/cron/once_award_badges_virtualenv @@ -0,0 +1,10 @@ +#!/bin/sh + +WORKON_HOME=~/envs/askbot +PROJECT_ROOT=~/webapps/askbot_server/projects/askbot/ + +# activate virtual environment +. $WORKON_HOME/bin/activate + +cd $PROJECT_ROOT +python manage.py once_award_badges >> $PROJECT_ROOT/log/cron_badges.log 2>&1 diff --git a/forum/cron/send_email_alerts b/forum/cron/send_email_alerts new file mode 100644 index 00000000..7581a88c --- /dev/null +++ b/forum/cron/send_email_alerts @@ -0,0 +1,5 @@ +#!/bin/sh +PYTHONPATH=/path/to/dir_above_askbot_site +export PYTHONPATH +PROJECT_ROOT=$PYTHONPATH/askbot_site +/path/to/python $PROJECT_ROOT/manage.py send_email_alerts diff --git a/forum/cron/send_email_alerts_virtualenv b/forum/cron/send_email_alerts_virtualenv new file mode 100644 index 00000000..2f1b64d0 --- /dev/null +++ b/forum/cron/send_email_alerts_virtualenv @@ -0,0 +1,10 @@ +#!/bin/sh + +WORKON_HOME=~/envs/askbot +PROJECT_ROOT=~/webapps/askbot_server/projects/askbot/ + +# activate virtual environment +. $WORKON_HOME/bin/activate + +cd $PROJECT_ROOT +python manage.py send_email_alerts >> $PROJECT_ROOT/log/cron_mail.log 2>&1 diff --git a/forum/documentation/HOW_TO_DEBUG b/forum/documentation/HOW_TO_DEBUG new file mode 100644 index 00000000..ba36198a --- /dev/null +++ b/forum/documentation/HOW_TO_DEBUG @@ -0,0 +1,39 @@ +1) LOGGING +Please remember that log files may contain plaintext passwords, etc. + +Please do not add print statements - at least do not commit them to git +because in some environments printing to stdout causes errors + +Instead use python logging this way: +-------------------------------- +#somewere on top of file +import logging + +#anywhere below +logging.debug('this maybe works') +logging.error('have big error!') +#or even +logging.debug('') #this will add time, line number, function and file record +#sometimes useful record for call tracing on its own +#etc - take a look at http://docs.python.org/library/logging.html +------------------------------- + +in OSQA logging is currently set up in settings_local.py.dist +please update it if you need - in older revs logging strings have less info + +messages of interest can be grepped out of the log file by module/file/function name +e.g. to take out all django_authopenid logs run: +>grep 'osqa\/django_authopenid' log/django.osqa.log | sed 's/^.*MSG: //' +in the example above 'sed' call truncates out a long prefix +and makes output look more meaningful + +2) DJANGO DEBUG TOOLBAR +osqa works with django debug toolbar +if debugging under apache server, check +that debug toolbar media is loaded correctly +if toolbar is enabled but you do not see it, possibly some Alias statement +in apache config is wrong in your VirtualHost or elsewhere + +3) If you discover new debugging techniques, please add here. +Possible areas to improve - at this point there is no SQL query logging, +as well as request data and http header. diff --git a/forum/documentation/INSTALL b/forum/documentation/INSTALL new file mode 100644 index 00000000..c1a41544 --- /dev/null +++ b/forum/documentation/INSTALL @@ -0,0 +1,284 @@ +CONTENTS +------------------ +A. PREREQUISITES +B. INSTALLATION + 1. Settings file + 2. Database + 3. Running Askbot in the development server + 4. Installation under Apache/WSGI + 5. Full text search + 6. Email subscriptions + 7. Sitemap + 8. Miscellaneous +C. CONFIGURATION PARAMETERS (settings_local.py) +D. CUSTOMIZATION + + +A. PREREQUISITES +----------------------------------------------- +Note: by default all installation activity is made in the superuser 'root' account. +This can be achieved either by logging in as root (su root), +or - if you have program sudo installed - prefix all commands with sudo. +So sodo will be listed below as optional. + +0. We recommend you to use python-setuptools to install pre-requirement libraries. +If you haven't installed it, please try to install it first. +e.g, [sudo] apt-get install python-setuptools + +1. Python2.5/2.6, Django v1.1.1 + +1A If you are using MySQL, mysql client for python must be installed +[sudo] easy_install mysql-python + +2. Python-openid v2.2 +http://openidenabled.com/python-openid/ +[sudo] easy_install python-openid + +4. html5lib +http://code.google.com/p/html5lib/ +Used for HTML sanitizer +[sudo] easy_install html5lib + +5. Markdown2 +http://code.google.com/p/python-markdown2/ +[sudo] easy_install markdown2 + +6. Django Debug Toolbar +http://github.com/robhudson/django-debug-toolbar/tree/master + +7. djangosphinx (optional - for full text questions+answer+tag) +http://github.com/dcramer/django-sphinx/tree/master/djangosphinx + +8. sphinx search engine (optional, works together with djangosphinx) +http://sphinxsearch.com/downloads.html + +9. recaptcha_django +http://code.google.com/p/recaptcha-django/ + +10. python recaptcha module +http://code.google.com/p/recaptcha/ +Notice that you will need to register with recaptcha.net and receive +recaptcha public and private keys that need to be saved in your +settings_local.py file + +11. South +http://south.aeracode.org/docs/installation.html +Used for database schema and data migrations +[sudo] easy_install South + +EXTRA DEPENDENCIES FOR PYTHON 2.4 +* hashlib (made standard in python 2.5) + +NOTES: django_authopenid is included into Askbot code +and is significantly modified. http://code.google.com/p/django-authopenid/ +no need to install this library + +B. INSTALLATION +----------------------------------------------- +0. Make sure you have all above python libraries installed. + + DO NOT name the main directory 'askbot' - this name is reserved + for the future name of the app file itself. + + make askbot installation server-readable on Linux command might be: + chown -R yourlogin:apache /path/to/askbot-site + + directories: + /path/to/askbot-site/forum/upfiles + /path/to/askbot-site/log + must be server writable + + on Linux type chmod + chmod -R g+w /path/to/askbot-site/forum/upfiles + chmod -R g+w /path/to/askbot-site/log + + above it is assumed that webserver runs under group named "apache" + +1. Settings file + +Copy settings_local.py.dist to settings_local.py and +update all your settings. Check settings.py and update +it as well if necessory. +Section C explains configuration paramaters. + +Minimally required modification of settings_local.py are +DATABASE_NAME +DATABASE_USER +DATABASE_PASSWORD +DATABASE_ENGINE + +If you set these up, and your database is ready (see section 2), +run (note that application 'forum' is under control of south migration system: + +python manage.py syncdb #create tables for anything not under control of migration system +python manage.py migrate forum #run migration command - will apply all migrations in sequence + +Now you are ready to test your installation: +python manage.py runserver `hostname -i`:8000 +(choose another port number if you wish) + +and askbot should be running - if you have any issues at this point (or later:) +please post them at http://askbot.org/meta + +2. Database + +Prepare your database by using the same database/account +configuration from above. + +If your host has database manager in the control panel - you +can use that or you can create database by typing commands manually + +on MySQL the commands are: + +create database askbot DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci; +grant all on askbot.* to 'askbot'@'localhost'; + +And then run : + +python manage.py syncdb +python manage.py migrate + + +3. Running Askbot on the development server + +Run "python manage.py runserver" to startup django +development environment. +(Under Linux you can use command "python manage.py runserver `hostname -i`:8000", +where you can use any other available number for the port) + +you might want to have DEBUG=True in the beginning of settings.py +when using the test server + +4. Installation under Apache/WSGI + +The main wsgi script is in the file django.wsgi +it does not need to be modified + +4.1 Configure webserver +Settings below are not perfect but may be a good starting point + +--------- +WSGISocketPrefix /path/to/socket/sock #must be readable and writable by apache +WSGIPythonHome /usr/local #must be readable by apache +WSGIPythonEggs /var/python/eggs #must be readable and writable by apache + +#NOTE: all urs below will need to be adjusted if +#settings.FORUM_SCRIPT_ALIAS !='' (e.g. = 'forum/') +#this allows "rooting" forum at http://example.com/forum, if you like + + ServerAdmin forum@example.com + DocumentRoot /path/to/askbot-site + ServerName example.com + + #run mod_wsgi process for django in daemon mode + #this allows avoiding confused timezone settings when + #another application runs in the same virtual host + WSGIDaemonProcess askbot + WSGIProcessGroup askbot + + #force all content to be served as static files + #otherwise django will be crunching images through itself wasting time + Alias /m/ /path/to/askbot-site/forum/skins/ + Alias /upfiles/ /path/to/askbot-site/forum/upfiles/ + + Order deny,allow + Allow from all + + + #this is your wsgi script described in the prev section + WSGIScriptAlias / /path/to/askbot-site/django.wsgi + + #this will force admin interface to work only + #through https (optional) + #"nimda" is the secret spelling of "admin" ;) + + RewriteEngine on + RewriteRule /nimda(.*)$ https://example.com/nimda$1 [L,R=301] + + CustomLog /var/log/httpd/askbot/access_log common + ErrorLog /var/log/httpd/askbot/error_log + +#(optional) run admin interface under https + + ServerAdmin forum@example.com + DocumentRoot /path/to/askbot-site + ServerName example.com + SSLEngine on + SSLCertificateFile /path/to/ssl-certificate/server.crt + SSLCertificateKeyFile /path/to/ssl-certificate/server.key + WSGIScriptAlias / /path/to/askbot-site/django.wsgi + CustomLog /var/log/httpd/askbot/access_log common + ErrorLog /var/log/httpd/askbot/error_log + DirectoryIndex index.html + +------------- + +5. Full text search (using sphinx search) + + Currently full text search works only with sphinx search engine + And builtin PostgreSQL (postgres only >= 8.3???) + + 5.1 Instructions for Sphinx search setup + Sphinx at this time supports only MySQL and PostgreSQL databases + to enable this, install sphinx search engine and djangosphinx + + configure sphinx, sample configuration can be found in + sphinx/sphinx.conf file usually goes somewhere in /etc tree + + build askbot index first time manually + + % indexer --config /path/to/sphinx.conf --index askbot + + setup cron job to rebuild index periodically with command + your crontab entry may be something like + + 0 9,15,21 * * * /usr/local/bin/indexer --config /etc/sphinx/sphinx.conf --all --rotate >/dev/null 2>&1 + adjust it as necessary this one will reindex three times a day at 9am 3pm and 9pm + + if your forum grows very big ( good luck with that :) you'll + need to two search indices one diff index and one main + please refer to online sphinx search documentation for the information + on the subject http://sphinxsearch.com/docs/ + + in settings_local.py set + USE_SPHINX_SEARCH=True + adjust other settings that have SPHINX_* prefix accordingly + remember that there must be trailing comma in parentheses for + SHPINX_SEARCH_INDICES tuple - particlarly with just one item! + + in settings.py look for INSTALLED_APPS + and uncomment #'djangosphinx', + + +6. Email subscriptions + + This function at the moment requires Django 1.1 + + edit paths in the file forum/cron/send_email_alerts + set up a cron job to call forum/cron/send_email_alerts once or twice a day + subscription sender may be tested manually in shell + by calling foru/cron/send_email_alerts + +7. Sitemap +Sitemap will be available at /sitemap.xml +e.g yoursite.com/forum/sitemap.xml + +google will be pinged each time question, answer or +comment is saved or a question deleted + +for this to be useful - do register you sitemap with Google at +https://www.google.com/webmasters/tools/ + +8. Miscellaneous + +There are some demo scripts under foru/sql_scripts folder, +including badges and test accounts for CNProg.com. You +don't need them to run your sample. + +C. Customization + +Other than settings_local.py the following will most likely need customization: +* locale/*/django.po - language files that may also contain your site-specific messages + if you want to start with english messages file - look for words like "forum" and + "Askbot" in the msgstr lines +* skins diff --git a/forum/documentation/INSTALL.pip b/forum/documentation/INSTALL.pip new file mode 100644 index 00000000..92b1c7fa --- /dev/null +++ b/forum/documentation/INSTALL.pip @@ -0,0 +1,31 @@ +* Install virtualenv and pip: + easy_install virtualenv + easy_install pip + +* Install MySQL: + sudo apt-get install mysql-client mysql-server + +* Install sphinxsearch. See: + [optional] + http://sphinxsearch.com/downloads.html + http://www.hackido.com/2009/01/install-sphinx-search-on-ubuntu.html + git://github.com/johnl/deb-sphinx-search.git + +* Install a virtual environment OUTSIDE of this directory: + pip install -E ~/env -r osqa-requirements.txt +[there is discussion on the pinax forums about what it should be outside +the source directory] + +* Notice that you will need to register with recaptcha.net and receive + recaptcha public and private keys that need to be saved in your + settings_local.py file + +* Start your environment: + source ~/env/bin/activate + +* Install mysql-python into your virtualenv, because we can't +automagically install it with pip: + easy_install --prefix ~/env/ mysql-python + +For more information about why pip can't automatically install the +MySQL driver, see this message: http://groups.google.com/group/python-virtualenv/msg/ea988085951c92b3 diff --git a/forum/documentation/INSTALL.webfaction b/forum/documentation/INSTALL.webfaction new file mode 100644 index 00000000..401971a0 --- /dev/null +++ b/forum/documentation/INSTALL.webfaction @@ -0,0 +1,346 @@ +Detailed instructions for installing OSQA on WebFaction + +Adapted from http://code.pinaxproject.com/wiki/DetailedPinaxWebfaction/ + +Please email turian at gmail with any updates or corrections. + + +Installing OSQA on Webfaction +------------------------------------ + +Details the steps for setting up OSQA on a Webfaction shared-hosting +account, including email setup, using Apache2, mod_wsgi, psycopg2. + +If you want to search-and-replace through this file, you will need to replace: + osqa_server [name of Webfaction application, which will be in ~/webapps/] + osqa_static [name of Webfaction application for static media serving] + DOMAIN.com [domain name for OSQA site] + PORT [port number assigned by WebFaction to your mod_wsgi application] + SITENAME [name you give the OSQA site, which will contain the apache logs] + MYOSQA [name of the OSQA project] + MAILBOX_USERNAME [username you give the email address] + MAILBOX_PASSWORD [password that webfaction gives to this email username] + OSQADATABASE_NAME [username you give the database] + OSQADATABASE_PASSWORD [password that webfaction gives to this database] + ~/envs/osqa [directory for the OSQA python environment, grep for 'env'] + USERNAME [your WebFaction username] + +Some things I'm not sure about: + +Here's what I don't know how to do: + * Set up a nginx server for static media. + * Configure sphinx search + * Use PostgreSQL, not MySQL: http://osqa.net/question/13/can-i-use-osqa-with-postgresql + + +Webfaction Control Panel +-------------------------- + +(Note: if you sign up and pick django it will create the application +for you, website/subdomain and associate the two for you.) + + If necessary, add or create any domains or subdomains you may need. + + https://panel.webfaction.com/domain/list/ + + Let's call the domain DOMAIN.com. + + Create a new Webfaction application with a "Type:" of "mod_wsgi + 2.5/Python2.5", naming it "osqa_server". (These instructions + might also work with mod_wsgi 2.0, if you like.) + + https://panel.webfaction.com/app_/list + + Note the port number assigned to the mod_wsgi application. Call + it PORT. + + Create a new Webfaction website which will associate the subdomain + with the new osqa_server application. Give it name SITENAME, at least one + domain, and set it to use the osqa_server application for the site's + root location, "/". + + https://panel.webfaction.com/site/list + + You will need to create a database, typically one for each project + you create. Change the type to PostgreSql and modify the name (it + defaults to your webfaction account name) by adding an underscore + and a project-specific identifier such as "_osqa". Before + leaving this section of the control panel, you may wish to change + the password. + + https://panel.webfaction.com/database/create + + Call these OSQADATABASE_NAME and OSQADATABASE_PASSWORD. + + Save the database password for later. + + [The following I haven't figured out yet] + You will probably want to add a static media server. This is a + Webfaction application. I created one of type "Static only (no + .htaccess)" and with the name of "osqa_static". + + https://panel.webfaction.com/app_/create + + To configure email, you need an email mailbox. Add one here. Note + that your mailbox password shouldn't be the same password you use + to SSH to webfaction. + + https://panel.webfaction.com/mailbox/list + + Save the mail password for later. + We will call the username and password MAILBOX_USERNAME and + MAILBOX_PASSWORD, respectively. + You might also consider adding an email address like admin@DOMAIN.com, + here: + + https://panel.webfaction.com/email/list + + +OSQA Software +-------------- + + Log onto webfaction and get the code. I use my fork because I have + a simple pip installation: + git://github.com/turian/osqa.git + In my situation, I keep source code in ~/utils/src, create + virtual environments in ~/envs/osqa, and create Pinax projects in + ~/webapps/osqa_server/projects. + + You will need pip + virtualenv installed: + + easy_install --prefix=~/utils/ pip + easy_install --prefix=~/utils/ virtualenv + + cd ~/utils/src/ + git clone git://github.com/turian/osqa.git + cd osqa + + # We need python2.5 to be compatible with WSGI + python2.5 ~/utils/bin/pip install -E ~/envs/osqa -r osqa-requirements.txt + source ~/envs/osqa/bin/activate + + # [Optional] If you want a MySQL database + easy_install-2.5 --prefix ~/envs/osqa/ mysql-python + +Additional Software +------------------- + + [Note that PostgreSQL installation doesn't work for me.] + + You will need to install psycopg2 separately for PostgreSQL. + Psycopg2 requires a little fiddling. Continuing to + work in the ~/utils/src/ directory: + + cd ~/utils/src/ + wget http://initd.org/pub/software/psycopg/psycopg2-2.0.13.tar.gz + tar zxf psycopg2-2.0.13.tar.gz + cd psycopg2-2.0.13 + nano setup.cfg + + # edit the line reading "#pg_config=" so that it reads: + "pg_config=/usr/local/pgsql/bin/pg_config" + + python2.5 setup.py build + python2.5 setup.py install + + +Create a Project +---------------- + + In Pinax, you clone a project from OSQA. + However, OSQA we just copy it. + + cd ~/webapps/osqa_server + mkdir projects + cd projects + cp -R ~/utils/src/osqa MYOSQA + cd MYOSQA + export OSQAPROJECT=`pwd` + + Make some directories, as described in the OSQA INSTALL file: + [okay I haven't actually done this yet] + +# mkdir -p $OSQASITE/upfiles/ +# mkdir -p $OSQALOG +# sudo chown -R `whoami`:www-data $OSQASITE +# sudo chown -R `whoami`:www-data $OSQALOG +# chmod -R g+w $OSQASITE/upfiles +# chmod -R g+w $OSQALOG + + + Edit the settings files: + + cd $OSQAPROJECT + cp settings_local.py.dist settings_local.py + vi settings_local.py settings.py + + Pay attention to the following settings: + + DATABASE_ENGINE = 'mysql' + DATABASE_NAME = 'OSQADATABASE_NAME' + DATABASE_USER = 'OSQADATABASE_NAME' + DATABASE_PASSWORD = 'OSQADATABASE_PASSWORD' + + EMAIL_HOST='smtp.webfaction.com' + EMAIL_HOST_USER='MAILBOX_USERNAME' + EMAIL_HOST_PASSWORD='MAILBOX_PASSWORD' + EMAIL_PORT='25' + DEFAULT_FROM_EMAIL = 'MAILBOX_USERNAME@DOMAIN.com' + SERVER_EMAIL = 'MAILBOX_USERNAME@DOMAIN.com' + # The following setting might not be necessary, it's used in Pinax tho + CONTACT_EMAIL = "MAILBOX_USERNAME@DOMAIN.com" + + APP_URL = 'http://DOMAIN.com' #used by email notif system and RSS + + [Later on, the install instructions should talk about] + SERVE_MEDIA = False # [Not present, not ready yet] + + Create a directory for logs: + + cd $OSQAPROJECT + mkdir log + + Modify mail cron scripts "cron/send_email_alerts" as follows: + [Pinax has cron/emit_notices.sh, cron/retry_deferred.sh, + cron/send_mail.sh, are these also necessary?] + + #!/bin/sh + + WORKON_HOME=~/envs/osqa + PROJECT_ROOT=~/webapps/osqa_server/projects/MYOSQA/ + + # activate virtual environment + . $WORKON_HOME/bin/activate + + cd $PROJECT_ROOT + python manage.py send_email_alerts >> $PROJECT_ROOT/log/cron_mail.log 2>&1 + + Use command "crontab -e" to add this script to your cron file, to run twice a day:: + + 1 0,12 * * * ~/webapps/osqa_server/projects/MYOSQA/cron/send_email_alerts + + [Configure sphinx] + + Create the database tables, indices, and so forth: + + python manage.py syncdb + + [Ignore the following static media steps, I haven't tried them] + Build media directory links within the project and create symbolic + links on the static media server. + python manage.py build_media -all + mkdir ~/webapps/OSQA_STATIC/MYOSQA + ln -sd ~/webapps/osqa_server/projects/MYOSQA/site_media ~/webapps/OSQA_STATIC/MYOSQA/site_media + + + Set up the badges: + + 1. You should run the SQL commands in: + + sql_scripts/badges.sql + + 2. Edit paths in the file `cron/multi_award_badges`. (This + file doesn't yet exist in the git repositories, so just + copy `cron/send_email_alerts` and make sure the command + `multi_award_badges` is executed.) + + 3. Run `cron/multi_award_badges` to make sure it works okay. + + 4. Use `crontab -e` to call `cron/multi_award_badges` maybe + four times an hour. + + 4,19,34,49 * * * * ~/webapps/osqa_server/projects/MYOSQA/cron/multi_award_badges + + 5. Repeat steps 1-4 for `cron/once_award_badges`. + + +Configure Apache2 +---------------- + + Edit ~/webapps/osqa_server/apache2/conf/httpd.conf as follows:: + + ServerAdmin "MAILBOX_USERNAME@DOMAIN.com" + ServerRoot "/home/USERNAME/webapps/osqa_server/apache2" + ServerName DOMAIN.com + + LoadModule dir_module modules/mod_dir.so + LoadModule env_module modules/mod_env.so + #LoadModule setenvif_module modules/mod_setenvif.so + LoadModule log_config_module modules/mod_log_config.so + LoadModule mime_module modules/mod_mime.so + LoadModule rewrite_module modules/mod_rewrite.so + LoadModule wsgi_module modules/mod_wsgi.so + + KeepAlive Off + Listen PORT + LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined + CustomLog /home/USERNAME/logs/user/access_osqa_server_log combined + ErrorLog /home/USERNAME/logs/user/error_osqa_server_log + ServerLimit 2 + + #SetEnvIf X-Forwarded-SSL on HTTPS=1 + + WSGIPythonPath /home/USERNAME/envs/osqa/lib/python2.5/site-packages/ + WSGIScriptAlias / /home/USERNAME/webapps/osqa_server/projects/MYOSQA/osqa.wsgi + + LoadModule alias_module modules/mod_alias.so + WSGIDaemonProcess osqaWSGI user=USERNAME group=USERNAME threads=25 python-path=/home/USERNAME/envs/osqa/lib/python2.5/site-packages + WSGIProcessGroup osqaWSGI + + NameVirtualHost 127.0.0.1:PORT + + #ErrorLog "logs/MYOSQA_2009_05_06.log" + SetHandler none + #Alias /site_media /home/USERNAME/webapps/static/MYOSQA/site_media + + #force all content to be served as static files + #otherwise django will be crunching images through itself wasting time + Alias /content/ /home/USERNAME/webapps/osqa_server/projects/MYOSQA/templates/content/ + Alias /forum/admin/media/ /home/turian/envs/osqa/lib/python2.5/site-packages/django/contrib/admin/media/ + #AliasMatch /([^/]*\.css) /home/USERNAME/webapps/osqa_server/projects/MYOSQA/templates/content/style/$1 + + # Order deny,allow + # Allow from all + + + If you want virtual hosts of the admin interface under HTTPS, please + look at OSQA's install file. + + Create osqa.wsgi and edit it: + cp osqa.wsgi.dist osqa.wsgi + + Edit ~/webapps/osqa_server/projects/MYOSQA/deploy/osqa.wsgi as follows:: + + import os + import sys + + # redirect sys.stdout to sys.stderr for bad libraries like geopy that uses + # print statements for optional import exceptions. + sys.stdout = sys.stderr + + from os.path import abspath, dirname, join + from site import addsitedir + + # add the virtual environment site-packages to the path + from site import addsitedir + addsitedir('/home/USERNAME/envs/osqa/lib/python2.5/site-packages') + + sys.path.insert(0, abspath(join(dirname(__file__), "../"))) + sys.path.append(abspath(dirname(__file__))) + + from django.conf import settings + os.environ["DJANGO_SETTINGS_MODULE"] = "MYOSQA.settings" + + #print sys.path + + from django.core.handlers.wsgi import WSGIHandler + application = WSGIHandler() + +And then you're up and running with: + + ~/webapps/osqa_server/apache2/bin/stop + ~/webapps/osqa_server/apache2/bin/start + +You should log in to the admin interface (http://DOMAIN.com/admin/), +and go to "Sites > Sites", and change the domain name that is used in +all emails. diff --git a/forum/documentation/ROADMAP.rst b/forum/documentation/ROADMAP.rst new file mode 100644 index 00000000..c79e0ae4 --- /dev/null +++ b/forum/documentation/ROADMAP.rst @@ -0,0 +1,88 @@ +Intro +========= +ROADMAP aims to streamline activities of the Askbot open source project and +to minimize ad-hoc approaches of "big-picture" level. + +Aksbot is a Question and Asnwer system for the normal people! + +Let's discuss stuff that goes into this file on +http://groups.google.com/group/askbot + +Bacic principles of the project +================================== +Here they are: + +* our rule #1 is that all developers have commit right to the project + repository, but they must follow this ROADMAP and TODO - + to keep up with our own sanity. +* we welcome contributions by other people and show tolerance + and patience - especially to the new team members. +* when users who might not be tech-savvy ask questions - + we try to answer to the point and using their language + (i.e. not programmer jargon:) +* we favor plain and minimalistic style of programming, but pay + attention to detail - especially details of user experience. + +We try do develop using the following workflow: + +* specify problem that we try to solve +* create requirements that will guarantee a solution, once met +* dream up some implementation ideas (maybe even some sketches on the paper) +* discuss and decide on the best one +* write and test code + +The process doesn't have to be this formal all the time, but trying to stick +to some subset of this almost always helps! +Especially it helps to iron out disagreements between +individual programmers (which if you are one - you know are qute common +- and they don't all end well :). + +Ad-hoc programming - i.e. simply go and add code - is not really encouraged. +This works fine in the one person team or when the team consists of +best friends, but is almost sure to fail in a heterogenous group. + +Architecture and Requirements +===================================== +Obviously Django and Python are pre-made choices - so this +is not going to change any time soon. At this point all of +the client side Javascript is written using jQuery library. + +Our basic principle is that Askbot should be a mashable Q&A component. +Askbot is an application written in Python/Django. So it should be +distributable as a Django App alone or as a whole site (by option). + +If we develop sub-systems that can be used in the broader scope - +we package that thing as a separate django application (login system is one example). + +We will start using Google Closure library soon! + +Sub-systems +----------------- +* authentication system +* Q&A system +* admin interface +* full text search +* skins (directory forum/skins) + +Authentication system +------------------------- +Authentication system will be a separate django application + +Here is the discussion thread: +* http://groups.google.com/group/askbot/browse_thread/thread/1916dfcf666dd56c + +Most of the requirements are listed in the first message + +Skins +----------- +Skins eventually must be upgrade-stable - that is people who created custom +skins should not need to change anything if something changes in the code + +Admin interface +----------------------- +* extend forum/settings.py to list default settings of various groups +* create Registry database table the will store setting values +* leave only essential settings that go to the main django settings.py +Create key-value storage +* should some settings be accessible to admins and some to staff??? + for example-secret keys probably should not be shared with staff members diff --git a/forum/documentation/TODO.rst b/forum/documentation/TODO.rst new file mode 100644 index 00000000..f202a3f7 --- /dev/null +++ b/forum/documentation/TODO.rst @@ -0,0 +1,63 @@ +note: there is also WISH_LIST. Here is only stuff that will be done soon. + +Site looks +=========== +* make links within posts blue so that they are visible + +Code Cleanups +============== +* remove usage of EXTERNAL_LEGACY_LOGIN +* clean up forum_modules: + * keep this directory for dependency modules that can be shared + by multiple apps, + * but move other things that are not shared + inside forum app directory + * one-by one convert "auto-discovery" modules into + regular explicit python imports +* python2.4 incompatibilities + * datatime.datetime.strptime + +Bugs +====== +* make sure that search feature covers questions and answers + (title, body, tags) + +Refactoring +============= +* merge search, question and index view functions into one + +Skins +======= +* organize templates and document them so that + skins could be more easily created by others + who are savvy enough +* identify and maybe create snippet-type templates + and put them into a separate directory + for example: + * gravatar (currently a string in + forum/templatetags/extra_tags.py - try inclusion template + and see if it slows things down a lot) + * question body + * answer body + * datetime widget??? +* there is a separator line between posts + but it shows either before the post or after + it is nice that separator is lightweight - + based on css alone - but we need to fix it so that + it shows only between the posts as a joining item + +Features +=========== +* new login system, please see + http://groups.google.com/group/askbot/browse_thread/thread/1916dfcf666dd56c + on a separate branch multi-auth-app, then merge +* forum admin interface, some badge configuration + +Development environment +========================== +* set up environment for closure development + +Project website +==================== +* Logo!!! Ideas? +* Adopt Jekyll for project site and transition from Dango diff --git a/forum/documentation/WISH_LIST b/forum/documentation/WISH_LIST new file mode 100644 index 00000000..3e383d3e --- /dev/null +++ b/forum/documentation/WISH_LIST @@ -0,0 +1,55 @@ +* smarter debug mode +* The wonder bar (integrated the search / ask functionality) +* The authentication system ??? +* allow multiple logins to the same account +* allow multiple logins to the same account +* more advanced templating/skinning system +* per-tag email subscriptions +* view for personalized news on the site +* a little flag popping when there are news +* drill-down mode for navigation by tags +* improved admin console +* sort out mess with profile - currently we patch django User + +* Some functionality should be moved out of the forums app, in the case +that the forum app is restricted only to authenticated users: + + (r'^%s/$' % _('signin/'), 'django_authopenid.views.signin'), + url(r'^%s$' % _('about/'), app.about, name='about'), + url(r'^%s$' % _('faq/'), app.faq, name='faq'), + url(r'^%s$' % _('privacy/'), app.privacy, name='privacy'), + url(r'^%s$' % _('logout/'), app.logout, name='logout'), + url(r'^%s$' % _('feedback/'), app.feedback, name='feedback'), + (r'^%sfb/' % _('account/'), include('fbconnect.urls')), + (r'^%s' % _('account/'), include('django_authopenid.urls')), + +Copied from old todo list: + +There are two kinds of things that can be done: +refactorings (think of jogging in the morning, going to a spa, well make the code better :) +new features (go to law school, get a job, do something real) +Just a joke - pick yourself a task and work on it. + +==Refactoring== +* validate HTML +* set up loading of default settings from inside the /forum dir +* automatic dependency checking for modules +* propose how to rename directory forum --> osqa + without breaking things and keeping name of the project root + named the same way - osqa + +==New features== +Whoever wants - pick a feature from the WISH_LIST +add it here and start working on it +If you are not starting immediately - leave it on the wishlist :) + +==Notes== +1)after this is done most new suggested features + may be worked on easily since most of them + only require editing view functions and templates + + However, anyone can work on new features anyway - you'll + just have to probably copy-paste your code into + the branch undergoing refactoring which involves + splitting the files. Auto merging across split points + is harder or impossible. diff --git a/forum/documentation/askbot-requirements.txt b/forum/documentation/askbot-requirements.txt new file mode 100644 index 00000000..66a37fbe --- /dev/null +++ b/forum/documentation/askbot-requirements.txt @@ -0,0 +1,9 @@ +django>=1.1 # Note: email subscription sender job requires Django 1.1, everything else works with 1.0 +#mysql-python # Can't use with pip, see http://groups.google.com/group/python-virtualenv/msg/ea988085951c92b3 +python-openid +html5lib +markdown2 +git+git://github.com/robhudson/django-debug-toolbar.git +git+git://github.com/dcramer/django-sphinx.git +svn+http://recaptcha-django.googlecode.com/svn/trunk/ +svn+http://recaptcha.googlecode.com/svn/trunk/recaptcha-plugins/python/ diff --git a/forum/importers/__init__.py b/forum/importers/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/forum/importers/stackexchange/ANOMALIES b/forum/importers/stackexchange/ANOMALIES new file mode 100644 index 00000000..05a7dbdb --- /dev/null +++ b/forum/importers/stackexchange/ANOMALIES @@ -0,0 +1,14 @@ +* several user accounts with same email +* users with no openid +* users with no email (hack: gravatar set to settings.ANONYMOUS_USER_EMAIL) +* users with no screen name +* users with no email and no screen name (25% in homeschool) +* tag preferences are not stored explicitly (interesting/ignored) + maybe they are in se.User.preferences_raw + but the data there is not marked up and is kind of cryptic +* we don't have Community user. SE has one with id=-1 + this id may break the load script + potential break places are anywhere where is X.get_user() call + issues may happen with larger data sets where activity + of user "Community" is somehow reflected in a way + that load_stackexchange does not take care of diff --git a/forum/importers/stackexchange/README b/forum/importers/stackexchange/README new file mode 100644 index 00000000..64d8f5fb --- /dev/null +++ b/forum/importers/stackexchange/README @@ -0,0 +1,62 @@ +this app's function will be to: + +* install it's own tables (#todo: not yet automated) +* read SE xml dump into DjangoDB (automated) +* populate osqa database (automated) +* remove SE tables (#todo: not done yet) + +Current process to load SE data into OSQA is: +============================================== + +1) backup database + +2) unzip SE dump into dump_dir (any directory name) + you may want to make sure that your dump directory in .gitignore file + so that you don't publish it by mistake + +3) enable 'stackexchange' in the list of installed apps (probably aready in settings.py) + +4) (optional - create models.py for SE, which is included anyway) run: + + #a) run in-place removal of xml namspace prefix to make parsing easier + perl -pi -w -e 's/xs://g' $SE_DUMP_PATH/xsd/*.xsd + cd stackexchange + python parse_models.py $SE_DUMP_PATH/xsd/*.xsd > models.py + +5) Install stackexchange models (as well as any other missing models) + python manage.py syncdb + +6) make sure that osqa badges are installed + if not, run (example for mysql): + + mysql -u user -p dbname < sql_scripts/badges.sql + +7) load SE data: + + python manage.py load_stackexchange dump_dir + + if anything doesn't go right - run 'python manage.py flush' and repeat + steps 6 and 7 + +NOTES: +============ + +Here is the load script that I used for the testing +it assumes that SE dump has been unzipped inside the tmp directory + + #!/bin/sh$ + python manage.py flush + #delete all data + mysql -u osqa -p osqa < sql_scripts/badges.sql + python manage.py load_stackexchange tmp + +Untested parts are tagged with comments starting with +#todo: + +The test set did not have all the usage cases of StackExchange represented so +it may break with other sets. + +The job takes some time to run, especially +content revisions and votes - may be optimized + +Some of the fringe cases are described in file stackexchange/ANOMALIES diff --git a/forum/importers/stackexchange/__init__.py b/forum/importers/stackexchange/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/forum/importers/stackexchange/management/__init__.py b/forum/importers/stackexchange/management/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/forum/importers/stackexchange/management/commands/__init__.py b/forum/importers/stackexchange/management/commands/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/forum/importers/stackexchange/management/commands/load_stackexchange.py b/forum/importers/stackexchange/management/commands/load_stackexchange.py new file mode 100644 index 00000000..ee22e33a --- /dev/null +++ b/forum/importers/stackexchange/management/commands/load_stackexchange.py @@ -0,0 +1,804 @@ +from django.core.management.base import BaseCommand +from django.template.defaultfilters import slugify #todo: adopt unicode-aware slugify +#todo: http://stackoverflow.com/questions/837828/how-to-use-a-slug-in-django +import os +import re +import sys +import forum.importers.stackexchange.parse_models as se_parser +from xml.etree import ElementTree as et +from django.db import models +import forum.models as askbot +import forum.importers.stackexchange.models as se +from forum.forms import EditUserEmailFeedsForm +from forum.utils.html import sanitize_html +from django.conf import settings +from django.contrib.auth.models import Message as DjangoMessage +from django.utils.translation import ugettext as _ +#from markdown2 import Markdown +#markdowner = Markdown(html4tags=True) + +xml_read_order = ( + 'VoteTypes','UserTypes','Users','Users2Votes', + 'Badges','Users2Badges','CloseReasons','FlatPages', + 'MessageTypes','PostHistoryTypes','PostTypes','SchemaVersion', + 'Settings','SystemMessages','ThemeResources','ThemeTextResources', + 'ThrottleBucket','UserHistoryTypes','UserHistory', + 'Users2Badges','VoteTypes','Users2Votes','MessageTypes', + 'Posts','Posts2Votes','PostHistory','PostComments', + 'ModeratorMessages','Messages','Comments2Votes', + ) + +#association tables SE item id --> ASKBOT item id +#table associations are implied +#todo: there is an issue that these may be inconsistent with the database +USER = {}#SE User.id --> django(ASKBOT) User.id +QUESTION = {} +ANSWER = {} +NAMESAKE_COUNT = {}# number of times user name was used - for X.get_screen_name + +class X(object):# + """class with methods for handling some details + of SE --> ASKBOT mapping + """ + badge_type_map = {'1':'gold','2':'silver','3':'bronze'} + + askbot_supported_id_providers = ( + 'google','yahoo','aol','myopenid', + 'flickr','technorati', + 'wordpress','blogger','livejournal', + 'claimid','vidoop','verisign', + 'openidurl','facebook','local', + 'twitter' #oauth is not on this list, b/c it has no own url + ) + + #map SE VoteType -> askbot.User vote method + #created methods with the same call structure in askbot.User + #User.(post, timestamp=None, cancel=False) + vote_actions = { + 'UpMod':'upvote', + 'DownMod':'downvote', + 'AcceptedByOriginator':'accept_answer', + 'Offensive':'flag_post', + 'Favorite':'toggle_favorite_question', + } + + #these modes cannot be mixed + #only wiki is assumed to be mixable + exclusive_revision_modes = ( + 'initial','edit','rollback','lock', + 'migrate','close','merge','delete', + ) + + #badges whose names don't match exactly, but + #present in both SE and ASKBOT + badge_exceptions = {# SE --> ASKBOT + 'Citizen Patrol':'Citizen patrol',#single #todo: why sentence case? + 'Strunk & White':'Strunk & White',#single + 'Civic Duty':'Civic duty', + } + + revision_type_map = { + 'Initial Title':'initial', + 'Initial Body':'initial', + 'Initial Tags':'initial', + 'Edit Title':'edit', + 'Edit Body':'edit', + 'Edit Tags':'edit', + 'Rollback Title':'rollback', + 'Rollback Body':'rollback', + 'Rollback Tags':'rollback', + 'Post Closed':'close', + 'Post Reopened':'close', + 'Post Deleted':'delete', + 'Post Undeleted':'delete', + 'Post Locked':'lock', + 'Post Unlocked':'lock', + 'Community Owned':'wiki', + 'Post Migrated':'migrate', + 'Question Merged':'merge', + } + + close_reason_map = { + 1:1,#duplicate + 2:2,#off-topic + 3:3,#subjective and argumentative + 4:4,#not a real question + 5:7,#offensive + 6:6,#irrelevant or outdated question + 7:9,#too localized + 10:8,#spam + } + + @classmethod + def get_message_text(cls, se_m): + """try to intelligently translate + SE message to ASKBOT so that it makese sense in + our context + """ + #todo: properly translate messages + #todo: maybe work through more instances of messages + if se_m.message_type.name == 'Badge Notification': + return se_m.text + else: + if 'you are now an administrator' in se_m.text: + return _('Congratulations, you are now an Administrator') + elif re.search(r'^You have \d+ new',se_m.text): + bits = se_m.text.split('.') + text = bits[0] + if se_m.user.id == -1: + return None + url = cls.get_user(se_m.user).get_profile_url() + return '%s' % (url,text) + return None + + @classmethod + def get_post(cls, se_post): + #todo: fix this hack - either in-memory id association table + #or use database to store these associations + post_type = se_post.post_type.name + if post_type == 'Question': + return askbot.Question.objects.get(id=QUESTION[se_post.id].id) + elif post_type == 'Answer': + return askbot.Answer.objects.get(id=ANSWER[se_post.id].id) + else: + raise Exception('unknown post type %s' % post_type) + + @classmethod + def get_close_reason(cls, se_reason): + #todo: this is a guess - have not seen real data + se_reason = int(se_reason) + return cls.close_reason_map[se_reason] + + @classmethod + def get_user(cls, se_user): + #todo: same as get_post + return askbot.User.objects.get(id=USER[se_user.id].id) + + @classmethod + def get_post_revision_group_types(cls, rev_group): + rev_types = {} + for rev in rev_group: + rev_type = cls.get_post_revision_type(rev) + rev_types[rev_type] = 1 + rev_types = rev_types.keys() + + #make sure that exclusive rev modes are not mixed + exclusive = cls.exclusive_revision_modes + if len(rev_types) > 1 and all([t in exclusive for t in rev_types]): + tstr = ','.join(rev_types) + gstr = ','.join([str(rev.id) for rev in rev_group]) + msg = 'incompatible revision types %s in PostHistory %s' % (tstr,gstr) + raise Exception(msg) + return rev_types + + @classmethod + def clean_tags(cls, tags): + tags = re.subn(r'\s+',' ',tags.strip())[0] + bits = tags.split(' ') + tags = ' '.join([bit[1:-1] for bit in bits]) + tags = re.subn(r'\xf6','-',tags)[0] + return tags + + @classmethod + def get_screen_name(cls, name): + """always returns unique screen name + even if there are multiple users in SE + with the same exact screen name + """ + if name is None: + name = 'anonymous' + name = name.strip() + name = re.subn(r'\s+',' ',name)[0]#remove repeating spaces + + try: + u = askbot.User.objects.get(username = name) + try: + if u.location: + name += ', %s' % u.location + if name in NAMESAKE_COUNT: + NAMESAKE_COUNT[name] += 1 + name += ' %d' % NAMESAKE_COUNT[name] + else: + NAMESAKE_COUNT[name] = 1 + except askbot.User.DoesNotExist: + pass + except askbot.User.DoesNotExist: + NAMESAKE_COUNT[name] = 1 + return name + + @classmethod + def get_email(cls, email):#todo: fix fringe case - user did not give email! + if email is None: + return settings.ANONYMOUS_USER_EMAIL + else: + assert(email != '') + return email + + @classmethod + def get_post_revision_type(cls, rev): + rev_name = rev.post_history_type.name + rev_type = cls.revision_type_map.get(rev_name, None) + if rev_type is None: + raise Exception('dont understand revision type %s' % rev) + return rev_type + + #crude method of getting id provider name from the url + @classmethod + def get_openid_provider_name(cls, openid_url): + openid_str = str(openid_url) + bits = openid_str.split('/') + base_url = bits[2] #assume this is base url + url_bits = base_url.split('.') + provider_name = url_bits[-2].lower() + if provider_name not in cls.askbot_supported_id_providers: + raise Exception('could not determine login provider for %s' % openid_url) + return provider_name + + @staticmethod + def blankable(input): + if input is None: + return '' + else: + return input + + @classmethod + def parse_badge_summary(cls, badge_summary): + (gold,silver,bronze) = (0,0,0) + if badge_summary: + if len(badge_summary) > 3: + print 'warning: guessing that badge summary is comma separated' + print 'have %s' % badge_summary + bits = badge_summary.split(',') + else: + bits = [badge_summary] + for bit in bits: + m = re.search(r'^(?P[1-3])=(?P\d+)$', bit) + if not m: + raise Exception('could not parse badge summary: %s' % badge_summary) + else: + badge_type = cls.badge_type_map[m.groupdict()['type']] + locals()[badge_type] = int(m.groupdict()['count']) + return (gold,silver,bronze) + + @classmethod + def get_badge_name(cls, name): + return cls.badge_exceptions.get(name, name) + +class Command(BaseCommand): + help = 'Loads StackExchange data from unzipped directory of XML files into the ASKBOT database' + args = 'se_dump_dir' + + def handle(self, *arg, **kwarg): + if len(arg) < 1 or not os.path.isdir(arg[0]): + print 'Error: first argument must be a directory with all the SE *.xml files' + sys.exit(1) + + self.dump_path = arg[0] + #read the data into SE tables + for xml in xml_read_order: + xml_path = self.get_xml_path(xml) + table_name = self.get_table_name(xml) + self.load_xml_file(xml_path, table_name) + + #this is important so that when we clean up messages + #automatically generated by the procedures below + #we do not delete old messages + #todo: unfortunately this may need to be redone + #when we upgrade to django 1.2 and definitely by 1.4 when + #the current message system will be replaced with the + #django messages framework + self.save_askbot_message_id_list() + + #transfer data into ASKBOT tables + print 'Transferring users...', + sys.stdout.flush() + self.transfer_users() + print 'done.' + print 'Transferring content edits...', + sys.stdout.flush() + self.transfer_question_and_answer_activity() + print 'done.' + print 'Transferring view counts...', + sys.stdout.flush() + self.transfer_question_view_counts() + print 'done.' + print 'Transferring comments...', + sys.stdout.flush() + self.transfer_comments() + print 'done.' + print 'Transferring badges and badge awards...', + sys.stdout.flush() + self.transfer_badges() + print 'done.' + print 'Transferring votes...', + sys.stdout.flush() + self.transfer_votes()#includes favorites, accepts and flags + print 'done.' + + self.cleanup_messages()#delete autogenerated messages + self.transfer_messages() + + #todo: these are not clear how to go about + self.transfer_update_subscriptions() + self.transfer_tag_preferences() + self.transfer_meta_pages() + + def save_askbot_message_id_list(self): + id_list = list(DjangoMessage.objects.all().values('id')) + self._askbot_message_id_list = id_list + + def cleanup_messages(self): + """deletes messages generated by the load process + """ + id_list = self._askbot_message_id_list + mset = DjangoMessage.objects.all().exclude(id__in=id_list) + mset.delete() + + def transfer_messages(self): + """transfers some messages from + SE to ASKBOT + """ + for m in se.Message.objects.all(): + if m.is_read: + continue + if m.user.id == -1: + continue + u = X.get_user(m.user) + text = X.get_message_text(m) + if text: + u.message_set.create( + message=text, + ) + + def _process_post_initial_revision_group(self, rev_group): + + title = None + text = None + tags = None + wiki = False + author = USER[rev_group[0].user.id] + added_at = rev_group[0].creation_date + + for rev in rev_group: + rev_type = rev.post_history_type.name + if rev_type == 'Initial Title': + title = rev.text + elif rev_type == 'Initial Body': + text = rev.text + elif rev_type == 'Initial Tags': + tags = X.clean_tags(rev.text) + elif rev_type == 'Community Owned': + wiki = True + else: + raise Exception('unexpected revision type %s' % rev_type) + + post_type = rev_group[0].post.post_type.name + if post_type == 'Question': + q = askbot.Question.objects.create_new( + title = title, + author = author, + added_at = added_at, + wiki = wiki, + tagnames = tags, + text = text + ) + QUESTION[rev_group[0].post.id] = q + elif post_type == 'Answer': + q = X.get_post(rev_group[0].post.parent) + a = askbot.Answer.objects.create_new( + question = q, + author = author, + added_at = added_at, + wiki = wiki, + text = text, + ) + ANSWER[rev_group[0].post.id] = a + else: + post_id = rev_group[0].post.id + raise Exception('unknown post type %s for id=%d' % (post_type, post_id)) + + def _process_post_edit_revision_group(self, rev_group): + #question apply edit + (title, text, tags) = (None, None, None) + for rev in rev_group: + rev_type = rev.post_history_type.name + if rev_type == 'Edit Title': + title = rev.text + elif rev_type == 'Edit Body': + text = rev.text + elif rev_type == 'Edit Tags': + tags = X.clean_tags(rev.text) + elif rev_type == 'Community Owned': + pass + else: + raise Exception('unexpected revision type %s' % rev_type) + + rev0 = rev_group[0] + edited_by = USER[rev0.user.id] + edited_at = rev0.creation_date + comment = ';'.join([rev.comment for rev in rev_group if rev.comment]) + post_type = rev0.post.post_type.name + + if post_type == 'Question': + q = X.get_post(rev0.post) + q.apply_edit( + edited_at = edited_at, + edited_by = edited_by, + title = title, + text = text, + comment = comment, + tags = tags, + ) + elif post_type == 'Answer': + a = X.get_post(rev0.post) + a.apply_edit( + edited_at = edited_at, + edited_by = edited_by, + text = text, + comment = comment, + ) + + def _make_post_wiki(self, rev_group): + #todo: untested + for rev in rev_group: + if rev.post_history_type.name == 'Community Owned': + p = X.get_post(rev.post) + u = X.get_user(rev.user) + t = rev.creation_date + p.wiki = True + p.wikified_at = t + p.wikified_by = u + self.mark_activity(p,u,t) + p.save() + return + + def mark_activity(self,p,u,t): + """p,u,t - post, user, timestamp + """ + if isinstance(p, askbot.Question): + p.last_activity_by = u + p.last_activity_at = t + elif isinstance(p, askbot.Answer): + p.question.last_activity_by = u + p.question.last_activity_at = t + p.question.save() + + def _process_post_rollback_revision_group(self, rev_group): + #todo: don't know what to do here as there were no + #such data available + pass + + def _process_post_lock_revision_group(self, rev_group): + #todo: untested + for rev in rev_group: + rev_type = rev.post_history_type.name + if rev_type.endswith('ocked'): + t = rev.creation_date + u = X.get_user(rev.user) + p = X.get_post(rev.post) + if rev_type == 'Post Locked': + p.locked = True + p.locked_by = u + p.locked_at = t + elif rev_type == 'Post Unlocked': + p.locked = False + p.locked_by = None + p.locked_at = None + else: + return + self.mark_activity(p,u,t) + p.save() + return + + def _process_post_close_revision_group(self, rev_group): + #todo: untested + for rev in rev_group: + if rev.post.post_type.name != 'Question': + return + rev_type = rev.post_history_type.name + if rev_type in ('Post Closed', 'Post Reopened'): + t = rev.creation_date + u = X.get_user(rev.user) + p = X.get_post(rev.post) + if rev_type == 'Post Closed': + p.closed = True + p.closed_at = t + p.closed_by = u + p.close_reason = X.get_close_reason(rev.text) + elif rev_type == 'Post Reopened': + p.closed = False + p.closed_at = None + p.closed_by = None + p.close_reason = None + self.mark_activity(p,u,t) + p.save() + return + + def _process_post_delete_revision_group(self, rev_group): + #todo: untested + for rev in rev_group: + rev_type = rev.post_history_type.name + if rev_type.endswith('eleted'): + t = rev.creation_date + u = X.get_user(rev.user) + p = X.get_post(rev.post) + if rev_type == 'Post Deleted': + p.deleted = True + p.deleted_at = t + p.deleted_by = u + elif rev_type == 'Post Undeleted': + p.deleted = False + p.deleted_at = None + p.deleted_by = None + self.mark_activity(p,u,t) + p.save() + return + + def _process_post_revision_group(self, rev_group): + #determine revision type + #'initial','edit','rollback','lock', + #'migrate','close','merge','delete', + rev_types = X.get_post_revision_group_types(rev_group) + if 'initial' in rev_types: + self._process_post_initial_revision_group(rev_group) + elif 'edit' in rev_types: + self._process_post_edit_revision_group(rev_group) + elif 'rollback' in rev_types: + self._process_post_rollback_revision_group(rev_group) + elif 'lock' in rev_types: + self._process_post_lock_revision_group(rev_group) + elif 'close' in rev_types: + self._process_post_close_revision_group(rev_group) + elif 'delete' in rev_types: + self._process_post_delete_revision_group(rev_group) + else: + pass + #todo: rollback, lock, close and delete are + #not tested + #merge and migrate actions are ignored + #wiki is mixable with other groups, so process it in addition + if 'wiki' in rev_types: + self._make_post_wiki(rev_group) + + def transfer_tag_preferences(self): + #todo: figure out where these are stored in SE + #maybe in se.User.preferences_raw? + pass + + def transfer_question_and_answer_activity(self): + """transfers all question and answer + edits and related status changes + """ + #assuming that there are only two post types + se_revs = se.PostHistory.objects.all() + #assuming that chronologial order is correct and there + #will be no problems of data integrity upon insertion of records + se_revs = se_revs.order_by('creation_date','revision_guid') + #todo: ignored fringe case - no revisions + c_guid = se_revs[0].revision_guid + c_group = [] + #this loop groups revisions by revision id, then calls process function + #for the revision grup (elementary revisions posted at once) + for se_rev in se_revs: + if se_rev.revision_guid == c_guid: + c_group.append(se_rev) + else: + self._process_post_revision_group(c_group) + c_group = [] + c_group.append(se_rev) + c_guid = se_rev.revision_guid + if len(c_group) != 0: + self._process_post_revision_group(c_group) + + def transfer_comments(self): + for se_c in se.PostComment.objects.all(): + if se_c.deletion_date: + print 'Warning deleted comment %d dropped' % se_c.id + continue + se_post = se_c.post + if se_post.post_type.name == 'Question': + askbot_post = QUESTION[se_post.id] + elif se_post.post_type.name == 'Answer': + askbot_post = ANSWER[se_post.id] + + askbot_post.add_comment( + comment = se_c.text, + added_at = se_c.creation_date, + user = USER[se_c.user.id] + ) + + def _install_missing_badges(self): + self._missing_badges = {} + for se_b in se.Badge.objects.all(): + name = X.get_badge_name(se_b.name) + try: + askbot.Badge.objects.get(name=name) + except: + self._missing_badges[name] = 0 + if len(se_b.description) > 300: + print 'Warning truncated description for badge %d' % se_b.id + askbot.Badge.objects.create( + name = name, + slug = slugify(name), + description = se_b.description, + multiple = (not se_b.single), + type = se_b.class_type + ) + + def _award_badges(self): + #note: SE does not keep information on + #content-related badges like askbot does + for se_a in se.User2Badge.objects.all(): + if se_a.user.id == -1: + continue #skip community user + u = USER[se_a.user.id] + badge_name = X.get_badge_name(se_a.badge.name) + b = askbot.Badge.objects.get(name=badge_name) + if b.multiple == False: + if b.award_badge.count() > 0: + continue + #todo: fake content object here b/c SE does not support this + #todo: but askbot requires related content object + askbot.Award.objects.create( + user=u, + badge=b, + awarded_at=se_a.date, + content_object=u, + ) + if b.name in self._missing_badges: + self._missing_badges[b.name] += 1 + + def _cleanup_badges(self): + d = self._missing_badges + unused = [name for name in d.keys() if d[name] == 0] + askbot.Badge.objects.filter(name__in=unused).delete() + installed = [name for name in d.keys() if d[name] > 0] + print 'Warning - following unsupported badges were installed:' + print ', '.join(installed) + + def transfer_badges(self): + #note: badge level is neglected + #1) install missing badges + self._install_missing_badges() + #2) award badges + self._award_badges() + #3) delete unused newly installed badges + self._cleanup_badges() + pass + + def transfer_question_view_counts(self): + for se_q in se.Post.objects.filter(post_type__name='Question'): + q = X.get_post(se_q) + q.view_count = se_q.view_count + q.save() + + + def transfer_votes(self): + for v in se.Post2Vote.objects.all(): + vote_type = v.vote_type.name + if not vote_type in X.vote_actions: + continue + + u = X.get_user(v.user) + p = X.get_post(v.post) + m = X.vote_actions[vote_type] + vote_method = getattr(askbot.User, m) + vote_method(u, p, timestamp = v.creation_date) + if v.deletion_date: + vote_method(u, p, timestamp = v.deletion_date, cancel=True) + + def transfer_update_subscriptions(self): + #todo: not clear where this is stored in SE + #maybe in se.User.preferences_raw? + pass + + def transfer_meta_pages(self): + #here we actually don't have anything in the database yet + #so we can't do this + pass + + def load_xml_file(self, xml_path, table_name): + tree = et.parse(xml_path) + print 'loading from %s to %s' % (xml_path, table_name) , + model = models.get_model('stackexchange', table_name) + i = 0 + for row in tree.findall('.//row'): + model_entry = model() + i += 1 + for col in row.getchildren(): + field_name = se_parser.parse_field_name(col.tag) + field_type = model._meta.get_field(field_name) + field_value = se_parser.parse_value(col.text, field_type) + setattr(model_entry, field_name, field_value) + model_entry.save() + print '... %d objects saved' % i + + def get_table_name(self,xml): + return se_parser.get_table_name(xml) + + def get_xml_path(self, xml): + xml_path = os.path.join(self.dump_path, xml + '.xml') + if not os.path.isfile(xml_path): + print 'Error: file %s not found' % xml_path + sys.exit(1) + return xml_path + + def transfer_users(self): + for se_u in se.User.objects.all(): + if se_u.id < 1:#skip the Community user + continue + u = askbot.User() + u_type = se_u.user_type.name + if u_type == 'Administrator': + u.is_superuser = True + elif u_type == 'Moderator': + u.is_staff = True + elif u_type not in ('Unregistered', 'Registered'): + raise Exception('unknown user type %s' % u_type) + + #if user is not registered, no association record created + #we do not allow posting by users who are not authenticated + #probably they'll just have to "recover" their account by email + if u_type != 'Unregistered': + assert(se_u.open_id)#everybody must have open_id + u_auth = askbot.AuthKeyUserAssociation() + u_auth.key = se_u.open_id + u_auth.provider = X.get_openid_provider_name(se_u.open_id) + u_auth.added_at = se_u.creation_date + + if se_u.open_id is None and se_u.email is None: + print 'Warning: SE user %d is not recoverable (no email or openid)' + + u.reputation = 1#se_u.reputation, it's actually re-computed + u.last_seen = se_u.last_access_date + u.email = X.get_email(se_u.email) + u.location = X.blankable(se_u.location) + u.date_of_birth = se_u.birthday #dattime -> date + u.website = X.blankable(se_u.website_url) + u.about = X.blankable(se_u.about_me) + u.last_login = se_u.last_login_date + u.date_joined = se_u.creation_date + u.is_active = True #todo: this may not be the case + + u.username = X.get_screen_name(se_u.display_name) + u.real_name = X.blankable(se_u.real_name) + + (gold,silver,bronze) = X.parse_badge_summary(se_u.badge_summary) + u.gold = gold + u.silver = silver + u.bronze = bronze + + #todo: we don't have these fields + #views - number of profile views? + #has_replies + #has_message + #opt_in_recruit + #last_login_ip + #open_id_alt - ?? + #preferences_raw - not clear how to use + #display_name_cleaned - lowercased, srtipped name + #timed_penalty_date + #phone + + #don't know how to handle these - there was no usage example + #password_id + #guid + + #ignored + #last_email_date - this translates directly to EmailFeedSetting.reported_at + + #save the data + u.save() + form = EditUserEmailFeedsForm() + form.reset() + if se_u.opt_in_email == True:#set up daily subscription on "own" items + form.initial['individually_selected'] = 'd' + form.initial['asked_by_me'] = 'd' + form.initial['answered_by_me'] = 'd' + # + form.save(user=u, save_unbound=True) + + if 'u_auth' in locals(): + u_auth.user = u + u_auth.save() + USER[se_u.id] = u diff --git a/forum/importers/stackexchange/models.py b/forum/importers/stackexchange/models.py new file mode 100644 index 00000000..a30a9859 --- /dev/null +++ b/forum/importers/stackexchange/models.py @@ -0,0 +1,266 @@ +from django.db import models +class Badge(models.Model): + id = models.IntegerField(primary_key=True) + class_type = models.IntegerField(null=True) + name = models.CharField(max_length=50, null=True) + description = models.TextField(null=True) + single = models.NullBooleanField(null=True) + secret = models.NullBooleanField(null=True) + tag_based = models.NullBooleanField(null=True) + command = models.TextField(null=True) + award_frequency = models.IntegerField(null=True) + +class CloseReason(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=200, null=True) + description = models.CharField(max_length=256, null=True) + display_order = models.IntegerField(null=True) + +class Comment2Vote(models.Model): + id = models.IntegerField(primary_key=True) + post_comment = models.ForeignKey('PostComment', related_name='Comment2Vote_by_post_comment_set', null=True) + vote_type = models.ForeignKey('VoteType', related_name='Comment2Vote_by_vote_type_set', null=True) + creation_date = models.DateTimeField(null=True) + user = models.ForeignKey('User', related_name='Comment2Vote_by_user_set', null=True) + ip_address = models.CharField(max_length=40, null=True) + user_display_name = models.CharField(max_length=40, null=True) + deletion_date = models.DateTimeField(null=True) + +class FlatPage(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=50, null=True) + url = models.CharField(max_length=128, null=True) + value = models.TextField(null=True) + content_type = models.CharField(max_length=50, null=True) + active = models.NullBooleanField(null=True) + use_master = models.NullBooleanField(null=True) + +class Message(models.Model): + id = models.IntegerField(primary_key=True) + user = models.ForeignKey('User', related_name='Message_by_user_set', null=True) + message_type = models.ForeignKey('MessageType', related_name='Message_by_message_type_set', null=True) + is_read = models.NullBooleanField(null=True) + creation_date = models.DateTimeField(null=True) + text = models.TextField(null=True) + post = models.ForeignKey('Post', related_name='Message_by_post_set', null=True) + +class MessageType(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=50, null=True) + description = models.CharField(max_length=300, null=True) + +class ModeratorMessage(models.Model): + id = models.IntegerField(primary_key=True) + message_type = models.ForeignKey('MessageType', related_name='ModeratorMessage_by_message_type_set', null=True) + creation_date = models.DateTimeField(null=True) + creation_ip_address = models.CharField(max_length=40, null=True) + text = models.TextField(null=True) + user = models.ForeignKey('User', related_name='ModeratorMessage_by_user_set', null=True) + post = models.ForeignKey('Post', related_name='ModeratorMessage_by_post_set', null=True) + deletion_date = models.DateTimeField(null=True) + deletion_user = models.ForeignKey('User', related_name='ModeratorMessage_by_deletion_user_set', null=True) + deletion_ip_address = models.CharField(max_length=40, null=True) + user_display_name = models.CharField(max_length=40, null=True) + +class PostComment(models.Model): + id = models.IntegerField(primary_key=True) + post = models.ForeignKey('Post', related_name='PostComment_by_post_set', null=True) + text = models.TextField(null=True) + creation_date = models.DateTimeField(null=True) + ip_address = models.CharField(max_length=15, null=True) + user = models.ForeignKey('User', related_name='PostComment_by_user_set', null=True) + user_display_name = models.CharField(max_length=30, null=True) + deletion_date = models.DateTimeField(null=True) + deletion_user = models.ForeignKey('User', related_name='PostComment_by_deletion_user_set', null=True) + score = models.IntegerField(null=True) + +class PostHistoryType(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=50, null=True) + description = models.CharField(max_length=300, null=True) + +class PostHistory(models.Model): + id = models.IntegerField(primary_key=True) + post_history_type = models.ForeignKey('PostHistoryType', related_name='PostHistory_by_post_history_type_set', null=True) + post = models.ForeignKey('Post', related_name='PostHistory_by_post_set', null=True) + revision_guid = models.CharField(max_length=64, null=True) + creation_date = models.DateTimeField(null=True) + ip_address = models.CharField(max_length=40, null=True) + user = models.ForeignKey('User', related_name='PostHistory_by_user_set', null=True) + comment = models.CharField(max_length=400, null=True) + text = models.TextField(null=True) + user_display_name = models.CharField(max_length=40, null=True) + user_email = models.CharField(max_length=100, null=True) + user_website_url = models.CharField(max_length=200, null=True) + +class Post2Vote(models.Model): + id = models.IntegerField(primary_key=True) + post = models.ForeignKey('Post', related_name='Post2Vote_by_post_set', null=True) + user = models.ForeignKey('User', related_name='Post2Vote_by_user_set', null=True) + vote_type = models.ForeignKey('VoteType', related_name='Post2Vote_by_vote_type_set', null=True) + creation_date = models.DateTimeField(null=True) + deletion_date = models.DateTimeField(null=True) + target_user = models.ForeignKey('User', related_name='Post2Vote_by_target_user_set', null=True) + target_rep_change = models.IntegerField(null=True) + voter_rep_change = models.IntegerField(null=True) + comment = models.CharField(max_length=150, null=True) + ip_address = models.CharField(max_length=40, null=True) + linked_post = models.ForeignKey('Post', related_name='Post2Vote_by_linked_post_set', null=True) + +class Post(models.Model): + id = models.IntegerField(primary_key=True) + post_type = models.ForeignKey('PostType', related_name='Post_by_post_type_set', null=True) + creation_date = models.DateTimeField(null=True) + score = models.IntegerField(null=True) + view_count = models.IntegerField(null=True) + body = models.TextField(null=True) + owner_user = models.ForeignKey('User', related_name='Post_by_owner_user_set', null=True) + last_editor_user = models.ForeignKey('User', related_name='Post_by_last_editor_user_set', null=True) + last_edit_date = models.DateTimeField(null=True) + last_activity_date = models.DateTimeField(null=True) + last_activity_user = models.ForeignKey('User', related_name='Post_by_last_activity_user_set', null=True) + parent = models.ForeignKey('self', related_name='Post_by_parent_set', null=True) + accepted_answer = models.ForeignKey('self', related_name='Post_by_accepted_answer_set', null=True) + title = models.CharField(max_length=250, null=True) + tags = models.CharField(max_length=150, null=True) + community_owned_date = models.DateTimeField(null=True) + history_summary = models.CharField(max_length=150, null=True) + answer_score = models.IntegerField(null=True) + answer_count = models.IntegerField(null=True) + comment_count = models.IntegerField(null=True) + favorite_count = models.IntegerField(null=True) + deletion_date = models.DateTimeField(null=True) + closed_date = models.DateTimeField(null=True) + locked_date = models.DateTimeField(null=True) + locked_duration = models.IntegerField(null=True) + owner_display_name = models.CharField(max_length=40, null=True) + last_editor_display_name = models.CharField(max_length=40, null=True) + bounty_amount = models.IntegerField(null=True) + bounty_closes = models.DateTimeField(null=True) + bounty_closed = models.DateTimeField(null=True) + last_owner_email_date = models.DateTimeField(null=True) + +class PostType(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=50, null=True) + description = models.CharField(max_length=300, null=True) + +class SchemaVersion(models.Model): + version = models.IntegerField(null=True) + +class Setting(models.Model): + id = models.IntegerField(primary_key=True) + key = models.CharField(max_length=256, null=True) + value = models.TextField(null=True) + +class SystemMessage(models.Model): + id = models.IntegerField(primary_key=True) + user = models.ForeignKey('User', related_name='SystemMessage_by_user_set', null=True) + creation_date = models.DateTimeField(null=True) + text = models.TextField(null=True) + deletion_date = models.DateTimeField(null=True) + deletion_user = models.ForeignKey('User', related_name='SystemMessage_by_deletion_user_set', null=True) + +class Tag(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=50, null=True) + count = models.IntegerField(null=True) + user = models.ForeignKey('User', related_name='Tag_by_user_set', null=True) + creation_date = models.DateTimeField(null=True) + is_moderator_only = models.NullBooleanField(null=True) + is_required = models.NullBooleanField(null=True) + aliases = models.CharField(max_length=200, null=True) + +class ThemeResource(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=50, null=True) + value = models.TextField(null=True) + content_type = models.CharField(max_length=50, null=True) + version = models.CharField(max_length=6, null=True) + +class ThemeTextResource(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=50, null=True) + value = models.TextField(null=True) + content_type = models.CharField(max_length=50, null=True) + +class ThrottleBucket(models.Model): + id = models.IntegerField(primary_key=True) + type = models.CharField(max_length=256, null=True) + ip_address = models.CharField(max_length=64, null=True) + tokens = models.IntegerField(null=True) + last_update = models.DateTimeField(null=True) + +class UserHistoryType(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=50, null=True) + description = models.CharField(max_length=300, null=True) + +class UserHistory(models.Model): + id = models.IntegerField(primary_key=True) + user_history_type = models.ForeignKey('UserHistoryType', related_name='UserHistory_by_user_history_type_set', null=True) + creation_date = models.DateTimeField(null=True) + ip_address = models.CharField(max_length=40, null=True) + user = models.ForeignKey('User', related_name='UserHistory_by_user_set', null=True) + comment = models.CharField(max_length=400, null=True) + user_display_name = models.CharField(max_length=40, null=True) + moderator_user = models.ForeignKey('User', related_name='UserHistory_by_moderator_user_set', null=True) + reputation = models.IntegerField(null=True) + +class User2Badge(models.Model): + id = models.IntegerField(primary_key=True) + user = models.ForeignKey('User', related_name='User2Badge_by_user_set', null=True) + badge = models.ForeignKey('Badge', related_name='User2Badge_by_badge_set', null=True) + date = models.DateTimeField(null=True) + comment = models.CharField(max_length=50, null=True) + +class User2Vote(models.Model): + id = models.IntegerField(primary_key=True) + user = models.ForeignKey('User', related_name='User2Vote_by_user_set', null=True) + vote_type = models.ForeignKey('VoteType', related_name='User2Vote_by_vote_type_set', null=True) + target_user = models.ForeignKey('User', related_name='User2Vote_by_target_user_set', null=True) + creation_date = models.DateTimeField(null=True) + deletion_date = models.DateTimeField(null=True) + ip_address = models.CharField(max_length=40, null=True) + +class User(models.Model): + id = models.IntegerField(primary_key=True) + user_type = models.ForeignKey('UserType', related_name='User_by_user_type_set', null=True) + open_id = models.CharField(max_length=200, null=True) + reputation = models.IntegerField(null=True) + views = models.IntegerField(null=True) + creation_date = models.DateTimeField(null=True) + last_access_date = models.DateTimeField(null=True) + has_replies = models.NullBooleanField(null=True) + has_message = models.NullBooleanField(null=True) + opt_in_email = models.NullBooleanField(null=True) + opt_in_recruit = models.NullBooleanField(null=True) + last_login_date = models.DateTimeField(null=True) + last_email_date = models.DateTimeField(null=True) + last_login_ip = models.CharField(max_length=15, null=True) + open_id_alt = models.CharField(max_length=200, null=True) + email = models.CharField(max_length=100, null=True) + display_name = models.CharField(max_length=40, null=True) + display_name_cleaned = models.CharField(max_length=40, null=True) + website_url = models.CharField(max_length=200, null=True) + real_name = models.CharField(max_length=100, null=True) + location = models.CharField(max_length=100, null=True) + birthday = models.DateTimeField(null=True) + badge_summary = models.CharField(max_length=50, null=True) + about_me = models.TextField(null=True) + preferences_raw = models.TextField(null=True) + timed_penalty_date = models.DateTimeField(null=True) + guid = models.CharField(max_length=64, null=True) + phone = models.CharField(max_length=20, null=True) + password_id = models.IntegerField(null=True) + +class UserType(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=50, null=True) + description = models.CharField(max_length=300, null=True) + +class VoteType(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=50, null=True) + description = models.CharField(max_length=300, null=True) + diff --git a/forum/importers/stackexchange/parse_models.py b/forum/importers/stackexchange/parse_models.py new file mode 100644 index 00000000..64796e57 --- /dev/null +++ b/forum/importers/stackexchange/parse_models.py @@ -0,0 +1,225 @@ +from xml.etree import ElementTree as et +import sys +import re +import os +if __name__ != '__main__':#hack do not import models if run as script + from django.db import models +from datetime import datetime + +table_prefix = ''#StackExchange or something, if needed +date_time_format = '%Y-%m-%dT%H:%M:%S' #note that fractional part of second is lost +time_re = re.compile(r'(\.[\d]+)?$') +loader_app_name = os.path.dirname(__file__) + +types = { + 'unsignedByte':'models.IntegerField', + 'FK':'models.ForeignKey', + 'PK':'models.IntegerField', + 'string':'models.CharField', + 'text':'models.TextField', + 'int':'models.IntegerField', + 'boolean':'models.NullBooleanField', + 'dateTime':'models.DateTimeField', + 'base64Binary':'models.TextField', + 'double':'models.IntegerField', +} + +def camel_to_python(camel): + """http://stackoverflow.com/questions/1175208/ + """ + s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', camel) + return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() + +def singular(word): + if word.endswith('s'): + return word[:-1] + else: + return word + +def get_table_name(name): + """Determine db table name + from the basename of the .xml file + """ + out = table_prefix + if name.find('2') == -1: + out += singular(name) + else: + bits = name.split('2') + bits = map(singular, bits) + out += '2'.join(bits) + return out + +class DjangoModel(object): + def __init__(self, name): + self.name = get_table_name(name) + self.fields = [] + def add_field(self,field): + field.table = self + self.fields.append(field) + def __str__(self): + out = 'class %s(models.Model):\n' % self.name + for f in self.fields: + out += ' %s\n' % str(f) + return out + +class DjangoField(object): + def __init__(self, name, type, restriction = None): + self.name = camel_to_python(name) + if self.name == 'class': + self.name = 'class_type'#work around python keyword + self.type = type + self.table = None + self.restriction = restriction + self.relation = None + + def __str__(self): + out = '%s = %s(' % (self.name, types[self.type]) + if self.type == 'FK': + out += "'%s'" % self.relation + out += ", related_name='%s_by_%s_set'" % (self.table.name, self.name) + out += ', null=True'#nullable to make life easier + elif self.type == 'PK': + out += 'primary_key=True' + elif self.restriction != -1: + if self.type == 'string': + out += 'max_length=%s' % self.restriction + out += ', null=True' + else: + raise Exception('restriction (max_length) supported only for string type') + else: + out += 'null=True' + out += ')' + return out + + def get_type(self): + return self.type + +class DjangoPK(DjangoField): + def __init__(self): + self.name = 'id' + self.type = 'PK' + +class DjangoFK(DjangoField): + def __init__(self, source_name): + bits = source_name.split('Id') + if len(bits) == 2 and bits[1] == '': + name = bits[0] + super(DjangoFK, self).__init__(name, 'FK') + self.set_relation(name) + + def set_relation(self, name): + """some relations need to be mapped + to actual tables + """ + self.relation = table_prefix + if name.endswith('User'): + self.relation += 'User' + elif name.endswith('Post'): + self.relation += 'Post' + elif name in ('AcceptedAnswer','Parent'): + self.relation = 'self' #self-referential Post model + else: + self.relation += name + def get_relation(self): + return self.relation + +def get_col_type(col): + type = col.get('type') + restriction = -1 + if type == None: + type_e = col.find('.//simpleType/restriction') + type = type_e.get('base') + try: + restriction = int(type_e.getchildren()[0].get('value')) + except: + restriction = -1 + if restriction > 400: + type = 'text' + restriction = -1 + return type, restriction + +def make_field_from_xml_tree(xml_element): + """used by the model parser + here we need to be detailed about field types + because this defines the database schema + """ + name = xml_element.get('name') + if name == 'LinkedVoteId':#not used + return None + if name == 'Id': + field = DjangoPK() + elif name.endswith('Id') and name not in ('OpenId','PasswordId'): + field = DjangoFK(name) + elif name.endswith('GUID'): + field = DjangoField(name, 'string', 64) + else: + type, restriction = get_col_type(xml_element) + field = DjangoField(name, type, restriction) + return field + +def parse_field_name(input): + """used by the data reader + + The problem is that I've scattered + code for determination of field name over three classes: + DjangoField, DjangoPK and DjangoFK + so the function actually cretes fake field objects + many time over + """ + if input == 'Id': + return DjangoPK().name + elif input in ('OpenId', 'PasswordId'): + return DjangoField(input, 'string', 7).name#happy fake field + elif input.endswith('Id'): + return DjangoFK(input).name#real FK field + else: + return DjangoField(input, 'string', 7).name#happy fake field + +def parse_value(input, field_object): + if isinstance(field_object, models.ForeignKey): + try: + id = int(input) + except: + raise Exception('non-numeric foreign key %s' % input) + related_model = field_object.rel.to + try: + return related_model.objects.get(id=id) + except related_model.DoesNotExist: + obj = related_model(id=id) + obj.save()#save fake empty object + return obj + elif isinstance(field_object, models.IntegerField): + try: + return int(input) + except: + raise Exception('expected integer, found %s' % input) + elif isinstance(field_object, models.CharField): + return input + elif isinstance(field_object, models.TextField): + return input + elif isinstance(field_object, models.BooleanField): + try: + return bool(input) + except: + raise Exception('boolean value expected %s found' % input) + elif isinstance(field_object, models.DateTimeField): + input = time_re.sub('', input) + try: + return datetime.strptime(input, date_time_format) + except: + raise Exception('datetime expected "%s" found' % input) + +print 'from django.db import models' +for file in sys.argv: + if '.xsd' in file: + tname = os.path.basename(file).replace('.xsd','') + tree = et.parse(file) + + model = DjangoModel(tname) + + row = tree.find('.//sequence') + for col in row.getchildren(): + field = make_field_from_xml_tree(col) + if field: + model.add_field(field) + print model diff --git a/forum/search/sphinx/README b/forum/search/sphinx/README new file mode 100644 index 00000000..8c008a23 --- /dev/null +++ b/forum/search/sphinx/README @@ -0,0 +1,4 @@ +This directory contains sample configuration for sphinx search + +Sphinx is a full text search engine for MySQL (only) with full +word stemming in English and Russion (other languages are not supported) diff --git a/forum/search/sphinx/sphinx.conf b/forum/search/sphinx/sphinx.conf new file mode 100644 index 00000000..bf4bdc8b --- /dev/null +++ b/forum/search/sphinx/sphinx.conf @@ -0,0 +1,127 @@ +#if you have many posts, it's best to configure another index for new posts and +#periodically merge the diff index to the main +#this is not important until you get to hundreds of thousands posts + +source src_cnprog +{ + # data source + type = mysql + sql_host = localhost + sql_user = cnprog #replace with your db username + sql_pass = secret #replace with your db password + sql_db = cnprog #replace with your db name + # these two are optional + #sql_port = 3306 + #sql_sock = /var/lib/mysql/mysql.sock + + # pre-query, executed before the main fetch query + sql_query_pre = SET NAMES utf8 + + # main document fetch query - change the table names if you are using a prefix + # this query creates a flat document from each question that includes only latest + # revisions of the question and all of it's answers + sql_query = SELECT q.id as id, q.title AS title, q.tagnames as tags, qr.text AS text, answers_combined.text AS answers \ + FROM question AS q \ + INNER JOIN \ + ( \ + SELECT MAX(id) as id, question_id \ + FROM question_revision \ + GROUP BY question_id \ + ) \ + AS mqr \ + ON q.id=mqr.question_id \ + INNER JOIN question_revision AS qr ON qr.id=mqr.id \ + LEFT JOIN \ + ( \ + SELECT GROUP_CONCAT(answer_current.text SEPARATOR '. ') AS text, \ + question_id \ + FROM \ + ( \ + SELECT a.question_id as question_id, ar.text as text \ + FROM answer AS a \ + INNER JOIN \ + ( \ + SELECT MAX(id) as id, answer_id \ + FROM answer_revision \ + GROUP BY answer_id \ + ) \ + AS mar \ + ON mar.answer_id = a.id \ + INNER JOIN answer_revision AS ar ON ar.id=mar.id \ + WHERE a.deleted=0 \ + ) \ + AS answer_current \ + GROUP BY question_id \ + ) \ + AS answers_combined ON q.id=answers_combined.question_id \ + WHERE q.deleted=0; + + # optional - used by command-line search utility to display document information + sql_query_info = SELECT title, id FROM question WHERE id=$id +} + +index cnprog { + # which document source to index + source = src_cnprog + + # this is path and index file name without extension + # you may need to change this path or create this folder + path = /var/data/sphinx/cnprog_main + + # docinfo (ie. per-document attribute values) storage strategy + docinfo = extern + + # morphology + morphology = stem_en + + # stopwords file + #stopwords = /var/data/sphinx/stopwords.txt + + # minimum word length + min_word_len = 1 + + # uncomment next 2 lines to allow wildcard (*) searches + #min_infix_len = 1 + #enable_star = 1 + + # charset encoding type + charset_type = utf-8 +} + +# indexer settings +indexer +{ + # memory limit (default is 32M) + mem_limit = 64M +} + +# searchd settings +searchd +{ + # IP address on which search daemon will bind and accept + # optional, default is to listen on all addresses, + # ie. address = 0.0.0.0 + address = 127.0.0.1 + + # port on which search daemon will listen + port = 3312 + + # searchd run info is logged here - create or change the folder + log = /var/log/sphinx/searchd.log + + # all the search queries are logged here + query_log = /var/log/sphinx/query.log + + # client read timeout, seconds + read_timeout = 5 + + # maximum amount of children to fork + max_children = 30 + + # a file which will contain searchd process ID + pid_file = /var/log/sphinx/searchd.pid + + # maximum amount of matches this daemon would ever retrieve + # from each index and serve to client + max_matches = 1000 +} diff --git a/forum/sql_scripts/091111_upgrade_evgeny.sql b/forum/sql_scripts/091111_upgrade_evgeny.sql new file mode 100644 index 00000000..cb76ec3c --- /dev/null +++ b/forum/sql_scripts/091111_upgrade_evgeny.sql @@ -0,0 +1 @@ +ALTER TABLE `auth_user` add column is_approved tinyint(1) not NULL; diff --git a/forum/sql_scripts/091208_upgrade_evgeny.sql b/forum/sql_scripts/091208_upgrade_evgeny.sql new file mode 100644 index 00000000..d9c4289a --- /dev/null +++ b/forum/sql_scripts/091208_upgrade_evgeny.sql @@ -0,0 +1 @@ +ALTER TABLE `auth_user` add column hide_ignored_questions tinyint(1) not NULL; diff --git a/forum/sql_scripts/091208_upgrade_evgeny_1.sql b/forum/sql_scripts/091208_upgrade_evgeny_1.sql new file mode 100644 index 00000000..b1b4107f --- /dev/null +++ b/forum/sql_scripts/091208_upgrade_evgeny_1.sql @@ -0,0 +1 @@ +ALTER TABLE `auth_user` add column `tag_filter_setting` varchar(16) not NULL default 'ignored'; diff --git a/forum/sql_scripts/100108_upgrade_ef.sql b/forum/sql_scripts/100108_upgrade_ef.sql new file mode 100644 index 00000000..1c9a5c1c --- /dev/null +++ b/forum/sql_scripts/100108_upgrade_ef.sql @@ -0,0 +1,4 @@ +alter table auth_user add column hide_ignored_questions tinyint(1) not NULL; +update auth_user set hide_ignored_questions=0; +alter table auth_user add column tag_filter_setting varchar(16) not NULL; +update auth_user set tag_filter_setting='ignored'; diff --git a/forum/sql_scripts/badges.sql b/forum/sql_scripts/badges.sql new file mode 100644 index 00000000..5fd03d18 --- /dev/null +++ b/forum/sql_scripts/badges.sql @@ -0,0 +1,37 @@ +INSERT INTO badge ( id, name, type, slug, description, multiple, awarded_count) VALUES +(1, 'Disciplined', 3, 'disciplined', 'Deleted own post with score of 3 or higher', TRUE, 0), +(2, 'Peer Pressure', 3, 'peer-pressure', 'Deleted own post with score of -3 or lower', TRUE, 0), +(3, 'Nice answer', 3, 'nice-answer', 'Answer voted up 10 times', TRUE, 0), +(4, 'Nice Question', 3, 'nice-question', 'Question voted up 10 times', TRUE, 0), +(5, 'Pundit', 3, 'pundit', 'Left 10 comments with score of 10 or more', FALSE, 0), +(6, 'Popular Question', 3, 'popular-question', 'Asked a question with 1,000 views', TRUE, 0), +(7, 'Citizen patrol', 3, 'citizen-patrol', 'First flagged post', FALSE, 0), +(8, 'Cleanup', 3, 'cleanup', 'First rollback', FALSE, 0), +(9, 'Critic', 3, 'critic', 'First down vote', FALSE, 0), +(10, 'Editor', 3, 'editor', 'First edit', FALSE, 0), +(11, 'Organizer', 3, 'organizer', 'First retag', FALSE, 0), +(12, 'Scholar', 3, 'scholar', 'First accepted answer on your own question', FALSE, 0), +(13, 'Student', 3, 'student', 'Asked first question with at least one up vote', FALSE, 0), +(14, 'Supporter', 3, 'supporter', 'First up vote', FALSE, 0), +(15, 'Teacher', 3, 'teacher', 'Answered first question with at least one up vote', FALSE, 0), +(16, 'Autobiographer', 3, 'autobiographer', 'Completed all user profile fields', FALSE, 0), +(17, 'Self-Learner', 3, 'self-learner', 'Answered your own question with at least 3 up votes', TRUE, 0), +(18, 'Great Answer', 1, 'great-answer', 'Answer voted up 100 times', TRUE, 0), +(19, 'Great Question', 1, 'great-question', 'Question voted up 100 times', TRUE, 0), +(20, 'Stellar Question', 1, 'stellar-question', 'Question favorited by 100 users', TRUE, 0), +(21, 'Famous question', 1, 'famous-question', 'Asked a question with 10,000 views', TRUE, 0), +(22, 'Alpha', 2, 'alpha', 'Actively participated in the private alpha', FALSE, 0), +(23, 'Good Answer', 2, 'good-answer', 'Answer voted up 25 times', TRUE, 0), +(24, 'Good Question', 2, 'good-question', 'Question voted up 25 times', TRUE, 0), +(25, 'Favorite Question', 2, 'favorite-question', 'Question favorited by 25 users', TRUE, 0), +(26, 'Civic duty', 2, 'civic-duty', 'Voted 300 times', FALSE, 0), +(27, 'Strunk & White', 2, 'strunk-and-white', 'Edited 100 entries', FALSE, 0), +(28, 'Generalist', 2, 'generalist', 'Active in many different tags', FALSE, 0), +(29, 'Expert', 2, 'export', 'Very active in one tag', FALSE, 0), +(30, 'Yearling', 2, 'yearling', 'Active member for a year', FALSE, 0), +(31, 'Notable Question', 2, 'notable-question', 'Asked a question with 2,500 views', TRUE, 0), +(32, 'Enlightened', 2, 'enlightened', 'First answer was accepted with at least 10 up votes', FALSE, 0), +(33, 'Beta', 2, 'beta', 'Actively participated in the private beta', FALSE, 0), +(34, 'Guru', 2, 'guru', 'Accepted answer and voted up 40 times', TRUE, 0), +(35, 'Necromancer', 2, 'necromancer', 'Answered a question more than 60 days later with at least 5 votes', TRUE, 0), +(36, 'Taxonomist', 2, 'taxonomist', 'Created a tag used by 50 questions', TRUE, 0); diff --git a/forum/sql_scripts/cnprog.xml b/forum/sql_scripts/cnprog.xml new file mode 100644 index 00000000..95f9b362 --- /dev/null +++ b/forum/sql_scripts/cnprog.xml @@ -0,0 +1,1498 @@ + + + + + +/Users/sailing/Development/cnprog_beta2/sql_scripts + + +ENGINE=MyISAM AUTO_INCREMENT=103 DEFAULT CHARSET=latin1 + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + +content_type_id + + +user_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +author_id + + +deleted_by_id + + +last_edited_by_id + + +locked_by_id + + +question_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + +answer_id + + +author_id + + + + +ENGINE=InnoDB DEFAULT CHARSET=utf8 + + +
+ + +
+ + +name + + + + +ENGINE=InnoDB DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + + + + + + + + + + + +group_id, permission_id + + +permission_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + + + + + + +user_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + + + + + + +content_type_id + + +content_type_id, codename + + + + +ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +username + + + + +ENGINE=InnoDB DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + + + + + + + + + + + +group_id + + +user_id, group_id + + + + +ENGINE=InnoDB DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + + + + + + + + + + + +permission_id + + +user_id, permission_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + + +badge_id + + +user_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +slug + + +name, type + + + + + + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + +short_name + + +user_id + + + + + + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + + +user_id + + +book_id + + + + + + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + + +user_id + + +book_id + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + +book_id + + +question_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + + +content_type_id + + +user_id + + +content_type_id, object_id, user_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + + +content_type_id + + +user_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + +ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + + + +ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + + + + + + +user_id + + + + +ENGINE=InnoDB DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + + + + + + +user_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + +app_label, model + + + + +ENGINE=InnoDB DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + + + +ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + + + +ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + + +question_id + + +user_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + + +content_type_id, object_id, user_id + + +content_type_id + + +user_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +author_id + + +closed_by_id + + +deleted_by_id + + +last_activity_by_id + + +last_edited_by_id + + +locked_by_id + + + + +ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + + +author_id + + +question_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + + + + + + + + + + + +question_id, tag_id + + +tag_id + + + + +ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + + +question_id + + +user_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + + + + + + +name + + +created_by_id + + + + +ENGINE=InnoDB DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + + + + + + + + + + + +user_id + + +badge_id + + + + +ENGINE=InnoDB DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + + + + + + + + + + + +user_id + + +question_id + + + + +ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + + + + + + +content_type_id, object_id, user_id + + +content_type_id + + +user_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +db.doc.option.mgr + + + + + + + + + + + + + diff --git a/forum/sql_scripts/cnprog_new_install.sql b/forum/sql_scripts/cnprog_new_install.sql new file mode 100644 index 00000000..ac33a6ba --- /dev/null +++ b/forum/sql_scripts/cnprog_new_install.sql @@ -0,0 +1,811 @@ +-- MySQL Administrator dump 1.4 +-- +-- ------------------------------------------------------ +-- Server version 5.0.67 + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + + +-- +-- Create schema cnprog +-- + +CREATE DATABASE IF NOT EXISTS cnprog; +USE cnprog; + +-- +-- Definition of table `cnprog`.`answer` +-- + +DROP TABLE IF EXISTS `cnprog`.`answer`; +CREATE TABLE `cnprog`.`answer` ( + `id` int(11) NOT NULL auto_increment, + `question_id` int(11) NOT NULL, + `author_id` int(11) NOT NULL, + `added_at` datetime NOT NULL, + `wiki` tinyint(1) NOT NULL, + `wikified_at` datetime default NULL, + `accepted` tinyint(1) NOT NULL, + `deleted` tinyint(1) NOT NULL, + `deleted_by_id` int(11) default NULL, + `locked` tinyint(1) NOT NULL, + `locked_by_id` int(11) default NULL, + `locked_at` datetime default NULL, + `score` int(11) NOT NULL, + `vote_up_count` int(11) NOT NULL, + `vote_down_count` int(11) NOT NULL, + `comment_count` int(10) unsigned NOT NULL, + `offensive_flag_count` smallint(6) NOT NULL, + `last_edited_at` datetime default NULL, + `last_edited_by_id` int(11) default NULL, + `html` longtext NOT NULL, + PRIMARY KEY (`id`), + KEY `answer_question_id` (`question_id`), + KEY `answer_author_id` (`author_id`), + KEY `answer_deleted_by_id` (`deleted_by_id`), + KEY `answer_locked_by_id` (`locked_by_id`), + KEY `answer_last_edited_by_id` (`last_edited_by_id`), + CONSTRAINT `author_id_refs_id_192b0170` FOREIGN KEY (`author_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `deleted_by_id_refs_id_192b0170` FOREIGN KEY (`deleted_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `last_edited_by_id_refs_id_192b0170` FOREIGN KEY (`last_edited_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `locked_by_id_refs_id_192b0170` FOREIGN KEY (`locked_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `question_id_refs_id_7d6550c9` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; + +-- +-- Definition of table `cnprog`.`auth_group` +-- + +DROP TABLE IF EXISTS `cnprog`.`auth_group`; +CREATE TABLE `cnprog`.`auth_group` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(80) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`auth_group` +-- + +-- +-- Definition of table `cnprog`.`auth_group_permissions` +-- + +DROP TABLE IF EXISTS `cnprog`.`auth_group_permissions`; +CREATE TABLE `cnprog`.`auth_group_permissions` ( + `id` int(11) NOT NULL auto_increment, + `group_id` int(11) NOT NULL, + `permission_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `group_id` (`group_id`,`permission_id`), + KEY `permission_id_refs_id_5886d21f` (`permission_id`), + CONSTRAINT `group_id_refs_id_3cea63fe` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), + CONSTRAINT `permission_id_refs_id_5886d21f` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`auth_group_permissions` +-- + +-- +-- Definition of table `cnprog`.`auth_message` +-- + +DROP TABLE IF EXISTS `cnprog`.`auth_message`; +CREATE TABLE `cnprog`.`auth_message` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL, + `message` longtext NOT NULL, + PRIMARY KEY (`id`), + KEY `auth_message_user_id` (`user_id`), + CONSTRAINT `user_id_refs_id_650f49a6` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`auth_message` +-- + +-- +-- Definition of table `cnprog`.`auth_permission` +-- + +DROP TABLE IF EXISTS `cnprog`.`auth_permission`; +CREATE TABLE `cnprog`.`auth_permission` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(50) NOT NULL, + `content_type_id` int(11) NOT NULL, + `codename` varchar(100) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `content_type_id` (`content_type_id`,`codename`), + KEY `auth_permission_content_type_id` (`content_type_id`), + CONSTRAINT `content_type_id_refs_id_728de91f` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`auth_permission` +-- +INSERT INTO `cnprog`.`auth_permission` VALUES (1,'Can add permission',1,'add_permission'), + (2,'Can change permission',1,'change_permission'), + (3,'Can delete permission',1,'delete_permission'), + (4,'Can add group',2,'add_group'), + (5,'Can change group',2,'change_group'), + (6,'Can delete group',2,'delete_group'), + (7,'Can add user',3,'add_user'), + (8,'Can change user',3,'change_user'), + (9,'Can delete user',3,'delete_user'), + (10,'Can add message',4,'add_message'), + (11,'Can change message',4,'change_message'), + (12,'Can delete message',4,'delete_message'), + (13,'Can add content type',5,'add_contenttype'), + (14,'Can change content type',5,'change_contenttype'), + (15,'Can delete content type',5,'delete_contenttype'), + (16,'Can add session',6,'add_session'), + (17,'Can change session',6,'change_session'), + (18,'Can delete session',6,'delete_session'), + (19,'Can add site',7,'add_site'), + (20,'Can change site',7,'change_site'), + (21,'Can delete site',7,'delete_site'), + (25,'Can add answer',9,'add_answer'), + (26,'Can change answer',9,'change_answer'), + (27,'Can delete answer',9,'delete_answer'), + (28,'Can add comment',10,'add_comment'), + (29,'Can change comment',10,'change_comment'), + (30,'Can delete comment',10,'delete_comment'), + (31,'Can add tag',11,'add_tag'), + (32,'Can change tag',11,'change_tag'), + (33,'Can delete tag',11,'delete_tag'), + (37,'Can add nonce',13,'add_nonce'), + (38,'Can change nonce',13,'change_nonce'), + (39,'Can delete nonce',13,'delete_nonce'), + (40,'Can add association',14,'add_association'), + (41,'Can change association',14,'change_association'), + (42,'Can delete association',14,'delete_association'), + (43,'Can add nonce',15,'add_nonce'), + (44,'Can change nonce',15,'change_nonce'), + (45,'Can delete nonce',15,'delete_nonce'), + (46,'Can add association',16,'add_association'), + (47,'Can change association',16,'change_association'), + (48,'Can delete association',16,'delete_association'), + (49,'Can add user association',17,'add_userassociation'), + (50,'Can change user association',17,'change_userassociation'), + (51,'Can delete user association',17,'delete_userassociation'), + (52,'Can add user password queue',18,'add_userpasswordqueue'), + (53,'Can change user password queue',18,'change_userpasswordqueue'), + (54,'Can delete user password queue',18,'delete_userpasswordqueue'), + (55,'Can add log entry',19,'add_logentry'), + (56,'Can change log entry',19,'change_logentry'), + (57,'Can delete log entry',19,'delete_logentry'), + (58,'Can add question',20,'add_question'), + (59,'Can change question',20,'change_question'), + (60,'Can delete question',20,'delete_question'), + (61,'Can add vote',21,'add_vote'), + (62,'Can change vote',21,'change_vote'), + (63,'Can delete vote',21,'delete_vote'), + (64,'Can add flagged item',22,'add_flaggeditem'), + (65,'Can change flagged item',22,'change_flaggeditem'), + (66,'Can delete flagged item',22,'delete_flaggeditem'), + (67,'Can add favorite question',23,'add_favoritequestion'), + (68,'Can change favorite question',23,'change_favoritequestion'), + (69,'Can delete favorite question',23,'delete_favoritequestion'), + (70,'Can add badge',24,'add_badge'), + (71,'Can change badge',24,'change_badge'), + (72,'Can delete badge',24,'delete_badge'), + (73,'Can add award',25,'add_award'), + (74,'Can change award',25,'change_award'), + (75,'Can delete award',25,'delete_award'); + +-- +-- Definition of table `cnprog`.`auth_user` +-- + +DROP TABLE IF EXISTS `cnprog`.`auth_user`; +CREATE TABLE `cnprog`.`auth_user` ( + `id` int(11) NOT NULL auto_increment, + `username` varchar(30) NOT NULL, + `first_name` varchar(30) NOT NULL, + `last_name` varchar(30) NOT NULL, + `email` varchar(75) NOT NULL, + `password` varchar(128) NOT NULL, + `is_staff` tinyint(1) NOT NULL, + `is_active` tinyint(1) NOT NULL, + `is_superuser` tinyint(1) NOT NULL, + `last_login` datetime NOT NULL, + `date_joined` datetime NOT NULL, + `gold` smallint(6) NOT NULL default '0', + `silver` smallint(5) unsigned NOT NULL default '0', + `bronze` smallint(5) unsigned NOT NULL default '0', + `reputation` int(10) unsigned default '1', + `gravatar` varchar(128) default NULL, + `questions_per_page` smallint(5) unsigned default '10', + `last_seen` datetime default NULL, + `real_name` varchar(100) default NULL, + `website` varchar(200) default NULL, + `location` varchar(100) default NULL, + `date_of_birth` datetime default NULL, + `about` text, + PRIMARY KEY (`id`), + UNIQUE KEY `username` (`username`) +) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`auth_user` +-- +INSERT INTO `cnprog`.`auth_user` VALUES (2,'chagel','','','chagel@gmail.com','sha1$6a2fb$0d2ffe90bcba542fc962f57967a88e507799cc74',1,1,1,'2008-12-16 15:35:17','2008-12-11 20:12:53',0,0,0,1,'8c1efc4f4618aa68b18c88f2bcaa5564',10,NULL,NULL,NULL,NULL,NULL,NULL), + (3,'mike','','','ichagel@yahoo.com','sha1$f7ef5$1015ae6b2c8a2774a028419d3c57e13145b83284',0,1,0,'2008-12-15 12:56:23','2008-12-15 12:56:23',0,0,0,1,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL), + (4,'sailingcai','','','sailingcai@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-23 06:14:45','2008-12-20 15:19:21',1,2,3,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','',NULL,''), + (5,'sailingcai1','','','1@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21',NULL,NULL,NULL,NULL,NULL), + (6,'sailing2','','','2@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (7,'sailing3','','','3@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (8,'sailing4','','','4@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (9,'sailing5','','','5@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (10,'sailing6','','','6@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (11,'sailing7','','','7@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (12,'sailing8','','','8@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (13,'sailing9','','','9@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (14,'sailing10','','','10@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (15,'sailing11','','','11@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (16,'sailing12','','','12@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (17,'sailing13','','','13@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (18,'sailing14','','','14@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (19,'sailing15','','','15@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (20,'sailing16','','','16@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (21,'sailing17','','','17@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (22,'sailing18','','','18@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (23,'sailing19','','','19@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (24,'sailing20','','','20@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (25,'sailing21','','','21@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (26,'sailing22','','','22@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (27,'sailing23','','','23@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (28,'sailing24','','','24@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (29,'sailing25','','','25@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (30,'sailing26','','','26@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (31,'sailing27','','','27@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (32,'sailing28','','','28@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (33,'sailing29','','','29@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (34,'sailing30','','','30@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (35,'sailing31','','','31@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (36,'sailing32','','','32@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (37,'sailing33','','','33@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (38,'sailing34','','','34@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (39,'sailing35','','','35@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (40,'sailing36','','','36@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (41,'sailing37','','','37@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (42,'sailing38','','','38@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (43,'sailing39','','','39@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (44,'sailing40','','','40@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (45,'sailing41','','','41@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (46,'sailing42','','','42@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (47,'sailing43','','','43@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (48,'sailing44','','','44@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (49,'sailing45','','','45@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (50,'sailing46','','','46@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (51,'sailing47','','','47@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (52,'sailing48','','','48@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (53,'sailing49','','','49@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (54,'sailing50','','','50@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (55,'sailing51','','','51@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (56,'sailing52','','','52@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (57,'sailing53','','','53@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (58,'sailing54','','','54@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (59,'sailing55','','','55@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (60,'sailing56','','','56@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (61,'sailing57','','','57@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (62,'sailing58','','','58@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (63,'sailing59','','','59@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (64,'sailing60','','','60@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (65,'sailing61','','','61@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (66,'sailing62','','','62@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (67,'sailing63','','','63@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (68,'sailing64','','','64@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (69,'sailing65','','','65@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (70,'sailing66','','','66@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (71,'sailing67','','','67@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (72,'sailing68','','','68@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (73,'sailing69','','','69@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (74,'sailing70','','','70@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (75,'sailing71','','','71@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (76,'sailing72','','','72@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (77,'sailing73','','','73@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (78,'sailing74','','','74@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (79,'sailing75','','','75@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (80,'sailing76','','','76@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (81,'sailing77','','','77@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (82,'sailing78','','','78@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (83,'sailing79','','','79@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (84,'sailing80','','','80@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (85,'sailing81','','','81@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (86,'sailing82','','','82@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (87,'sailing83','','','83@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (88,'sailing84','','','84@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (89,'sailing85','','','85@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (90,'sailing86','','','86@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (91,'sailing87','','','87@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (92,'sailing88','','','88@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (93,'sailing89','','','89@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (94,'sailing90','','','90@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (95,'sailing91','','','91@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (96,'sailing92','','','92@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (97,'sailing93','','','93@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (98,'sailing94','','','94@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (99,'sailing95','','','95@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (100,'sailing96','','','96@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (101,'sailing97','','','97@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (102,'sailing98','','','98@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), + (103,'sailing99','','','99@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''); + +-- +-- Definition of table `cnprog`.`auth_user_groups` +-- + +DROP TABLE IF EXISTS `cnprog`.`auth_user_groups`; +CREATE TABLE `cnprog`.`auth_user_groups` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL, + `group_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`,`group_id`), + KEY `group_id_refs_id_f116770` (`group_id`), + CONSTRAINT `group_id_refs_id_f116770` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), + CONSTRAINT `user_id_refs_id_7ceef80f` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`auth_user_groups` +-- + +-- +-- Definition of table `cnprog`.`auth_user_user_permissions` +-- + +DROP TABLE IF EXISTS `cnprog`.`auth_user_user_permissions`; +CREATE TABLE `cnprog`.`auth_user_user_permissions` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL, + `permission_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`,`permission_id`), + KEY `permission_id_refs_id_67e79cb` (`permission_id`), + CONSTRAINT `permission_id_refs_id_67e79cb` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), + CONSTRAINT `user_id_refs_id_dfbab7d` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`auth_user_user_permissions` +-- + +-- +-- Definition of table `cnprog`.`award` +-- + +DROP TABLE IF EXISTS `cnprog`.`award`; +CREATE TABLE `cnprog`.`award` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL, + `badge_id` int(11) NOT NULL, + `awarded_at` datetime NOT NULL, + `notified` tinyint(1) NOT NULL, + PRIMARY KEY (`id`), + KEY `award_user_id` (`user_id`), + KEY `award_badge_id` (`badge_id`), + CONSTRAINT `badge_id_refs_id_651af0e1` FOREIGN KEY (`badge_id`) REFERENCES `badge` (`id`), + CONSTRAINT `user_id_refs_id_2d83e9b6` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`award` +-- + +-- +-- Definition of table `cnprog`.`badge` +-- + +DROP TABLE IF EXISTS `cnprog`.`badge`; +CREATE TABLE `cnprog`.`badge` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(50) NOT NULL, + `type` smallint(6) NOT NULL, + `slug` varchar(50) NOT NULL, + `description` varchar(300) NOT NULL, + `multiple` tinyint(1) NOT NULL, + `awarded_count` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`,`type`), + KEY `badge_slug` (`slug`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`badge` +-- + +-- +-- Definition of table `cnprog`.`comment` +-- + +DROP TABLE IF EXISTS `cnprog`.`comment`; +CREATE TABLE `cnprog`.`comment` ( + `id` int(11) NOT NULL auto_increment, + `content_type_id` int(11) NOT NULL, + `object_id` int(10) unsigned NOT NULL, + `user_id` int(11) NOT NULL, + `comment` varchar(300) NOT NULL, + `added_at` datetime NOT NULL, + PRIMARY KEY (`id`), + KEY `content_type_id` (`content_type_id`,`object_id`,`user_id`), + KEY `comment_content_type_id` (`content_type_id`), + KEY `comment_user_id` (`user_id`), + CONSTRAINT `content_type_id_refs_id_13a5866c` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), + CONSTRAINT `user_id_refs_id_6be725e8` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`comment` +-- + +-- +-- Definition of table `cnprog`.`django_admin_log` +-- + +DROP TABLE IF EXISTS `cnprog`.`django_admin_log`; +CREATE TABLE `cnprog`.`django_admin_log` ( + `id` int(11) NOT NULL auto_increment, + `action_time` datetime NOT NULL, + `user_id` int(11) NOT NULL, + `content_type_id` int(11) default NULL, + `object_id` longtext, + `object_repr` varchar(200) NOT NULL, + `action_flag` smallint(5) unsigned NOT NULL, + `change_message` longtext NOT NULL, + PRIMARY KEY (`id`), + KEY `django_admin_log_user_id` (`user_id`), + KEY `django_admin_log_content_type_id` (`content_type_id`), + CONSTRAINT `content_type_id_refs_id_288599e6` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), + CONSTRAINT `user_id_refs_id_c8665aa` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`django_admin_log` +-- +INSERT INTO `cnprog`.`django_admin_log` VALUES (1,'2008-12-18 23:41:41',2,7,'1','cnprog.com',2,'已修改 domain 和 name 。'); + +-- +-- Definition of table `cnprog`.`django_authopenid_association` +-- + +DROP TABLE IF EXISTS `cnprog`.`django_authopenid_association`; +CREATE TABLE `cnprog`.`django_authopenid_association` ( + `id` int(11) NOT NULL auto_increment, + `server_url` longtext NOT NULL, + `handle` varchar(255) NOT NULL, + `secret` longtext NOT NULL, + `issued` int(11) NOT NULL, + `lifetime` int(11) NOT NULL, + `assoc_type` longtext NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`django_authopenid_association` +-- +INSERT INTO `cnprog`.`django_authopenid_association` VALUES (2,'https://www.google.com/accounts/o8/ud','AOQobUfcCH4sgjsBGGscrzxIa5UM4clofAB6nixx8Qq_NWco4ynn_Kc4','u5cva43abzdwF8CJOFZfkzfk7x8=\n',1229022261,1229022261,'HMAC-SHA1'), + (3,'https://api.screenname.aol.com/auth/openidServer','diAyLjAgayAwIGJhT2VvYkdDZ21RSHJ4QldzQnhTdjIxV3BVbz0%3D-j5HRXRB1VbPyg48jGKE1Q70dfv76lGHEPwd9071%2FJ7f6SSw5YhakrwWpsVXtr34T6iHwPDdo6RU%3D','EmQL3+5oR6mFKIaeBNy6hXyUJ/w=\n',1229282202,1229282202,'HMAC-SHA1'), + (4,'https://open.login.yahooapis.com/openid/op/auth','JcBeY.uWXu2YjzbuCQiqFzAb0MIc7ATeKiPO4eAp3vluPMqZp_NCxepvMLGrJjxxDKTaNnr06wepMos8ap6SQYZiTi51tZ05lMWnpZAiOA1hsq_WMlEL7G9YE66GEA9A','QXiuN6B7E8nP5QhyHI3IB26t4SA=\n',1229282256,1229282256,'HMAC-SHA1'), + (5,'http://openid.claimid.com/server','{HMAC-SHA1}{494575fd}{uLEbxQ==}','GvPbkgMHh0QVPH7mStCGuWb2AKY=\n',1229288957,1229288957,'HMAC-SHA1'), + (6,'http://www.blogger.com/openid-server.g','oida-1229424484019-158830626','8gaU4aKnIFCLKIkHdxZQp7ZGNck=\n',1229424478,1229424478,'HMAC-SHA1'); + +-- +-- Definition of table `cnprog`.`django_authopenid_nonce` +-- + +DROP TABLE IF EXISTS `cnprog`.`django_authopenid_nonce`; +CREATE TABLE `cnprog`.`django_authopenid_nonce` ( + `id` int(11) NOT NULL auto_increment, + `server_url` varchar(255) NOT NULL, + `timestamp` int(11) NOT NULL, + `salt` varchar(40) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; + +-- +-- Definition of table `cnprog`.`django_authopenid_userassociation` +-- + +DROP TABLE IF EXISTS `cnprog`.`django_authopenid_userassociation`; +CREATE TABLE `cnprog`.`django_authopenid_userassociation` ( + `id` int(11) NOT NULL auto_increment, + `openid_url` varchar(255) NOT NULL, + `user_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`), + CONSTRAINT `user_id_refs_id_163d208d` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`django_authopenid_userassociation` +-- +INSERT INTO `cnprog`.`django_authopenid_userassociation` VALUES (2,'https://www.google.com/accounts/o8/id?id=AItOawl7CVVHl4DWtteqj4dd_A23zKRwPZgOOjw',2), + (3,'https://me.yahoo.com/a/f8f2zXF91okYL4iN2Zh4P542a5s-#f4af2',3), + (4,'https://me.yahoo.com/sailingcai#6fa4e',4); + +-- +-- Definition of table `cnprog`.`django_authopenid_userpasswordqueue` +-- + +DROP TABLE IF EXISTS `cnprog`.`django_authopenid_userpasswordqueue`; +CREATE TABLE `cnprog`.`django_authopenid_userpasswordqueue` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL, + `new_password` varchar(30) NOT NULL, + `confirm_key` varchar(40) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`), + CONSTRAINT `user_id_refs_id_76bcaaa4` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`django_authopenid_userpasswordqueue` +-- + +-- +-- Definition of table `cnprog`.`django_content_type` +-- + +DROP TABLE IF EXISTS `cnprog`.`django_content_type`; +CREATE TABLE `cnprog`.`django_content_type` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(100) NOT NULL, + `app_label` varchar(100) NOT NULL, + `model` varchar(100) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `app_label` (`app_label`,`model`) +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`django_content_type` +-- +INSERT INTO `cnprog`.`django_content_type` VALUES (1,'permission','auth','permission'), + (2,'group','auth','group'), + (3,'user','auth','user'), + (4,'message','auth','message'), + (5,'content type','contenttypes','contenttype'), + (6,'session','sessions','session'), + (7,'site','sites','site'), + (9,'answer','forum','answer'), + (10,'comment','forum','comment'), + (11,'tag','forum','tag'), + (13,'nonce','django_openidconsumer','nonce'), + (14,'association','django_openidconsumer','association'), + (15,'nonce','django_authopenid','nonce'), + (16,'association','django_authopenid','association'), + (17,'user association','django_authopenid','userassociation'), + (18,'user password queue','django_authopenid','userpasswordqueue'), + (19,'log entry','admin','logentry'), + (20,'question','forum','question'), + (21,'vote','forum','vote'), + (22,'flagged item','forum','flaggeditem'), + (23,'favorite question','forum','favoritequestion'), + (24,'badge','forum','badge'), + (25,'award','forum','award'); + +-- +-- Definition of table `cnprog`.`django_session` +-- + +DROP TABLE IF EXISTS `cnprog`.`django_session`; +CREATE TABLE `cnprog`.`django_session` ( + `session_key` varchar(40) NOT NULL, + `session_data` longtext NOT NULL, + `expire_date` datetime NOT NULL, + PRIMARY KEY (`session_key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Definition of table `cnprog`.`django_site` +-- + +DROP TABLE IF EXISTS `cnprog`.`django_site`; +CREATE TABLE `cnprog`.`django_site` ( + `id` int(11) NOT NULL auto_increment, + `domain` varchar(100) NOT NULL, + `name` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`django_site` +-- +INSERT INTO `cnprog`.`django_site` VALUES (1,'cnprog.com','CNProg.com'); + +-- +-- Definition of table `cnprog`.`favorite_question` +-- + +DROP TABLE IF EXISTS `cnprog`.`favorite_question`; +CREATE TABLE `cnprog`.`favorite_question` ( + `id` int(11) NOT NULL auto_increment, + `question_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + `added_at` datetime NOT NULL, + PRIMARY KEY (`id`), + KEY `favorite_question_question_id` (`question_id`), + KEY `favorite_question_user_id` (`user_id`), + CONSTRAINT `question_id_refs_id_1ebe1cc3` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`), + CONSTRAINT `user_id_refs_id_52853822` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`favorite_question` +-- + +-- +-- Definition of table `cnprog`.`flagged_item` +-- + +DROP TABLE IF EXISTS `cnprog`.`flagged_item`; +CREATE TABLE `cnprog`.`flagged_item` ( + `id` int(11) NOT NULL auto_increment, + `content_type_id` int(11) NOT NULL, + `object_id` int(10) unsigned NOT NULL, + `user_id` int(11) NOT NULL, + `flagged_at` datetime NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `content_type_id` (`content_type_id`,`object_id`,`user_id`), + KEY `flagged_item_content_type_id` (`content_type_id`), + KEY `flagged_item_user_id` (`user_id`), + CONSTRAINT `content_type_id_refs_id_76e44d74` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), + CONSTRAINT `user_id_refs_id_35e3c608` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`flagged_item` +-- + +-- +-- Definition of table `cnprog`.`question` +-- + +DROP TABLE IF EXISTS `cnprog`.`question`; +CREATE TABLE `cnprog`.`question` ( + `id` int(11) NOT NULL auto_increment, + `title` varchar(300) NOT NULL, + `author_id` int(11) NOT NULL, + `added_at` datetime NOT NULL, + `wiki` tinyint(1) NOT NULL, + `wikified_at` datetime default NULL, + `answer_accepted` tinyint(1) NOT NULL, + `closed` tinyint(1) NOT NULL, + `closed_by_id` int(11) default NULL, + `closed_at` datetime default NULL, + `close_reason` smallint(6) default NULL, + `deleted` tinyint(1) NOT NULL, + `deleted_at` datetime default NULL, + `deleted_by_id` int(11) default NULL, + `locked` tinyint(1) NOT NULL, + `locked_by_id` int(11) default NULL, + `locked_at` datetime default NULL, + `vote_up_count` int(11) NOT NULL, + `vote_down_count` int(11) NOT NULL, + `score` int(11) NOT NULL, + `answer_count` int(10) unsigned NOT NULL, + `comment_count` int(10) unsigned NOT NULL, + `view_count` int(10) unsigned NOT NULL, + `offensive_flag_count` smallint(6) NOT NULL, + `favourite_count` int(10) unsigned NOT NULL, + `last_edited_at` datetime default NULL, + `last_edited_by_id` int(11) default NULL, + `last_activity_at` datetime NOT NULL, + `last_activity_by_id` int(11) NOT NULL, + `tagnames` varchar(125) NOT NULL, + `summary` varchar(180) NOT NULL, + `html` longtext NOT NULL, + PRIMARY KEY (`id`), + KEY `question_author_id` (`author_id`), + KEY `question_closed_by_id` (`closed_by_id`), + KEY `question_deleted_by_id` (`deleted_by_id`), + KEY `question_locked_by_id` (`locked_by_id`), + KEY `question_last_edited_by_id` (`last_edited_by_id`), + KEY `question_last_activity_by_id` (`last_activity_by_id`), + CONSTRAINT `author_id_refs_id_56e9d00c` FOREIGN KEY (`author_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `closed_by_id_refs_id_56e9d00c` FOREIGN KEY (`closed_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `deleted_by_id_refs_id_56e9d00c` FOREIGN KEY (`deleted_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `last_activity_by_id_refs_id_56e9d00c` FOREIGN KEY (`last_activity_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `last_edited_by_id_refs_id_56e9d00c` FOREIGN KEY (`last_edited_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `locked_by_id_refs_id_56e9d00c` FOREIGN KEY (`locked_by_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; + +-- +-- Definition of table `cnprog`.`question_tags` +-- + +DROP TABLE IF EXISTS `cnprog`.`question_tags`; +CREATE TABLE `cnprog`.`question_tags` ( + `id` int(11) NOT NULL auto_increment, + `question_id` int(11) NOT NULL, + `tag_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `question_id` (`question_id`,`tag_id`), + KEY `tag_id_refs_id_43fcb953` (`tag_id`), + CONSTRAINT `question_id_refs_id_266147c6` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`), + CONSTRAINT `tag_id_refs_id_43fcb953` FOREIGN KEY (`tag_id`) REFERENCES `tag` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; + +-- +-- Definition of table `cnprog`.`tag` +-- + +DROP TABLE IF EXISTS `cnprog`.`tag`; +CREATE TABLE `cnprog`.`tag` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(255) NOT NULL, + `created_by_id` int(11) NOT NULL, + `used_count` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`), + KEY `tag_created_by_id` (`created_by_id`), + CONSTRAINT `created_by_id_refs_id_47205d6d` FOREIGN KEY (`created_by_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8; + +-- +-- Definition of table `cnprog`.`user_badge` +-- + +DROP TABLE IF EXISTS `cnprog`.`user_badge`; +CREATE TABLE `cnprog`.`user_badge` ( + `id` int(10) unsigned NOT NULL auto_increment, + `user_id` int(10) unsigned NOT NULL, + `badge_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Definition of table `cnprog`.`user_favorite_questions` +-- + +DROP TABLE IF EXISTS `cnprog`.`user_favorite_questions`; +CREATE TABLE `cnprog`.`user_favorite_questions` ( + `id` int(10) unsigned NOT NULL auto_increment, + `user_id` int(10) unsigned NOT NULL, + `question_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`user_favorite_questions` +-- + +DROP TABLE IF EXISTS `cnprog`.`vote`; +CREATE TABLE `cnprog`.`vote` ( + `id` int(11) NOT NULL auto_increment, + `content_type_id` int(11) NOT NULL, + `object_id` int(10) unsigned NOT NULL, + `user_id` int(11) NOT NULL, + `vote` smallint(6) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `content_type_id` (`content_type_id`,`object_id`,`user_id`), + KEY `vote_content_type_id` (`content_type_id`), + KEY `vote_user_id` (`user_id`), + CONSTRAINT `content_type_id_refs_id_50124414` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), + CONSTRAINT `user_id_refs_id_760a4df0` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `cnprog`.`vote` +-- + + + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/forum/sql_scripts/cnprog_new_install_2009_02_28.sql b/forum/sql_scripts/cnprog_new_install_2009_02_28.sql new file mode 100644 index 00000000..80b9fced --- /dev/null +++ b/forum/sql_scripts/cnprog_new_install_2009_02_28.sql @@ -0,0 +1,456 @@ +SET FOREIGN_KEY_CHECKS = 0; + +CREATE TABLE `activity` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL, + `activity_type` smallint(6) NOT NULL, + `active_at` datetime NOT NULL, + `content_type_id` int(11) NOT NULL, + `object_id` int(10) unsigned NOT NULL, + `is_auditted` tinyint(1) default '0', + PRIMARY KEY (`id`), + KEY `activity_user_id` (`user_id`), + KEY `activity_content_type_id` (`content_type_id`) +) ENGINE=MyISAM AUTO_INCREMENT=103 DEFAULT CHARSET=utf8; + + +CREATE TABLE `answer` ( + `id` int(11) NOT NULL auto_increment, + `question_id` int(11) NOT NULL, + `author_id` int(11) NOT NULL, + `added_at` datetime NOT NULL, + `wiki` tinyint(1) NOT NULL, + `wikified_at` datetime default NULL, + `accepted` tinyint(1) NOT NULL, + `deleted` tinyint(1) NOT NULL, + `deleted_by_id` int(11) default NULL, + `locked` tinyint(1) NOT NULL, + `locked_by_id` int(11) default NULL, + `locked_at` datetime default NULL, + `score` int(11) NOT NULL, + `comment_count` int(10) unsigned NOT NULL, + `offensive_flag_count` smallint(6) NOT NULL, + `last_edited_at` datetime default NULL, + `last_edited_by_id` int(11) default NULL, + `html` longtext NOT NULL, + `vote_up_count` int(11) NOT NULL, + `vote_down_count` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `answer_question_id` (`question_id`), + KEY `answer_author_id` (`author_id`), + KEY `answer_deleted_by_id` (`deleted_by_id`), + KEY `answer_locked_by_id` (`locked_by_id`), + KEY `answer_last_edited_by_id` (`last_edited_by_id`), + CONSTRAINT `author_id_refs_id_192b0170` FOREIGN KEY (`author_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `deleted_by_id_refs_id_192b0170` FOREIGN KEY (`deleted_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `last_edited_by_id_refs_id_192b0170` FOREIGN KEY (`last_edited_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `locked_by_id_refs_id_192b0170` FOREIGN KEY (`locked_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `question_id_refs_id_7d6550c9` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; + + +CREATE TABLE `answer_revision` ( + `id` int(11) NOT NULL auto_increment, + `answer_id` int(11) NOT NULL, + `revision` int(10) unsigned NOT NULL, + `author_id` int(11) NOT NULL, + `revised_at` datetime NOT NULL, + `summary` varchar(300) collate utf8_unicode_ci NOT NULL, + `text` longtext collate utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + KEY `answer_revision_answer_id` (`answer_id`), + KEY `answer_revision_author_id` (`author_id`) +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8; + + +CREATE TABLE `auth_group` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(80) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `auth_group_permissions` ( + `id` int(11) NOT NULL auto_increment, + `group_id` int(11) NOT NULL, + `permission_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `group_id` (`group_id`,`permission_id`), + KEY `permission_id_refs_id_5886d21f` (`permission_id`), + CONSTRAINT `group_id_refs_id_3cea63fe` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), + CONSTRAINT `permission_id_refs_id_5886d21f` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `auth_message` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL, + `message` longtext NOT NULL, + PRIMARY KEY (`id`), + KEY `auth_message_user_id` (`user_id`), + CONSTRAINT `user_id_refs_id_650f49a6` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8; + + +CREATE TABLE `auth_permission` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(50) NOT NULL, + `content_type_id` int(11) NOT NULL, + `codename` varchar(100) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `content_type_id` (`content_type_id`,`codename`), + KEY `auth_permission_content_type_id` (`content_type_id`), + CONSTRAINT `content_type_id_refs_id_728de91f` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8; + + +CREATE TABLE `auth_user` ( + `id` int(11) NOT NULL auto_increment, + `username` varchar(30) NOT NULL, + `first_name` varchar(30) NOT NULL, + `last_name` varchar(30) NOT NULL, + `email` varchar(75) NOT NULL, + `password` varchar(128) NOT NULL, + `is_staff` tinyint(1) NOT NULL, + `is_active` tinyint(1) NOT NULL, + `is_superuser` tinyint(1) NOT NULL, + `last_login` datetime NOT NULL, + `date_joined` datetime NOT NULL, + `gold` smallint(6) NOT NULL default '0', + `silver` smallint(5) unsigned NOT NULL default '0', + `bronze` smallint(5) unsigned NOT NULL default '0', + `reputation` int(10) unsigned default '1', + `gravatar` varchar(128) default NULL, + `questions_per_page` smallint(5) unsigned default '10', + `last_seen` datetime default NULL, + `real_name` varchar(100) default NULL, + `website` varchar(200) default NULL, + `location` varchar(100) default NULL, + `date_of_birth` datetime default NULL, + `about` text, + PRIMARY KEY (`id`), + UNIQUE KEY `username` (`username`) +) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8; + + +CREATE TABLE `auth_user_groups` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL, + `group_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`,`group_id`), + KEY `group_id_refs_id_f116770` (`group_id`), + CONSTRAINT `group_id_refs_id_f116770` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), + CONSTRAINT `user_id_refs_id_7ceef80f` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `auth_user_user_permissions` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL, + `permission_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`,`permission_id`), + KEY `permission_id_refs_id_67e79cb` (`permission_id`), + CONSTRAINT `permission_id_refs_id_67e79cb` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), + CONSTRAINT `user_id_refs_id_dfbab7d` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `award` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL, + `badge_id` int(11) NOT NULL, + `awarded_at` datetime NOT NULL, + `notified` tinyint(1) NOT NULL, + `content_type_id` int(11) default NULL, + `object_id` int(10) default NULL, + PRIMARY KEY (`id`), + KEY `award_user_id` (`user_id`), + KEY `award_badge_id` (`badge_id`), + CONSTRAINT `badge_id_refs_id_651af0e1` FOREIGN KEY (`badge_id`) REFERENCES `badge` (`id`), + CONSTRAINT `user_id_refs_id_2d83e9b6` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; + + +CREATE TABLE `badge` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(50) NOT NULL, + `type` smallint(6) NOT NULL, + `slug` varchar(50) NOT NULL, + `description` varchar(300) NOT NULL, + `multiple` tinyint(1) NOT NULL, + `awarded_count` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`,`type`), + KEY `badge_slug` (`slug`) +) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; + + +CREATE TABLE `comment` ( + `id` int(11) NOT NULL auto_increment, + `content_type_id` int(11) NOT NULL, + `object_id` int(10) unsigned NOT NULL, + `user_id` int(11) NOT NULL, + `comment` varchar(300) NOT NULL, + `added_at` datetime NOT NULL, + PRIMARY KEY (`id`), + KEY `comment_content_type_id` (`content_type_id`), + KEY `comment_user_id` (`user_id`), + KEY `content_type_id` (`content_type_id`,`object_id`,`user_id`), + CONSTRAINT `content_type_id_refs_id_13a5866c` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), + CONSTRAINT `user_id_refs_id_6be725e8` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8; + + +CREATE TABLE `django_admin_log` ( + `id` int(11) NOT NULL auto_increment, + `action_time` datetime NOT NULL, + `user_id` int(11) NOT NULL, + `content_type_id` int(11) default NULL, + `object_id` longtext, + `object_repr` varchar(200) NOT NULL, + `action_flag` smallint(5) unsigned NOT NULL, + `change_message` longtext NOT NULL, + PRIMARY KEY (`id`), + KEY `django_admin_log_user_id` (`user_id`), + KEY `django_admin_log_content_type_id` (`content_type_id`), + CONSTRAINT `content_type_id_refs_id_288599e6` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), + CONSTRAINT `user_id_refs_id_c8665aa` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + + +CREATE TABLE `django_authopenid_association` ( + `id` int(11) NOT NULL auto_increment, + `server_url` longtext NOT NULL, + `handle` varchar(255) NOT NULL, + `secret` longtext NOT NULL, + `issued` int(11) NOT NULL, + `lifetime` int(11) NOT NULL, + `assoc_type` longtext NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + + +CREATE TABLE `django_authopenid_nonce` ( + `id` int(11) NOT NULL auto_increment, + `server_url` varchar(255) NOT NULL, + `timestamp` int(11) NOT NULL, + `salt` varchar(40) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8; + + +CREATE TABLE `django_authopenid_userassociation` ( + `id` int(11) NOT NULL auto_increment, + `openid_url` varchar(255) NOT NULL, + `user_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`), + CONSTRAINT `user_id_refs_id_163d208d` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; + + +CREATE TABLE `django_authopenid_userpasswordqueue` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL, + `new_password` varchar(30) NOT NULL, + `confirm_key` varchar(40) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`), + CONSTRAINT `user_id_refs_id_76bcaaa4` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `django_content_type` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(100) NOT NULL, + `app_label` varchar(100) NOT NULL, + `model` varchar(100) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `app_label` (`app_label`,`model`) +) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; + + +CREATE TABLE `django_session` ( + `session_key` varchar(40) NOT NULL, + `session_data` longtext NOT NULL, + `expire_date` datetime NOT NULL, + PRIMARY KEY (`session_key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `django_site` ( + `id` int(11) NOT NULL auto_increment, + `domain` varchar(100) NOT NULL, + `name` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + + +CREATE TABLE `favorite_question` ( + `id` int(11) NOT NULL auto_increment, + `question_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + `added_at` datetime NOT NULL, + PRIMARY KEY (`id`), + KEY `favorite_question_question_id` (`question_id`), + KEY `favorite_question_user_id` (`user_id`), + CONSTRAINT `question_id_refs_id_1ebe1cc3` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`), + CONSTRAINT `user_id_refs_id_52853822` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; + + +CREATE TABLE `flagged_item` ( + `id` int(11) NOT NULL auto_increment, + `content_type_id` int(11) NOT NULL, + `object_id` int(10) unsigned NOT NULL, + `user_id` int(11) NOT NULL, + `flagged_at` datetime NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `content_type_id` (`content_type_id`,`object_id`,`user_id`), + KEY `flagged_item_content_type_id` (`content_type_id`), + KEY `flagged_item_user_id` (`user_id`), + CONSTRAINT `content_type_id_refs_id_76e44d74` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), + CONSTRAINT `user_id_refs_id_35e3c608` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + + +CREATE TABLE `question` ( + `id` int(11) NOT NULL auto_increment, + `title` varchar(300) NOT NULL, + `author_id` int(11) NOT NULL, + `added_at` datetime NOT NULL, + `wiki` tinyint(1) NOT NULL, + `wikified_at` datetime default NULL, + `answer_accepted` tinyint(1) NOT NULL, + `closed` tinyint(1) NOT NULL, + `closed_by_id` int(11) default NULL, + `closed_at` datetime default NULL, + `close_reason` smallint(6) default NULL, + `deleted` tinyint(1) NOT NULL, + `deleted_at` datetime default NULL, + `deleted_by_id` int(11) default NULL, + `locked` tinyint(1) NOT NULL, + `locked_by_id` int(11) default NULL, + `locked_at` datetime default NULL, + `score` int(11) NOT NULL, + `answer_count` int(10) unsigned NOT NULL, + `comment_count` int(10) unsigned NOT NULL, + `view_count` int(10) unsigned NOT NULL, + `offensive_flag_count` smallint(6) NOT NULL, + `favourite_count` int(10) unsigned NOT NULL, + `last_edited_at` datetime default NULL, + `last_edited_by_id` int(11) default NULL, + `last_activity_at` datetime NOT NULL, + `last_activity_by_id` int(11) NOT NULL, + `tagnames` varchar(125) NOT NULL, + `summary` varchar(180) NOT NULL, + `html` longtext NOT NULL, + `vote_up_count` int(11) NOT NULL, + `vote_down_count` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `question_author_id` (`author_id`), + KEY `question_closed_by_id` (`closed_by_id`), + KEY `question_deleted_by_id` (`deleted_by_id`), + KEY `question_locked_by_id` (`locked_by_id`), + KEY `question_last_edited_by_id` (`last_edited_by_id`), + KEY `question_last_activity_by_id` (`last_activity_by_id`), + CONSTRAINT `author_id_refs_id_56e9d00c` FOREIGN KEY (`author_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `closed_by_id_refs_id_56e9d00c` FOREIGN KEY (`closed_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `deleted_by_id_refs_id_56e9d00c` FOREIGN KEY (`deleted_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `last_activity_by_id_refs_id_56e9d00c` FOREIGN KEY (`last_activity_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `last_edited_by_id_refs_id_56e9d00c` FOREIGN KEY (`last_edited_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `locked_by_id_refs_id_56e9d00c` FOREIGN KEY (`locked_by_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; + + +CREATE TABLE `question_revision` ( + `id` int(11) NOT NULL auto_increment, + `question_id` int(11) NOT NULL, + `revision` int(10) unsigned NOT NULL, + `title` varchar(300) NOT NULL, + `author_id` int(11) NOT NULL, + `revised_at` datetime NOT NULL, + `tagnames` varchar(125) NOT NULL, + `summary` varchar(300) NOT NULL, + `text` longtext NOT NULL, + PRIMARY KEY (`id`), + KEY `question_revision_question_id` (`question_id`), + KEY `question_revision_author_id` (`author_id`) +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + + +CREATE TABLE `question_tags` ( + `id` int(11) NOT NULL auto_increment, + `question_id` int(11) NOT NULL, + `tag_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `question_id` (`question_id`,`tag_id`), + KEY `tag_id_refs_id_43fcb953` (`tag_id`), + CONSTRAINT `question_id_refs_id_266147c6` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`), + CONSTRAINT `tag_id_refs_id_43fcb953` FOREIGN KEY (`tag_id`) REFERENCES `tag` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; + + +CREATE TABLE `repute` ( + `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL, + `positive` smallint(6) NOT NULL, + `negative` smallint(6) NOT NULL, + `question_id` int(11) NOT NULL, + `reputed_at` datetime NOT NULL, + `reputation_type` smallint(6) NOT NULL, + `reputation` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `repute_user_id` (`user_id`), + KEY `repute_question_id` (`question_id`) +) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; + + +CREATE TABLE `tag` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(255) NOT NULL, + `created_by_id` int(11) NOT NULL, + `used_count` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`), + KEY `tag_created_by_id` (`created_by_id`), + CONSTRAINT `created_by_id_refs_id_47205d6d` FOREIGN KEY (`created_by_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; + + +CREATE TABLE `user_badge` ( + `id` int(10) unsigned NOT NULL auto_increment, + `user_id` int(10) unsigned NOT NULL, + `badge_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `user_favorite_questions` ( + `id` int(10) unsigned NOT NULL auto_increment, + `user_id` int(10) unsigned NOT NULL, + `question_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `vote` ( + `id` int(11) NOT NULL auto_increment, + `content_type_id` int(11) NOT NULL, + `object_id` int(10) unsigned NOT NULL, + `user_id` int(11) NOT NULL, + `vote` smallint(6) NOT NULL, + `voted_at` datetime NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `content_type_id` (`content_type_id`,`object_id`,`user_id`), + KEY `vote_content_type_id` (`content_type_id`), + KEY `vote_user_id` (`user_id`), + CONSTRAINT `content_type_id_refs_id_50124414` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), + CONSTRAINT `user_id_refs_id_760a4df0` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; + + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/forum/sql_scripts/cnprog_new_install_2009_03_31.sql b/forum/sql_scripts/cnprog_new_install_2009_03_31.sql new file mode 100644 index 00000000..c2c69f36 --- /dev/null +++ b/forum/sql_scripts/cnprog_new_install_2009_03_31.sql @@ -0,0 +1,891 @@ +USE cnprog; + + +/************ Update: Tables ***************/ + +/******************** Add Table: activity ************************/ + +/* Build Table Structure */ +CREATE TABLE activity +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + activity_type SMALLINT NOT NULL, + active_at DATETIME NOT NULL, + content_type_id INTEGER NOT NULL, + object_id INTEGER UNSIGNED NOT NULL, + is_auditted TINYINT NULL DEFAULT 0 +) ENGINE=MyISAM AUTO_INCREMENT=103 DEFAULT CHARSET=latin1; + +/* Table Items: activity */ + +/* Add Indexes for: activity */ +CREATE INDEX activity_content_type_id ON activity (content_type_id); +CREATE INDEX activity_user_id ON activity (user_id); + +/******************** Add Table: answer ************************/ + +/* Build Table Structure */ +CREATE TABLE answer +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + question_id INTEGER NOT NULL, + author_id INTEGER NOT NULL, + added_at DATETIME NOT NULL, + wiki TINYINT NOT NULL, + wikified_at DATETIME NULL, + accepted TINYINT NOT NULL, + deleted TINYINT NOT NULL, + deleted_by_id INTEGER NULL, + locked TINYINT NOT NULL, + locked_by_id INTEGER NULL, + locked_at DATETIME NULL, + score INTEGER NOT NULL, + comment_count INTEGER UNSIGNED NOT NULL, + offensive_flag_count SMALLINT NOT NULL, + last_edited_at DATETIME NULL, + last_edited_by_id INTEGER NULL, + html LONGTEXT NOT NULL, + vote_up_count INTEGER NOT NULL, + vote_down_count INTEGER NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; + +/* Table Items: answer */ + +/* Add Indexes for: answer */ +CREATE INDEX answer_author_id ON answer (author_id); +CREATE INDEX answer_deleted_by_id ON answer (deleted_by_id); +CREATE INDEX answer_last_edited_by_id ON answer (last_edited_by_id); +CREATE INDEX answer_locked_by_id ON answer (locked_by_id); +CREATE INDEX answer_question_id ON answer (question_id); + +/******************** Add Table: answer_revision ************************/ + +/* Build Table Structure */ +CREATE TABLE answer_revision +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + answer_id INTEGER NOT NULL, + revision INTEGER UNSIGNED NOT NULL, + author_id INTEGER NOT NULL, + revised_at DATETIME NOT NULL, + summary TEXT NOT NULL, + `text` LONGTEXT NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/* Table Items: answer_revision */ + +/* Add Indexes for: answer_revision */ +CREATE INDEX answer_revision_answer_id ON answer_revision (answer_id); +CREATE INDEX answer_revision_author_id ON answer_revision (author_id); + +/******************** Add Table: auth_group ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_group +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(80) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: auth_group */ + +/* Add Indexes for: auth_group */ +CREATE UNIQUE INDEX name ON auth_group (name); + +/******************** Add Table: auth_group_permissions ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_group_permissions +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + group_id INTEGER NOT NULL, + permission_id INTEGER NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: auth_group_permissions */ + +/* Add Indexes for: auth_group_permissions */ +CREATE UNIQUE INDEX group_id ON auth_group_permissions (group_id, permission_id); +CREATE INDEX permission_id_refs_id_5886d21f ON auth_group_permissions (permission_id); + +/******************** Add Table: auth_message ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_message +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + message LONGTEXT NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8; + +/* Table Items: auth_message */ + +/* Add Indexes for: auth_message */ +CREATE INDEX auth_message_user_id ON auth_message (user_id); + +/******************** Add Table: auth_permission ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_permission +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(50) NOT NULL, + content_type_id INTEGER NOT NULL, + codename VARCHAR(100) NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8; + +/* Table Items: auth_permission */ + +/* Add Indexes for: auth_permission */ +CREATE INDEX auth_permission_content_type_id ON auth_permission (content_type_id); +CREATE UNIQUE INDEX content_type_id ON auth_permission (content_type_id, codename); + +/******************** Add Table: auth_user ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_user +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + username VARCHAR(30) NOT NULL, + first_name VARCHAR(30) NOT NULL, + last_name VARCHAR(30) NOT NULL, + email VARCHAR(75) NOT NULL, + password VARCHAR(128) NOT NULL, + is_staff TINYINT NOT NULL, + is_active TINYINT NOT NULL, + is_superuser TINYINT NOT NULL, + last_login DATETIME NOT NULL, + date_joined DATETIME NOT NULL, + gold SMALLINT NOT NULL DEFAULT 0, + silver SMALLINT UNSIGNED NOT NULL DEFAULT 0, + bronze SMALLINT UNSIGNED NOT NULL DEFAULT 0, + reputation INTEGER UNSIGNED NULL DEFAULT 1, + gravatar VARCHAR(128) NULL, + questions_per_page SMALLINT UNSIGNED NULL DEFAULT 10, + last_seen DATETIME NULL, + real_name VARCHAR(100) NULL, + website VARCHAR(200) NULL, + location VARCHAR(100) NULL, + date_of_birth DATETIME NULL, + about TEXT NULL +) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8; + +/* Table Items: auth_user */ + +/* Add Indexes for: auth_user */ +CREATE UNIQUE INDEX username ON auth_user (username); + +/******************** Add Table: auth_user_groups ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_user_groups +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + group_id INTEGER NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: auth_user_groups */ + +/* Add Indexes for: auth_user_groups */ +CREATE INDEX group_id_refs_id_f116770 ON auth_user_groups (group_id); +CREATE UNIQUE INDEX user_id ON auth_user_groups (user_id, group_id); + +/******************** Add Table: auth_user_user_permissions ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_user_user_permissions +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + permission_id INTEGER NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: auth_user_user_permissions */ + +/* Add Indexes for: auth_user_user_permissions */ +CREATE INDEX permission_id_refs_id_67e79cb ON auth_user_user_permissions (permission_id); +CREATE UNIQUE INDEX user_id ON auth_user_user_permissions (user_id, permission_id); + +/******************** Add Table: award ************************/ + +/* Build Table Structure */ +CREATE TABLE award +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + badge_id INTEGER NOT NULL, + awarded_at DATETIME NOT NULL, + notified TINYINT NOT NULL, + content_type_id INTEGER NULL, + object_id INTEGER NULL +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; + +/* Table Items: award */ + +/* Add Indexes for: award */ +CREATE INDEX award_badge_id ON award (badge_id); +CREATE INDEX award_user_id ON award (user_id); + +/******************** Add Table: badge ************************/ + +/* Build Table Structure */ +CREATE TABLE badge +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(50) NOT NULL, + `type` SMALLINT NOT NULL, + slug VARCHAR(50) NOT NULL, + description TEXT NOT NULL, + multiple TINYINT NOT NULL, + awarded_count INTEGER UNSIGNED NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; + +/* Table Items: badge */ + +/* Add Indexes for: badge */ +CREATE INDEX badge_slug ON badge (slug); +CREATE UNIQUE INDEX name ON badge (name, `type`); + +/******************** Add Table: book ************************/ + +/* Build Table Structure */ +CREATE TABLE book +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL, + short_name VARCHAR(255) NOT NULL, + author VARCHAR(255) NOT NULL, + user_id INTEGER NULL, + price DECIMAL(10, 2) NULL, + pages SMALLINT NULL, + published_at DATE NOT NULL, + publication VARCHAR(255) NOT NULL, + cover_img VARCHAR(255) NULL, + tagnames VARCHAR(125) NULL, + added_at DATETIME NOT NULL, + last_edited_at DATETIME NOT NULL +) TYPE=InnoDB; + +/* Table Items: book */ + +/* Add Indexes for: book */ +CREATE UNIQUE INDEX book_short_name_Idx ON book (short_name); +CREATE INDEX fk_books_auth_user ON book (user_id); + +/******************** Add Table: book_author_info ************************/ + +/* Build Table Structure */ +CREATE TABLE book_author_info +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + blog_url VARCHAR(255) NULL, + user_id INTEGER NOT NULL, + added_at DATETIME NOT NULL, + last_edited_at DATETIME NOT NULL +) TYPE=InnoDB; + +/* Table Items: book_author_info */ + +/* Add Indexes for: book_author_info */ +CREATE INDEX fk_book_author_info_auth_user ON book_author_info (user_id); + +/******************** Add Table: book_author_rss ************************/ + +/* Build Table Structure */ +CREATE TABLE book_author_rss +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL, + url VARCHAR(255) NOT NULL, + rss_created_at DATETIME NOT NULL, + user_id INTEGER NOT NULL, + added_at DATETIME NOT NULL +) TYPE=InnoDB; + +/* Table Items: book_author_rss */ + +/* Add Indexes for: book_author_rss */ +CREATE INDEX fk_book_author_rss_auth_user ON book_author_rss (user_id); + +/******************** Add Table: book_question ************************/ + +/* Build Table Structure */ +CREATE TABLE book_question +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + book_id INTEGER NOT NULL, + question_id INTEGER NOT NULL +) TYPE=InnoDB; + +/* Table Items: book_question */ + +/* Add Indexes for: book_question */ +CREATE INDEX fk_book_question_book ON book_question (book_id); +CREATE INDEX fk_book_question_question ON book_question (question_id); + +/******************** Add Table: `comment` ************************/ + +/* Build Table Structure */ +CREATE TABLE `comment` +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + content_type_id INTEGER NOT NULL, + object_id INTEGER UNSIGNED NOT NULL, + user_id INTEGER NOT NULL, + `comment` TEXT NOT NULL, + added_at DATETIME NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8; + +/* Table Items: `comment` */ + +/* Add Indexes for: comment */ +CREATE INDEX comment_content_type_id ON `comment` (content_type_id); +CREATE INDEX comment_user_id ON `comment` (user_id); +CREATE INDEX content_type_id ON `comment` (content_type_id, object_id, user_id); + +/******************** Add Table: django_admin_log ************************/ + +/* Build Table Structure */ +CREATE TABLE django_admin_log +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + action_time DATETIME NOT NULL, + user_id INTEGER NOT NULL, + content_type_id INTEGER NULL, + object_id LONGTEXT NULL, + object_repr VARCHAR(200) NOT NULL, + action_flag SMALLINT UNSIGNED NOT NULL, + change_message LONGTEXT NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/* Table Items: django_admin_log */ + +/* Add Indexes for: django_admin_log */ +CREATE INDEX django_admin_log_content_type_id ON django_admin_log (content_type_id); +CREATE INDEX django_admin_log_user_id ON django_admin_log (user_id); + +/******************** Add Table: django_authopenid_association ************************/ + +/* Build Table Structure */ +CREATE TABLE django_authopenid_association +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + server_url LONGTEXT NOT NULL, + handle VARCHAR(255) NOT NULL, + secret LONGTEXT NOT NULL, + issued INTEGER NOT NULL, + lifetime INTEGER NOT NULL, + assoc_type LONGTEXT NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + +/******************** Add Table: django_authopenid_nonce ************************/ + +/* Build Table Structure */ +CREATE TABLE django_authopenid_nonce +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + server_url VARCHAR(255) NOT NULL, + `timestamp` INTEGER NOT NULL, + salt VARCHAR(40) NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8; + +/******************** Add Table: django_authopenid_userassociation ************************/ + +/* Build Table Structure */ +CREATE TABLE django_authopenid_userassociation +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + openid_url VARCHAR(255) NOT NULL, + user_id INTEGER NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; + +/* Table Items: django_authopenid_userassociation */ + +/* Add Indexes for: django_authopenid_userassociation */ +CREATE UNIQUE INDEX user_id ON django_authopenid_userassociation (user_id); + +/******************** Add Table: django_authopenid_userpasswordqueue ************************/ + +/* Build Table Structure */ +CREATE TABLE django_authopenid_userpasswordqueue +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + new_password VARCHAR(30) NOT NULL, + confirm_key VARCHAR(40) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: django_authopenid_userpasswordqueue */ + +/* Add Indexes for: django_authopenid_userpasswordqueue */ +CREATE UNIQUE INDEX user_id ON django_authopenid_userpasswordqueue (user_id); + +/******************** Add Table: django_content_type ************************/ + +/* Build Table Structure */ +CREATE TABLE django_content_type +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + app_label VARCHAR(100) NOT NULL, + model VARCHAR(100) NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; + +/* Table Items: django_content_type */ + +/* Add Indexes for: django_content_type */ +CREATE UNIQUE INDEX app_label ON django_content_type (app_label, model); + +/******************** Add Table: django_session ************************/ + +/* Build Table Structure */ +CREATE TABLE django_session +( + session_key VARCHAR(40) NOT NULL, + session_data LONGTEXT NOT NULL, + expire_date DATETIME NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: django_session */ +ALTER TABLE django_session ADD CONSTRAINT pkdjango_session + PRIMARY KEY (session_key); + +/******************** Add Table: django_site ************************/ + +/* Build Table Structure */ +CREATE TABLE django_site +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + domain VARCHAR(100) NOT NULL, + name VARCHAR(50) NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/******************** Add Table: favorite_question ************************/ + +/* Build Table Structure */ +CREATE TABLE favorite_question +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + question_id INTEGER NOT NULL, + user_id INTEGER NOT NULL, + added_at DATETIME NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; + +/* Table Items: favorite_question */ + +/* Add Indexes for: favorite_question */ +CREATE INDEX favorite_question_question_id ON favorite_question (question_id); +CREATE INDEX favorite_question_user_id ON favorite_question (user_id); + +/******************** Add Table: flagged_item ************************/ + +/* Build Table Structure */ +CREATE TABLE flagged_item +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + content_type_id INTEGER NOT NULL, + object_id INTEGER UNSIGNED NOT NULL, + user_id INTEGER NOT NULL, + flagged_at DATETIME NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + +/* Table Items: flagged_item */ + +/* Add Indexes for: flagged_item */ +CREATE UNIQUE INDEX content_type_id ON flagged_item (content_type_id, object_id, user_id); +CREATE INDEX flagged_item_content_type_id ON flagged_item (content_type_id); +CREATE INDEX flagged_item_user_id ON flagged_item (user_id); + +/******************** Add Table: question ************************/ + +/* Build Table Structure */ +CREATE TABLE question +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + title TEXT NOT NULL, + author_id INTEGER NOT NULL, + added_at DATETIME NOT NULL, + wiki TINYINT NOT NULL, + wikified_at DATETIME NULL, + answer_accepted TINYINT NOT NULL, + closed TINYINT NOT NULL, + closed_by_id INTEGER NULL, + closed_at DATETIME NULL, + close_reason SMALLINT NULL, + deleted TINYINT NOT NULL, + deleted_at DATETIME NULL, + deleted_by_id INTEGER NULL, + locked TINYINT NOT NULL, + locked_by_id INTEGER NULL, + locked_at DATETIME NULL, + score INTEGER NOT NULL, + answer_count INTEGER UNSIGNED NOT NULL, + comment_count INTEGER UNSIGNED NOT NULL, + view_count INTEGER UNSIGNED NOT NULL, + offensive_flag_count SMALLINT NOT NULL, + favourite_count INTEGER UNSIGNED NOT NULL, + last_edited_at DATETIME NULL, + last_edited_by_id INTEGER NULL, + last_activity_at DATETIME NOT NULL, + last_activity_by_id INTEGER NOT NULL, + tagnames VARCHAR(125) NOT NULL, + summary VARCHAR(180) NOT NULL, + html LONGTEXT NOT NULL, + vote_up_count INTEGER NOT NULL, + vote_down_count INTEGER NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; + +/* Table Items: question */ + +/* Add Indexes for: question */ +CREATE INDEX question_author_id ON question (author_id); +CREATE INDEX question_closed_by_id ON question (closed_by_id); +CREATE INDEX question_deleted_by_id ON question (deleted_by_id); +CREATE INDEX question_last_activity_by_id ON question (last_activity_by_id); +CREATE INDEX question_last_edited_by_id ON question (last_edited_by_id); +CREATE INDEX question_locked_by_id ON question (locked_by_id); + +/******************** Add Table: question_revision ************************/ + +/* Build Table Structure */ +CREATE TABLE question_revision +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + question_id INTEGER NOT NULL, + revision INTEGER UNSIGNED NOT NULL, + title TEXT NOT NULL, + author_id INTEGER NOT NULL, + revised_at DATETIME NOT NULL, + tagnames VARCHAR(125) NOT NULL, + summary TEXT NOT NULL, + `text` LONGTEXT NOT NULL +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +/* Table Items: question_revision */ + +/* Add Indexes for: question_revision */ +CREATE INDEX question_revision_author_id ON question_revision (author_id); +CREATE INDEX question_revision_question_id ON question_revision (question_id); + +/******************** Add Table: question_tags ************************/ + +/* Build Table Structure */ +CREATE TABLE question_tags +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + question_id INTEGER NOT NULL, + tag_id INTEGER NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; + +/* Table Items: question_tags */ + +/* Add Indexes for: question_tags */ +CREATE UNIQUE INDEX question_id ON question_tags (question_id, tag_id); +CREATE INDEX tag_id_refs_id_43fcb953 ON question_tags (tag_id); + +/******************** Add Table: repute ************************/ + +/* Build Table Structure */ +CREATE TABLE repute +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + positive SMALLINT NOT NULL, + negative SMALLINT NOT NULL, + question_id INTEGER NOT NULL, + reputed_at DATETIME NOT NULL, + reputation_type SMALLINT NOT NULL, + reputation INTEGER NOT NULL +) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1; + +/* Table Items: repute */ + +/* Add Indexes for: repute */ +CREATE INDEX repute_question_id ON repute (question_id); +CREATE INDEX repute_user_id ON repute (user_id); + +/******************** Add Table: tag ************************/ + +/* Build Table Structure */ +CREATE TABLE tag +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + created_by_id INTEGER NOT NULL, + used_count INTEGER UNSIGNED NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; + +/* Table Items: tag */ + +/* Add Indexes for: tag */ +CREATE UNIQUE INDEX name ON tag (name); +CREATE INDEX tag_created_by_id ON tag (created_by_id); + +/******************** Add Table: user_badge ************************/ + +/* Build Table Structure */ +CREATE TABLE user_badge +( + id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + badge_id INTEGER NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: user_badge */ + +/* Add Indexes for: user_badge */ +CREATE INDEX fk_user_badge_auth_user ON user_badge (user_id); +CREATE INDEX fk_user_badge_badge ON user_badge (badge_id); + +/******************** Add Table: user_favorite_questions ************************/ + +/* Build Table Structure */ +CREATE TABLE user_favorite_questions +( + id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + question_id INTEGER NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: user_favorite_questions */ + +/* Add Indexes for: user_favorite_questions */ +CREATE INDEX fk_user_favorite_questions_auth_user ON user_favorite_questions (user_id); +CREATE INDEX fk_user_favorite_questions_question ON user_favorite_questions (question_id); + +/******************** Add Table: vote ************************/ + +/* Build Table Structure */ +CREATE TABLE vote +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + content_type_id INTEGER NOT NULL, + object_id INTEGER UNSIGNED NOT NULL, + user_id INTEGER NOT NULL, + vote SMALLINT NOT NULL, + voted_at DATETIME NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; + +/* Table Items: vote */ + +/* Add Indexes for: vote */ +CREATE UNIQUE INDEX content_type_id ON vote (content_type_id, object_id, user_id); +CREATE INDEX vote_content_type_id ON vote (content_type_id); +CREATE INDEX vote_user_id ON vote (user_id); + + +/************ Add Foreign Keys to Database ***************/ +/*----------------------------------------------------------- +Warning: Versions of MySQL prior to 4.1.2 require indexes on all columns involved in a foreign key. The following indexes may be required: +fk_auth_group_permissions_auth_group may require an index on table: auth_group_permissions, column: group_id +fk_auth_user_groups_auth_user may require an index on table: auth_user_groups, column: user_id +fk_auth_user_user_permissions_auth_user may require an index on table: auth_user_user_permissions, column: user_id +fk_question_tags_question may require an index on table: question_tags, column: question_id +----------------------------------------------------------- +*/ + +/************ Foreign Key: fk_activity_auth_user ***************/ +ALTER TABLE activity ADD CONSTRAINT fk_activity_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: deleted_by_id_refs_id_192b0170 ***************/ +ALTER TABLE answer ADD CONSTRAINT deleted_by_id_refs_id_192b0170 + FOREIGN KEY (deleted_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_answer_auth_user ***************/ +ALTER TABLE answer ADD CONSTRAINT fk_answer_auth_user + FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_answer_question ***************/ +ALTER TABLE answer ADD CONSTRAINT fk_answer_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: last_edited_by_id_refs_id_192b0170 ***************/ +ALTER TABLE answer ADD CONSTRAINT last_edited_by_id_refs_id_192b0170 + FOREIGN KEY (last_edited_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: locked_by_id_refs_id_192b0170 ***************/ +ALTER TABLE answer ADD CONSTRAINT locked_by_id_refs_id_192b0170 + FOREIGN KEY (locked_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_answer_revision_auth_user ***************/ +ALTER TABLE answer_revision ADD CONSTRAINT fk_answer_revision_auth_user + FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_group_permissions_auth_group ***************/ +ALTER TABLE auth_group_permissions ADD CONSTRAINT fk_auth_group_permissions_auth_group + FOREIGN KEY (group_id) REFERENCES auth_group (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_group_permissions_auth_permission ***************/ +ALTER TABLE auth_group_permissions ADD CONSTRAINT fk_auth_group_permissions_auth_permission + FOREIGN KEY (permission_id) REFERENCES auth_permission (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_message_auth_user ***************/ +ALTER TABLE auth_message ADD CONSTRAINT fk_auth_message_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_permission_django_content_type ***************/ +ALTER TABLE auth_permission ADD CONSTRAINT fk_auth_permission_django_content_type + FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_user_groups_auth_group ***************/ +ALTER TABLE auth_user_groups ADD CONSTRAINT fk_auth_user_groups_auth_group + FOREIGN KEY (group_id) REFERENCES auth_group (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_user_groups_auth_user ***************/ +ALTER TABLE auth_user_groups ADD CONSTRAINT fk_auth_user_groups_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_user_user_permissions_auth_permission ***************/ +ALTER TABLE auth_user_user_permissions ADD CONSTRAINT fk_auth_user_user_permissions_auth_permission + FOREIGN KEY (permission_id) REFERENCES auth_permission (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_user_user_permissions_auth_user ***************/ +ALTER TABLE auth_user_user_permissions ADD CONSTRAINT fk_auth_user_user_permissions_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_award_auth_user ***************/ +ALTER TABLE award ADD CONSTRAINT fk_award_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_award_badge ***************/ +ALTER TABLE award ADD CONSTRAINT fk_award_badge + FOREIGN KEY (badge_id) REFERENCES badge (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_books_auth_user ***************/ +ALTER TABLE book ADD CONSTRAINT fk_books_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_book_author_info_auth_user ***************/ +ALTER TABLE book_author_info ADD CONSTRAINT fk_book_author_info_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_book_author_rss_auth_user ***************/ +ALTER TABLE book_author_rss ADD CONSTRAINT fk_book_author_rss_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_book_question_book ***************/ +ALTER TABLE book_question ADD CONSTRAINT fk_book_question_book + FOREIGN KEY (book_id) REFERENCES book (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_book_question_question ***************/ +ALTER TABLE book_question ADD CONSTRAINT fk_book_question_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_comment_auth_user ***************/ +ALTER TABLE `comment` ADD CONSTRAINT fk_comment_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_comment_django_content_type ***************/ +ALTER TABLE `comment` ADD CONSTRAINT fk_comment_django_content_type + FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_django_admin_log_auth_user ***************/ +ALTER TABLE django_admin_log ADD CONSTRAINT fk_django_admin_log_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_django_admin_log_django_content_type ***************/ +ALTER TABLE django_admin_log ADD CONSTRAINT fk_django_admin_log_django_content_type + FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_django_authopenid_userassociation_auth_user ***************/ +ALTER TABLE django_authopenid_userassociation ADD CONSTRAINT fk_django_authopenid_userassociation_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_django_authopenid_userpasswordqueue_auth_user ***************/ +ALTER TABLE django_authopenid_userpasswordqueue ADD CONSTRAINT fk_django_authopenid_userpasswordqueue_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_favorite_question_auth_user ***************/ +ALTER TABLE favorite_question ADD CONSTRAINT fk_favorite_question_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_favorite_question_question ***************/ +ALTER TABLE favorite_question ADD CONSTRAINT fk_favorite_question_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_flagged_item_auth_user ***************/ +ALTER TABLE flagged_item ADD CONSTRAINT fk_flagged_item_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_flagged_item_django_content_type ***************/ +ALTER TABLE flagged_item ADD CONSTRAINT fk_flagged_item_django_content_type + FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: closed_by_id_refs_id_56e9d00c ***************/ +ALTER TABLE question ADD CONSTRAINT closed_by_id_refs_id_56e9d00c + FOREIGN KEY (closed_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: deleted_by_id_refs_id_56e9d00c ***************/ +ALTER TABLE question ADD CONSTRAINT deleted_by_id_refs_id_56e9d00c + FOREIGN KEY (deleted_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_question_auth_user ***************/ +ALTER TABLE question ADD CONSTRAINT fk_question_auth_user + FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: last_activity_by_id_refs_id_56e9d00c ***************/ +ALTER TABLE question ADD CONSTRAINT last_activity_by_id_refs_id_56e9d00c + FOREIGN KEY (last_activity_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: last_edited_by_id_refs_id_56e9d00c ***************/ +ALTER TABLE question ADD CONSTRAINT last_edited_by_id_refs_id_56e9d00c + FOREIGN KEY (last_edited_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: locked_by_id_refs_id_56e9d00c ***************/ +ALTER TABLE question ADD CONSTRAINT locked_by_id_refs_id_56e9d00c + FOREIGN KEY (locked_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_question_revision_auth_user ***************/ +ALTER TABLE question_revision ADD CONSTRAINT fk_question_revision_auth_user + FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_question_revision_question ***************/ +ALTER TABLE question_revision ADD CONSTRAINT fk_question_revision_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_question_tags_question ***************/ +ALTER TABLE question_tags ADD CONSTRAINT fk_question_tags_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_question_tags_tag ***************/ +ALTER TABLE question_tags ADD CONSTRAINT fk_question_tags_tag + FOREIGN KEY (tag_id) REFERENCES tag (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_repute_auth_user ***************/ +ALTER TABLE repute ADD CONSTRAINT fk_repute_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_repute_question ***************/ +ALTER TABLE repute ADD CONSTRAINT fk_repute_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_tag_auth_user ***************/ +ALTER TABLE tag ADD CONSTRAINT fk_tag_auth_user + FOREIGN KEY (created_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_user_badge_auth_user ***************/ +ALTER TABLE user_badge ADD CONSTRAINT fk_user_badge_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_user_badge_badge ***************/ +ALTER TABLE user_badge ADD CONSTRAINT fk_user_badge_badge + FOREIGN KEY (badge_id) REFERENCES badge (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_user_favorite_questions_auth_user ***************/ +ALTER TABLE user_favorite_questions ADD CONSTRAINT fk_user_favorite_questions_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_user_favorite_questions_question ***************/ +ALTER TABLE user_favorite_questions ADD CONSTRAINT fk_user_favorite_questions_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_vote_auth_user ***************/ +ALTER TABLE vote ADD CONSTRAINT fk_vote_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_vote_django_content_type ***************/ +ALTER TABLE vote ADD CONSTRAINT fk_vote_django_content_type + FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; \ No newline at end of file diff --git a/forum/sql_scripts/cnprog_new_install_2009_04_07.sql b/forum/sql_scripts/cnprog_new_install_2009_04_07.sql new file mode 100644 index 00000000..ff9016fa --- /dev/null +++ b/forum/sql_scripts/cnprog_new_install_2009_04_07.sql @@ -0,0 +1,24 @@ +USE cnprog; + + +/************ Add Foreign Keys to Database ***************/ + +/************ Foreign Key: fk_activity_auth_user ***************/ +ALTER TABLE activity ADD CONSTRAINT fk_activity_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_question_revision_auth_user ***************/ +ALTER TABLE question_revision ADD CONSTRAINT fk_question_revision_auth_user + FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_question_revision_question ***************/ +ALTER TABLE question_revision ADD CONSTRAINT fk_question_revision_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_repute_auth_user ***************/ +ALTER TABLE repute ADD CONSTRAINT fk_repute_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_repute_question ***************/ +ALTER TABLE repute ADD CONSTRAINT fk_repute_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; \ No newline at end of file diff --git a/forum/sql_scripts/cnprog_new_install_2009_04_09.sql b/forum/sql_scripts/cnprog_new_install_2009_04_09.sql new file mode 100644 index 00000000..f4424852 --- /dev/null +++ b/forum/sql_scripts/cnprog_new_install_2009_04_09.sql @@ -0,0 +1,904 @@ +USE cnprog; + + +/************ Update: Tables ***************/ + +/******************** Add Table: activity ************************/ + +/* Build Table Structure */ +CREATE TABLE activity +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + activity_type SMALLINT NOT NULL, + active_at DATETIME NOT NULL, + content_type_id INTEGER NOT NULL, + object_id INTEGER UNSIGNED NOT NULL, + is_auditted TINYINT NULL DEFAULT 0 +) ENGINE=MyISAM AUTO_INCREMENT=103 DEFAULT CHARSET=latin1; + +/* Table Items: activity */ + +/* Add Indexes for: activity */ +CREATE INDEX activity_content_type_id ON activity (content_type_id); +CREATE INDEX activity_user_id ON activity (user_id); + +/******************** Add Table: answer ************************/ + +/* Build Table Structure */ +CREATE TABLE answer +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + question_id INTEGER NOT NULL, + author_id INTEGER NOT NULL, + added_at DATETIME NOT NULL, + wiki TINYINT NOT NULL, + wikified_at DATETIME NULL, + accepted TINYINT NOT NULL, + deleted TINYINT NOT NULL, + deleted_by_id INTEGER NULL, + locked TINYINT NOT NULL, + locked_by_id INTEGER NULL, + locked_at DATETIME NULL, + score INTEGER NOT NULL, + comment_count INTEGER UNSIGNED NOT NULL, + offensive_flag_count SMALLINT NOT NULL, + last_edited_at DATETIME NULL, + last_edited_by_id INTEGER NULL, + html LONGTEXT NOT NULL, + vote_up_count INTEGER NOT NULL, + vote_down_count INTEGER NOT NULL, + accepted_at DATETIME NULL +) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; + +/* Table Items: answer */ + +/* Add Indexes for: answer */ +CREATE INDEX answer_author_id ON answer (author_id); +CREATE INDEX answer_deleted_by_id ON answer (deleted_by_id); +CREATE INDEX answer_last_edited_by_id ON answer (last_edited_by_id); +CREATE INDEX answer_locked_by_id ON answer (locked_by_id); +CREATE INDEX answer_question_id ON answer (question_id); + +/******************** Add Table: answer_revision ************************/ + +/* Build Table Structure */ +CREATE TABLE answer_revision +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + answer_id INTEGER NOT NULL, + revision INTEGER UNSIGNED NOT NULL, + author_id INTEGER NOT NULL, + revised_at DATETIME NOT NULL, + summary TEXT NOT NULL, + `text` LONGTEXT NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/* Table Items: answer_revision */ + +/* Add Indexes for: answer_revision */ +CREATE INDEX answer_revision_answer_id ON answer_revision (answer_id); +CREATE INDEX answer_revision_author_id ON answer_revision (author_id); + +/******************** Add Table: auth_group ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_group +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(80) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: auth_group */ + +/* Add Indexes for: auth_group */ +CREATE UNIQUE INDEX name ON auth_group (name); + +/******************** Add Table: auth_group_permissions ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_group_permissions +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + group_id INTEGER NOT NULL, + permission_id INTEGER NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: auth_group_permissions */ + +/* Add Indexes for: auth_group_permissions */ +CREATE UNIQUE INDEX group_id ON auth_group_permissions (group_id, permission_id); +CREATE INDEX permission_id_refs_id_5886d21f ON auth_group_permissions (permission_id); + +/******************** Add Table: auth_message ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_message +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + message LONGTEXT NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8; + +/* Table Items: auth_message */ + +/* Add Indexes for: auth_message */ +CREATE INDEX auth_message_user_id ON auth_message (user_id); + +/******************** Add Table: auth_permission ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_permission +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(50) NOT NULL, + content_type_id INTEGER NOT NULL, + codename VARCHAR(100) NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8; + +/* Table Items: auth_permission */ + +/* Add Indexes for: auth_permission */ +CREATE INDEX auth_permission_content_type_id ON auth_permission (content_type_id); +CREATE UNIQUE INDEX content_type_id ON auth_permission (content_type_id, codename); + +/******************** Add Table: auth_user ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_user +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + username VARCHAR(30) NOT NULL, + first_name VARCHAR(30) NOT NULL, + last_name VARCHAR(30) NOT NULL, + email VARCHAR(75) NOT NULL, + password VARCHAR(128) NOT NULL, + is_staff TINYINT NOT NULL, + is_active TINYINT NOT NULL, + is_superuser TINYINT NOT NULL, + last_login DATETIME NOT NULL, + date_joined DATETIME NOT NULL, + gold SMALLINT NOT NULL DEFAULT 0, + silver SMALLINT UNSIGNED NOT NULL DEFAULT 0, + bronze SMALLINT UNSIGNED NOT NULL DEFAULT 0, + reputation INTEGER UNSIGNED NULL DEFAULT 1, + gravatar VARCHAR(128) NULL, + questions_per_page SMALLINT UNSIGNED NULL DEFAULT 10, + last_seen DATETIME NULL, + real_name VARCHAR(100) NULL, + website VARCHAR(200) NULL, + location VARCHAR(100) NULL, + date_of_birth DATETIME NULL, + about TEXT NULL +) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8; + +/* Table Items: auth_user */ + +/* Add Indexes for: auth_user */ +CREATE UNIQUE INDEX username ON auth_user (username); + +/******************** Add Table: auth_user_groups ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_user_groups +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + group_id INTEGER NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: auth_user_groups */ + +/* Add Indexes for: auth_user_groups */ +CREATE INDEX group_id_refs_id_f116770 ON auth_user_groups (group_id); +CREATE UNIQUE INDEX user_id ON auth_user_groups (user_id, group_id); + +/******************** Add Table: auth_user_user_permissions ************************/ + +/* Build Table Structure */ +CREATE TABLE auth_user_user_permissions +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + permission_id INTEGER NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: auth_user_user_permissions */ + +/* Add Indexes for: auth_user_user_permissions */ +CREATE INDEX permission_id_refs_id_67e79cb ON auth_user_user_permissions (permission_id); +CREATE UNIQUE INDEX user_id ON auth_user_user_permissions (user_id, permission_id); + +/******************** Add Table: award ************************/ + +/* Build Table Structure */ +CREATE TABLE award +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + badge_id INTEGER NOT NULL, + awarded_at DATETIME NOT NULL, + notified TINYINT NOT NULL, + content_type_id INTEGER NULL, + object_id INTEGER NULL +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; + +/* Table Items: award */ + +/* Add Indexes for: award */ +CREATE INDEX award_badge_id ON award (badge_id); +CREATE INDEX award_user_id ON award (user_id); + +/******************** Add Table: badge ************************/ + +/* Build Table Structure */ +CREATE TABLE badge +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(50) NOT NULL, + `type` SMALLINT NOT NULL, + slug VARCHAR(50) NOT NULL, + description TEXT NOT NULL, + multiple TINYINT NOT NULL, + awarded_count INTEGER UNSIGNED NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; + +/* Table Items: badge */ + +/* Add Indexes for: badge */ +CREATE INDEX badge_slug ON badge (slug); +CREATE UNIQUE INDEX name ON badge (name, `type`); + +/******************** Add Table: book ************************/ + +/* Build Table Structure */ +CREATE TABLE book +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL, + short_name VARCHAR(255) NOT NULL, + author VARCHAR(255) NOT NULL, + user_id INTEGER NULL, + price DECIMAL(10, 2) NULL, + pages SMALLINT NULL, + published_at DATE NOT NULL, + publication VARCHAR(255) NOT NULL, + cover_img VARCHAR(255) NULL, + tagnames VARCHAR(125) NULL, + added_at DATETIME NOT NULL, + last_edited_at DATETIME NOT NULL +) TYPE=InnoDB; + +/* Table Items: book */ + +/* Add Indexes for: book */ +CREATE UNIQUE INDEX book_short_name_Idx ON book (short_name); +CREATE INDEX fk_books_auth_user ON book (user_id); + +/******************** Add Table: book_author_info ************************/ + +/* Build Table Structure */ +CREATE TABLE book_author_info +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + blog_url VARCHAR(255) NULL, + user_id INTEGER NOT NULL, + added_at DATETIME NOT NULL, + last_edited_at DATETIME NOT NULL, + book_id INTEGER NOT NULL +) TYPE=InnoDB; + +/* Table Items: book_author_info */ + +/* Add Indexes for: book_author_info */ +CREATE INDEX fk_book_author_info_auth_user ON book_author_info (user_id); +CREATE INDEX fk_book_author_info_book ON book_author_info (book_id); + +/******************** Add Table: book_author_rss ************************/ + +/* Build Table Structure */ +CREATE TABLE book_author_rss +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL, + url VARCHAR(255) NOT NULL, + rss_created_at DATETIME NOT NULL, + user_id INTEGER NOT NULL, + added_at DATETIME NOT NULL, + book_id INTEGER NOT NULL +) TYPE=InnoDB; + +/* Table Items: book_author_rss */ + +/* Add Indexes for: book_author_rss */ +CREATE INDEX fk_book_author_rss_auth_user ON book_author_rss (user_id); +CREATE INDEX fk_book_author_rss_book ON book_author_rss (book_id); + +/******************** Add Table: book_question ************************/ + +/* Build Table Structure */ +CREATE TABLE book_question +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + book_id INTEGER NOT NULL, + question_id INTEGER NOT NULL +) TYPE=InnoDB; + +/* Table Items: book_question */ + +/* Add Indexes for: book_question */ +CREATE INDEX fk_book_question_book ON book_question (book_id); +CREATE INDEX fk_book_question_question ON book_question (question_id); + +/******************** Add Table: `comment` ************************/ + +/* Build Table Structure */ +CREATE TABLE `comment` +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + content_type_id INTEGER NOT NULL, + object_id INTEGER UNSIGNED NOT NULL, + user_id INTEGER NOT NULL, + `comment` TEXT NOT NULL, + added_at DATETIME NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8; + +/* Table Items: `comment` */ + +/* Add Indexes for: comment */ +CREATE INDEX comment_content_type_id ON `comment` (content_type_id); +CREATE INDEX comment_user_id ON `comment` (user_id); +CREATE INDEX content_type_id ON `comment` (content_type_id, object_id, user_id); + +/******************** Add Table: django_admin_log ************************/ + +/* Build Table Structure */ +CREATE TABLE django_admin_log +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + action_time DATETIME NOT NULL, + user_id INTEGER NOT NULL, + content_type_id INTEGER NULL, + object_id LONGTEXT NULL, + object_repr VARCHAR(200) NOT NULL, + action_flag SMALLINT UNSIGNED NOT NULL, + change_message LONGTEXT NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/* Table Items: django_admin_log */ + +/* Add Indexes for: django_admin_log */ +CREATE INDEX django_admin_log_content_type_id ON django_admin_log (content_type_id); +CREATE INDEX django_admin_log_user_id ON django_admin_log (user_id); + +/******************** Add Table: django_authopenid_association ************************/ + +/* Build Table Structure */ +CREATE TABLE django_authopenid_association +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + server_url LONGTEXT NOT NULL, + handle VARCHAR(255) NOT NULL, + secret LONGTEXT NOT NULL, + issued INTEGER NOT NULL, + lifetime INTEGER NOT NULL, + assoc_type LONGTEXT NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + +/******************** Add Table: django_authopenid_nonce ************************/ + +/* Build Table Structure */ +CREATE TABLE django_authopenid_nonce +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + server_url VARCHAR(255) NOT NULL, + `timestamp` INTEGER NOT NULL, + salt VARCHAR(40) NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8; + +/******************** Add Table: django_authopenid_userassociation ************************/ + +/* Build Table Structure */ +CREATE TABLE django_authopenid_userassociation +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + openid_url VARCHAR(255) NOT NULL, + user_id INTEGER NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; + +/* Table Items: django_authopenid_userassociation */ + +/* Add Indexes for: django_authopenid_userassociation */ +CREATE UNIQUE INDEX user_id ON django_authopenid_userassociation (user_id); + +/******************** Add Table: django_authopenid_userpasswordqueue ************************/ + +/* Build Table Structure */ +CREATE TABLE django_authopenid_userpasswordqueue +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + new_password VARCHAR(30) NOT NULL, + confirm_key VARCHAR(40) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: django_authopenid_userpasswordqueue */ + +/* Add Indexes for: django_authopenid_userpasswordqueue */ +CREATE UNIQUE INDEX user_id ON django_authopenid_userpasswordqueue (user_id); + +/******************** Add Table: django_content_type ************************/ + +/* Build Table Structure */ +CREATE TABLE django_content_type +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + app_label VARCHAR(100) NOT NULL, + model VARCHAR(100) NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; + +/* Table Items: django_content_type */ + +/* Add Indexes for: django_content_type */ +CREATE UNIQUE INDEX app_label ON django_content_type (app_label, model); + +/******************** Add Table: django_session ************************/ + +/* Build Table Structure */ +CREATE TABLE django_session +( + session_key VARCHAR(40) NOT NULL, + session_data LONGTEXT NOT NULL, + expire_date DATETIME NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: django_session */ +ALTER TABLE django_session ADD CONSTRAINT pkdjango_session + PRIMARY KEY (session_key); + +/******************** Add Table: django_site ************************/ + +/* Build Table Structure */ +CREATE TABLE django_site +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + domain VARCHAR(100) NOT NULL, + name VARCHAR(50) NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/******************** Add Table: favorite_question ************************/ + +/* Build Table Structure */ +CREATE TABLE favorite_question +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + question_id INTEGER NOT NULL, + user_id INTEGER NOT NULL, + added_at DATETIME NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; + +/* Table Items: favorite_question */ + +/* Add Indexes for: favorite_question */ +CREATE INDEX favorite_question_question_id ON favorite_question (question_id); +CREATE INDEX favorite_question_user_id ON favorite_question (user_id); + +/******************** Add Table: flagged_item ************************/ + +/* Build Table Structure */ +CREATE TABLE flagged_item +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + content_type_id INTEGER NOT NULL, + object_id INTEGER UNSIGNED NOT NULL, + user_id INTEGER NOT NULL, + flagged_at DATETIME NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + +/* Table Items: flagged_item */ + +/* Add Indexes for: flagged_item */ +CREATE UNIQUE INDEX content_type_id ON flagged_item (content_type_id, object_id, user_id); +CREATE INDEX flagged_item_content_type_id ON flagged_item (content_type_id); +CREATE INDEX flagged_item_user_id ON flagged_item (user_id); + +/******************** Add Table: question ************************/ + +/* Build Table Structure */ +CREATE TABLE question +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + title TEXT NOT NULL, + author_id INTEGER NOT NULL, + added_at DATETIME NOT NULL, + wiki TINYINT NOT NULL, + wikified_at DATETIME NULL, + answer_accepted TINYINT NOT NULL, + closed TINYINT NOT NULL, + closed_by_id INTEGER NULL, + closed_at DATETIME NULL, + close_reason SMALLINT NULL, + deleted TINYINT NOT NULL, + deleted_at DATETIME NULL, + deleted_by_id INTEGER NULL, + locked TINYINT NOT NULL, + locked_by_id INTEGER NULL, + locked_at DATETIME NULL, + score INTEGER NOT NULL, + answer_count INTEGER UNSIGNED NOT NULL, + comment_count INTEGER UNSIGNED NOT NULL, + view_count INTEGER UNSIGNED NOT NULL, + offensive_flag_count SMALLINT NOT NULL, + favourite_count INTEGER UNSIGNED NOT NULL, + last_edited_at DATETIME NULL, + last_edited_by_id INTEGER NULL, + last_activity_at DATETIME NOT NULL, + last_activity_by_id INTEGER NOT NULL, + tagnames VARCHAR(125) NOT NULL, + summary VARCHAR(180) NOT NULL, + html LONGTEXT NOT NULL, + vote_up_count INTEGER NOT NULL, + vote_down_count INTEGER NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; + +/* Table Items: question */ + +/* Add Indexes for: question */ +CREATE INDEX question_author_id ON question (author_id); +CREATE INDEX question_closed_by_id ON question (closed_by_id); +CREATE INDEX question_deleted_by_id ON question (deleted_by_id); +CREATE INDEX question_last_activity_by_id ON question (last_activity_by_id); +CREATE INDEX question_last_edited_by_id ON question (last_edited_by_id); +CREATE INDEX question_locked_by_id ON question (locked_by_id); + +/******************** Add Table: question_revision ************************/ + +/* Build Table Structure */ +CREATE TABLE question_revision +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + question_id INTEGER NOT NULL, + revision INTEGER UNSIGNED NOT NULL, + title TEXT NOT NULL, + author_id INTEGER NOT NULL, + revised_at DATETIME NOT NULL, + tagnames VARCHAR(125) NOT NULL, + summary TEXT NOT NULL, + `text` LONGTEXT NOT NULL +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +/* Table Items: question_revision */ + +/* Add Indexes for: question_revision */ +CREATE INDEX question_revision_author_id ON question_revision (author_id); +CREATE INDEX question_revision_question_id ON question_revision (question_id); + +/******************** Add Table: question_tags ************************/ + +/* Build Table Structure */ +CREATE TABLE question_tags +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + question_id INTEGER NOT NULL, + tag_id INTEGER NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; + +/* Table Items: question_tags */ + +/* Add Indexes for: question_tags */ +CREATE UNIQUE INDEX question_id ON question_tags (question_id, tag_id); +CREATE INDEX tag_id_refs_id_43fcb953 ON question_tags (tag_id); + +/******************** Add Table: repute ************************/ + +/* Build Table Structure */ +CREATE TABLE repute +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + positive SMALLINT NOT NULL, + negative SMALLINT NOT NULL, + question_id INTEGER NOT NULL, + reputed_at DATETIME NOT NULL, + reputation_type SMALLINT NOT NULL, + reputation INTEGER NOT NULL +) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1; + +/* Table Items: repute */ + +/* Add Indexes for: repute */ +CREATE INDEX repute_question_id ON repute (question_id); +CREATE INDEX repute_user_id ON repute (user_id); + +/******************** Add Table: tag ************************/ + +/* Build Table Structure */ +CREATE TABLE tag +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + created_by_id INTEGER NOT NULL, + used_count INTEGER UNSIGNED NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; + +/* Table Items: tag */ + +/* Add Indexes for: tag */ +CREATE UNIQUE INDEX name ON tag (name); +CREATE INDEX tag_created_by_id ON tag (created_by_id); + +/******************** Add Table: user_badge ************************/ + +/* Build Table Structure */ +CREATE TABLE user_badge +( + id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + badge_id INTEGER NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: user_badge */ + +/* Add Indexes for: user_badge */ +CREATE INDEX fk_user_badge_auth_user ON user_badge (user_id); +CREATE INDEX fk_user_badge_badge ON user_badge (badge_id); + +/******************** Add Table: user_favorite_questions ************************/ + +/* Build Table Structure */ +CREATE TABLE user_favorite_questions +( + id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + user_id INTEGER NOT NULL, + question_id INTEGER NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Table Items: user_favorite_questions */ + +/* Add Indexes for: user_favorite_questions */ +CREATE INDEX fk_user_favorite_questions_auth_user ON user_favorite_questions (user_id); +CREATE INDEX fk_user_favorite_questions_question ON user_favorite_questions (question_id); + +/******************** Add Table: vote ************************/ + +/* Build Table Structure */ +CREATE TABLE vote +( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + content_type_id INTEGER NOT NULL, + object_id INTEGER UNSIGNED NOT NULL, + user_id INTEGER NOT NULL, + vote SMALLINT NOT NULL, + voted_at DATETIME NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; + +/* Table Items: vote */ + +/* Add Indexes for: vote */ +CREATE UNIQUE INDEX content_type_id ON vote (content_type_id, object_id, user_id); +CREATE INDEX vote_content_type_id ON vote (content_type_id); +CREATE INDEX vote_user_id ON vote (user_id); + + +/************ Add Foreign Keys to Database ***************/ +/*----------------------------------------------------------- +Warning: Versions of MySQL prior to 4.1.2 require indexes on all columns involved in a foreign key. The following indexes may be required: +fk_auth_group_permissions_auth_group may require an index on table: auth_group_permissions, column: group_id +fk_auth_user_groups_auth_user may require an index on table: auth_user_groups, column: user_id +fk_auth_user_user_permissions_auth_user may require an index on table: auth_user_user_permissions, column: user_id +fk_question_tags_question may require an index on table: question_tags, column: question_id +----------------------------------------------------------- +*/ + +/************ Foreign Key: fk_activity_auth_user ***************/ +ALTER TABLE activity ADD CONSTRAINT fk_activity_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: deleted_by_id_refs_id_192b0170 ***************/ +ALTER TABLE answer ADD CONSTRAINT deleted_by_id_refs_id_192b0170 + FOREIGN KEY (deleted_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_answer_auth_user ***************/ +ALTER TABLE answer ADD CONSTRAINT fk_answer_auth_user + FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_answer_question ***************/ +ALTER TABLE answer ADD CONSTRAINT fk_answer_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: last_edited_by_id_refs_id_192b0170 ***************/ +ALTER TABLE answer ADD CONSTRAINT last_edited_by_id_refs_id_192b0170 + FOREIGN KEY (last_edited_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: locked_by_id_refs_id_192b0170 ***************/ +ALTER TABLE answer ADD CONSTRAINT locked_by_id_refs_id_192b0170 + FOREIGN KEY (locked_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_answer_revision_auth_user ***************/ +ALTER TABLE answer_revision ADD CONSTRAINT fk_answer_revision_auth_user + FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_group_permissions_auth_group ***************/ +ALTER TABLE auth_group_permissions ADD CONSTRAINT fk_auth_group_permissions_auth_group + FOREIGN KEY (group_id) REFERENCES auth_group (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_group_permissions_auth_permission ***************/ +ALTER TABLE auth_group_permissions ADD CONSTRAINT fk_auth_group_permissions_auth_permission + FOREIGN KEY (permission_id) REFERENCES auth_permission (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_message_auth_user ***************/ +ALTER TABLE auth_message ADD CONSTRAINT fk_auth_message_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_permission_django_content_type ***************/ +ALTER TABLE auth_permission ADD CONSTRAINT fk_auth_permission_django_content_type + FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_user_groups_auth_group ***************/ +ALTER TABLE auth_user_groups ADD CONSTRAINT fk_auth_user_groups_auth_group + FOREIGN KEY (group_id) REFERENCES auth_group (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_user_groups_auth_user ***************/ +ALTER TABLE auth_user_groups ADD CONSTRAINT fk_auth_user_groups_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_user_user_permissions_auth_permission ***************/ +ALTER TABLE auth_user_user_permissions ADD CONSTRAINT fk_auth_user_user_permissions_auth_permission + FOREIGN KEY (permission_id) REFERENCES auth_permission (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_auth_user_user_permissions_auth_user ***************/ +ALTER TABLE auth_user_user_permissions ADD CONSTRAINT fk_auth_user_user_permissions_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_award_auth_user ***************/ +ALTER TABLE award ADD CONSTRAINT fk_award_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_award_badge ***************/ +ALTER TABLE award ADD CONSTRAINT fk_award_badge + FOREIGN KEY (badge_id) REFERENCES badge (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_books_auth_user ***************/ +ALTER TABLE book ADD CONSTRAINT fk_books_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_book_author_info_auth_user ***************/ +ALTER TABLE book_author_info ADD CONSTRAINT fk_book_author_info_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_book_author_info_book ***************/ +ALTER TABLE book_author_info ADD CONSTRAINT fk_book_author_info_book + FOREIGN KEY (book_id) REFERENCES book (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_book_author_rss_auth_user ***************/ +ALTER TABLE book_author_rss ADD CONSTRAINT fk_book_author_rss_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_book_author_rss_book ***************/ +ALTER TABLE book_author_rss ADD CONSTRAINT fk_book_author_rss_book + FOREIGN KEY (book_id) REFERENCES book (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_book_question_book ***************/ +ALTER TABLE book_question ADD CONSTRAINT fk_book_question_book + FOREIGN KEY (book_id) REFERENCES book (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_book_question_question ***************/ +ALTER TABLE book_question ADD CONSTRAINT fk_book_question_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_comment_auth_user ***************/ +ALTER TABLE `comment` ADD CONSTRAINT fk_comment_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_comment_django_content_type ***************/ +ALTER TABLE `comment` ADD CONSTRAINT fk_comment_django_content_type + FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_django_admin_log_auth_user ***************/ +ALTER TABLE django_admin_log ADD CONSTRAINT fk_django_admin_log_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_django_admin_log_django_content_type ***************/ +ALTER TABLE django_admin_log ADD CONSTRAINT fk_django_admin_log_django_content_type + FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_django_authopenid_userassociation_auth_user ***************/ +ALTER TABLE django_authopenid_userassociation ADD CONSTRAINT fk_django_authopenid_userassociation_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_django_authopenid_userpasswordqueue_auth_user ***************/ +ALTER TABLE django_authopenid_userpasswordqueue ADD CONSTRAINT fk_django_authopenid_userpasswordqueue_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_favorite_question_auth_user ***************/ +ALTER TABLE favorite_question ADD CONSTRAINT fk_favorite_question_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_favorite_question_question ***************/ +ALTER TABLE favorite_question ADD CONSTRAINT fk_favorite_question_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_flagged_item_auth_user ***************/ +ALTER TABLE flagged_item ADD CONSTRAINT fk_flagged_item_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_flagged_item_django_content_type ***************/ +ALTER TABLE flagged_item ADD CONSTRAINT fk_flagged_item_django_content_type + FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: closed_by_id_refs_id_56e9d00c ***************/ +ALTER TABLE question ADD CONSTRAINT closed_by_id_refs_id_56e9d00c + FOREIGN KEY (closed_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: deleted_by_id_refs_id_56e9d00c ***************/ +ALTER TABLE question ADD CONSTRAINT deleted_by_id_refs_id_56e9d00c + FOREIGN KEY (deleted_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_question_auth_user ***************/ +ALTER TABLE question ADD CONSTRAINT fk_question_auth_user + FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: last_activity_by_id_refs_id_56e9d00c ***************/ +ALTER TABLE question ADD CONSTRAINT last_activity_by_id_refs_id_56e9d00c + FOREIGN KEY (last_activity_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: last_edited_by_id_refs_id_56e9d00c ***************/ +ALTER TABLE question ADD CONSTRAINT last_edited_by_id_refs_id_56e9d00c + FOREIGN KEY (last_edited_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: locked_by_id_refs_id_56e9d00c ***************/ +ALTER TABLE question ADD CONSTRAINT locked_by_id_refs_id_56e9d00c + FOREIGN KEY (locked_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_question_revision_auth_user ***************/ +ALTER TABLE question_revision ADD CONSTRAINT fk_question_revision_auth_user + FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_question_revision_question ***************/ +ALTER TABLE question_revision ADD CONSTRAINT fk_question_revision_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_question_tags_question ***************/ +ALTER TABLE question_tags ADD CONSTRAINT fk_question_tags_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_question_tags_tag ***************/ +ALTER TABLE question_tags ADD CONSTRAINT fk_question_tags_tag + FOREIGN KEY (tag_id) REFERENCES tag (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_repute_auth_user ***************/ +ALTER TABLE repute ADD CONSTRAINT fk_repute_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_repute_question ***************/ +ALTER TABLE repute ADD CONSTRAINT fk_repute_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_tag_auth_user ***************/ +ALTER TABLE tag ADD CONSTRAINT fk_tag_auth_user + FOREIGN KEY (created_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_user_badge_auth_user ***************/ +ALTER TABLE user_badge ADD CONSTRAINT fk_user_badge_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_user_badge_badge ***************/ +ALTER TABLE user_badge ADD CONSTRAINT fk_user_badge_badge + FOREIGN KEY (badge_id) REFERENCES badge (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_user_favorite_questions_auth_user ***************/ +ALTER TABLE user_favorite_questions ADD CONSTRAINT fk_user_favorite_questions_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_user_favorite_questions_question ***************/ +ALTER TABLE user_favorite_questions ADD CONSTRAINT fk_user_favorite_questions_question + FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_vote_auth_user ***************/ +ALTER TABLE vote ADD CONSTRAINT fk_vote_auth_user + FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; + +/************ Foreign Key: fk_vote_django_content_type ***************/ +ALTER TABLE vote ADD CONSTRAINT fk_vote_django_content_type + FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; \ No newline at end of file diff --git a/forum/sql_scripts/drop-all-tables.sh b/forum/sql_scripts/drop-all-tables.sh new file mode 100644 index 00000000..1e55cb1f --- /dev/null +++ b/forum/sql_scripts/drop-all-tables.sh @@ -0,0 +1,4 @@ +mysql_username='' +mysql_database='' +mysqldump -u $mysql_username -p --add-drop-table --no-data $mysql_database | grep ^DROP +#| mysql -u[USERNAME] -p[PASSWORD] [DATABASE] diff --git a/forum/sql_scripts/drop-auth.sql b/forum/sql_scripts/drop-auth.sql new file mode 100644 index 00000000..bc17dce3 --- /dev/null +++ b/forum/sql_scripts/drop-auth.sql @@ -0,0 +1,8 @@ +drop table auth_group; +drop table auth_group_permissions; +drop table auth_message; +drop table auth_permission; +drop table auth_user; +drop table auth_user_groups; +drop table auth_user_user_permissions; + diff --git a/forum/sql_scripts/pg_fts_install.sql b/forum/sql_scripts/pg_fts_install.sql new file mode 100644 index 00000000..d0655134 --- /dev/null +++ b/forum/sql_scripts/pg_fts_install.sql @@ -0,0 +1,38 @@ +ALTER TABLE question ADD COLUMN tsv tsvector; + +CREATE OR REPLACE FUNCTION public.create_plpgsql_language () + RETURNS TEXT + AS $$ + CREATE LANGUAGE plpgsql; + SELECT 'language plpgsql created'::TEXT; + $$ +LANGUAGE 'sql'; + +SELECT CASE WHEN + (SELECT true::BOOLEAN + FROM pg_language + WHERE lanname='plpgsql') + THEN + (SELECT 'language already installed'::TEXT) + ELSE + (SELECT public.create_plpgsql_language()) + END; + +DROP FUNCTION public.create_plpgsql_language (); + +CREATE OR REPLACE FUNCTION set_question_tsv() RETURNS TRIGGER AS $$ +begin + new.tsv := + setweight(to_tsvector('english', coalesce(new.tagnames,'')), 'A') || + setweight(to_tsvector('english', coalesce(new.title,'')), 'B') || + setweight(to_tsvector('english', coalesce(new.summary,'')), 'C'); + RETURN new; +end +$$ LANGUAGE plpgsql; + +CREATE TRIGGER tsvectorupdate BEFORE INSERT OR UPDATE +ON question FOR EACH ROW EXECUTE PROCEDURE set_question_tsv(); + +CREATE INDEX blog_entry_tsv ON blog_entry USING gin(body_tsv); + +UPDATE question SET title = title; diff --git a/forum/sql_scripts/update_2009_01_13_001.sql b/forum/sql_scripts/update_2009_01_13_001.sql new file mode 100644 index 00000000..165d1125 --- /dev/null +++ b/forum/sql_scripts/update_2009_01_13_001.sql @@ -0,0 +1,62 @@ +-- phpMyAdmin SQL Dump +-- version 3.0.0-beta +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Generation Time: Jan 12, 2009 at 08:55 PM +-- Server version: 5.0.67 +-- PHP Version: 5.2.6 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Database: `twogeekt_lanai` +-- + +-- +-- Dumping data for table `badge` +-- + +INSERT INTO `badge` (`id`, `name`, `type`, `slug`, `description`, `multiple`, `awarded_count`) VALUES +(1, '炼狱法师', 3, '炼狱法师', '删除自己有3个以上赞成票的帖子', 1, 0), +(2, '压力白领', 3, '压力白领', '删除自己有3个以上反对票的帖子', 1, 0), +(3, '优秀回答', 3, '优秀回答', '回答好评10次以上', 1, 0), +(4, '优秀问题', 3, '优秀问题', '问题好评10次以上', 1, 0), +(5, '评论家', 3, '评论家', '评论10次以上', 1, 0), +(6, '流行问题', 3, '流行问题', '问题的浏览量超过1000人次', 1, 0), +(7, '巡逻兵', 3, '巡逻兵', '第一次标记垃圾帖子', 1, 0), +(8, '清洁工', 3, '清洁工', '第一次撤销投票', 1, 0), +(9, '批评家', 3, '批评家', '第一次反对票', 1, 0), +(10, '小编', 3, '小编', '第一次编辑更新', 1, 0), +(11, '村长', 3, '村长', '第一次重新标签', 1, 0), +(12, '学者', 3, '学者', '第一次标记答案', 1, 0), +(13, '学生', 3, '学生', '第一次提问并且有一次以上赞成票', 1, 0), +(14, '支持者', 3, '支持者', '第一次赞成票', 1, 0), +(15, '教师', 3, '教师', '第一次回答问题并且得到一个以上赞成票', 1, 0), +(16, '自传作者', 3, '自传作者', '完整填写用户资料所有选项', 1, 0), +(17, '自学成才', 3, '自学成才', '回答自己的问题并且有3个以上赞成票', 1, 0), +(18, '最有价值回答', 1, '最有价值回答', '回答超过100次赞成票', 1, 0), +(19, '最有价值问题', 1, '最有价值问题', '问题超过100次赞成票', 1, 0), +(20, '万人迷', 1, '万人迷', '问题被100人以上收藏', 1, 0), +(21, '著名问题', 1, '著名问题', '问题的浏览量超过10000人次', 1, 0), +(22, 'alpha用户', 2, 'alpha用户', '内测期间的活跃用户', 1, 0), +(23, '极好回答', 2, '极好回答', '回答超过25次赞成票', 1, 0), +(24, '极好问题', 2, '极好问题', '问题超过25次赞成票', 1, 0), +(25, '受欢迎问题', 2, '受欢迎问题', '问题被25人以上收藏', 1, 0), +(26, '优秀市民', 2, '优秀市民', '投票300次以上', 1, 0), +(27, '编辑主任', 2, '编辑主任', '编辑了100个帖子', 1, 0), +(28, '通才', 2, '通才', '在多个标签领域活跃', 1, 0), +(29, '专家', 2, '专家', '在一个标签领域活跃出众', 1, 0), +(30, '老鸟', 2, '老鸟', '活跃超过一年的用户', 1, 0), +(31, '最受关注问题', 2, '最受关注问题', '问题的浏览量超过2500人次', 1, 0), +(32, '学问家', 2, '学问家', '第一次回答被投赞成票10次以上', 1, 0), +(33, 'beta用户', 2, 'beta用户', 'beta期间活跃参与', 1, 0), +(34, '导师', 2, '导师', '被指定为最佳答案并且赞成票40以上', 1, 0), +(35, '巫师', 2, '巫师', '在提问60天之后回答并且赞成票5次以上', 1, 0), +(36, '分类专家', 2, '分类专家', '创建的标签被50个以上问题使用', 1, 0); diff --git a/forum/sql_scripts/update_2009_01_13_002.sql b/forum/sql_scripts/update_2009_01_13_002.sql new file mode 100644 index 00000000..c223cb8c --- /dev/null +++ b/forum/sql_scripts/update_2009_01_13_002.sql @@ -0,0 +1 @@ +ALTER TABLE activity ADD COLUMN is_auditted tinyint(1) DEFAULT 0 \ No newline at end of file diff --git a/forum/sql_scripts/update_2009_01_18_001.sql b/forum/sql_scripts/update_2009_01_18_001.sql new file mode 100644 index 00000000..6f29fa32 --- /dev/null +++ b/forum/sql_scripts/update_2009_01_18_001.sql @@ -0,0 +1,62 @@ +-- phpMyAdmin SQL Dump +-- version 3.0.0-beta +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Generation Time: Jan 12, 2009 at 08:55 PM +-- Server version: 5.0.67 +-- PHP Version: 5.2.6 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Database: `twogeekt_lanai` +-- + +-- +-- Dumping data for table `badge` +-- + +INSERT INTO `badge` (`id`, `name`, `type`, `slug`, `description`, `multiple`, `awarded_count`) VALUES +(1, '炼狱法师', 3, '炼狱法师', '删除自己有3个以上赞成票的帖子', 1, 0), +(2, '压力白领', 3, '压力白领', '删除自己有3个以上反对票的帖子', 1, 0), +(3, '优秀回答', 3, '优秀回答', '回答好评10次以上', 1, 0), +(4, '优秀问题', 3, '优秀问题', '问题好评10次以上', 1, 0), +(5, '评论家', 3, '评论家', '评论10次以上', 0, 0), +(6, '流行问题', 3, '流行问题', '问题的浏览量超过1000人次', 1, 0), +(7, '巡逻兵', 3, '巡逻兵', '第一次标记垃圾帖子', 0, 0), +(8, '清洁工', 3, '清洁工', '第一次撤销投票', 0, 0), +(9, '批评家', 3, '批评家', '第一次反对票', 0, 0), +(10, '小编', 3, '小编', '第一次编辑更新', 0, 0), +(11, '村长', 3, '村长', '第一次重新标签', 0, 0), +(12, '学者', 3, '学者', '第一次标记答案', 0, 0), +(13, '学生', 3, '学生', '第一次提问并且有一次以上赞成票', 0, 0), +(14, '支持者', 3, '支持者', '第一次赞成票', 0, 0), +(15, '教师', 3, '教师', '第一次回答问题并且得到一个以上赞成票', 0, 0), +(16, '自传作者', 3, '自传作者', '完整填写用户资料所有选项', 0, 0), +(17, '自学成才', 3, '自学成才', '回答自己的问题并且有3个以上赞成票', 1, 0), +(18, '最有价值回答', 1, '最有价值回答', '回答超过100次赞成票', 1, 0), +(19, '最有价值问题', 1, '最有价值问题', '问题超过100次赞成票', 1, 0), +(20, '万人迷', 1, '万人迷', '问题被100人以上收藏', 1, 0), +(21, '著名问题', 1, '著名问题', '问题的浏览量超过10000人次', 1, 0), +(22, 'alpha用户', 2, 'alpha用户', '内测期间的活跃用户', 0, 0), +(23, '极好回答', 2, '极好回答', '回答超过25次赞成票', 1, 0), +(24, '极好问题', 2, '极好问题', '问题超过25次赞成票', 1, 0), +(25, '受欢迎问题', 2, '受欢迎问题', '问题被25人以上收藏', 1, 0), +(26, '优秀市民', 2, '优秀市民', '投票300次以上', 0, 0), +(27, '编辑主任', 2, '编辑主任', '编辑了100个帖子', 0, 0), +(28, '通才', 2, '通才', '在多个标签领域活跃', 0, 0), +(29, '专家', 2, '专家', '在一个标签领域活跃出众', 0, 0), +(30, '老鸟', 2, '老鸟', '活跃超过一年的用户', 0, 0), +(31, '最受关注问题', 2, '最受关注问题', '问题的浏览量超过2500人次', 1, 0), +(32, '学问家', 2, '学问家', '第一次回答被投赞成票10次以上', 0, 0), +(33, 'beta用户', 2, 'beta用户', 'beta期间活跃参与', 0, 0), +(34, '导师', 2, '导师', '被指定为最佳答案并且赞成票40以上', 1, 0), +(35, '巫师', 2, '巫师', '在提问60天之后回答并且赞成票5次以上', 1, 0), +(36, '分类专家', 2, '分类专家', '创建的标签被50个以上问题使用', 1, 0); diff --git a/forum/sql_scripts/update_2009_01_24.sql b/forum/sql_scripts/update_2009_01_24.sql new file mode 100644 index 00000000..45b83935 --- /dev/null +++ b/forum/sql_scripts/update_2009_01_24.sql @@ -0,0 +1,2 @@ +ALTER TABLE award ADD COLUMN `content_type_id` int(11); +ALTER TABLE award ADD COLUMN `object_id` int(10); \ No newline at end of file diff --git a/forum/sql_scripts/update_2009_01_25_001.sql b/forum/sql_scripts/update_2009_01_25_001.sql new file mode 100644 index 00000000..16c3487b --- /dev/null +++ b/forum/sql_scripts/update_2009_01_25_001.sql @@ -0,0 +1,2 @@ +ALTER TABLE `award` ADD `content_type_id` INT NULL +ALTER TABLE `award` ADD `object_id` INT NULL diff --git a/forum/sql_scripts/update_2009_02_26_001.sql b/forum/sql_scripts/update_2009_02_26_001.sql new file mode 100644 index 00000000..a6af5931 --- /dev/null +++ b/forum/sql_scripts/update_2009_02_26_001.sql @@ -0,0 +1,19 @@ +ALTER TABLE answer ADD COLUMN `accepted_at` datetime default null; + +/* Update accepted_at column with answer added datetime for existing data */ +UPDATE answer +SET accepted_at = added_at +WHERE accepted = 1 AND accepted_at IS NULL; + +/* workround for c# url problem on bluehost server */ +UPDATE tag +SET name = 'csharp' +WHERE name = 'c#' + +UPDATE question +SET tagnames = replace(tagnames, 'c#', 'csharp') +WHERE tagnames like '%c#%' + +UPDATE question_revision +SET tagnames = replace(tagnames, 'c#', 'csharp') +WHERE tagnames like '%c#%' diff --git a/forum/sql_scripts/update_2009_04_10_001.sql b/forum/sql_scripts/update_2009_04_10_001.sql new file mode 100644 index 00000000..8148632a --- /dev/null +++ b/forum/sql_scripts/update_2009_04_10_001.sql @@ -0,0 +1,3 @@ +ALTER TABLE Tag ADD COLUMN deleted_at datetime default null; +ALTER TABLE Tag ADD COLUMN deleted_by_id INTEGER NULL; +ALTER TABLE Tag ADD COLUMN deleted TINYINT NOT NULL; diff --git a/forum/sql_scripts/update_2009_07_05_EF.sql b/forum/sql_scripts/update_2009_07_05_EF.sql new file mode 100644 index 00000000..43c7c2f0 --- /dev/null +++ b/forum/sql_scripts/update_2009_07_05_EF.sql @@ -0,0 +1,3 @@ +ALTER TABLE auth_user ADD COLUMN email_isvalid TINYINT(1) NOT NULL; +UPDATE auth_user SET email_isvalid=1; +ALTER TABLE auth_user ADD COLUMN email_key varchar(32); diff --git a/forum/sql_scripts/update_2009_12_24_001.sql b/forum/sql_scripts/update_2009_12_24_001.sql new file mode 100644 index 00000000..3d082c2f --- /dev/null +++ b/forum/sql_scripts/update_2009_12_24_001.sql @@ -0,0 +1,5 @@ +alter table question add column `vote_up_count` int(11) NOT NULL; +alter table question add column `vote_down_count` int(11) NOT NULL; + +alter table answer add column `vote_up_count` int(11) NOT NULL; +alter table answer add column `vote_down_count` int(11) NOT NULL; \ No newline at end of file diff --git a/forum/sql_scripts/update_2009_12_27_001.sql b/forum/sql_scripts/update_2009_12_27_001.sql new file mode 100644 index 00000000..e2da7d4d --- /dev/null +++ b/forum/sql_scripts/update_2009_12_27_001.sql @@ -0,0 +1,3 @@ +ALTER TABLE comment DROP INDEX content_type_id; + +ALTER TABLE comment ADD INDEX `content_type_id` (`content_type_id`,`object_id`,`user_id`); \ No newline at end of file diff --git a/forum/sql_scripts/update_2009_12_27_002.sql b/forum/sql_scripts/update_2009_12_27_002.sql new file mode 100644 index 00000000..a36470bf --- /dev/null +++ b/forum/sql_scripts/update_2009_12_27_002.sql @@ -0,0 +1 @@ +ALTER TABLE `vote` ADD `voted_at` DATETIME NOT NULL \ No newline at end of file diff --git a/forum/sql_scripts/update_2010_01_23.sql b/forum/sql_scripts/update_2010_01_23.sql new file mode 100755 index 00000000..621207be --- /dev/null +++ b/forum/sql_scripts/update_2010_01_23.sql @@ -0,0 +1,9 @@ +CREATE TABLE `fbconnect_fbassociation` ( + `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, + `user_id` integer NOT NULL, + `fbuid` varchar(12) NOT NULL UNIQUE +) +; +ALTER TABLE `fbconnect_fbassociation` ADD CONSTRAINT `user_id_refs_id_3534873d` +FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`); +CREATE INDEX `fbconnect_fbassociation_user_id` ON `fbconnect_fbassociation` (`user_id`); diff --git a/forum/sql_scripts/update_2010_02_22.sql b/forum/sql_scripts/update_2010_02_22.sql new file mode 100644 index 00000000..2778885a --- /dev/null +++ b/forum/sql_scripts/update_2010_02_22.sql @@ -0,0 +1 @@ +alter table answer add column deleted_at datetime; diff --git a/settings.py b/settings.py index b80eb4f2..a26d666b 100644 --- a/settings.py +++ b/settings.py @@ -74,7 +74,7 @@ INSTALLED_APPS = ( 'forum', 'django_authopenid', 'debug_toolbar' , - #'stackexchange', #se loader + #'forum.importers.stackexchange', #se loader 'south', ) diff --git a/sphinx/sphinx.conf b/sphinx/sphinx.conf deleted file mode 100644 index bf4bdc8b..00000000 --- a/sphinx/sphinx.conf +++ /dev/null @@ -1,127 +0,0 @@ -#if you have many posts, it's best to configure another index for new posts and -#periodically merge the diff index to the main -#this is not important until you get to hundreds of thousands posts - -source src_cnprog -{ - # data source - type = mysql - sql_host = localhost - sql_user = cnprog #replace with your db username - sql_pass = secret #replace with your db password - sql_db = cnprog #replace with your db name - # these two are optional - #sql_port = 3306 - #sql_sock = /var/lib/mysql/mysql.sock - - # pre-query, executed before the main fetch query - sql_query_pre = SET NAMES utf8 - - # main document fetch query - change the table names if you are using a prefix - # this query creates a flat document from each question that includes only latest - # revisions of the question and all of it's answers - sql_query = SELECT q.id as id, q.title AS title, q.tagnames as tags, qr.text AS text, answers_combined.text AS answers \ - FROM question AS q \ - INNER JOIN \ - ( \ - SELECT MAX(id) as id, question_id \ - FROM question_revision \ - GROUP BY question_id \ - ) \ - AS mqr \ - ON q.id=mqr.question_id \ - INNER JOIN question_revision AS qr ON qr.id=mqr.id \ - LEFT JOIN \ - ( \ - SELECT GROUP_CONCAT(answer_current.text SEPARATOR '. ') AS text, \ - question_id \ - FROM \ - ( \ - SELECT a.question_id as question_id, ar.text as text \ - FROM answer AS a \ - INNER JOIN \ - ( \ - SELECT MAX(id) as id, answer_id \ - FROM answer_revision \ - GROUP BY answer_id \ - ) \ - AS mar \ - ON mar.answer_id = a.id \ - INNER JOIN answer_revision AS ar ON ar.id=mar.id \ - WHERE a.deleted=0 \ - ) \ - AS answer_current \ - GROUP BY question_id \ - ) \ - AS answers_combined ON q.id=answers_combined.question_id \ - WHERE q.deleted=0; - - # optional - used by command-line search utility to display document information - sql_query_info = SELECT title, id FROM question WHERE id=$id -} - -index cnprog { - # which document source to index - source = src_cnprog - - # this is path and index file name without extension - # you may need to change this path or create this folder - path = /var/data/sphinx/cnprog_main - - # docinfo (ie. per-document attribute values) storage strategy - docinfo = extern - - # morphology - morphology = stem_en - - # stopwords file - #stopwords = /var/data/sphinx/stopwords.txt - - # minimum word length - min_word_len = 1 - - # uncomment next 2 lines to allow wildcard (*) searches - #min_infix_len = 1 - #enable_star = 1 - - # charset encoding type - charset_type = utf-8 -} - -# indexer settings -indexer -{ - # memory limit (default is 32M) - mem_limit = 64M -} - -# searchd settings -searchd -{ - # IP address on which search daemon will bind and accept - # optional, default is to listen on all addresses, - # ie. address = 0.0.0.0 - address = 127.0.0.1 - - # port on which search daemon will listen - port = 3312 - - # searchd run info is logged here - create or change the folder - log = /var/log/sphinx/searchd.log - - # all the search queries are logged here - query_log = /var/log/sphinx/query.log - - # client read timeout, seconds - read_timeout = 5 - - # maximum amount of children to fork - max_children = 30 - - # a file which will contain searchd process ID - pid_file = /var/log/sphinx/searchd.pid - - # maximum amount of matches this daemon would ever retrieve - # from each index and serve to client - max_matches = 1000 -} diff --git a/sql_scripts/091111_upgrade_evgeny.sql b/sql_scripts/091111_upgrade_evgeny.sql deleted file mode 100644 index cb76ec3c..00000000 --- a/sql_scripts/091111_upgrade_evgeny.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `auth_user` add column is_approved tinyint(1) not NULL; diff --git a/sql_scripts/091208_upgrade_evgeny.sql b/sql_scripts/091208_upgrade_evgeny.sql deleted file mode 100644 index d9c4289a..00000000 --- a/sql_scripts/091208_upgrade_evgeny.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `auth_user` add column hide_ignored_questions tinyint(1) not NULL; diff --git a/sql_scripts/091208_upgrade_evgeny_1.sql b/sql_scripts/091208_upgrade_evgeny_1.sql deleted file mode 100644 index b1b4107f..00000000 --- a/sql_scripts/091208_upgrade_evgeny_1.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `auth_user` add column `tag_filter_setting` varchar(16) not NULL default 'ignored'; diff --git a/sql_scripts/100108_upgrade_ef.sql b/sql_scripts/100108_upgrade_ef.sql deleted file mode 100644 index 1c9a5c1c..00000000 --- a/sql_scripts/100108_upgrade_ef.sql +++ /dev/null @@ -1,4 +0,0 @@ -alter table auth_user add column hide_ignored_questions tinyint(1) not NULL; -update auth_user set hide_ignored_questions=0; -alter table auth_user add column tag_filter_setting varchar(16) not NULL; -update auth_user set tag_filter_setting='ignored'; diff --git a/sql_scripts/badges.sql b/sql_scripts/badges.sql deleted file mode 100644 index 5fd03d18..00000000 --- a/sql_scripts/badges.sql +++ /dev/null @@ -1,37 +0,0 @@ -INSERT INTO badge ( id, name, type, slug, description, multiple, awarded_count) VALUES -(1, 'Disciplined', 3, 'disciplined', 'Deleted own post with score of 3 or higher', TRUE, 0), -(2, 'Peer Pressure', 3, 'peer-pressure', 'Deleted own post with score of -3 or lower', TRUE, 0), -(3, 'Nice answer', 3, 'nice-answer', 'Answer voted up 10 times', TRUE, 0), -(4, 'Nice Question', 3, 'nice-question', 'Question voted up 10 times', TRUE, 0), -(5, 'Pundit', 3, 'pundit', 'Left 10 comments with score of 10 or more', FALSE, 0), -(6, 'Popular Question', 3, 'popular-question', 'Asked a question with 1,000 views', TRUE, 0), -(7, 'Citizen patrol', 3, 'citizen-patrol', 'First flagged post', FALSE, 0), -(8, 'Cleanup', 3, 'cleanup', 'First rollback', FALSE, 0), -(9, 'Critic', 3, 'critic', 'First down vote', FALSE, 0), -(10, 'Editor', 3, 'editor', 'First edit', FALSE, 0), -(11, 'Organizer', 3, 'organizer', 'First retag', FALSE, 0), -(12, 'Scholar', 3, 'scholar', 'First accepted answer on your own question', FALSE, 0), -(13, 'Student', 3, 'student', 'Asked first question with at least one up vote', FALSE, 0), -(14, 'Supporter', 3, 'supporter', 'First up vote', FALSE, 0), -(15, 'Teacher', 3, 'teacher', 'Answered first question with at least one up vote', FALSE, 0), -(16, 'Autobiographer', 3, 'autobiographer', 'Completed all user profile fields', FALSE, 0), -(17, 'Self-Learner', 3, 'self-learner', 'Answered your own question with at least 3 up votes', TRUE, 0), -(18, 'Great Answer', 1, 'great-answer', 'Answer voted up 100 times', TRUE, 0), -(19, 'Great Question', 1, 'great-question', 'Question voted up 100 times', TRUE, 0), -(20, 'Stellar Question', 1, 'stellar-question', 'Question favorited by 100 users', TRUE, 0), -(21, 'Famous question', 1, 'famous-question', 'Asked a question with 10,000 views', TRUE, 0), -(22, 'Alpha', 2, 'alpha', 'Actively participated in the private alpha', FALSE, 0), -(23, 'Good Answer', 2, 'good-answer', 'Answer voted up 25 times', TRUE, 0), -(24, 'Good Question', 2, 'good-question', 'Question voted up 25 times', TRUE, 0), -(25, 'Favorite Question', 2, 'favorite-question', 'Question favorited by 25 users', TRUE, 0), -(26, 'Civic duty', 2, 'civic-duty', 'Voted 300 times', FALSE, 0), -(27, 'Strunk & White', 2, 'strunk-and-white', 'Edited 100 entries', FALSE, 0), -(28, 'Generalist', 2, 'generalist', 'Active in many different tags', FALSE, 0), -(29, 'Expert', 2, 'export', 'Very active in one tag', FALSE, 0), -(30, 'Yearling', 2, 'yearling', 'Active member for a year', FALSE, 0), -(31, 'Notable Question', 2, 'notable-question', 'Asked a question with 2,500 views', TRUE, 0), -(32, 'Enlightened', 2, 'enlightened', 'First answer was accepted with at least 10 up votes', FALSE, 0), -(33, 'Beta', 2, 'beta', 'Actively participated in the private beta', FALSE, 0), -(34, 'Guru', 2, 'guru', 'Accepted answer and voted up 40 times', TRUE, 0), -(35, 'Necromancer', 2, 'necromancer', 'Answered a question more than 60 days later with at least 5 votes', TRUE, 0), -(36, 'Taxonomist', 2, 'taxonomist', 'Created a tag used by 50 questions', TRUE, 0); diff --git a/sql_scripts/cnprog.xml b/sql_scripts/cnprog.xml deleted file mode 100644 index 95f9b362..00000000 --- a/sql_scripts/cnprog.xml +++ /dev/null @@ -1,1498 +0,0 @@ - - - - - -/Users/sailing/Development/cnprog_beta2/sql_scripts - - -ENGINE=MyISAM AUTO_INCREMENT=103 DEFAULT CHARSET=latin1 - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - -content_type_id - - -user_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -author_id - - -deleted_by_id - - -last_edited_by_id - - -locked_by_id - - -question_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - -answer_id - - -author_id - - - - -ENGINE=InnoDB DEFAULT CHARSET=utf8 - - -
- - -
- - -name - - - - -ENGINE=InnoDB DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - - - - - - - - - - - -group_id, permission_id - - -permission_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - - - - - - -user_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - - - - - - -content_type_id - - -content_type_id, codename - - - - -ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -username - - - - -ENGINE=InnoDB DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - - - - - - - - - - - -group_id - - -user_id, group_id - - - - -ENGINE=InnoDB DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - - - - - - - - - - - -permission_id - - -user_id, permission_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - - - - - - -badge_id - - -user_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -slug - - -name, type - - - - - - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - -short_name - - -user_id - - - - - - - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - - - - - - -user_id - - -book_id - - - - - - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - - - - - - -user_id - - -book_id - - - - - - - -
- - -
- - -
- - - - - - - - - - - - -book_id - - -question_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - - - - - - -content_type_id - - -user_id - - -content_type_id, object_id, user_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - - - - - - -content_type_id - - -user_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - - - -ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - - - -ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - - - - - - -user_id - - - - -ENGINE=InnoDB DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - - - - - - -user_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - -app_label, model - - - - -ENGINE=InnoDB DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - - - -ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - - - -ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - - - - - - - - - - - -question_id - - -user_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - -
- - - - - - - - - - - - -content_type_id, object_id, user_id - - -content_type_id - - -user_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -author_id - - -closed_by_id - - -deleted_by_id - - -last_activity_by_id - - -last_edited_by_id - - -locked_by_id - - - - -ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - - - - - - -author_id - - -question_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - - - - - - - - - - - -question_id, tag_id - - -tag_id - - - - -ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - - - - - - -question_id - - -user_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - - - - - - -name - - -created_by_id - - - - -ENGINE=InnoDB DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - - - - - - - - - - - -user_id - - -badge_id - - - - -ENGINE=InnoDB DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - - - - - - - - - - - -user_id - - -question_id - - - - -ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 - - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - - - - - - -content_type_id, object_id, user_id - - -content_type_id - - -user_id - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -db.doc.option.mgr - - - - - - - - - - - - - diff --git a/sql_scripts/cnprog_new_install.sql b/sql_scripts/cnprog_new_install.sql deleted file mode 100644 index ac33a6ba..00000000 --- a/sql_scripts/cnprog_new_install.sql +++ /dev/null @@ -1,811 +0,0 @@ --- MySQL Administrator dump 1.4 --- --- ------------------------------------------------------ --- Server version 5.0.67 - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; - - --- --- Create schema cnprog --- - -CREATE DATABASE IF NOT EXISTS cnprog; -USE cnprog; - --- --- Definition of table `cnprog`.`answer` --- - -DROP TABLE IF EXISTS `cnprog`.`answer`; -CREATE TABLE `cnprog`.`answer` ( - `id` int(11) NOT NULL auto_increment, - `question_id` int(11) NOT NULL, - `author_id` int(11) NOT NULL, - `added_at` datetime NOT NULL, - `wiki` tinyint(1) NOT NULL, - `wikified_at` datetime default NULL, - `accepted` tinyint(1) NOT NULL, - `deleted` tinyint(1) NOT NULL, - `deleted_by_id` int(11) default NULL, - `locked` tinyint(1) NOT NULL, - `locked_by_id` int(11) default NULL, - `locked_at` datetime default NULL, - `score` int(11) NOT NULL, - `vote_up_count` int(11) NOT NULL, - `vote_down_count` int(11) NOT NULL, - `comment_count` int(10) unsigned NOT NULL, - `offensive_flag_count` smallint(6) NOT NULL, - `last_edited_at` datetime default NULL, - `last_edited_by_id` int(11) default NULL, - `html` longtext NOT NULL, - PRIMARY KEY (`id`), - KEY `answer_question_id` (`question_id`), - KEY `answer_author_id` (`author_id`), - KEY `answer_deleted_by_id` (`deleted_by_id`), - KEY `answer_locked_by_id` (`locked_by_id`), - KEY `answer_last_edited_by_id` (`last_edited_by_id`), - CONSTRAINT `author_id_refs_id_192b0170` FOREIGN KEY (`author_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `deleted_by_id_refs_id_192b0170` FOREIGN KEY (`deleted_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `last_edited_by_id_refs_id_192b0170` FOREIGN KEY (`last_edited_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `locked_by_id_refs_id_192b0170` FOREIGN KEY (`locked_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `question_id_refs_id_7d6550c9` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; - --- --- Definition of table `cnprog`.`auth_group` --- - -DROP TABLE IF EXISTS `cnprog`.`auth_group`; -CREATE TABLE `cnprog`.`auth_group` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(80) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`auth_group` --- - --- --- Definition of table `cnprog`.`auth_group_permissions` --- - -DROP TABLE IF EXISTS `cnprog`.`auth_group_permissions`; -CREATE TABLE `cnprog`.`auth_group_permissions` ( - `id` int(11) NOT NULL auto_increment, - `group_id` int(11) NOT NULL, - `permission_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `group_id` (`group_id`,`permission_id`), - KEY `permission_id_refs_id_5886d21f` (`permission_id`), - CONSTRAINT `group_id_refs_id_3cea63fe` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), - CONSTRAINT `permission_id_refs_id_5886d21f` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`auth_group_permissions` --- - --- --- Definition of table `cnprog`.`auth_message` --- - -DROP TABLE IF EXISTS `cnprog`.`auth_message`; -CREATE TABLE `cnprog`.`auth_message` ( - `id` int(11) NOT NULL auto_increment, - `user_id` int(11) NOT NULL, - `message` longtext NOT NULL, - PRIMARY KEY (`id`), - KEY `auth_message_user_id` (`user_id`), - CONSTRAINT `user_id_refs_id_650f49a6` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`auth_message` --- - --- --- Definition of table `cnprog`.`auth_permission` --- - -DROP TABLE IF EXISTS `cnprog`.`auth_permission`; -CREATE TABLE `cnprog`.`auth_permission` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(50) NOT NULL, - `content_type_id` int(11) NOT NULL, - `codename` varchar(100) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `content_type_id` (`content_type_id`,`codename`), - KEY `auth_permission_content_type_id` (`content_type_id`), - CONSTRAINT `content_type_id_refs_id_728de91f` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`auth_permission` --- -INSERT INTO `cnprog`.`auth_permission` VALUES (1,'Can add permission',1,'add_permission'), - (2,'Can change permission',1,'change_permission'), - (3,'Can delete permission',1,'delete_permission'), - (4,'Can add group',2,'add_group'), - (5,'Can change group',2,'change_group'), - (6,'Can delete group',2,'delete_group'), - (7,'Can add user',3,'add_user'), - (8,'Can change user',3,'change_user'), - (9,'Can delete user',3,'delete_user'), - (10,'Can add message',4,'add_message'), - (11,'Can change message',4,'change_message'), - (12,'Can delete message',4,'delete_message'), - (13,'Can add content type',5,'add_contenttype'), - (14,'Can change content type',5,'change_contenttype'), - (15,'Can delete content type',5,'delete_contenttype'), - (16,'Can add session',6,'add_session'), - (17,'Can change session',6,'change_session'), - (18,'Can delete session',6,'delete_session'), - (19,'Can add site',7,'add_site'), - (20,'Can change site',7,'change_site'), - (21,'Can delete site',7,'delete_site'), - (25,'Can add answer',9,'add_answer'), - (26,'Can change answer',9,'change_answer'), - (27,'Can delete answer',9,'delete_answer'), - (28,'Can add comment',10,'add_comment'), - (29,'Can change comment',10,'change_comment'), - (30,'Can delete comment',10,'delete_comment'), - (31,'Can add tag',11,'add_tag'), - (32,'Can change tag',11,'change_tag'), - (33,'Can delete tag',11,'delete_tag'), - (37,'Can add nonce',13,'add_nonce'), - (38,'Can change nonce',13,'change_nonce'), - (39,'Can delete nonce',13,'delete_nonce'), - (40,'Can add association',14,'add_association'), - (41,'Can change association',14,'change_association'), - (42,'Can delete association',14,'delete_association'), - (43,'Can add nonce',15,'add_nonce'), - (44,'Can change nonce',15,'change_nonce'), - (45,'Can delete nonce',15,'delete_nonce'), - (46,'Can add association',16,'add_association'), - (47,'Can change association',16,'change_association'), - (48,'Can delete association',16,'delete_association'), - (49,'Can add user association',17,'add_userassociation'), - (50,'Can change user association',17,'change_userassociation'), - (51,'Can delete user association',17,'delete_userassociation'), - (52,'Can add user password queue',18,'add_userpasswordqueue'), - (53,'Can change user password queue',18,'change_userpasswordqueue'), - (54,'Can delete user password queue',18,'delete_userpasswordqueue'), - (55,'Can add log entry',19,'add_logentry'), - (56,'Can change log entry',19,'change_logentry'), - (57,'Can delete log entry',19,'delete_logentry'), - (58,'Can add question',20,'add_question'), - (59,'Can change question',20,'change_question'), - (60,'Can delete question',20,'delete_question'), - (61,'Can add vote',21,'add_vote'), - (62,'Can change vote',21,'change_vote'), - (63,'Can delete vote',21,'delete_vote'), - (64,'Can add flagged item',22,'add_flaggeditem'), - (65,'Can change flagged item',22,'change_flaggeditem'), - (66,'Can delete flagged item',22,'delete_flaggeditem'), - (67,'Can add favorite question',23,'add_favoritequestion'), - (68,'Can change favorite question',23,'change_favoritequestion'), - (69,'Can delete favorite question',23,'delete_favoritequestion'), - (70,'Can add badge',24,'add_badge'), - (71,'Can change badge',24,'change_badge'), - (72,'Can delete badge',24,'delete_badge'), - (73,'Can add award',25,'add_award'), - (74,'Can change award',25,'change_award'), - (75,'Can delete award',25,'delete_award'); - --- --- Definition of table `cnprog`.`auth_user` --- - -DROP TABLE IF EXISTS `cnprog`.`auth_user`; -CREATE TABLE `cnprog`.`auth_user` ( - `id` int(11) NOT NULL auto_increment, - `username` varchar(30) NOT NULL, - `first_name` varchar(30) NOT NULL, - `last_name` varchar(30) NOT NULL, - `email` varchar(75) NOT NULL, - `password` varchar(128) NOT NULL, - `is_staff` tinyint(1) NOT NULL, - `is_active` tinyint(1) NOT NULL, - `is_superuser` tinyint(1) NOT NULL, - `last_login` datetime NOT NULL, - `date_joined` datetime NOT NULL, - `gold` smallint(6) NOT NULL default '0', - `silver` smallint(5) unsigned NOT NULL default '0', - `bronze` smallint(5) unsigned NOT NULL default '0', - `reputation` int(10) unsigned default '1', - `gravatar` varchar(128) default NULL, - `questions_per_page` smallint(5) unsigned default '10', - `last_seen` datetime default NULL, - `real_name` varchar(100) default NULL, - `website` varchar(200) default NULL, - `location` varchar(100) default NULL, - `date_of_birth` datetime default NULL, - `about` text, - PRIMARY KEY (`id`), - UNIQUE KEY `username` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`auth_user` --- -INSERT INTO `cnprog`.`auth_user` VALUES (2,'chagel','','','chagel@gmail.com','sha1$6a2fb$0d2ffe90bcba542fc962f57967a88e507799cc74',1,1,1,'2008-12-16 15:35:17','2008-12-11 20:12:53',0,0,0,1,'8c1efc4f4618aa68b18c88f2bcaa5564',10,NULL,NULL,NULL,NULL,NULL,NULL), - (3,'mike','','','ichagel@yahoo.com','sha1$f7ef5$1015ae6b2c8a2774a028419d3c57e13145b83284',0,1,0,'2008-12-15 12:56:23','2008-12-15 12:56:23',0,0,0,1,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL), - (4,'sailingcai','','','sailingcai@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-23 06:14:45','2008-12-20 15:19:21',1,2,3,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','',NULL,''), - (5,'sailingcai1','','','1@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21',NULL,NULL,NULL,NULL,NULL), - (6,'sailing2','','','2@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (7,'sailing3','','','3@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (8,'sailing4','','','4@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (9,'sailing5','','','5@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (10,'sailing6','','','6@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (11,'sailing7','','','7@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (12,'sailing8','','','8@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (13,'sailing9','','','9@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (14,'sailing10','','','10@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (15,'sailing11','','','11@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (16,'sailing12','','','12@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (17,'sailing13','','','13@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (18,'sailing14','','','14@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (19,'sailing15','','','15@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (20,'sailing16','','','16@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (21,'sailing17','','','17@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (22,'sailing18','','','18@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (23,'sailing19','','','19@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (24,'sailing20','','','20@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (25,'sailing21','','','21@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (26,'sailing22','','','22@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (27,'sailing23','','','23@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (28,'sailing24','','','24@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (29,'sailing25','','','25@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (30,'sailing26','','','26@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (31,'sailing27','','','27@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (32,'sailing28','','','28@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (33,'sailing29','','','29@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (34,'sailing30','','','30@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (35,'sailing31','','','31@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (36,'sailing32','','','32@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (37,'sailing33','','','33@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (38,'sailing34','','','34@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (39,'sailing35','','','35@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (40,'sailing36','','','36@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (41,'sailing37','','','37@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (42,'sailing38','','','38@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (43,'sailing39','','','39@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (44,'sailing40','','','40@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (45,'sailing41','','','41@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (46,'sailing42','','','42@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (47,'sailing43','','','43@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (48,'sailing44','','','44@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (49,'sailing45','','','45@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (50,'sailing46','','','46@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (51,'sailing47','','','47@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (52,'sailing48','','','48@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (53,'sailing49','','','49@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (54,'sailing50','','','50@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (55,'sailing51','','','51@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (56,'sailing52','','','52@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (57,'sailing53','','','53@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (58,'sailing54','','','54@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (59,'sailing55','','','55@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (60,'sailing56','','','56@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (61,'sailing57','','','57@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (62,'sailing58','','','58@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (63,'sailing59','','','59@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (64,'sailing60','','','60@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (65,'sailing61','','','61@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (66,'sailing62','','','62@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (67,'sailing63','','','63@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (68,'sailing64','','','64@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (69,'sailing65','','','65@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (70,'sailing66','','','66@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (71,'sailing67','','','67@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (72,'sailing68','','','68@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (73,'sailing69','','','69@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (74,'sailing70','','','70@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (75,'sailing71','','','71@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (76,'sailing72','','','72@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (77,'sailing73','','','73@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (78,'sailing74','','','74@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (79,'sailing75','','','75@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (80,'sailing76','','','76@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (81,'sailing77','','','77@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (82,'sailing78','','','78@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (83,'sailing79','','','79@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (84,'sailing80','','','80@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (85,'sailing81','','','81@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (86,'sailing82','','','82@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (87,'sailing83','','','83@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (88,'sailing84','','','84@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (89,'sailing85','','','85@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (90,'sailing86','','','86@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (91,'sailing87','','','87@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (92,'sailing88','','','88@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (93,'sailing89','','','89@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (94,'sailing90','','','90@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (95,'sailing91','','','91@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (96,'sailing92','','','92@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (97,'sailing93','','','93@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (98,'sailing94','','','94@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (99,'sailing95','','','95@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (100,'sailing96','','','96@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (101,'sailing97','','','97@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (102,'sailing98','','','98@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''), - (103,'sailing99','','','99@gmail.com','sha1$a417c$ca7d9f2ad55666bf98068cc392b6f62450b216e0',0,1,0,'2008-12-20 15:19:21','2008-12-20 15:19:21',0,0,0,1,'a1cb9864605a32760518b90a4f9a0e73',10,'2008-12-20 15:19:21','','','','0000-00-00 00:00:00',''); - --- --- Definition of table `cnprog`.`auth_user_groups` --- - -DROP TABLE IF EXISTS `cnprog`.`auth_user_groups`; -CREATE TABLE `cnprog`.`auth_user_groups` ( - `id` int(11) NOT NULL auto_increment, - `user_id` int(11) NOT NULL, - `group_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `user_id` (`user_id`,`group_id`), - KEY `group_id_refs_id_f116770` (`group_id`), - CONSTRAINT `group_id_refs_id_f116770` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), - CONSTRAINT `user_id_refs_id_7ceef80f` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`auth_user_groups` --- - --- --- Definition of table `cnprog`.`auth_user_user_permissions` --- - -DROP TABLE IF EXISTS `cnprog`.`auth_user_user_permissions`; -CREATE TABLE `cnprog`.`auth_user_user_permissions` ( - `id` int(11) NOT NULL auto_increment, - `user_id` int(11) NOT NULL, - `permission_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `user_id` (`user_id`,`permission_id`), - KEY `permission_id_refs_id_67e79cb` (`permission_id`), - CONSTRAINT `permission_id_refs_id_67e79cb` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), - CONSTRAINT `user_id_refs_id_dfbab7d` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`auth_user_user_permissions` --- - --- --- Definition of table `cnprog`.`award` --- - -DROP TABLE IF EXISTS `cnprog`.`award`; -CREATE TABLE `cnprog`.`award` ( - `id` int(11) NOT NULL auto_increment, - `user_id` int(11) NOT NULL, - `badge_id` int(11) NOT NULL, - `awarded_at` datetime NOT NULL, - `notified` tinyint(1) NOT NULL, - PRIMARY KEY (`id`), - KEY `award_user_id` (`user_id`), - KEY `award_badge_id` (`badge_id`), - CONSTRAINT `badge_id_refs_id_651af0e1` FOREIGN KEY (`badge_id`) REFERENCES `badge` (`id`), - CONSTRAINT `user_id_refs_id_2d83e9b6` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`award` --- - --- --- Definition of table `cnprog`.`badge` --- - -DROP TABLE IF EXISTS `cnprog`.`badge`; -CREATE TABLE `cnprog`.`badge` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(50) NOT NULL, - `type` smallint(6) NOT NULL, - `slug` varchar(50) NOT NULL, - `description` varchar(300) NOT NULL, - `multiple` tinyint(1) NOT NULL, - `awarded_count` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`,`type`), - KEY `badge_slug` (`slug`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`badge` --- - --- --- Definition of table `cnprog`.`comment` --- - -DROP TABLE IF EXISTS `cnprog`.`comment`; -CREATE TABLE `cnprog`.`comment` ( - `id` int(11) NOT NULL auto_increment, - `content_type_id` int(11) NOT NULL, - `object_id` int(10) unsigned NOT NULL, - `user_id` int(11) NOT NULL, - `comment` varchar(300) NOT NULL, - `added_at` datetime NOT NULL, - PRIMARY KEY (`id`), - KEY `content_type_id` (`content_type_id`,`object_id`,`user_id`), - KEY `comment_content_type_id` (`content_type_id`), - KEY `comment_user_id` (`user_id`), - CONSTRAINT `content_type_id_refs_id_13a5866c` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), - CONSTRAINT `user_id_refs_id_6be725e8` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`comment` --- - --- --- Definition of table `cnprog`.`django_admin_log` --- - -DROP TABLE IF EXISTS `cnprog`.`django_admin_log`; -CREATE TABLE `cnprog`.`django_admin_log` ( - `id` int(11) NOT NULL auto_increment, - `action_time` datetime NOT NULL, - `user_id` int(11) NOT NULL, - `content_type_id` int(11) default NULL, - `object_id` longtext, - `object_repr` varchar(200) NOT NULL, - `action_flag` smallint(5) unsigned NOT NULL, - `change_message` longtext NOT NULL, - PRIMARY KEY (`id`), - KEY `django_admin_log_user_id` (`user_id`), - KEY `django_admin_log_content_type_id` (`content_type_id`), - CONSTRAINT `content_type_id_refs_id_288599e6` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), - CONSTRAINT `user_id_refs_id_c8665aa` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`django_admin_log` --- -INSERT INTO `cnprog`.`django_admin_log` VALUES (1,'2008-12-18 23:41:41',2,7,'1','cnprog.com',2,'已修改 domain 和 name 。'); - --- --- Definition of table `cnprog`.`django_authopenid_association` --- - -DROP TABLE IF EXISTS `cnprog`.`django_authopenid_association`; -CREATE TABLE `cnprog`.`django_authopenid_association` ( - `id` int(11) NOT NULL auto_increment, - `server_url` longtext NOT NULL, - `handle` varchar(255) NOT NULL, - `secret` longtext NOT NULL, - `issued` int(11) NOT NULL, - `lifetime` int(11) NOT NULL, - `assoc_type` longtext NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`django_authopenid_association` --- -INSERT INTO `cnprog`.`django_authopenid_association` VALUES (2,'https://www.google.com/accounts/o8/ud','AOQobUfcCH4sgjsBGGscrzxIa5UM4clofAB6nixx8Qq_NWco4ynn_Kc4','u5cva43abzdwF8CJOFZfkzfk7x8=\n',1229022261,1229022261,'HMAC-SHA1'), - (3,'https://api.screenname.aol.com/auth/openidServer','diAyLjAgayAwIGJhT2VvYkdDZ21RSHJ4QldzQnhTdjIxV3BVbz0%3D-j5HRXRB1VbPyg48jGKE1Q70dfv76lGHEPwd9071%2FJ7f6SSw5YhakrwWpsVXtr34T6iHwPDdo6RU%3D','EmQL3+5oR6mFKIaeBNy6hXyUJ/w=\n',1229282202,1229282202,'HMAC-SHA1'), - (4,'https://open.login.yahooapis.com/openid/op/auth','JcBeY.uWXu2YjzbuCQiqFzAb0MIc7ATeKiPO4eAp3vluPMqZp_NCxepvMLGrJjxxDKTaNnr06wepMos8ap6SQYZiTi51tZ05lMWnpZAiOA1hsq_WMlEL7G9YE66GEA9A','QXiuN6B7E8nP5QhyHI3IB26t4SA=\n',1229282256,1229282256,'HMAC-SHA1'), - (5,'http://openid.claimid.com/server','{HMAC-SHA1}{494575fd}{uLEbxQ==}','GvPbkgMHh0QVPH7mStCGuWb2AKY=\n',1229288957,1229288957,'HMAC-SHA1'), - (6,'http://www.blogger.com/openid-server.g','oida-1229424484019-158830626','8gaU4aKnIFCLKIkHdxZQp7ZGNck=\n',1229424478,1229424478,'HMAC-SHA1'); - --- --- Definition of table `cnprog`.`django_authopenid_nonce` --- - -DROP TABLE IF EXISTS `cnprog`.`django_authopenid_nonce`; -CREATE TABLE `cnprog`.`django_authopenid_nonce` ( - `id` int(11) NOT NULL auto_increment, - `server_url` varchar(255) NOT NULL, - `timestamp` int(11) NOT NULL, - `salt` varchar(40) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; - --- --- Definition of table `cnprog`.`django_authopenid_userassociation` --- - -DROP TABLE IF EXISTS `cnprog`.`django_authopenid_userassociation`; -CREATE TABLE `cnprog`.`django_authopenid_userassociation` ( - `id` int(11) NOT NULL auto_increment, - `openid_url` varchar(255) NOT NULL, - `user_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `user_id` (`user_id`), - CONSTRAINT `user_id_refs_id_163d208d` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`django_authopenid_userassociation` --- -INSERT INTO `cnprog`.`django_authopenid_userassociation` VALUES (2,'https://www.google.com/accounts/o8/id?id=AItOawl7CVVHl4DWtteqj4dd_A23zKRwPZgOOjw',2), - (3,'https://me.yahoo.com/a/f8f2zXF91okYL4iN2Zh4P542a5s-#f4af2',3), - (4,'https://me.yahoo.com/sailingcai#6fa4e',4); - --- --- Definition of table `cnprog`.`django_authopenid_userpasswordqueue` --- - -DROP TABLE IF EXISTS `cnprog`.`django_authopenid_userpasswordqueue`; -CREATE TABLE `cnprog`.`django_authopenid_userpasswordqueue` ( - `id` int(11) NOT NULL auto_increment, - `user_id` int(11) NOT NULL, - `new_password` varchar(30) NOT NULL, - `confirm_key` varchar(40) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `user_id` (`user_id`), - CONSTRAINT `user_id_refs_id_76bcaaa4` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`django_authopenid_userpasswordqueue` --- - --- --- Definition of table `cnprog`.`django_content_type` --- - -DROP TABLE IF EXISTS `cnprog`.`django_content_type`; -CREATE TABLE `cnprog`.`django_content_type` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(100) NOT NULL, - `app_label` varchar(100) NOT NULL, - `model` varchar(100) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `app_label` (`app_label`,`model`) -) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`django_content_type` --- -INSERT INTO `cnprog`.`django_content_type` VALUES (1,'permission','auth','permission'), - (2,'group','auth','group'), - (3,'user','auth','user'), - (4,'message','auth','message'), - (5,'content type','contenttypes','contenttype'), - (6,'session','sessions','session'), - (7,'site','sites','site'), - (9,'answer','forum','answer'), - (10,'comment','forum','comment'), - (11,'tag','forum','tag'), - (13,'nonce','django_openidconsumer','nonce'), - (14,'association','django_openidconsumer','association'), - (15,'nonce','django_authopenid','nonce'), - (16,'association','django_authopenid','association'), - (17,'user association','django_authopenid','userassociation'), - (18,'user password queue','django_authopenid','userpasswordqueue'), - (19,'log entry','admin','logentry'), - (20,'question','forum','question'), - (21,'vote','forum','vote'), - (22,'flagged item','forum','flaggeditem'), - (23,'favorite question','forum','favoritequestion'), - (24,'badge','forum','badge'), - (25,'award','forum','award'); - --- --- Definition of table `cnprog`.`django_session` --- - -DROP TABLE IF EXISTS `cnprog`.`django_session`; -CREATE TABLE `cnprog`.`django_session` ( - `session_key` varchar(40) NOT NULL, - `session_data` longtext NOT NULL, - `expire_date` datetime NOT NULL, - PRIMARY KEY (`session_key`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Definition of table `cnprog`.`django_site` --- - -DROP TABLE IF EXISTS `cnprog`.`django_site`; -CREATE TABLE `cnprog`.`django_site` ( - `id` int(11) NOT NULL auto_increment, - `domain` varchar(100) NOT NULL, - `name` varchar(50) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`django_site` --- -INSERT INTO `cnprog`.`django_site` VALUES (1,'cnprog.com','CNProg.com'); - --- --- Definition of table `cnprog`.`favorite_question` --- - -DROP TABLE IF EXISTS `cnprog`.`favorite_question`; -CREATE TABLE `cnprog`.`favorite_question` ( - `id` int(11) NOT NULL auto_increment, - `question_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - `added_at` datetime NOT NULL, - PRIMARY KEY (`id`), - KEY `favorite_question_question_id` (`question_id`), - KEY `favorite_question_user_id` (`user_id`), - CONSTRAINT `question_id_refs_id_1ebe1cc3` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`), - CONSTRAINT `user_id_refs_id_52853822` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`favorite_question` --- - --- --- Definition of table `cnprog`.`flagged_item` --- - -DROP TABLE IF EXISTS `cnprog`.`flagged_item`; -CREATE TABLE `cnprog`.`flagged_item` ( - `id` int(11) NOT NULL auto_increment, - `content_type_id` int(11) NOT NULL, - `object_id` int(10) unsigned NOT NULL, - `user_id` int(11) NOT NULL, - `flagged_at` datetime NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `content_type_id` (`content_type_id`,`object_id`,`user_id`), - KEY `flagged_item_content_type_id` (`content_type_id`), - KEY `flagged_item_user_id` (`user_id`), - CONSTRAINT `content_type_id_refs_id_76e44d74` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), - CONSTRAINT `user_id_refs_id_35e3c608` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`flagged_item` --- - --- --- Definition of table `cnprog`.`question` --- - -DROP TABLE IF EXISTS `cnprog`.`question`; -CREATE TABLE `cnprog`.`question` ( - `id` int(11) NOT NULL auto_increment, - `title` varchar(300) NOT NULL, - `author_id` int(11) NOT NULL, - `added_at` datetime NOT NULL, - `wiki` tinyint(1) NOT NULL, - `wikified_at` datetime default NULL, - `answer_accepted` tinyint(1) NOT NULL, - `closed` tinyint(1) NOT NULL, - `closed_by_id` int(11) default NULL, - `closed_at` datetime default NULL, - `close_reason` smallint(6) default NULL, - `deleted` tinyint(1) NOT NULL, - `deleted_at` datetime default NULL, - `deleted_by_id` int(11) default NULL, - `locked` tinyint(1) NOT NULL, - `locked_by_id` int(11) default NULL, - `locked_at` datetime default NULL, - `vote_up_count` int(11) NOT NULL, - `vote_down_count` int(11) NOT NULL, - `score` int(11) NOT NULL, - `answer_count` int(10) unsigned NOT NULL, - `comment_count` int(10) unsigned NOT NULL, - `view_count` int(10) unsigned NOT NULL, - `offensive_flag_count` smallint(6) NOT NULL, - `favourite_count` int(10) unsigned NOT NULL, - `last_edited_at` datetime default NULL, - `last_edited_by_id` int(11) default NULL, - `last_activity_at` datetime NOT NULL, - `last_activity_by_id` int(11) NOT NULL, - `tagnames` varchar(125) NOT NULL, - `summary` varchar(180) NOT NULL, - `html` longtext NOT NULL, - PRIMARY KEY (`id`), - KEY `question_author_id` (`author_id`), - KEY `question_closed_by_id` (`closed_by_id`), - KEY `question_deleted_by_id` (`deleted_by_id`), - KEY `question_locked_by_id` (`locked_by_id`), - KEY `question_last_edited_by_id` (`last_edited_by_id`), - KEY `question_last_activity_by_id` (`last_activity_by_id`), - CONSTRAINT `author_id_refs_id_56e9d00c` FOREIGN KEY (`author_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `closed_by_id_refs_id_56e9d00c` FOREIGN KEY (`closed_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `deleted_by_id_refs_id_56e9d00c` FOREIGN KEY (`deleted_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `last_activity_by_id_refs_id_56e9d00c` FOREIGN KEY (`last_activity_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `last_edited_by_id_refs_id_56e9d00c` FOREIGN KEY (`last_edited_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `locked_by_id_refs_id_56e9d00c` FOREIGN KEY (`locked_by_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; - --- --- Definition of table `cnprog`.`question_tags` --- - -DROP TABLE IF EXISTS `cnprog`.`question_tags`; -CREATE TABLE `cnprog`.`question_tags` ( - `id` int(11) NOT NULL auto_increment, - `question_id` int(11) NOT NULL, - `tag_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `question_id` (`question_id`,`tag_id`), - KEY `tag_id_refs_id_43fcb953` (`tag_id`), - CONSTRAINT `question_id_refs_id_266147c6` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`), - CONSTRAINT `tag_id_refs_id_43fcb953` FOREIGN KEY (`tag_id`) REFERENCES `tag` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; - --- --- Definition of table `cnprog`.`tag` --- - -DROP TABLE IF EXISTS `cnprog`.`tag`; -CREATE TABLE `cnprog`.`tag` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(255) NOT NULL, - `created_by_id` int(11) NOT NULL, - `used_count` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`), - KEY `tag_created_by_id` (`created_by_id`), - CONSTRAINT `created_by_id_refs_id_47205d6d` FOREIGN KEY (`created_by_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8; - --- --- Definition of table `cnprog`.`user_badge` --- - -DROP TABLE IF EXISTS `cnprog`.`user_badge`; -CREATE TABLE `cnprog`.`user_badge` ( - `id` int(10) unsigned NOT NULL auto_increment, - `user_id` int(10) unsigned NOT NULL, - `badge_id` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Definition of table `cnprog`.`user_favorite_questions` --- - -DROP TABLE IF EXISTS `cnprog`.`user_favorite_questions`; -CREATE TABLE `cnprog`.`user_favorite_questions` ( - `id` int(10) unsigned NOT NULL auto_increment, - `user_id` int(10) unsigned NOT NULL, - `question_id` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`user_favorite_questions` --- - -DROP TABLE IF EXISTS `cnprog`.`vote`; -CREATE TABLE `cnprog`.`vote` ( - `id` int(11) NOT NULL auto_increment, - `content_type_id` int(11) NOT NULL, - `object_id` int(10) unsigned NOT NULL, - `user_id` int(11) NOT NULL, - `vote` smallint(6) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `content_type_id` (`content_type_id`,`object_id`,`user_id`), - KEY `vote_content_type_id` (`content_type_id`), - KEY `vote_user_id` (`user_id`), - CONSTRAINT `content_type_id_refs_id_50124414` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), - CONSTRAINT `user_id_refs_id_760a4df0` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `cnprog`.`vote` --- - - - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/sql_scripts/cnprog_new_install_2009_02_28.sql b/sql_scripts/cnprog_new_install_2009_02_28.sql deleted file mode 100644 index 80b9fced..00000000 --- a/sql_scripts/cnprog_new_install_2009_02_28.sql +++ /dev/null @@ -1,456 +0,0 @@ -SET FOREIGN_KEY_CHECKS = 0; - -CREATE TABLE `activity` ( - `id` int(11) NOT NULL auto_increment, - `user_id` int(11) NOT NULL, - `activity_type` smallint(6) NOT NULL, - `active_at` datetime NOT NULL, - `content_type_id` int(11) NOT NULL, - `object_id` int(10) unsigned NOT NULL, - `is_auditted` tinyint(1) default '0', - PRIMARY KEY (`id`), - KEY `activity_user_id` (`user_id`), - KEY `activity_content_type_id` (`content_type_id`) -) ENGINE=MyISAM AUTO_INCREMENT=103 DEFAULT CHARSET=utf8; - - -CREATE TABLE `answer` ( - `id` int(11) NOT NULL auto_increment, - `question_id` int(11) NOT NULL, - `author_id` int(11) NOT NULL, - `added_at` datetime NOT NULL, - `wiki` tinyint(1) NOT NULL, - `wikified_at` datetime default NULL, - `accepted` tinyint(1) NOT NULL, - `deleted` tinyint(1) NOT NULL, - `deleted_by_id` int(11) default NULL, - `locked` tinyint(1) NOT NULL, - `locked_by_id` int(11) default NULL, - `locked_at` datetime default NULL, - `score` int(11) NOT NULL, - `comment_count` int(10) unsigned NOT NULL, - `offensive_flag_count` smallint(6) NOT NULL, - `last_edited_at` datetime default NULL, - `last_edited_by_id` int(11) default NULL, - `html` longtext NOT NULL, - `vote_up_count` int(11) NOT NULL, - `vote_down_count` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `answer_question_id` (`question_id`), - KEY `answer_author_id` (`author_id`), - KEY `answer_deleted_by_id` (`deleted_by_id`), - KEY `answer_locked_by_id` (`locked_by_id`), - KEY `answer_last_edited_by_id` (`last_edited_by_id`), - CONSTRAINT `author_id_refs_id_192b0170` FOREIGN KEY (`author_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `deleted_by_id_refs_id_192b0170` FOREIGN KEY (`deleted_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `last_edited_by_id_refs_id_192b0170` FOREIGN KEY (`last_edited_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `locked_by_id_refs_id_192b0170` FOREIGN KEY (`locked_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `question_id_refs_id_7d6550c9` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; - - -CREATE TABLE `answer_revision` ( - `id` int(11) NOT NULL auto_increment, - `answer_id` int(11) NOT NULL, - `revision` int(10) unsigned NOT NULL, - `author_id` int(11) NOT NULL, - `revised_at` datetime NOT NULL, - `summary` varchar(300) collate utf8_unicode_ci NOT NULL, - `text` longtext collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - KEY `answer_revision_answer_id` (`answer_id`), - KEY `answer_revision_author_id` (`author_id`) -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8; - - -CREATE TABLE `auth_group` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(80) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `auth_group_permissions` ( - `id` int(11) NOT NULL auto_increment, - `group_id` int(11) NOT NULL, - `permission_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `group_id` (`group_id`,`permission_id`), - KEY `permission_id_refs_id_5886d21f` (`permission_id`), - CONSTRAINT `group_id_refs_id_3cea63fe` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), - CONSTRAINT `permission_id_refs_id_5886d21f` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `auth_message` ( - `id` int(11) NOT NULL auto_increment, - `user_id` int(11) NOT NULL, - `message` longtext NOT NULL, - PRIMARY KEY (`id`), - KEY `auth_message_user_id` (`user_id`), - CONSTRAINT `user_id_refs_id_650f49a6` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8; - - -CREATE TABLE `auth_permission` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(50) NOT NULL, - `content_type_id` int(11) NOT NULL, - `codename` varchar(100) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `content_type_id` (`content_type_id`,`codename`), - KEY `auth_permission_content_type_id` (`content_type_id`), - CONSTRAINT `content_type_id_refs_id_728de91f` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8; - - -CREATE TABLE `auth_user` ( - `id` int(11) NOT NULL auto_increment, - `username` varchar(30) NOT NULL, - `first_name` varchar(30) NOT NULL, - `last_name` varchar(30) NOT NULL, - `email` varchar(75) NOT NULL, - `password` varchar(128) NOT NULL, - `is_staff` tinyint(1) NOT NULL, - `is_active` tinyint(1) NOT NULL, - `is_superuser` tinyint(1) NOT NULL, - `last_login` datetime NOT NULL, - `date_joined` datetime NOT NULL, - `gold` smallint(6) NOT NULL default '0', - `silver` smallint(5) unsigned NOT NULL default '0', - `bronze` smallint(5) unsigned NOT NULL default '0', - `reputation` int(10) unsigned default '1', - `gravatar` varchar(128) default NULL, - `questions_per_page` smallint(5) unsigned default '10', - `last_seen` datetime default NULL, - `real_name` varchar(100) default NULL, - `website` varchar(200) default NULL, - `location` varchar(100) default NULL, - `date_of_birth` datetime default NULL, - `about` text, - PRIMARY KEY (`id`), - UNIQUE KEY `username` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8; - - -CREATE TABLE `auth_user_groups` ( - `id` int(11) NOT NULL auto_increment, - `user_id` int(11) NOT NULL, - `group_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `user_id` (`user_id`,`group_id`), - KEY `group_id_refs_id_f116770` (`group_id`), - CONSTRAINT `group_id_refs_id_f116770` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), - CONSTRAINT `user_id_refs_id_7ceef80f` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `auth_user_user_permissions` ( - `id` int(11) NOT NULL auto_increment, - `user_id` int(11) NOT NULL, - `permission_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `user_id` (`user_id`,`permission_id`), - KEY `permission_id_refs_id_67e79cb` (`permission_id`), - CONSTRAINT `permission_id_refs_id_67e79cb` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), - CONSTRAINT `user_id_refs_id_dfbab7d` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `award` ( - `id` int(11) NOT NULL auto_increment, - `user_id` int(11) NOT NULL, - `badge_id` int(11) NOT NULL, - `awarded_at` datetime NOT NULL, - `notified` tinyint(1) NOT NULL, - `content_type_id` int(11) default NULL, - `object_id` int(10) default NULL, - PRIMARY KEY (`id`), - KEY `award_user_id` (`user_id`), - KEY `award_badge_id` (`badge_id`), - CONSTRAINT `badge_id_refs_id_651af0e1` FOREIGN KEY (`badge_id`) REFERENCES `badge` (`id`), - CONSTRAINT `user_id_refs_id_2d83e9b6` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; - - -CREATE TABLE `badge` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(50) NOT NULL, - `type` smallint(6) NOT NULL, - `slug` varchar(50) NOT NULL, - `description` varchar(300) NOT NULL, - `multiple` tinyint(1) NOT NULL, - `awarded_count` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`,`type`), - KEY `badge_slug` (`slug`) -) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; - - -CREATE TABLE `comment` ( - `id` int(11) NOT NULL auto_increment, - `content_type_id` int(11) NOT NULL, - `object_id` int(10) unsigned NOT NULL, - `user_id` int(11) NOT NULL, - `comment` varchar(300) NOT NULL, - `added_at` datetime NOT NULL, - PRIMARY KEY (`id`), - KEY `comment_content_type_id` (`content_type_id`), - KEY `comment_user_id` (`user_id`), - KEY `content_type_id` (`content_type_id`,`object_id`,`user_id`), - CONSTRAINT `content_type_id_refs_id_13a5866c` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), - CONSTRAINT `user_id_refs_id_6be725e8` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8; - - -CREATE TABLE `django_admin_log` ( - `id` int(11) NOT NULL auto_increment, - `action_time` datetime NOT NULL, - `user_id` int(11) NOT NULL, - `content_type_id` int(11) default NULL, - `object_id` longtext, - `object_repr` varchar(200) NOT NULL, - `action_flag` smallint(5) unsigned NOT NULL, - `change_message` longtext NOT NULL, - PRIMARY KEY (`id`), - KEY `django_admin_log_user_id` (`user_id`), - KEY `django_admin_log_content_type_id` (`content_type_id`), - CONSTRAINT `content_type_id_refs_id_288599e6` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), - CONSTRAINT `user_id_refs_id_c8665aa` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; - - -CREATE TABLE `django_authopenid_association` ( - `id` int(11) NOT NULL auto_increment, - `server_url` longtext NOT NULL, - `handle` varchar(255) NOT NULL, - `secret` longtext NOT NULL, - `issued` int(11) NOT NULL, - `lifetime` int(11) NOT NULL, - `assoc_type` longtext NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; - - -CREATE TABLE `django_authopenid_nonce` ( - `id` int(11) NOT NULL auto_increment, - `server_url` varchar(255) NOT NULL, - `timestamp` int(11) NOT NULL, - `salt` varchar(40) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8; - - -CREATE TABLE `django_authopenid_userassociation` ( - `id` int(11) NOT NULL auto_increment, - `openid_url` varchar(255) NOT NULL, - `user_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `user_id` (`user_id`), - CONSTRAINT `user_id_refs_id_163d208d` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; - - -CREATE TABLE `django_authopenid_userpasswordqueue` ( - `id` int(11) NOT NULL auto_increment, - `user_id` int(11) NOT NULL, - `new_password` varchar(30) NOT NULL, - `confirm_key` varchar(40) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `user_id` (`user_id`), - CONSTRAINT `user_id_refs_id_76bcaaa4` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `django_content_type` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(100) NOT NULL, - `app_label` varchar(100) NOT NULL, - `model` varchar(100) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `app_label` (`app_label`,`model`) -) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; - - -CREATE TABLE `django_session` ( - `session_key` varchar(40) NOT NULL, - `session_data` longtext NOT NULL, - `expire_date` datetime NOT NULL, - PRIMARY KEY (`session_key`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `django_site` ( - `id` int(11) NOT NULL auto_increment, - `domain` varchar(100) NOT NULL, - `name` varchar(50) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; - - -CREATE TABLE `favorite_question` ( - `id` int(11) NOT NULL auto_increment, - `question_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - `added_at` datetime NOT NULL, - PRIMARY KEY (`id`), - KEY `favorite_question_question_id` (`question_id`), - KEY `favorite_question_user_id` (`user_id`), - CONSTRAINT `question_id_refs_id_1ebe1cc3` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`), - CONSTRAINT `user_id_refs_id_52853822` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; - - -CREATE TABLE `flagged_item` ( - `id` int(11) NOT NULL auto_increment, - `content_type_id` int(11) NOT NULL, - `object_id` int(10) unsigned NOT NULL, - `user_id` int(11) NOT NULL, - `flagged_at` datetime NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `content_type_id` (`content_type_id`,`object_id`,`user_id`), - KEY `flagged_item_content_type_id` (`content_type_id`), - KEY `flagged_item_user_id` (`user_id`), - CONSTRAINT `content_type_id_refs_id_76e44d74` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), - CONSTRAINT `user_id_refs_id_35e3c608` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; - - -CREATE TABLE `question` ( - `id` int(11) NOT NULL auto_increment, - `title` varchar(300) NOT NULL, - `author_id` int(11) NOT NULL, - `added_at` datetime NOT NULL, - `wiki` tinyint(1) NOT NULL, - `wikified_at` datetime default NULL, - `answer_accepted` tinyint(1) NOT NULL, - `closed` tinyint(1) NOT NULL, - `closed_by_id` int(11) default NULL, - `closed_at` datetime default NULL, - `close_reason` smallint(6) default NULL, - `deleted` tinyint(1) NOT NULL, - `deleted_at` datetime default NULL, - `deleted_by_id` int(11) default NULL, - `locked` tinyint(1) NOT NULL, - `locked_by_id` int(11) default NULL, - `locked_at` datetime default NULL, - `score` int(11) NOT NULL, - `answer_count` int(10) unsigned NOT NULL, - `comment_count` int(10) unsigned NOT NULL, - `view_count` int(10) unsigned NOT NULL, - `offensive_flag_count` smallint(6) NOT NULL, - `favourite_count` int(10) unsigned NOT NULL, - `last_edited_at` datetime default NULL, - `last_edited_by_id` int(11) default NULL, - `last_activity_at` datetime NOT NULL, - `last_activity_by_id` int(11) NOT NULL, - `tagnames` varchar(125) NOT NULL, - `summary` varchar(180) NOT NULL, - `html` longtext NOT NULL, - `vote_up_count` int(11) NOT NULL, - `vote_down_count` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `question_author_id` (`author_id`), - KEY `question_closed_by_id` (`closed_by_id`), - KEY `question_deleted_by_id` (`deleted_by_id`), - KEY `question_locked_by_id` (`locked_by_id`), - KEY `question_last_edited_by_id` (`last_edited_by_id`), - KEY `question_last_activity_by_id` (`last_activity_by_id`), - CONSTRAINT `author_id_refs_id_56e9d00c` FOREIGN KEY (`author_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `closed_by_id_refs_id_56e9d00c` FOREIGN KEY (`closed_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `deleted_by_id_refs_id_56e9d00c` FOREIGN KEY (`deleted_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `last_activity_by_id_refs_id_56e9d00c` FOREIGN KEY (`last_activity_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `last_edited_by_id_refs_id_56e9d00c` FOREIGN KEY (`last_edited_by_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `locked_by_id_refs_id_56e9d00c` FOREIGN KEY (`locked_by_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; - - -CREATE TABLE `question_revision` ( - `id` int(11) NOT NULL auto_increment, - `question_id` int(11) NOT NULL, - `revision` int(10) unsigned NOT NULL, - `title` varchar(300) NOT NULL, - `author_id` int(11) NOT NULL, - `revised_at` datetime NOT NULL, - `tagnames` varchar(125) NOT NULL, - `summary` varchar(300) NOT NULL, - `text` longtext NOT NULL, - PRIMARY KEY (`id`), - KEY `question_revision_question_id` (`question_id`), - KEY `question_revision_author_id` (`author_id`) -) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; - - -CREATE TABLE `question_tags` ( - `id` int(11) NOT NULL auto_increment, - `question_id` int(11) NOT NULL, - `tag_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `question_id` (`question_id`,`tag_id`), - KEY `tag_id_refs_id_43fcb953` (`tag_id`), - CONSTRAINT `question_id_refs_id_266147c6` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`), - CONSTRAINT `tag_id_refs_id_43fcb953` FOREIGN KEY (`tag_id`) REFERENCES `tag` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; - - -CREATE TABLE `repute` ( - `id` int(11) NOT NULL auto_increment, - `user_id` int(11) NOT NULL, - `positive` smallint(6) NOT NULL, - `negative` smallint(6) NOT NULL, - `question_id` int(11) NOT NULL, - `reputed_at` datetime NOT NULL, - `reputation_type` smallint(6) NOT NULL, - `reputation` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `repute_user_id` (`user_id`), - KEY `repute_question_id` (`question_id`) -) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; - - -CREATE TABLE `tag` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(255) NOT NULL, - `created_by_id` int(11) NOT NULL, - `used_count` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`), - KEY `tag_created_by_id` (`created_by_id`), - CONSTRAINT `created_by_id_refs_id_47205d6d` FOREIGN KEY (`created_by_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; - - -CREATE TABLE `user_badge` ( - `id` int(10) unsigned NOT NULL auto_increment, - `user_id` int(10) unsigned NOT NULL, - `badge_id` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `user_favorite_questions` ( - `id` int(10) unsigned NOT NULL auto_increment, - `user_id` int(10) unsigned NOT NULL, - `question_id` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `vote` ( - `id` int(11) NOT NULL auto_increment, - `content_type_id` int(11) NOT NULL, - `object_id` int(10) unsigned NOT NULL, - `user_id` int(11) NOT NULL, - `vote` smallint(6) NOT NULL, - `voted_at` datetime NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `content_type_id` (`content_type_id`,`object_id`,`user_id`), - KEY `vote_content_type_id` (`content_type_id`), - KEY `vote_user_id` (`user_id`), - CONSTRAINT `content_type_id_refs_id_50124414` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), - CONSTRAINT `user_id_refs_id_760a4df0` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; - - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/sql_scripts/cnprog_new_install_2009_03_31.sql b/sql_scripts/cnprog_new_install_2009_03_31.sql deleted file mode 100644 index c2c69f36..00000000 --- a/sql_scripts/cnprog_new_install_2009_03_31.sql +++ /dev/null @@ -1,891 +0,0 @@ -USE cnprog; - - -/************ Update: Tables ***************/ - -/******************** Add Table: activity ************************/ - -/* Build Table Structure */ -CREATE TABLE activity -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - activity_type SMALLINT NOT NULL, - active_at DATETIME NOT NULL, - content_type_id INTEGER NOT NULL, - object_id INTEGER UNSIGNED NOT NULL, - is_auditted TINYINT NULL DEFAULT 0 -) ENGINE=MyISAM AUTO_INCREMENT=103 DEFAULT CHARSET=latin1; - -/* Table Items: activity */ - -/* Add Indexes for: activity */ -CREATE INDEX activity_content_type_id ON activity (content_type_id); -CREATE INDEX activity_user_id ON activity (user_id); - -/******************** Add Table: answer ************************/ - -/* Build Table Structure */ -CREATE TABLE answer -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - question_id INTEGER NOT NULL, - author_id INTEGER NOT NULL, - added_at DATETIME NOT NULL, - wiki TINYINT NOT NULL, - wikified_at DATETIME NULL, - accepted TINYINT NOT NULL, - deleted TINYINT NOT NULL, - deleted_by_id INTEGER NULL, - locked TINYINT NOT NULL, - locked_by_id INTEGER NULL, - locked_at DATETIME NULL, - score INTEGER NOT NULL, - comment_count INTEGER UNSIGNED NOT NULL, - offensive_flag_count SMALLINT NOT NULL, - last_edited_at DATETIME NULL, - last_edited_by_id INTEGER NULL, - html LONGTEXT NOT NULL, - vote_up_count INTEGER NOT NULL, - vote_down_count INTEGER NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; - -/* Table Items: answer */ - -/* Add Indexes for: answer */ -CREATE INDEX answer_author_id ON answer (author_id); -CREATE INDEX answer_deleted_by_id ON answer (deleted_by_id); -CREATE INDEX answer_last_edited_by_id ON answer (last_edited_by_id); -CREATE INDEX answer_locked_by_id ON answer (locked_by_id); -CREATE INDEX answer_question_id ON answer (question_id); - -/******************** Add Table: answer_revision ************************/ - -/* Build Table Structure */ -CREATE TABLE answer_revision -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - answer_id INTEGER NOT NULL, - revision INTEGER UNSIGNED NOT NULL, - author_id INTEGER NOT NULL, - revised_at DATETIME NOT NULL, - summary TEXT NOT NULL, - `text` LONGTEXT NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -/* Table Items: answer_revision */ - -/* Add Indexes for: answer_revision */ -CREATE INDEX answer_revision_answer_id ON answer_revision (answer_id); -CREATE INDEX answer_revision_author_id ON answer_revision (author_id); - -/******************** Add Table: auth_group ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_group -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(80) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: auth_group */ - -/* Add Indexes for: auth_group */ -CREATE UNIQUE INDEX name ON auth_group (name); - -/******************** Add Table: auth_group_permissions ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_group_permissions -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - group_id INTEGER NOT NULL, - permission_id INTEGER NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: auth_group_permissions */ - -/* Add Indexes for: auth_group_permissions */ -CREATE UNIQUE INDEX group_id ON auth_group_permissions (group_id, permission_id); -CREATE INDEX permission_id_refs_id_5886d21f ON auth_group_permissions (permission_id); - -/******************** Add Table: auth_message ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_message -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - message LONGTEXT NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8; - -/* Table Items: auth_message */ - -/* Add Indexes for: auth_message */ -CREATE INDEX auth_message_user_id ON auth_message (user_id); - -/******************** Add Table: auth_permission ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_permission -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(50) NOT NULL, - content_type_id INTEGER NOT NULL, - codename VARCHAR(100) NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8; - -/* Table Items: auth_permission */ - -/* Add Indexes for: auth_permission */ -CREATE INDEX auth_permission_content_type_id ON auth_permission (content_type_id); -CREATE UNIQUE INDEX content_type_id ON auth_permission (content_type_id, codename); - -/******************** Add Table: auth_user ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_user -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - username VARCHAR(30) NOT NULL, - first_name VARCHAR(30) NOT NULL, - last_name VARCHAR(30) NOT NULL, - email VARCHAR(75) NOT NULL, - password VARCHAR(128) NOT NULL, - is_staff TINYINT NOT NULL, - is_active TINYINT NOT NULL, - is_superuser TINYINT NOT NULL, - last_login DATETIME NOT NULL, - date_joined DATETIME NOT NULL, - gold SMALLINT NOT NULL DEFAULT 0, - silver SMALLINT UNSIGNED NOT NULL DEFAULT 0, - bronze SMALLINT UNSIGNED NOT NULL DEFAULT 0, - reputation INTEGER UNSIGNED NULL DEFAULT 1, - gravatar VARCHAR(128) NULL, - questions_per_page SMALLINT UNSIGNED NULL DEFAULT 10, - last_seen DATETIME NULL, - real_name VARCHAR(100) NULL, - website VARCHAR(200) NULL, - location VARCHAR(100) NULL, - date_of_birth DATETIME NULL, - about TEXT NULL -) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8; - -/* Table Items: auth_user */ - -/* Add Indexes for: auth_user */ -CREATE UNIQUE INDEX username ON auth_user (username); - -/******************** Add Table: auth_user_groups ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_user_groups -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - group_id INTEGER NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: auth_user_groups */ - -/* Add Indexes for: auth_user_groups */ -CREATE INDEX group_id_refs_id_f116770 ON auth_user_groups (group_id); -CREATE UNIQUE INDEX user_id ON auth_user_groups (user_id, group_id); - -/******************** Add Table: auth_user_user_permissions ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_user_user_permissions -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - permission_id INTEGER NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: auth_user_user_permissions */ - -/* Add Indexes for: auth_user_user_permissions */ -CREATE INDEX permission_id_refs_id_67e79cb ON auth_user_user_permissions (permission_id); -CREATE UNIQUE INDEX user_id ON auth_user_user_permissions (user_id, permission_id); - -/******************** Add Table: award ************************/ - -/* Build Table Structure */ -CREATE TABLE award -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - badge_id INTEGER NOT NULL, - awarded_at DATETIME NOT NULL, - notified TINYINT NOT NULL, - content_type_id INTEGER NULL, - object_id INTEGER NULL -) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; - -/* Table Items: award */ - -/* Add Indexes for: award */ -CREATE INDEX award_badge_id ON award (badge_id); -CREATE INDEX award_user_id ON award (user_id); - -/******************** Add Table: badge ************************/ - -/* Build Table Structure */ -CREATE TABLE badge -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(50) NOT NULL, - `type` SMALLINT NOT NULL, - slug VARCHAR(50) NOT NULL, - description TEXT NOT NULL, - multiple TINYINT NOT NULL, - awarded_count INTEGER UNSIGNED NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; - -/* Table Items: badge */ - -/* Add Indexes for: badge */ -CREATE INDEX badge_slug ON badge (slug); -CREATE UNIQUE INDEX name ON badge (name, `type`); - -/******************** Add Table: book ************************/ - -/* Build Table Structure */ -CREATE TABLE book -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - title VARCHAR(255) NOT NULL, - short_name VARCHAR(255) NOT NULL, - author VARCHAR(255) NOT NULL, - user_id INTEGER NULL, - price DECIMAL(10, 2) NULL, - pages SMALLINT NULL, - published_at DATE NOT NULL, - publication VARCHAR(255) NOT NULL, - cover_img VARCHAR(255) NULL, - tagnames VARCHAR(125) NULL, - added_at DATETIME NOT NULL, - last_edited_at DATETIME NOT NULL -) TYPE=InnoDB; - -/* Table Items: book */ - -/* Add Indexes for: book */ -CREATE UNIQUE INDEX book_short_name_Idx ON book (short_name); -CREATE INDEX fk_books_auth_user ON book (user_id); - -/******************** Add Table: book_author_info ************************/ - -/* Build Table Structure */ -CREATE TABLE book_author_info -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - blog_url VARCHAR(255) NULL, - user_id INTEGER NOT NULL, - added_at DATETIME NOT NULL, - last_edited_at DATETIME NOT NULL -) TYPE=InnoDB; - -/* Table Items: book_author_info */ - -/* Add Indexes for: book_author_info */ -CREATE INDEX fk_book_author_info_auth_user ON book_author_info (user_id); - -/******************** Add Table: book_author_rss ************************/ - -/* Build Table Structure */ -CREATE TABLE book_author_rss -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - title VARCHAR(255) NOT NULL, - url VARCHAR(255) NOT NULL, - rss_created_at DATETIME NOT NULL, - user_id INTEGER NOT NULL, - added_at DATETIME NOT NULL -) TYPE=InnoDB; - -/* Table Items: book_author_rss */ - -/* Add Indexes for: book_author_rss */ -CREATE INDEX fk_book_author_rss_auth_user ON book_author_rss (user_id); - -/******************** Add Table: book_question ************************/ - -/* Build Table Structure */ -CREATE TABLE book_question -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - book_id INTEGER NOT NULL, - question_id INTEGER NOT NULL -) TYPE=InnoDB; - -/* Table Items: book_question */ - -/* Add Indexes for: book_question */ -CREATE INDEX fk_book_question_book ON book_question (book_id); -CREATE INDEX fk_book_question_question ON book_question (question_id); - -/******************** Add Table: `comment` ************************/ - -/* Build Table Structure */ -CREATE TABLE `comment` -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - content_type_id INTEGER NOT NULL, - object_id INTEGER UNSIGNED NOT NULL, - user_id INTEGER NOT NULL, - `comment` TEXT NOT NULL, - added_at DATETIME NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8; - -/* Table Items: `comment` */ - -/* Add Indexes for: comment */ -CREATE INDEX comment_content_type_id ON `comment` (content_type_id); -CREATE INDEX comment_user_id ON `comment` (user_id); -CREATE INDEX content_type_id ON `comment` (content_type_id, object_id, user_id); - -/******************** Add Table: django_admin_log ************************/ - -/* Build Table Structure */ -CREATE TABLE django_admin_log -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - action_time DATETIME NOT NULL, - user_id INTEGER NOT NULL, - content_type_id INTEGER NULL, - object_id LONGTEXT NULL, - object_repr VARCHAR(200) NOT NULL, - action_flag SMALLINT UNSIGNED NOT NULL, - change_message LONGTEXT NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; - -/* Table Items: django_admin_log */ - -/* Add Indexes for: django_admin_log */ -CREATE INDEX django_admin_log_content_type_id ON django_admin_log (content_type_id); -CREATE INDEX django_admin_log_user_id ON django_admin_log (user_id); - -/******************** Add Table: django_authopenid_association ************************/ - -/* Build Table Structure */ -CREATE TABLE django_authopenid_association -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - server_url LONGTEXT NOT NULL, - handle VARCHAR(255) NOT NULL, - secret LONGTEXT NOT NULL, - issued INTEGER NOT NULL, - lifetime INTEGER NOT NULL, - assoc_type LONGTEXT NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; - -/******************** Add Table: django_authopenid_nonce ************************/ - -/* Build Table Structure */ -CREATE TABLE django_authopenid_nonce -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - server_url VARCHAR(255) NOT NULL, - `timestamp` INTEGER NOT NULL, - salt VARCHAR(40) NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8; - -/******************** Add Table: django_authopenid_userassociation ************************/ - -/* Build Table Structure */ -CREATE TABLE django_authopenid_userassociation -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - openid_url VARCHAR(255) NOT NULL, - user_id INTEGER NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; - -/* Table Items: django_authopenid_userassociation */ - -/* Add Indexes for: django_authopenid_userassociation */ -CREATE UNIQUE INDEX user_id ON django_authopenid_userassociation (user_id); - -/******************** Add Table: django_authopenid_userpasswordqueue ************************/ - -/* Build Table Structure */ -CREATE TABLE django_authopenid_userpasswordqueue -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - new_password VARCHAR(30) NOT NULL, - confirm_key VARCHAR(40) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: django_authopenid_userpasswordqueue */ - -/* Add Indexes for: django_authopenid_userpasswordqueue */ -CREATE UNIQUE INDEX user_id ON django_authopenid_userpasswordqueue (user_id); - -/******************** Add Table: django_content_type ************************/ - -/* Build Table Structure */ -CREATE TABLE django_content_type -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(100) NOT NULL, - app_label VARCHAR(100) NOT NULL, - model VARCHAR(100) NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; - -/* Table Items: django_content_type */ - -/* Add Indexes for: django_content_type */ -CREATE UNIQUE INDEX app_label ON django_content_type (app_label, model); - -/******************** Add Table: django_session ************************/ - -/* Build Table Structure */ -CREATE TABLE django_session -( - session_key VARCHAR(40) NOT NULL, - session_data LONGTEXT NOT NULL, - expire_date DATETIME NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: django_session */ -ALTER TABLE django_session ADD CONSTRAINT pkdjango_session - PRIMARY KEY (session_key); - -/******************** Add Table: django_site ************************/ - -/* Build Table Structure */ -CREATE TABLE django_site -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - domain VARCHAR(100) NOT NULL, - name VARCHAR(50) NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; - -/******************** Add Table: favorite_question ************************/ - -/* Build Table Structure */ -CREATE TABLE favorite_question -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - question_id INTEGER NOT NULL, - user_id INTEGER NOT NULL, - added_at DATETIME NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; - -/* Table Items: favorite_question */ - -/* Add Indexes for: favorite_question */ -CREATE INDEX favorite_question_question_id ON favorite_question (question_id); -CREATE INDEX favorite_question_user_id ON favorite_question (user_id); - -/******************** Add Table: flagged_item ************************/ - -/* Build Table Structure */ -CREATE TABLE flagged_item -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - content_type_id INTEGER NOT NULL, - object_id INTEGER UNSIGNED NOT NULL, - user_id INTEGER NOT NULL, - flagged_at DATETIME NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; - -/* Table Items: flagged_item */ - -/* Add Indexes for: flagged_item */ -CREATE UNIQUE INDEX content_type_id ON flagged_item (content_type_id, object_id, user_id); -CREATE INDEX flagged_item_content_type_id ON flagged_item (content_type_id); -CREATE INDEX flagged_item_user_id ON flagged_item (user_id); - -/******************** Add Table: question ************************/ - -/* Build Table Structure */ -CREATE TABLE question -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - title TEXT NOT NULL, - author_id INTEGER NOT NULL, - added_at DATETIME NOT NULL, - wiki TINYINT NOT NULL, - wikified_at DATETIME NULL, - answer_accepted TINYINT NOT NULL, - closed TINYINT NOT NULL, - closed_by_id INTEGER NULL, - closed_at DATETIME NULL, - close_reason SMALLINT NULL, - deleted TINYINT NOT NULL, - deleted_at DATETIME NULL, - deleted_by_id INTEGER NULL, - locked TINYINT NOT NULL, - locked_by_id INTEGER NULL, - locked_at DATETIME NULL, - score INTEGER NOT NULL, - answer_count INTEGER UNSIGNED NOT NULL, - comment_count INTEGER UNSIGNED NOT NULL, - view_count INTEGER UNSIGNED NOT NULL, - offensive_flag_count SMALLINT NOT NULL, - favourite_count INTEGER UNSIGNED NOT NULL, - last_edited_at DATETIME NULL, - last_edited_by_id INTEGER NULL, - last_activity_at DATETIME NOT NULL, - last_activity_by_id INTEGER NOT NULL, - tagnames VARCHAR(125) NOT NULL, - summary VARCHAR(180) NOT NULL, - html LONGTEXT NOT NULL, - vote_up_count INTEGER NOT NULL, - vote_down_count INTEGER NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; - -/* Table Items: question */ - -/* Add Indexes for: question */ -CREATE INDEX question_author_id ON question (author_id); -CREATE INDEX question_closed_by_id ON question (closed_by_id); -CREATE INDEX question_deleted_by_id ON question (deleted_by_id); -CREATE INDEX question_last_activity_by_id ON question (last_activity_by_id); -CREATE INDEX question_last_edited_by_id ON question (last_edited_by_id); -CREATE INDEX question_locked_by_id ON question (locked_by_id); - -/******************** Add Table: question_revision ************************/ - -/* Build Table Structure */ -CREATE TABLE question_revision -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - question_id INTEGER NOT NULL, - revision INTEGER UNSIGNED NOT NULL, - title TEXT NOT NULL, - author_id INTEGER NOT NULL, - revised_at DATETIME NOT NULL, - tagnames VARCHAR(125) NOT NULL, - summary TEXT NOT NULL, - `text` LONGTEXT NOT NULL -) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; - -/* Table Items: question_revision */ - -/* Add Indexes for: question_revision */ -CREATE INDEX question_revision_author_id ON question_revision (author_id); -CREATE INDEX question_revision_question_id ON question_revision (question_id); - -/******************** Add Table: question_tags ************************/ - -/* Build Table Structure */ -CREATE TABLE question_tags -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - question_id INTEGER NOT NULL, - tag_id INTEGER NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; - -/* Table Items: question_tags */ - -/* Add Indexes for: question_tags */ -CREATE UNIQUE INDEX question_id ON question_tags (question_id, tag_id); -CREATE INDEX tag_id_refs_id_43fcb953 ON question_tags (tag_id); - -/******************** Add Table: repute ************************/ - -/* Build Table Structure */ -CREATE TABLE repute -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - positive SMALLINT NOT NULL, - negative SMALLINT NOT NULL, - question_id INTEGER NOT NULL, - reputed_at DATETIME NOT NULL, - reputation_type SMALLINT NOT NULL, - reputation INTEGER NOT NULL -) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1; - -/* Table Items: repute */ - -/* Add Indexes for: repute */ -CREATE INDEX repute_question_id ON repute (question_id); -CREATE INDEX repute_user_id ON repute (user_id); - -/******************** Add Table: tag ************************/ - -/* Build Table Structure */ -CREATE TABLE tag -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(255) NOT NULL, - created_by_id INTEGER NOT NULL, - used_count INTEGER UNSIGNED NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; - -/* Table Items: tag */ - -/* Add Indexes for: tag */ -CREATE UNIQUE INDEX name ON tag (name); -CREATE INDEX tag_created_by_id ON tag (created_by_id); - -/******************** Add Table: user_badge ************************/ - -/* Build Table Structure */ -CREATE TABLE user_badge -( - id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - badge_id INTEGER NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: user_badge */ - -/* Add Indexes for: user_badge */ -CREATE INDEX fk_user_badge_auth_user ON user_badge (user_id); -CREATE INDEX fk_user_badge_badge ON user_badge (badge_id); - -/******************** Add Table: user_favorite_questions ************************/ - -/* Build Table Structure */ -CREATE TABLE user_favorite_questions -( - id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - question_id INTEGER NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: user_favorite_questions */ - -/* Add Indexes for: user_favorite_questions */ -CREATE INDEX fk_user_favorite_questions_auth_user ON user_favorite_questions (user_id); -CREATE INDEX fk_user_favorite_questions_question ON user_favorite_questions (question_id); - -/******************** Add Table: vote ************************/ - -/* Build Table Structure */ -CREATE TABLE vote -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - content_type_id INTEGER NOT NULL, - object_id INTEGER UNSIGNED NOT NULL, - user_id INTEGER NOT NULL, - vote SMALLINT NOT NULL, - voted_at DATETIME NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; - -/* Table Items: vote */ - -/* Add Indexes for: vote */ -CREATE UNIQUE INDEX content_type_id ON vote (content_type_id, object_id, user_id); -CREATE INDEX vote_content_type_id ON vote (content_type_id); -CREATE INDEX vote_user_id ON vote (user_id); - - -/************ Add Foreign Keys to Database ***************/ -/*----------------------------------------------------------- -Warning: Versions of MySQL prior to 4.1.2 require indexes on all columns involved in a foreign key. The following indexes may be required: -fk_auth_group_permissions_auth_group may require an index on table: auth_group_permissions, column: group_id -fk_auth_user_groups_auth_user may require an index on table: auth_user_groups, column: user_id -fk_auth_user_user_permissions_auth_user may require an index on table: auth_user_user_permissions, column: user_id -fk_question_tags_question may require an index on table: question_tags, column: question_id ------------------------------------------------------------ -*/ - -/************ Foreign Key: fk_activity_auth_user ***************/ -ALTER TABLE activity ADD CONSTRAINT fk_activity_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: deleted_by_id_refs_id_192b0170 ***************/ -ALTER TABLE answer ADD CONSTRAINT deleted_by_id_refs_id_192b0170 - FOREIGN KEY (deleted_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_answer_auth_user ***************/ -ALTER TABLE answer ADD CONSTRAINT fk_answer_auth_user - FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_answer_question ***************/ -ALTER TABLE answer ADD CONSTRAINT fk_answer_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: last_edited_by_id_refs_id_192b0170 ***************/ -ALTER TABLE answer ADD CONSTRAINT last_edited_by_id_refs_id_192b0170 - FOREIGN KEY (last_edited_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: locked_by_id_refs_id_192b0170 ***************/ -ALTER TABLE answer ADD CONSTRAINT locked_by_id_refs_id_192b0170 - FOREIGN KEY (locked_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_answer_revision_auth_user ***************/ -ALTER TABLE answer_revision ADD CONSTRAINT fk_answer_revision_auth_user - FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_group_permissions_auth_group ***************/ -ALTER TABLE auth_group_permissions ADD CONSTRAINT fk_auth_group_permissions_auth_group - FOREIGN KEY (group_id) REFERENCES auth_group (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_group_permissions_auth_permission ***************/ -ALTER TABLE auth_group_permissions ADD CONSTRAINT fk_auth_group_permissions_auth_permission - FOREIGN KEY (permission_id) REFERENCES auth_permission (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_message_auth_user ***************/ -ALTER TABLE auth_message ADD CONSTRAINT fk_auth_message_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_permission_django_content_type ***************/ -ALTER TABLE auth_permission ADD CONSTRAINT fk_auth_permission_django_content_type - FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_user_groups_auth_group ***************/ -ALTER TABLE auth_user_groups ADD CONSTRAINT fk_auth_user_groups_auth_group - FOREIGN KEY (group_id) REFERENCES auth_group (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_user_groups_auth_user ***************/ -ALTER TABLE auth_user_groups ADD CONSTRAINT fk_auth_user_groups_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_user_user_permissions_auth_permission ***************/ -ALTER TABLE auth_user_user_permissions ADD CONSTRAINT fk_auth_user_user_permissions_auth_permission - FOREIGN KEY (permission_id) REFERENCES auth_permission (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_user_user_permissions_auth_user ***************/ -ALTER TABLE auth_user_user_permissions ADD CONSTRAINT fk_auth_user_user_permissions_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_award_auth_user ***************/ -ALTER TABLE award ADD CONSTRAINT fk_award_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_award_badge ***************/ -ALTER TABLE award ADD CONSTRAINT fk_award_badge - FOREIGN KEY (badge_id) REFERENCES badge (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_books_auth_user ***************/ -ALTER TABLE book ADD CONSTRAINT fk_books_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_book_author_info_auth_user ***************/ -ALTER TABLE book_author_info ADD CONSTRAINT fk_book_author_info_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_book_author_rss_auth_user ***************/ -ALTER TABLE book_author_rss ADD CONSTRAINT fk_book_author_rss_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_book_question_book ***************/ -ALTER TABLE book_question ADD CONSTRAINT fk_book_question_book - FOREIGN KEY (book_id) REFERENCES book (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_book_question_question ***************/ -ALTER TABLE book_question ADD CONSTRAINT fk_book_question_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_comment_auth_user ***************/ -ALTER TABLE `comment` ADD CONSTRAINT fk_comment_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_comment_django_content_type ***************/ -ALTER TABLE `comment` ADD CONSTRAINT fk_comment_django_content_type - FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_django_admin_log_auth_user ***************/ -ALTER TABLE django_admin_log ADD CONSTRAINT fk_django_admin_log_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_django_admin_log_django_content_type ***************/ -ALTER TABLE django_admin_log ADD CONSTRAINT fk_django_admin_log_django_content_type - FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_django_authopenid_userassociation_auth_user ***************/ -ALTER TABLE django_authopenid_userassociation ADD CONSTRAINT fk_django_authopenid_userassociation_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_django_authopenid_userpasswordqueue_auth_user ***************/ -ALTER TABLE django_authopenid_userpasswordqueue ADD CONSTRAINT fk_django_authopenid_userpasswordqueue_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_favorite_question_auth_user ***************/ -ALTER TABLE favorite_question ADD CONSTRAINT fk_favorite_question_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_favorite_question_question ***************/ -ALTER TABLE favorite_question ADD CONSTRAINT fk_favorite_question_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_flagged_item_auth_user ***************/ -ALTER TABLE flagged_item ADD CONSTRAINT fk_flagged_item_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_flagged_item_django_content_type ***************/ -ALTER TABLE flagged_item ADD CONSTRAINT fk_flagged_item_django_content_type - FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: closed_by_id_refs_id_56e9d00c ***************/ -ALTER TABLE question ADD CONSTRAINT closed_by_id_refs_id_56e9d00c - FOREIGN KEY (closed_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: deleted_by_id_refs_id_56e9d00c ***************/ -ALTER TABLE question ADD CONSTRAINT deleted_by_id_refs_id_56e9d00c - FOREIGN KEY (deleted_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_question_auth_user ***************/ -ALTER TABLE question ADD CONSTRAINT fk_question_auth_user - FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: last_activity_by_id_refs_id_56e9d00c ***************/ -ALTER TABLE question ADD CONSTRAINT last_activity_by_id_refs_id_56e9d00c - FOREIGN KEY (last_activity_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: last_edited_by_id_refs_id_56e9d00c ***************/ -ALTER TABLE question ADD CONSTRAINT last_edited_by_id_refs_id_56e9d00c - FOREIGN KEY (last_edited_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: locked_by_id_refs_id_56e9d00c ***************/ -ALTER TABLE question ADD CONSTRAINT locked_by_id_refs_id_56e9d00c - FOREIGN KEY (locked_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_question_revision_auth_user ***************/ -ALTER TABLE question_revision ADD CONSTRAINT fk_question_revision_auth_user - FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_question_revision_question ***************/ -ALTER TABLE question_revision ADD CONSTRAINT fk_question_revision_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_question_tags_question ***************/ -ALTER TABLE question_tags ADD CONSTRAINT fk_question_tags_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_question_tags_tag ***************/ -ALTER TABLE question_tags ADD CONSTRAINT fk_question_tags_tag - FOREIGN KEY (tag_id) REFERENCES tag (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_repute_auth_user ***************/ -ALTER TABLE repute ADD CONSTRAINT fk_repute_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_repute_question ***************/ -ALTER TABLE repute ADD CONSTRAINT fk_repute_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_tag_auth_user ***************/ -ALTER TABLE tag ADD CONSTRAINT fk_tag_auth_user - FOREIGN KEY (created_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_user_badge_auth_user ***************/ -ALTER TABLE user_badge ADD CONSTRAINT fk_user_badge_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_user_badge_badge ***************/ -ALTER TABLE user_badge ADD CONSTRAINT fk_user_badge_badge - FOREIGN KEY (badge_id) REFERENCES badge (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_user_favorite_questions_auth_user ***************/ -ALTER TABLE user_favorite_questions ADD CONSTRAINT fk_user_favorite_questions_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_user_favorite_questions_question ***************/ -ALTER TABLE user_favorite_questions ADD CONSTRAINT fk_user_favorite_questions_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_vote_auth_user ***************/ -ALTER TABLE vote ADD CONSTRAINT fk_vote_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_vote_django_content_type ***************/ -ALTER TABLE vote ADD CONSTRAINT fk_vote_django_content_type - FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; \ No newline at end of file diff --git a/sql_scripts/cnprog_new_install_2009_04_07.sql b/sql_scripts/cnprog_new_install_2009_04_07.sql deleted file mode 100644 index ff9016fa..00000000 --- a/sql_scripts/cnprog_new_install_2009_04_07.sql +++ /dev/null @@ -1,24 +0,0 @@ -USE cnprog; - - -/************ Add Foreign Keys to Database ***************/ - -/************ Foreign Key: fk_activity_auth_user ***************/ -ALTER TABLE activity ADD CONSTRAINT fk_activity_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_question_revision_auth_user ***************/ -ALTER TABLE question_revision ADD CONSTRAINT fk_question_revision_auth_user - FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_question_revision_question ***************/ -ALTER TABLE question_revision ADD CONSTRAINT fk_question_revision_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_repute_auth_user ***************/ -ALTER TABLE repute ADD CONSTRAINT fk_repute_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_repute_question ***************/ -ALTER TABLE repute ADD CONSTRAINT fk_repute_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; \ No newline at end of file diff --git a/sql_scripts/cnprog_new_install_2009_04_09.sql b/sql_scripts/cnprog_new_install_2009_04_09.sql deleted file mode 100644 index f4424852..00000000 --- a/sql_scripts/cnprog_new_install_2009_04_09.sql +++ /dev/null @@ -1,904 +0,0 @@ -USE cnprog; - - -/************ Update: Tables ***************/ - -/******************** Add Table: activity ************************/ - -/* Build Table Structure */ -CREATE TABLE activity -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - activity_type SMALLINT NOT NULL, - active_at DATETIME NOT NULL, - content_type_id INTEGER NOT NULL, - object_id INTEGER UNSIGNED NOT NULL, - is_auditted TINYINT NULL DEFAULT 0 -) ENGINE=MyISAM AUTO_INCREMENT=103 DEFAULT CHARSET=latin1; - -/* Table Items: activity */ - -/* Add Indexes for: activity */ -CREATE INDEX activity_content_type_id ON activity (content_type_id); -CREATE INDEX activity_user_id ON activity (user_id); - -/******************** Add Table: answer ************************/ - -/* Build Table Structure */ -CREATE TABLE answer -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - question_id INTEGER NOT NULL, - author_id INTEGER NOT NULL, - added_at DATETIME NOT NULL, - wiki TINYINT NOT NULL, - wikified_at DATETIME NULL, - accepted TINYINT NOT NULL, - deleted TINYINT NOT NULL, - deleted_by_id INTEGER NULL, - locked TINYINT NOT NULL, - locked_by_id INTEGER NULL, - locked_at DATETIME NULL, - score INTEGER NOT NULL, - comment_count INTEGER UNSIGNED NOT NULL, - offensive_flag_count SMALLINT NOT NULL, - last_edited_at DATETIME NULL, - last_edited_by_id INTEGER NULL, - html LONGTEXT NOT NULL, - vote_up_count INTEGER NOT NULL, - vote_down_count INTEGER NOT NULL, - accepted_at DATETIME NULL -) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; - -/* Table Items: answer */ - -/* Add Indexes for: answer */ -CREATE INDEX answer_author_id ON answer (author_id); -CREATE INDEX answer_deleted_by_id ON answer (deleted_by_id); -CREATE INDEX answer_last_edited_by_id ON answer (last_edited_by_id); -CREATE INDEX answer_locked_by_id ON answer (locked_by_id); -CREATE INDEX answer_question_id ON answer (question_id); - -/******************** Add Table: answer_revision ************************/ - -/* Build Table Structure */ -CREATE TABLE answer_revision -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - answer_id INTEGER NOT NULL, - revision INTEGER UNSIGNED NOT NULL, - author_id INTEGER NOT NULL, - revised_at DATETIME NOT NULL, - summary TEXT NOT NULL, - `text` LONGTEXT NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -/* Table Items: answer_revision */ - -/* Add Indexes for: answer_revision */ -CREATE INDEX answer_revision_answer_id ON answer_revision (answer_id); -CREATE INDEX answer_revision_author_id ON answer_revision (author_id); - -/******************** Add Table: auth_group ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_group -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(80) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: auth_group */ - -/* Add Indexes for: auth_group */ -CREATE UNIQUE INDEX name ON auth_group (name); - -/******************** Add Table: auth_group_permissions ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_group_permissions -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - group_id INTEGER NOT NULL, - permission_id INTEGER NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: auth_group_permissions */ - -/* Add Indexes for: auth_group_permissions */ -CREATE UNIQUE INDEX group_id ON auth_group_permissions (group_id, permission_id); -CREATE INDEX permission_id_refs_id_5886d21f ON auth_group_permissions (permission_id); - -/******************** Add Table: auth_message ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_message -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - message LONGTEXT NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8; - -/* Table Items: auth_message */ - -/* Add Indexes for: auth_message */ -CREATE INDEX auth_message_user_id ON auth_message (user_id); - -/******************** Add Table: auth_permission ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_permission -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(50) NOT NULL, - content_type_id INTEGER NOT NULL, - codename VARCHAR(100) NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8; - -/* Table Items: auth_permission */ - -/* Add Indexes for: auth_permission */ -CREATE INDEX auth_permission_content_type_id ON auth_permission (content_type_id); -CREATE UNIQUE INDEX content_type_id ON auth_permission (content_type_id, codename); - -/******************** Add Table: auth_user ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_user -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - username VARCHAR(30) NOT NULL, - first_name VARCHAR(30) NOT NULL, - last_name VARCHAR(30) NOT NULL, - email VARCHAR(75) NOT NULL, - password VARCHAR(128) NOT NULL, - is_staff TINYINT NOT NULL, - is_active TINYINT NOT NULL, - is_superuser TINYINT NOT NULL, - last_login DATETIME NOT NULL, - date_joined DATETIME NOT NULL, - gold SMALLINT NOT NULL DEFAULT 0, - silver SMALLINT UNSIGNED NOT NULL DEFAULT 0, - bronze SMALLINT UNSIGNED NOT NULL DEFAULT 0, - reputation INTEGER UNSIGNED NULL DEFAULT 1, - gravatar VARCHAR(128) NULL, - questions_per_page SMALLINT UNSIGNED NULL DEFAULT 10, - last_seen DATETIME NULL, - real_name VARCHAR(100) NULL, - website VARCHAR(200) NULL, - location VARCHAR(100) NULL, - date_of_birth DATETIME NULL, - about TEXT NULL -) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8; - -/* Table Items: auth_user */ - -/* Add Indexes for: auth_user */ -CREATE UNIQUE INDEX username ON auth_user (username); - -/******************** Add Table: auth_user_groups ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_user_groups -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - group_id INTEGER NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: auth_user_groups */ - -/* Add Indexes for: auth_user_groups */ -CREATE INDEX group_id_refs_id_f116770 ON auth_user_groups (group_id); -CREATE UNIQUE INDEX user_id ON auth_user_groups (user_id, group_id); - -/******************** Add Table: auth_user_user_permissions ************************/ - -/* Build Table Structure */ -CREATE TABLE auth_user_user_permissions -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - permission_id INTEGER NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: auth_user_user_permissions */ - -/* Add Indexes for: auth_user_user_permissions */ -CREATE INDEX permission_id_refs_id_67e79cb ON auth_user_user_permissions (permission_id); -CREATE UNIQUE INDEX user_id ON auth_user_user_permissions (user_id, permission_id); - -/******************** Add Table: award ************************/ - -/* Build Table Structure */ -CREATE TABLE award -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - badge_id INTEGER NOT NULL, - awarded_at DATETIME NOT NULL, - notified TINYINT NOT NULL, - content_type_id INTEGER NULL, - object_id INTEGER NULL -) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; - -/* Table Items: award */ - -/* Add Indexes for: award */ -CREATE INDEX award_badge_id ON award (badge_id); -CREATE INDEX award_user_id ON award (user_id); - -/******************** Add Table: badge ************************/ - -/* Build Table Structure */ -CREATE TABLE badge -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(50) NOT NULL, - `type` SMALLINT NOT NULL, - slug VARCHAR(50) NOT NULL, - description TEXT NOT NULL, - multiple TINYINT NOT NULL, - awarded_count INTEGER UNSIGNED NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; - -/* Table Items: badge */ - -/* Add Indexes for: badge */ -CREATE INDEX badge_slug ON badge (slug); -CREATE UNIQUE INDEX name ON badge (name, `type`); - -/******************** Add Table: book ************************/ - -/* Build Table Structure */ -CREATE TABLE book -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - title VARCHAR(255) NOT NULL, - short_name VARCHAR(255) NOT NULL, - author VARCHAR(255) NOT NULL, - user_id INTEGER NULL, - price DECIMAL(10, 2) NULL, - pages SMALLINT NULL, - published_at DATE NOT NULL, - publication VARCHAR(255) NOT NULL, - cover_img VARCHAR(255) NULL, - tagnames VARCHAR(125) NULL, - added_at DATETIME NOT NULL, - last_edited_at DATETIME NOT NULL -) TYPE=InnoDB; - -/* Table Items: book */ - -/* Add Indexes for: book */ -CREATE UNIQUE INDEX book_short_name_Idx ON book (short_name); -CREATE INDEX fk_books_auth_user ON book (user_id); - -/******************** Add Table: book_author_info ************************/ - -/* Build Table Structure */ -CREATE TABLE book_author_info -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - blog_url VARCHAR(255) NULL, - user_id INTEGER NOT NULL, - added_at DATETIME NOT NULL, - last_edited_at DATETIME NOT NULL, - book_id INTEGER NOT NULL -) TYPE=InnoDB; - -/* Table Items: book_author_info */ - -/* Add Indexes for: book_author_info */ -CREATE INDEX fk_book_author_info_auth_user ON book_author_info (user_id); -CREATE INDEX fk_book_author_info_book ON book_author_info (book_id); - -/******************** Add Table: book_author_rss ************************/ - -/* Build Table Structure */ -CREATE TABLE book_author_rss -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - title VARCHAR(255) NOT NULL, - url VARCHAR(255) NOT NULL, - rss_created_at DATETIME NOT NULL, - user_id INTEGER NOT NULL, - added_at DATETIME NOT NULL, - book_id INTEGER NOT NULL -) TYPE=InnoDB; - -/* Table Items: book_author_rss */ - -/* Add Indexes for: book_author_rss */ -CREATE INDEX fk_book_author_rss_auth_user ON book_author_rss (user_id); -CREATE INDEX fk_book_author_rss_book ON book_author_rss (book_id); - -/******************** Add Table: book_question ************************/ - -/* Build Table Structure */ -CREATE TABLE book_question -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - book_id INTEGER NOT NULL, - question_id INTEGER NOT NULL -) TYPE=InnoDB; - -/* Table Items: book_question */ - -/* Add Indexes for: book_question */ -CREATE INDEX fk_book_question_book ON book_question (book_id); -CREATE INDEX fk_book_question_question ON book_question (question_id); - -/******************** Add Table: `comment` ************************/ - -/* Build Table Structure */ -CREATE TABLE `comment` -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - content_type_id INTEGER NOT NULL, - object_id INTEGER UNSIGNED NOT NULL, - user_id INTEGER NOT NULL, - `comment` TEXT NOT NULL, - added_at DATETIME NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8; - -/* Table Items: `comment` */ - -/* Add Indexes for: comment */ -CREATE INDEX comment_content_type_id ON `comment` (content_type_id); -CREATE INDEX comment_user_id ON `comment` (user_id); -CREATE INDEX content_type_id ON `comment` (content_type_id, object_id, user_id); - -/******************** Add Table: django_admin_log ************************/ - -/* Build Table Structure */ -CREATE TABLE django_admin_log -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - action_time DATETIME NOT NULL, - user_id INTEGER NOT NULL, - content_type_id INTEGER NULL, - object_id LONGTEXT NULL, - object_repr VARCHAR(200) NOT NULL, - action_flag SMALLINT UNSIGNED NOT NULL, - change_message LONGTEXT NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; - -/* Table Items: django_admin_log */ - -/* Add Indexes for: django_admin_log */ -CREATE INDEX django_admin_log_content_type_id ON django_admin_log (content_type_id); -CREATE INDEX django_admin_log_user_id ON django_admin_log (user_id); - -/******************** Add Table: django_authopenid_association ************************/ - -/* Build Table Structure */ -CREATE TABLE django_authopenid_association -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - server_url LONGTEXT NOT NULL, - handle VARCHAR(255) NOT NULL, - secret LONGTEXT NOT NULL, - issued INTEGER NOT NULL, - lifetime INTEGER NOT NULL, - assoc_type LONGTEXT NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; - -/******************** Add Table: django_authopenid_nonce ************************/ - -/* Build Table Structure */ -CREATE TABLE django_authopenid_nonce -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - server_url VARCHAR(255) NOT NULL, - `timestamp` INTEGER NOT NULL, - salt VARCHAR(40) NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8; - -/******************** Add Table: django_authopenid_userassociation ************************/ - -/* Build Table Structure */ -CREATE TABLE django_authopenid_userassociation -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - openid_url VARCHAR(255) NOT NULL, - user_id INTEGER NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; - -/* Table Items: django_authopenid_userassociation */ - -/* Add Indexes for: django_authopenid_userassociation */ -CREATE UNIQUE INDEX user_id ON django_authopenid_userassociation (user_id); - -/******************** Add Table: django_authopenid_userpasswordqueue ************************/ - -/* Build Table Structure */ -CREATE TABLE django_authopenid_userpasswordqueue -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - new_password VARCHAR(30) NOT NULL, - confirm_key VARCHAR(40) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: django_authopenid_userpasswordqueue */ - -/* Add Indexes for: django_authopenid_userpasswordqueue */ -CREATE UNIQUE INDEX user_id ON django_authopenid_userpasswordqueue (user_id); - -/******************** Add Table: django_content_type ************************/ - -/* Build Table Structure */ -CREATE TABLE django_content_type -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(100) NOT NULL, - app_label VARCHAR(100) NOT NULL, - model VARCHAR(100) NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; - -/* Table Items: django_content_type */ - -/* Add Indexes for: django_content_type */ -CREATE UNIQUE INDEX app_label ON django_content_type (app_label, model); - -/******************** Add Table: django_session ************************/ - -/* Build Table Structure */ -CREATE TABLE django_session -( - session_key VARCHAR(40) NOT NULL, - session_data LONGTEXT NOT NULL, - expire_date DATETIME NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: django_session */ -ALTER TABLE django_session ADD CONSTRAINT pkdjango_session - PRIMARY KEY (session_key); - -/******************** Add Table: django_site ************************/ - -/* Build Table Structure */ -CREATE TABLE django_site -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - domain VARCHAR(100) NOT NULL, - name VARCHAR(50) NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; - -/******************** Add Table: favorite_question ************************/ - -/* Build Table Structure */ -CREATE TABLE favorite_question -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - question_id INTEGER NOT NULL, - user_id INTEGER NOT NULL, - added_at DATETIME NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; - -/* Table Items: favorite_question */ - -/* Add Indexes for: favorite_question */ -CREATE INDEX favorite_question_question_id ON favorite_question (question_id); -CREATE INDEX favorite_question_user_id ON favorite_question (user_id); - -/******************** Add Table: flagged_item ************************/ - -/* Build Table Structure */ -CREATE TABLE flagged_item -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - content_type_id INTEGER NOT NULL, - object_id INTEGER UNSIGNED NOT NULL, - user_id INTEGER NOT NULL, - flagged_at DATETIME NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; - -/* Table Items: flagged_item */ - -/* Add Indexes for: flagged_item */ -CREATE UNIQUE INDEX content_type_id ON flagged_item (content_type_id, object_id, user_id); -CREATE INDEX flagged_item_content_type_id ON flagged_item (content_type_id); -CREATE INDEX flagged_item_user_id ON flagged_item (user_id); - -/******************** Add Table: question ************************/ - -/* Build Table Structure */ -CREATE TABLE question -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - title TEXT NOT NULL, - author_id INTEGER NOT NULL, - added_at DATETIME NOT NULL, - wiki TINYINT NOT NULL, - wikified_at DATETIME NULL, - answer_accepted TINYINT NOT NULL, - closed TINYINT NOT NULL, - closed_by_id INTEGER NULL, - closed_at DATETIME NULL, - close_reason SMALLINT NULL, - deleted TINYINT NOT NULL, - deleted_at DATETIME NULL, - deleted_by_id INTEGER NULL, - locked TINYINT NOT NULL, - locked_by_id INTEGER NULL, - locked_at DATETIME NULL, - score INTEGER NOT NULL, - answer_count INTEGER UNSIGNED NOT NULL, - comment_count INTEGER UNSIGNED NOT NULL, - view_count INTEGER UNSIGNED NOT NULL, - offensive_flag_count SMALLINT NOT NULL, - favourite_count INTEGER UNSIGNED NOT NULL, - last_edited_at DATETIME NULL, - last_edited_by_id INTEGER NULL, - last_activity_at DATETIME NOT NULL, - last_activity_by_id INTEGER NOT NULL, - tagnames VARCHAR(125) NOT NULL, - summary VARCHAR(180) NOT NULL, - html LONGTEXT NOT NULL, - vote_up_count INTEGER NOT NULL, - vote_down_count INTEGER NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; - -/* Table Items: question */ - -/* Add Indexes for: question */ -CREATE INDEX question_author_id ON question (author_id); -CREATE INDEX question_closed_by_id ON question (closed_by_id); -CREATE INDEX question_deleted_by_id ON question (deleted_by_id); -CREATE INDEX question_last_activity_by_id ON question (last_activity_by_id); -CREATE INDEX question_last_edited_by_id ON question (last_edited_by_id); -CREATE INDEX question_locked_by_id ON question (locked_by_id); - -/******************** Add Table: question_revision ************************/ - -/* Build Table Structure */ -CREATE TABLE question_revision -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - question_id INTEGER NOT NULL, - revision INTEGER UNSIGNED NOT NULL, - title TEXT NOT NULL, - author_id INTEGER NOT NULL, - revised_at DATETIME NOT NULL, - tagnames VARCHAR(125) NOT NULL, - summary TEXT NOT NULL, - `text` LONGTEXT NOT NULL -) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; - -/* Table Items: question_revision */ - -/* Add Indexes for: question_revision */ -CREATE INDEX question_revision_author_id ON question_revision (author_id); -CREATE INDEX question_revision_question_id ON question_revision (question_id); - -/******************** Add Table: question_tags ************************/ - -/* Build Table Structure */ -CREATE TABLE question_tags -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - question_id INTEGER NOT NULL, - tag_id INTEGER NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; - -/* Table Items: question_tags */ - -/* Add Indexes for: question_tags */ -CREATE UNIQUE INDEX question_id ON question_tags (question_id, tag_id); -CREATE INDEX tag_id_refs_id_43fcb953 ON question_tags (tag_id); - -/******************** Add Table: repute ************************/ - -/* Build Table Structure */ -CREATE TABLE repute -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - positive SMALLINT NOT NULL, - negative SMALLINT NOT NULL, - question_id INTEGER NOT NULL, - reputed_at DATETIME NOT NULL, - reputation_type SMALLINT NOT NULL, - reputation INTEGER NOT NULL -) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1; - -/* Table Items: repute */ - -/* Add Indexes for: repute */ -CREATE INDEX repute_question_id ON repute (question_id); -CREATE INDEX repute_user_id ON repute (user_id); - -/******************** Add Table: tag ************************/ - -/* Build Table Structure */ -CREATE TABLE tag -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(255) NOT NULL, - created_by_id INTEGER NOT NULL, - used_count INTEGER UNSIGNED NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; - -/* Table Items: tag */ - -/* Add Indexes for: tag */ -CREATE UNIQUE INDEX name ON tag (name); -CREATE INDEX tag_created_by_id ON tag (created_by_id); - -/******************** Add Table: user_badge ************************/ - -/* Build Table Structure */ -CREATE TABLE user_badge -( - id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - badge_id INTEGER NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: user_badge */ - -/* Add Indexes for: user_badge */ -CREATE INDEX fk_user_badge_auth_user ON user_badge (user_id); -CREATE INDEX fk_user_badge_badge ON user_badge (badge_id); - -/******************** Add Table: user_favorite_questions ************************/ - -/* Build Table Structure */ -CREATE TABLE user_favorite_questions -( - id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - user_id INTEGER NOT NULL, - question_id INTEGER NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/* Table Items: user_favorite_questions */ - -/* Add Indexes for: user_favorite_questions */ -CREATE INDEX fk_user_favorite_questions_auth_user ON user_favorite_questions (user_id); -CREATE INDEX fk_user_favorite_questions_question ON user_favorite_questions (question_id); - -/******************** Add Table: vote ************************/ - -/* Build Table Structure */ -CREATE TABLE vote -( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - content_type_id INTEGER NOT NULL, - object_id INTEGER UNSIGNED NOT NULL, - user_id INTEGER NOT NULL, - vote SMALLINT NOT NULL, - voted_at DATETIME NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; - -/* Table Items: vote */ - -/* Add Indexes for: vote */ -CREATE UNIQUE INDEX content_type_id ON vote (content_type_id, object_id, user_id); -CREATE INDEX vote_content_type_id ON vote (content_type_id); -CREATE INDEX vote_user_id ON vote (user_id); - - -/************ Add Foreign Keys to Database ***************/ -/*----------------------------------------------------------- -Warning: Versions of MySQL prior to 4.1.2 require indexes on all columns involved in a foreign key. The following indexes may be required: -fk_auth_group_permissions_auth_group may require an index on table: auth_group_permissions, column: group_id -fk_auth_user_groups_auth_user may require an index on table: auth_user_groups, column: user_id -fk_auth_user_user_permissions_auth_user may require an index on table: auth_user_user_permissions, column: user_id -fk_question_tags_question may require an index on table: question_tags, column: question_id ------------------------------------------------------------ -*/ - -/************ Foreign Key: fk_activity_auth_user ***************/ -ALTER TABLE activity ADD CONSTRAINT fk_activity_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: deleted_by_id_refs_id_192b0170 ***************/ -ALTER TABLE answer ADD CONSTRAINT deleted_by_id_refs_id_192b0170 - FOREIGN KEY (deleted_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_answer_auth_user ***************/ -ALTER TABLE answer ADD CONSTRAINT fk_answer_auth_user - FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_answer_question ***************/ -ALTER TABLE answer ADD CONSTRAINT fk_answer_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: last_edited_by_id_refs_id_192b0170 ***************/ -ALTER TABLE answer ADD CONSTRAINT last_edited_by_id_refs_id_192b0170 - FOREIGN KEY (last_edited_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: locked_by_id_refs_id_192b0170 ***************/ -ALTER TABLE answer ADD CONSTRAINT locked_by_id_refs_id_192b0170 - FOREIGN KEY (locked_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_answer_revision_auth_user ***************/ -ALTER TABLE answer_revision ADD CONSTRAINT fk_answer_revision_auth_user - FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_group_permissions_auth_group ***************/ -ALTER TABLE auth_group_permissions ADD CONSTRAINT fk_auth_group_permissions_auth_group - FOREIGN KEY (group_id) REFERENCES auth_group (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_group_permissions_auth_permission ***************/ -ALTER TABLE auth_group_permissions ADD CONSTRAINT fk_auth_group_permissions_auth_permission - FOREIGN KEY (permission_id) REFERENCES auth_permission (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_message_auth_user ***************/ -ALTER TABLE auth_message ADD CONSTRAINT fk_auth_message_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_permission_django_content_type ***************/ -ALTER TABLE auth_permission ADD CONSTRAINT fk_auth_permission_django_content_type - FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_user_groups_auth_group ***************/ -ALTER TABLE auth_user_groups ADD CONSTRAINT fk_auth_user_groups_auth_group - FOREIGN KEY (group_id) REFERENCES auth_group (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_user_groups_auth_user ***************/ -ALTER TABLE auth_user_groups ADD CONSTRAINT fk_auth_user_groups_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_user_user_permissions_auth_permission ***************/ -ALTER TABLE auth_user_user_permissions ADD CONSTRAINT fk_auth_user_user_permissions_auth_permission - FOREIGN KEY (permission_id) REFERENCES auth_permission (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_auth_user_user_permissions_auth_user ***************/ -ALTER TABLE auth_user_user_permissions ADD CONSTRAINT fk_auth_user_user_permissions_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_award_auth_user ***************/ -ALTER TABLE award ADD CONSTRAINT fk_award_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_award_badge ***************/ -ALTER TABLE award ADD CONSTRAINT fk_award_badge - FOREIGN KEY (badge_id) REFERENCES badge (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_books_auth_user ***************/ -ALTER TABLE book ADD CONSTRAINT fk_books_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_book_author_info_auth_user ***************/ -ALTER TABLE book_author_info ADD CONSTRAINT fk_book_author_info_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_book_author_info_book ***************/ -ALTER TABLE book_author_info ADD CONSTRAINT fk_book_author_info_book - FOREIGN KEY (book_id) REFERENCES book (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_book_author_rss_auth_user ***************/ -ALTER TABLE book_author_rss ADD CONSTRAINT fk_book_author_rss_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_book_author_rss_book ***************/ -ALTER TABLE book_author_rss ADD CONSTRAINT fk_book_author_rss_book - FOREIGN KEY (book_id) REFERENCES book (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_book_question_book ***************/ -ALTER TABLE book_question ADD CONSTRAINT fk_book_question_book - FOREIGN KEY (book_id) REFERENCES book (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_book_question_question ***************/ -ALTER TABLE book_question ADD CONSTRAINT fk_book_question_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_comment_auth_user ***************/ -ALTER TABLE `comment` ADD CONSTRAINT fk_comment_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_comment_django_content_type ***************/ -ALTER TABLE `comment` ADD CONSTRAINT fk_comment_django_content_type - FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_django_admin_log_auth_user ***************/ -ALTER TABLE django_admin_log ADD CONSTRAINT fk_django_admin_log_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_django_admin_log_django_content_type ***************/ -ALTER TABLE django_admin_log ADD CONSTRAINT fk_django_admin_log_django_content_type - FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_django_authopenid_userassociation_auth_user ***************/ -ALTER TABLE django_authopenid_userassociation ADD CONSTRAINT fk_django_authopenid_userassociation_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_django_authopenid_userpasswordqueue_auth_user ***************/ -ALTER TABLE django_authopenid_userpasswordqueue ADD CONSTRAINT fk_django_authopenid_userpasswordqueue_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_favorite_question_auth_user ***************/ -ALTER TABLE favorite_question ADD CONSTRAINT fk_favorite_question_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_favorite_question_question ***************/ -ALTER TABLE favorite_question ADD CONSTRAINT fk_favorite_question_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_flagged_item_auth_user ***************/ -ALTER TABLE flagged_item ADD CONSTRAINT fk_flagged_item_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_flagged_item_django_content_type ***************/ -ALTER TABLE flagged_item ADD CONSTRAINT fk_flagged_item_django_content_type - FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: closed_by_id_refs_id_56e9d00c ***************/ -ALTER TABLE question ADD CONSTRAINT closed_by_id_refs_id_56e9d00c - FOREIGN KEY (closed_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: deleted_by_id_refs_id_56e9d00c ***************/ -ALTER TABLE question ADD CONSTRAINT deleted_by_id_refs_id_56e9d00c - FOREIGN KEY (deleted_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_question_auth_user ***************/ -ALTER TABLE question ADD CONSTRAINT fk_question_auth_user - FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: last_activity_by_id_refs_id_56e9d00c ***************/ -ALTER TABLE question ADD CONSTRAINT last_activity_by_id_refs_id_56e9d00c - FOREIGN KEY (last_activity_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: last_edited_by_id_refs_id_56e9d00c ***************/ -ALTER TABLE question ADD CONSTRAINT last_edited_by_id_refs_id_56e9d00c - FOREIGN KEY (last_edited_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: locked_by_id_refs_id_56e9d00c ***************/ -ALTER TABLE question ADD CONSTRAINT locked_by_id_refs_id_56e9d00c - FOREIGN KEY (locked_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_question_revision_auth_user ***************/ -ALTER TABLE question_revision ADD CONSTRAINT fk_question_revision_auth_user - FOREIGN KEY (author_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_question_revision_question ***************/ -ALTER TABLE question_revision ADD CONSTRAINT fk_question_revision_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_question_tags_question ***************/ -ALTER TABLE question_tags ADD CONSTRAINT fk_question_tags_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_question_tags_tag ***************/ -ALTER TABLE question_tags ADD CONSTRAINT fk_question_tags_tag - FOREIGN KEY (tag_id) REFERENCES tag (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_repute_auth_user ***************/ -ALTER TABLE repute ADD CONSTRAINT fk_repute_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_repute_question ***************/ -ALTER TABLE repute ADD CONSTRAINT fk_repute_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_tag_auth_user ***************/ -ALTER TABLE tag ADD CONSTRAINT fk_tag_auth_user - FOREIGN KEY (created_by_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_user_badge_auth_user ***************/ -ALTER TABLE user_badge ADD CONSTRAINT fk_user_badge_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_user_badge_badge ***************/ -ALTER TABLE user_badge ADD CONSTRAINT fk_user_badge_badge - FOREIGN KEY (badge_id) REFERENCES badge (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_user_favorite_questions_auth_user ***************/ -ALTER TABLE user_favorite_questions ADD CONSTRAINT fk_user_favorite_questions_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_user_favorite_questions_question ***************/ -ALTER TABLE user_favorite_questions ADD CONSTRAINT fk_user_favorite_questions_question - FOREIGN KEY (question_id) REFERENCES question (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_vote_auth_user ***************/ -ALTER TABLE vote ADD CONSTRAINT fk_vote_auth_user - FOREIGN KEY (user_id) REFERENCES auth_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION; - -/************ Foreign Key: fk_vote_django_content_type ***************/ -ALTER TABLE vote ADD CONSTRAINT fk_vote_django_content_type - FOREIGN KEY (content_type_id) REFERENCES django_content_type (id) ON UPDATE NO ACTION ON DELETE NO ACTION; \ No newline at end of file diff --git a/sql_scripts/drop-all-tables.sh b/sql_scripts/drop-all-tables.sh deleted file mode 100644 index 1e55cb1f..00000000 --- a/sql_scripts/drop-all-tables.sh +++ /dev/null @@ -1,4 +0,0 @@ -mysql_username='' -mysql_database='' -mysqldump -u $mysql_username -p --add-drop-table --no-data $mysql_database | grep ^DROP -#| mysql -u[USERNAME] -p[PASSWORD] [DATABASE] diff --git a/sql_scripts/drop-auth.sql b/sql_scripts/drop-auth.sql deleted file mode 100644 index bc17dce3..00000000 --- a/sql_scripts/drop-auth.sql +++ /dev/null @@ -1,8 +0,0 @@ -drop table auth_group; -drop table auth_group_permissions; -drop table auth_message; -drop table auth_permission; -drop table auth_user; -drop table auth_user_groups; -drop table auth_user_user_permissions; - diff --git a/sql_scripts/pg_fts_install.sql b/sql_scripts/pg_fts_install.sql deleted file mode 100644 index d0655134..00000000 --- a/sql_scripts/pg_fts_install.sql +++ /dev/null @@ -1,38 +0,0 @@ -ALTER TABLE question ADD COLUMN tsv tsvector; - -CREATE OR REPLACE FUNCTION public.create_plpgsql_language () - RETURNS TEXT - AS $$ - CREATE LANGUAGE plpgsql; - SELECT 'language plpgsql created'::TEXT; - $$ -LANGUAGE 'sql'; - -SELECT CASE WHEN - (SELECT true::BOOLEAN - FROM pg_language - WHERE lanname='plpgsql') - THEN - (SELECT 'language already installed'::TEXT) - ELSE - (SELECT public.create_plpgsql_language()) - END; - -DROP FUNCTION public.create_plpgsql_language (); - -CREATE OR REPLACE FUNCTION set_question_tsv() RETURNS TRIGGER AS $$ -begin - new.tsv := - setweight(to_tsvector('english', coalesce(new.tagnames,'')), 'A') || - setweight(to_tsvector('english', coalesce(new.title,'')), 'B') || - setweight(to_tsvector('english', coalesce(new.summary,'')), 'C'); - RETURN new; -end -$$ LANGUAGE plpgsql; - -CREATE TRIGGER tsvectorupdate BEFORE INSERT OR UPDATE -ON question FOR EACH ROW EXECUTE PROCEDURE set_question_tsv(); - -CREATE INDEX blog_entry_tsv ON blog_entry USING gin(body_tsv); - -UPDATE question SET title = title; diff --git a/sql_scripts/update_2009_01_13_001.sql b/sql_scripts/update_2009_01_13_001.sql deleted file mode 100644 index 165d1125..00000000 --- a/sql_scripts/update_2009_01_13_001.sql +++ /dev/null @@ -1,62 +0,0 @@ --- phpMyAdmin SQL Dump --- version 3.0.0-beta --- http://www.phpmyadmin.net --- --- Host: localhost --- Generation Time: Jan 12, 2009 at 08:55 PM --- Server version: 5.0.67 --- PHP Version: 5.2.6 - -SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; - --- --- Database: `twogeekt_lanai` --- - --- --- Dumping data for table `badge` --- - -INSERT INTO `badge` (`id`, `name`, `type`, `slug`, `description`, `multiple`, `awarded_count`) VALUES -(1, '炼狱法师', 3, '炼狱法师', '删除自己有3个以上赞成票的帖子', 1, 0), -(2, '压力白领', 3, '压力白领', '删除自己有3个以上反对票的帖子', 1, 0), -(3, '优秀回答', 3, '优秀回答', '回答好评10次以上', 1, 0), -(4, '优秀问题', 3, '优秀问题', '问题好评10次以上', 1, 0), -(5, '评论家', 3, '评论家', '评论10次以上', 1, 0), -(6, '流行问题', 3, '流行问题', '问题的浏览量超过1000人次', 1, 0), -(7, '巡逻兵', 3, '巡逻兵', '第一次标记垃圾帖子', 1, 0), -(8, '清洁工', 3, '清洁工', '第一次撤销投票', 1, 0), -(9, '批评家', 3, '批评家', '第一次反对票', 1, 0), -(10, '小编', 3, '小编', '第一次编辑更新', 1, 0), -(11, '村长', 3, '村长', '第一次重新标签', 1, 0), -(12, '学者', 3, '学者', '第一次标记答案', 1, 0), -(13, '学生', 3, '学生', '第一次提问并且有一次以上赞成票', 1, 0), -(14, '支持者', 3, '支持者', '第一次赞成票', 1, 0), -(15, '教师', 3, '教师', '第一次回答问题并且得到一个以上赞成票', 1, 0), -(16, '自传作者', 3, '自传作者', '完整填写用户资料所有选项', 1, 0), -(17, '自学成才', 3, '自学成才', '回答自己的问题并且有3个以上赞成票', 1, 0), -(18, '最有价值回答', 1, '最有价值回答', '回答超过100次赞成票', 1, 0), -(19, '最有价值问题', 1, '最有价值问题', '问题超过100次赞成票', 1, 0), -(20, '万人迷', 1, '万人迷', '问题被100人以上收藏', 1, 0), -(21, '著名问题', 1, '著名问题', '问题的浏览量超过10000人次', 1, 0), -(22, 'alpha用户', 2, 'alpha用户', '内测期间的活跃用户', 1, 0), -(23, '极好回答', 2, '极好回答', '回答超过25次赞成票', 1, 0), -(24, '极好问题', 2, '极好问题', '问题超过25次赞成票', 1, 0), -(25, '受欢迎问题', 2, '受欢迎问题', '问题被25人以上收藏', 1, 0), -(26, '优秀市民', 2, '优秀市民', '投票300次以上', 1, 0), -(27, '编辑主任', 2, '编辑主任', '编辑了100个帖子', 1, 0), -(28, '通才', 2, '通才', '在多个标签领域活跃', 1, 0), -(29, '专家', 2, '专家', '在一个标签领域活跃出众', 1, 0), -(30, '老鸟', 2, '老鸟', '活跃超过一年的用户', 1, 0), -(31, '最受关注问题', 2, '最受关注问题', '问题的浏览量超过2500人次', 1, 0), -(32, '学问家', 2, '学问家', '第一次回答被投赞成票10次以上', 1, 0), -(33, 'beta用户', 2, 'beta用户', 'beta期间活跃参与', 1, 0), -(34, '导师', 2, '导师', '被指定为最佳答案并且赞成票40以上', 1, 0), -(35, '巫师', 2, '巫师', '在提问60天之后回答并且赞成票5次以上', 1, 0), -(36, '分类专家', 2, '分类专家', '创建的标签被50个以上问题使用', 1, 0); diff --git a/sql_scripts/update_2009_01_13_002.sql b/sql_scripts/update_2009_01_13_002.sql deleted file mode 100644 index c223cb8c..00000000 --- a/sql_scripts/update_2009_01_13_002.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE activity ADD COLUMN is_auditted tinyint(1) DEFAULT 0 \ No newline at end of file diff --git a/sql_scripts/update_2009_01_18_001.sql b/sql_scripts/update_2009_01_18_001.sql deleted file mode 100644 index 6f29fa32..00000000 --- a/sql_scripts/update_2009_01_18_001.sql +++ /dev/null @@ -1,62 +0,0 @@ --- phpMyAdmin SQL Dump --- version 3.0.0-beta --- http://www.phpmyadmin.net --- --- Host: localhost --- Generation Time: Jan 12, 2009 at 08:55 PM --- Server version: 5.0.67 --- PHP Version: 5.2.6 - -SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; - --- --- Database: `twogeekt_lanai` --- - --- --- Dumping data for table `badge` --- - -INSERT INTO `badge` (`id`, `name`, `type`, `slug`, `description`, `multiple`, `awarded_count`) VALUES -(1, '炼狱法师', 3, '炼狱法师', '删除自己有3个以上赞成票的帖子', 1, 0), -(2, '压力白领', 3, '压力白领', '删除自己有3个以上反对票的帖子', 1, 0), -(3, '优秀回答', 3, '优秀回答', '回答好评10次以上', 1, 0), -(4, '优秀问题', 3, '优秀问题', '问题好评10次以上', 1, 0), -(5, '评论家', 3, '评论家', '评论10次以上', 0, 0), -(6, '流行问题', 3, '流行问题', '问题的浏览量超过1000人次', 1, 0), -(7, '巡逻兵', 3, '巡逻兵', '第一次标记垃圾帖子', 0, 0), -(8, '清洁工', 3, '清洁工', '第一次撤销投票', 0, 0), -(9, '批评家', 3, '批评家', '第一次反对票', 0, 0), -(10, '小编', 3, '小编', '第一次编辑更新', 0, 0), -(11, '村长', 3, '村长', '第一次重新标签', 0, 0), -(12, '学者', 3, '学者', '第一次标记答案', 0, 0), -(13, '学生', 3, '学生', '第一次提问并且有一次以上赞成票', 0, 0), -(14, '支持者', 3, '支持者', '第一次赞成票', 0, 0), -(15, '教师', 3, '教师', '第一次回答问题并且得到一个以上赞成票', 0, 0), -(16, '自传作者', 3, '自传作者', '完整填写用户资料所有选项', 0, 0), -(17, '自学成才', 3, '自学成才', '回答自己的问题并且有3个以上赞成票', 1, 0), -(18, '最有价值回答', 1, '最有价值回答', '回答超过100次赞成票', 1, 0), -(19, '最有价值问题', 1, '最有价值问题', '问题超过100次赞成票', 1, 0), -(20, '万人迷', 1, '万人迷', '问题被100人以上收藏', 1, 0), -(21, '著名问题', 1, '著名问题', '问题的浏览量超过10000人次', 1, 0), -(22, 'alpha用户', 2, 'alpha用户', '内测期间的活跃用户', 0, 0), -(23, '极好回答', 2, '极好回答', '回答超过25次赞成票', 1, 0), -(24, '极好问题', 2, '极好问题', '问题超过25次赞成票', 1, 0), -(25, '受欢迎问题', 2, '受欢迎问题', '问题被25人以上收藏', 1, 0), -(26, '优秀市民', 2, '优秀市民', '投票300次以上', 0, 0), -(27, '编辑主任', 2, '编辑主任', '编辑了100个帖子', 0, 0), -(28, '通才', 2, '通才', '在多个标签领域活跃', 0, 0), -(29, '专家', 2, '专家', '在一个标签领域活跃出众', 0, 0), -(30, '老鸟', 2, '老鸟', '活跃超过一年的用户', 0, 0), -(31, '最受关注问题', 2, '最受关注问题', '问题的浏览量超过2500人次', 1, 0), -(32, '学问家', 2, '学问家', '第一次回答被投赞成票10次以上', 0, 0), -(33, 'beta用户', 2, 'beta用户', 'beta期间活跃参与', 0, 0), -(34, '导师', 2, '导师', '被指定为最佳答案并且赞成票40以上', 1, 0), -(35, '巫师', 2, '巫师', '在提问60天之后回答并且赞成票5次以上', 1, 0), -(36, '分类专家', 2, '分类专家', '创建的标签被50个以上问题使用', 1, 0); diff --git a/sql_scripts/update_2009_01_24.sql b/sql_scripts/update_2009_01_24.sql deleted file mode 100644 index 45b83935..00000000 --- a/sql_scripts/update_2009_01_24.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE award ADD COLUMN `content_type_id` int(11); -ALTER TABLE award ADD COLUMN `object_id` int(10); \ No newline at end of file diff --git a/sql_scripts/update_2009_01_25_001.sql b/sql_scripts/update_2009_01_25_001.sql deleted file mode 100644 index 16c3487b..00000000 --- a/sql_scripts/update_2009_01_25_001.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `award` ADD `content_type_id` INT NULL -ALTER TABLE `award` ADD `object_id` INT NULL diff --git a/sql_scripts/update_2009_02_26_001.sql b/sql_scripts/update_2009_02_26_001.sql deleted file mode 100644 index a6af5931..00000000 --- a/sql_scripts/update_2009_02_26_001.sql +++ /dev/null @@ -1,19 +0,0 @@ -ALTER TABLE answer ADD COLUMN `accepted_at` datetime default null; - -/* Update accepted_at column with answer added datetime for existing data */ -UPDATE answer -SET accepted_at = added_at -WHERE accepted = 1 AND accepted_at IS NULL; - -/* workround for c# url problem on bluehost server */ -UPDATE tag -SET name = 'csharp' -WHERE name = 'c#' - -UPDATE question -SET tagnames = replace(tagnames, 'c#', 'csharp') -WHERE tagnames like '%c#%' - -UPDATE question_revision -SET tagnames = replace(tagnames, 'c#', 'csharp') -WHERE tagnames like '%c#%' diff --git a/sql_scripts/update_2009_04_10_001.sql b/sql_scripts/update_2009_04_10_001.sql deleted file mode 100644 index 8148632a..00000000 --- a/sql_scripts/update_2009_04_10_001.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE Tag ADD COLUMN deleted_at datetime default null; -ALTER TABLE Tag ADD COLUMN deleted_by_id INTEGER NULL; -ALTER TABLE Tag ADD COLUMN deleted TINYINT NOT NULL; diff --git a/sql_scripts/update_2009_07_05_EF.sql b/sql_scripts/update_2009_07_05_EF.sql deleted file mode 100644 index 43c7c2f0..00000000 --- a/sql_scripts/update_2009_07_05_EF.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE auth_user ADD COLUMN email_isvalid TINYINT(1) NOT NULL; -UPDATE auth_user SET email_isvalid=1; -ALTER TABLE auth_user ADD COLUMN email_key varchar(32); diff --git a/sql_scripts/update_2009_12_24_001.sql b/sql_scripts/update_2009_12_24_001.sql deleted file mode 100644 index 3d082c2f..00000000 --- a/sql_scripts/update_2009_12_24_001.sql +++ /dev/null @@ -1,5 +0,0 @@ -alter table question add column `vote_up_count` int(11) NOT NULL; -alter table question add column `vote_down_count` int(11) NOT NULL; - -alter table answer add column `vote_up_count` int(11) NOT NULL; -alter table answer add column `vote_down_count` int(11) NOT NULL; \ No newline at end of file diff --git a/sql_scripts/update_2009_12_27_001.sql b/sql_scripts/update_2009_12_27_001.sql deleted file mode 100644 index e2da7d4d..00000000 --- a/sql_scripts/update_2009_12_27_001.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE comment DROP INDEX content_type_id; - -ALTER TABLE comment ADD INDEX `content_type_id` (`content_type_id`,`object_id`,`user_id`); \ No newline at end of file diff --git a/sql_scripts/update_2009_12_27_002.sql b/sql_scripts/update_2009_12_27_002.sql deleted file mode 100644 index a36470bf..00000000 --- a/sql_scripts/update_2009_12_27_002.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `vote` ADD `voted_at` DATETIME NOT NULL \ No newline at end of file diff --git a/sql_scripts/update_2010_01_23.sql b/sql_scripts/update_2010_01_23.sql deleted file mode 100755 index 621207be..00000000 --- a/sql_scripts/update_2010_01_23.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE `fbconnect_fbassociation` ( - `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, - `user_id` integer NOT NULL, - `fbuid` varchar(12) NOT NULL UNIQUE -) -; -ALTER TABLE `fbconnect_fbassociation` ADD CONSTRAINT `user_id_refs_id_3534873d` -FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`); -CREATE INDEX `fbconnect_fbassociation_user_id` ON `fbconnect_fbassociation` (`user_id`); diff --git a/sql_scripts/update_2010_02_22.sql b/sql_scripts/update_2010_02_22.sql deleted file mode 100644 index 2778885a..00000000 --- a/sql_scripts/update_2010_02_22.sql +++ /dev/null @@ -1 +0,0 @@ -alter table answer add column deleted_at datetime; diff --git a/stackexchange/ANOMALIES b/stackexchange/ANOMALIES deleted file mode 100644 index 05a7dbdb..00000000 --- a/stackexchange/ANOMALIES +++ /dev/null @@ -1,14 +0,0 @@ -* several user accounts with same email -* users with no openid -* users with no email (hack: gravatar set to settings.ANONYMOUS_USER_EMAIL) -* users with no screen name -* users with no email and no screen name (25% in homeschool) -* tag preferences are not stored explicitly (interesting/ignored) - maybe they are in se.User.preferences_raw - but the data there is not marked up and is kind of cryptic -* we don't have Community user. SE has one with id=-1 - this id may break the load script - potential break places are anywhere where is X.get_user() call - issues may happen with larger data sets where activity - of user "Community" is somehow reflected in a way - that load_stackexchange does not take care of diff --git a/stackexchange/README b/stackexchange/README deleted file mode 100644 index 64d8f5fb..00000000 --- a/stackexchange/README +++ /dev/null @@ -1,62 +0,0 @@ -this app's function will be to: - -* install it's own tables (#todo: not yet automated) -* read SE xml dump into DjangoDB (automated) -* populate osqa database (automated) -* remove SE tables (#todo: not done yet) - -Current process to load SE data into OSQA is: -============================================== - -1) backup database - -2) unzip SE dump into dump_dir (any directory name) - you may want to make sure that your dump directory in .gitignore file - so that you don't publish it by mistake - -3) enable 'stackexchange' in the list of installed apps (probably aready in settings.py) - -4) (optional - create models.py for SE, which is included anyway) run: - - #a) run in-place removal of xml namspace prefix to make parsing easier - perl -pi -w -e 's/xs://g' $SE_DUMP_PATH/xsd/*.xsd - cd stackexchange - python parse_models.py $SE_DUMP_PATH/xsd/*.xsd > models.py - -5) Install stackexchange models (as well as any other missing models) - python manage.py syncdb - -6) make sure that osqa badges are installed - if not, run (example for mysql): - - mysql -u user -p dbname < sql_scripts/badges.sql - -7) load SE data: - - python manage.py load_stackexchange dump_dir - - if anything doesn't go right - run 'python manage.py flush' and repeat - steps 6 and 7 - -NOTES: -============ - -Here is the load script that I used for the testing -it assumes that SE dump has been unzipped inside the tmp directory - - #!/bin/sh$ - python manage.py flush - #delete all data - mysql -u osqa -p osqa < sql_scripts/badges.sql - python manage.py load_stackexchange tmp - -Untested parts are tagged with comments starting with -#todo: - -The test set did not have all the usage cases of StackExchange represented so -it may break with other sets. - -The job takes some time to run, especially -content revisions and votes - may be optimized - -Some of the fringe cases are described in file stackexchange/ANOMALIES diff --git a/stackexchange/__init__.py b/stackexchange/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/stackexchange/management/__init__.py b/stackexchange/management/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/stackexchange/management/commands/__init__.py b/stackexchange/management/commands/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/stackexchange/management/commands/load_stackexchange.py b/stackexchange/management/commands/load_stackexchange.py deleted file mode 100644 index 9cfc7192..00000000 --- a/stackexchange/management/commands/load_stackexchange.py +++ /dev/null @@ -1,804 +0,0 @@ -from django.core.management.base import BaseCommand -from django.template.defaultfilters import slugify #todo: adopt unicode-aware slugify -#todo: http://stackoverflow.com/questions/837828/how-to-use-a-slug-in-django -import os -import re -import sys -import stackexchange.parse_models as se_parser -from xml.etree import ElementTree as et -from django.db import models -import forum.models as askbot -import stackexchange.models as se -from forum.forms import EditUserEmailFeedsForm -from forum.utils.html import sanitize_html -from django.conf import settings -from django.contrib.auth.models import Message as DjangoMessage -from django.utils.translation import ugettext as _ -#from markdown2 import Markdown -#markdowner = Markdown(html4tags=True) - -xml_read_order = ( - 'VoteTypes','UserTypes','Users','Users2Votes', - 'Badges','Users2Badges','CloseReasons','FlatPages', - 'MessageTypes','PostHistoryTypes','PostTypes','SchemaVersion', - 'Settings','SystemMessages','ThemeResources','ThemeTextResources', - 'ThrottleBucket','UserHistoryTypes','UserHistory', - 'Users2Badges','VoteTypes','Users2Votes','MessageTypes', - 'Posts','Posts2Votes','PostHistory','PostComments', - 'ModeratorMessages','Messages','Comments2Votes', - ) - -#association tables SE item id --> ASKBOT item id -#table associations are implied -#todo: there is an issue that these may be inconsistent with the database -USER = {}#SE User.id --> django(ASKBOT) User.id -QUESTION = {} -ANSWER = {} -NAMESAKE_COUNT = {}# number of times user name was used - for X.get_screen_name - -class X(object):# - """class with methods for handling some details - of SE --> ASKBOT mapping - """ - badge_type_map = {'1':'gold','2':'silver','3':'bronze'} - - askbot_supported_id_providers = ( - 'google','yahoo','aol','myopenid', - 'flickr','technorati', - 'wordpress','blogger','livejournal', - 'claimid','vidoop','verisign', - 'openidurl','facebook','local', - 'twitter' #oauth is not on this list, b/c it has no own url - ) - - #map SE VoteType -> askbot.User vote method - #created methods with the same call structure in askbot.User - #User.(post, timestamp=None, cancel=False) - vote_actions = { - 'UpMod':'upvote', - 'DownMod':'downvote', - 'AcceptedByOriginator':'accept_answer', - 'Offensive':'flag_post', - 'Favorite':'toggle_favorite_question', - } - - #these modes cannot be mixed - #only wiki is assumed to be mixable - exclusive_revision_modes = ( - 'initial','edit','rollback','lock', - 'migrate','close','merge','delete', - ) - - #badges whose names don't match exactly, but - #present in both SE and ASKBOT - badge_exceptions = {# SE --> ASKBOT - 'Citizen Patrol':'Citizen patrol',#single #todo: why sentence case? - 'Strunk & White':'Strunk & White',#single - 'Civic Duty':'Civic duty', - } - - revision_type_map = { - 'Initial Title':'initial', - 'Initial Body':'initial', - 'Initial Tags':'initial', - 'Edit Title':'edit', - 'Edit Body':'edit', - 'Edit Tags':'edit', - 'Rollback Title':'rollback', - 'Rollback Body':'rollback', - 'Rollback Tags':'rollback', - 'Post Closed':'close', - 'Post Reopened':'close', - 'Post Deleted':'delete', - 'Post Undeleted':'delete', - 'Post Locked':'lock', - 'Post Unlocked':'lock', - 'Community Owned':'wiki', - 'Post Migrated':'migrate', - 'Question Merged':'merge', - } - - close_reason_map = { - 1:1,#duplicate - 2:2,#off-topic - 3:3,#subjective and argumentative - 4:4,#not a real question - 5:7,#offensive - 6:6,#irrelevant or outdated question - 7:9,#too localized - 10:8,#spam - } - - @classmethod - def get_message_text(cls, se_m): - """try to intelligently translate - SE message to ASKBOT so that it makese sense in - our context - """ - #todo: properly translate messages - #todo: maybe work through more instances of messages - if se_m.message_type.name == 'Badge Notification': - return se_m.text - else: - if 'you are now an administrator' in se_m.text: - return _('Congratulations, you are now an Administrator') - elif re.search(r'^You have \d+ new',se_m.text): - bits = se_m.text.split('.') - text = bits[0] - if se_m.user.id == -1: - return None - url = cls.get_user(se_m.user).get_profile_url() - return '%s' % (url,text) - return None - - @classmethod - def get_post(cls, se_post): - #todo: fix this hack - either in-memory id association table - #or use database to store these associations - post_type = se_post.post_type.name - if post_type == 'Question': - return askbot.Question.objects.get(id=QUESTION[se_post.id].id) - elif post_type == 'Answer': - return askbot.Answer.objects.get(id=ANSWER[se_post.id].id) - else: - raise Exception('unknown post type %s' % post_type) - - @classmethod - def get_close_reason(cls, se_reason): - #todo: this is a guess - have not seen real data - se_reason = int(se_reason) - return cls.close_reason_map[se_reason] - - @classmethod - def get_user(cls, se_user): - #todo: same as get_post - return askbot.User.objects.get(id=USER[se_user.id].id) - - @classmethod - def get_post_revision_group_types(cls, rev_group): - rev_types = {} - for rev in rev_group: - rev_type = cls.get_post_revision_type(rev) - rev_types[rev_type] = 1 - rev_types = rev_types.keys() - - #make sure that exclusive rev modes are not mixed - exclusive = cls.exclusive_revision_modes - if len(rev_types) > 1 and all([t in exclusive for t in rev_types]): - tstr = ','.join(rev_types) - gstr = ','.join([str(rev.id) for rev in rev_group]) - msg = 'incompatible revision types %s in PostHistory %s' % (tstr,gstr) - raise Exception(msg) - return rev_types - - @classmethod - def clean_tags(cls, tags): - tags = re.subn(r'\s+',' ',tags.strip())[0] - bits = tags.split(' ') - tags = ' '.join([bit[1:-1] for bit in bits]) - tags = re.subn(r'\xf6','-',tags)[0] - return tags - - @classmethod - def get_screen_name(cls, name): - """always returns unique screen name - even if there are multiple users in SE - with the same exact screen name - """ - if name is None: - name = 'anonymous' - name = name.strip() - name = re.subn(r'\s+',' ',name)[0]#remove repeating spaces - - try: - u = askbot.User.objects.get(username = name) - try: - if u.location: - name += ', %s' % u.location - if name in NAMESAKE_COUNT: - NAMESAKE_COUNT[name] += 1 - name += ' %d' % NAMESAKE_COUNT[name] - else: - NAMESAKE_COUNT[name] = 1 - except askbot.User.DoesNotExist: - pass - except askbot.User.DoesNotExist: - NAMESAKE_COUNT[name] = 1 - return name - - @classmethod - def get_email(cls, email):#todo: fix fringe case - user did not give email! - if email is None: - return settings.ANONYMOUS_USER_EMAIL - else: - assert(email != '') - return email - - @classmethod - def get_post_revision_type(cls, rev): - rev_name = rev.post_history_type.name - rev_type = cls.revision_type_map.get(rev_name, None) - if rev_type is None: - raise Exception('dont understand revision type %s' % rev) - return rev_type - - #crude method of getting id provider name from the url - @classmethod - def get_openid_provider_name(cls, openid_url): - openid_str = str(openid_url) - bits = openid_str.split('/') - base_url = bits[2] #assume this is base url - url_bits = base_url.split('.') - provider_name = url_bits[-2].lower() - if provider_name not in cls.askbot_supported_id_providers: - raise Exception('could not determine login provider for %s' % openid_url) - return provider_name - - @staticmethod - def blankable(input): - if input is None: - return '' - else: - return input - - @classmethod - def parse_badge_summary(cls, badge_summary): - (gold,silver,bronze) = (0,0,0) - if badge_summary: - if len(badge_summary) > 3: - print 'warning: guessing that badge summary is comma separated' - print 'have %s' % badge_summary - bits = badge_summary.split(',') - else: - bits = [badge_summary] - for bit in bits: - m = re.search(r'^(?P[1-3])=(?P\d+)$', bit) - if not m: - raise Exception('could not parse badge summary: %s' % badge_summary) - else: - badge_type = cls.badge_type_map[m.groupdict()['type']] - locals()[badge_type] = int(m.groupdict()['count']) - return (gold,silver,bronze) - - @classmethod - def get_badge_name(cls, name): - return cls.badge_exceptions.get(name, name) - -class Command(BaseCommand): - help = 'Loads StackExchange data from unzipped directory of XML files into the ASKBOT database' - args = 'se_dump_dir' - - def handle(self, *arg, **kwarg): - if len(arg) < 1 or not os.path.isdir(arg[0]): - print 'Error: first argument must be a directory with all the SE *.xml files' - sys.exit(1) - - self.dump_path = arg[0] - #read the data into SE tables - for xml in xml_read_order: - xml_path = self.get_xml_path(xml) - table_name = self.get_table_name(xml) - self.load_xml_file(xml_path, table_name) - - #this is important so that when we clean up messages - #automatically generated by the procedures below - #we do not delete old messages - #todo: unfortunately this may need to be redone - #when we upgrade to django 1.2 and definitely by 1.4 when - #the current message system will be replaced with the - #django messages framework - self.save_askbot_message_id_list() - - #transfer data into ASKBOT tables - print 'Transferring users...', - sys.stdout.flush() - self.transfer_users() - print 'done.' - print 'Transferring content edits...', - sys.stdout.flush() - self.transfer_question_and_answer_activity() - print 'done.' - print 'Transferring view counts...', - sys.stdout.flush() - self.transfer_question_view_counts() - print 'done.' - print 'Transferring comments...', - sys.stdout.flush() - self.transfer_comments() - print 'done.' - print 'Transferring badges and badge awards...', - sys.stdout.flush() - self.transfer_badges() - print 'done.' - print 'Transferring votes...', - sys.stdout.flush() - self.transfer_votes()#includes favorites, accepts and flags - print 'done.' - - self.cleanup_messages()#delete autogenerated messages - self.transfer_messages() - - #todo: these are not clear how to go about - self.transfer_update_subscriptions() - self.transfer_tag_preferences() - self.transfer_meta_pages() - - def save_askbot_message_id_list(self): - id_list = list(DjangoMessage.objects.all().values('id')) - self._askbot_message_id_list = id_list - - def cleanup_messages(self): - """deletes messages generated by the load process - """ - id_list = self._askbot_message_id_list - mset = DjangoMessage.objects.all().exclude(id__in=id_list) - mset.delete() - - def transfer_messages(self): - """transfers some messages from - SE to ASKBOT - """ - for m in se.Message.objects.all(): - if m.is_read: - continue - if m.user.id == -1: - continue - u = X.get_user(m.user) - text = X.get_message_text(m) - if text: - u.message_set.create( - message=text, - ) - - def _process_post_initial_revision_group(self, rev_group): - - title = None - text = None - tags = None - wiki = False - author = USER[rev_group[0].user.id] - added_at = rev_group[0].creation_date - - for rev in rev_group: - rev_type = rev.post_history_type.name - if rev_type == 'Initial Title': - title = rev.text - elif rev_type == 'Initial Body': - text = rev.text - elif rev_type == 'Initial Tags': - tags = X.clean_tags(rev.text) - elif rev_type == 'Community Owned': - wiki = True - else: - raise Exception('unexpected revision type %s' % rev_type) - - post_type = rev_group[0].post.post_type.name - if post_type == 'Question': - q = askbot.Question.objects.create_new( - title = title, - author = author, - added_at = added_at, - wiki = wiki, - tagnames = tags, - text = text - ) - QUESTION[rev_group[0].post.id] = q - elif post_type == 'Answer': - q = X.get_post(rev_group[0].post.parent) - a = askbot.Answer.objects.create_new( - question = q, - author = author, - added_at = added_at, - wiki = wiki, - text = text, - ) - ANSWER[rev_group[0].post.id] = a - else: - post_id = rev_group[0].post.id - raise Exception('unknown post type %s for id=%d' % (post_type, post_id)) - - def _process_post_edit_revision_group(self, rev_group): - #question apply edit - (title, text, tags) = (None, None, None) - for rev in rev_group: - rev_type = rev.post_history_type.name - if rev_type == 'Edit Title': - title = rev.text - elif rev_type == 'Edit Body': - text = rev.text - elif rev_type == 'Edit Tags': - tags = X.clean_tags(rev.text) - elif rev_type == 'Community Owned': - pass - else: - raise Exception('unexpected revision type %s' % rev_type) - - rev0 = rev_group[0] - edited_by = USER[rev0.user.id] - edited_at = rev0.creation_date - comment = ';'.join([rev.comment for rev in rev_group if rev.comment]) - post_type = rev0.post.post_type.name - - if post_type == 'Question': - q = X.get_post(rev0.post) - q.apply_edit( - edited_at = edited_at, - edited_by = edited_by, - title = title, - text = text, - comment = comment, - tags = tags, - ) - elif post_type == 'Answer': - a = X.get_post(rev0.post) - a.apply_edit( - edited_at = edited_at, - edited_by = edited_by, - text = text, - comment = comment, - ) - - def _make_post_wiki(self, rev_group): - #todo: untested - for rev in rev_group: - if rev.post_history_type.name == 'Community Owned': - p = X.get_post(rev.post) - u = X.get_user(rev.user) - t = rev.creation_date - p.wiki = True - p.wikified_at = t - p.wikified_by = u - self.mark_activity(p,u,t) - p.save() - return - - def mark_activity(self,p,u,t): - """p,u,t - post, user, timestamp - """ - if isinstance(p, askbot.Question): - p.last_activity_by = u - p.last_activity_at = t - elif isinstance(p, askbot.Answer): - p.question.last_activity_by = u - p.question.last_activity_at = t - p.question.save() - - def _process_post_rollback_revision_group(self, rev_group): - #todo: don't know what to do here as there were no - #such data available - pass - - def _process_post_lock_revision_group(self, rev_group): - #todo: untested - for rev in rev_group: - rev_type = rev.post_history_type.name - if rev_type.endswith('ocked'): - t = rev.creation_date - u = X.get_user(rev.user) - p = X.get_post(rev.post) - if rev_type == 'Post Locked': - p.locked = True - p.locked_by = u - p.locked_at = t - elif rev_type == 'Post Unlocked': - p.locked = False - p.locked_by = None - p.locked_at = None - else: - return - self.mark_activity(p,u,t) - p.save() - return - - def _process_post_close_revision_group(self, rev_group): - #todo: untested - for rev in rev_group: - if rev.post.post_type.name != 'Question': - return - rev_type = rev.post_history_type.name - if rev_type in ('Post Closed', 'Post Reopened'): - t = rev.creation_date - u = X.get_user(rev.user) - p = X.get_post(rev.post) - if rev_type == 'Post Closed': - p.closed = True - p.closed_at = t - p.closed_by = u - p.close_reason = X.get_close_reason(rev.text) - elif rev_type == 'Post Reopened': - p.closed = False - p.closed_at = None - p.closed_by = None - p.close_reason = None - self.mark_activity(p,u,t) - p.save() - return - - def _process_post_delete_revision_group(self, rev_group): - #todo: untested - for rev in rev_group: - rev_type = rev.post_history_type.name - if rev_type.endswith('eleted'): - t = rev.creation_date - u = X.get_user(rev.user) - p = X.get_post(rev.post) - if rev_type == 'Post Deleted': - p.deleted = True - p.deleted_at = t - p.deleted_by = u - elif rev_type == 'Post Undeleted': - p.deleted = False - p.deleted_at = None - p.deleted_by = None - self.mark_activity(p,u,t) - p.save() - return - - def _process_post_revision_group(self, rev_group): - #determine revision type - #'initial','edit','rollback','lock', - #'migrate','close','merge','delete', - rev_types = X.get_post_revision_group_types(rev_group) - if 'initial' in rev_types: - self._process_post_initial_revision_group(rev_group) - elif 'edit' in rev_types: - self._process_post_edit_revision_group(rev_group) - elif 'rollback' in rev_types: - self._process_post_rollback_revision_group(rev_group) - elif 'lock' in rev_types: - self._process_post_lock_revision_group(rev_group) - elif 'close' in rev_types: - self._process_post_close_revision_group(rev_group) - elif 'delete' in rev_types: - self._process_post_delete_revision_group(rev_group) - else: - pass - #todo: rollback, lock, close and delete are - #not tested - #merge and migrate actions are ignored - #wiki is mixable with other groups, so process it in addition - if 'wiki' in rev_types: - self._make_post_wiki(rev_group) - - def transfer_tag_preferences(self): - #todo: figure out where these are stored in SE - #maybe in se.User.preferences_raw? - pass - - def transfer_question_and_answer_activity(self): - """transfers all question and answer - edits and related status changes - """ - #assuming that there are only two post types - se_revs = se.PostHistory.objects.all() - #assuming that chronologial order is correct and there - #will be no problems of data integrity upon insertion of records - se_revs = se_revs.order_by('creation_date','revision_guid') - #todo: ignored fringe case - no revisions - c_guid = se_revs[0].revision_guid - c_group = [] - #this loop groups revisions by revision id, then calls process function - #for the revision grup (elementary revisions posted at once) - for se_rev in se_revs: - if se_rev.revision_guid == c_guid: - c_group.append(se_rev) - else: - self._process_post_revision_group(c_group) - c_group = [] - c_group.append(se_rev) - c_guid = se_rev.revision_guid - if len(c_group) != 0: - self._process_post_revision_group(c_group) - - def transfer_comments(self): - for se_c in se.PostComment.objects.all(): - if se_c.deletion_date: - print 'Warning deleted comment %d dropped' % se_c.id - continue - se_post = se_c.post - if se_post.post_type.name == 'Question': - askbot_post = QUESTION[se_post.id] - elif se_post.post_type.name == 'Answer': - askbot_post = ANSWER[se_post.id] - - askbot_post.add_comment( - comment = se_c.text, - added_at = se_c.creation_date, - user = USER[se_c.user.id] - ) - - def _install_missing_badges(self): - self._missing_badges = {} - for se_b in se.Badge.objects.all(): - name = X.get_badge_name(se_b.name) - try: - askbot.Badge.objects.get(name=name) - except: - self._missing_badges[name] = 0 - if len(se_b.description) > 300: - print 'Warning truncated description for badge %d' % se_b.id - askbot.Badge.objects.create( - name = name, - slug = slugify(name), - description = se_b.description, - multiple = (not se_b.single), - type = se_b.class_type - ) - - def _award_badges(self): - #note: SE does not keep information on - #content-related badges like askbot does - for se_a in se.User2Badge.objects.all(): - if se_a.user.id == -1: - continue #skip community user - u = USER[se_a.user.id] - badge_name = X.get_badge_name(se_a.badge.name) - b = askbot.Badge.objects.get(name=badge_name) - if b.multiple == False: - if b.award_badge.count() > 0: - continue - #todo: fake content object here b/c SE does not support this - #todo: but askbot requires related content object - askbot.Award.objects.create( - user=u, - badge=b, - awarded_at=se_a.date, - content_object=u, - ) - if b.name in self._missing_badges: - self._missing_badges[b.name] += 1 - - def _cleanup_badges(self): - d = self._missing_badges - unused = [name for name in d.keys() if d[name] == 0] - askbot.Badge.objects.filter(name__in=unused).delete() - installed = [name for name in d.keys() if d[name] > 0] - print 'Warning - following unsupported badges were installed:' - print ', '.join(installed) - - def transfer_badges(self): - #note: badge level is neglected - #1) install missing badges - self._install_missing_badges() - #2) award badges - self._award_badges() - #3) delete unused newly installed badges - self._cleanup_badges() - pass - - def transfer_question_view_counts(self): - for se_q in se.Post.objects.filter(post_type__name='Question'): - q = X.get_post(se_q) - q.view_count = se_q.view_count - q.save() - - - def transfer_votes(self): - for v in se.Post2Vote.objects.all(): - vote_type = v.vote_type.name - if not vote_type in X.vote_actions: - continue - - u = X.get_user(v.user) - p = X.get_post(v.post) - m = X.vote_actions[vote_type] - vote_method = getattr(askbot.User, m) - vote_method(u, p, timestamp = v.creation_date) - if v.deletion_date: - vote_method(u, p, timestamp = v.deletion_date, cancel=True) - - def transfer_update_subscriptions(self): - #todo: not clear where this is stored in SE - #maybe in se.User.preferences_raw? - pass - - def transfer_meta_pages(self): - #here we actually don't have anything in the database yet - #so we can't do this - pass - - def load_xml_file(self, xml_path, table_name): - tree = et.parse(xml_path) - print 'loading from %s to %s' % (xml_path, table_name) , - model = models.get_model('stackexchange', table_name) - i = 0 - for row in tree.findall('.//row'): - model_entry = model() - i += 1 - for col in row.getchildren(): - field_name = se_parser.parse_field_name(col.tag) - field_type = model._meta.get_field(field_name) - field_value = se_parser.parse_value(col.text, field_type) - setattr(model_entry, field_name, field_value) - model_entry.save() - print '... %d objects saved' % i - - def get_table_name(self,xml): - return se_parser.get_table_name(xml) - - def get_xml_path(self, xml): - xml_path = os.path.join(self.dump_path, xml + '.xml') - if not os.path.isfile(xml_path): - print 'Error: file %s not found' % xml_path - sys.exit(1) - return xml_path - - def transfer_users(self): - for se_u in se.User.objects.all(): - if se_u.id < 1:#skip the Community user - continue - u = askbot.User() - u_type = se_u.user_type.name - if u_type == 'Administrator': - u.is_superuser = True - elif u_type == 'Moderator': - u.is_staff = True - elif u_type not in ('Unregistered', 'Registered'): - raise Exception('unknown user type %s' % u_type) - - #if user is not registered, no association record created - #we do not allow posting by users who are not authenticated - #probably they'll just have to "recover" their account by email - if u_type != 'Unregistered': - assert(se_u.open_id)#everybody must have open_id - u_auth = askbot.AuthKeyUserAssociation() - u_auth.key = se_u.open_id - u_auth.provider = X.get_openid_provider_name(se_u.open_id) - u_auth.added_at = se_u.creation_date - - if se_u.open_id is None and se_u.email is None: - print 'Warning: SE user %d is not recoverable (no email or openid)' - - u.reputation = 1#se_u.reputation, it's actually re-computed - u.last_seen = se_u.last_access_date - u.email = X.get_email(se_u.email) - u.location = X.blankable(se_u.location) - u.date_of_birth = se_u.birthday #dattime -> date - u.website = X.blankable(se_u.website_url) - u.about = X.blankable(se_u.about_me) - u.last_login = se_u.last_login_date - u.date_joined = se_u.creation_date - u.is_active = True #todo: this may not be the case - - u.username = X.get_screen_name(se_u.display_name) - u.real_name = X.blankable(se_u.real_name) - - (gold,silver,bronze) = X.parse_badge_summary(se_u.badge_summary) - u.gold = gold - u.silver = silver - u.bronze = bronze - - #todo: we don't have these fields - #views - number of profile views? - #has_replies - #has_message - #opt_in_recruit - #last_login_ip - #open_id_alt - ?? - #preferences_raw - not clear how to use - #display_name_cleaned - lowercased, srtipped name - #timed_penalty_date - #phone - - #don't know how to handle these - there was no usage example - #password_id - #guid - - #ignored - #last_email_date - this translates directly to EmailFeedSetting.reported_at - - #save the data - u.save() - form = EditUserEmailFeedsForm() - form.reset() - if se_u.opt_in_email == True:#set up daily subscription on "own" items - form.initial['individually_selected'] = 'd' - form.initial['asked_by_me'] = 'd' - form.initial['answered_by_me'] = 'd' - # - form.save(user=u, save_unbound=True) - - if 'u_auth' in locals(): - u_auth.user = u - u_auth.save() - USER[se_u.id] = u diff --git a/stackexchange/models.py b/stackexchange/models.py deleted file mode 100644 index a30a9859..00000000 --- a/stackexchange/models.py +++ /dev/null @@ -1,266 +0,0 @@ -from django.db import models -class Badge(models.Model): - id = models.IntegerField(primary_key=True) - class_type = models.IntegerField(null=True) - name = models.CharField(max_length=50, null=True) - description = models.TextField(null=True) - single = models.NullBooleanField(null=True) - secret = models.NullBooleanField(null=True) - tag_based = models.NullBooleanField(null=True) - command = models.TextField(null=True) - award_frequency = models.IntegerField(null=True) - -class CloseReason(models.Model): - id = models.IntegerField(primary_key=True) - name = models.CharField(max_length=200, null=True) - description = models.CharField(max_length=256, null=True) - display_order = models.IntegerField(null=True) - -class Comment2Vote(models.Model): - id = models.IntegerField(primary_key=True) - post_comment = models.ForeignKey('PostComment', related_name='Comment2Vote_by_post_comment_set', null=True) - vote_type = models.ForeignKey('VoteType', related_name='Comment2Vote_by_vote_type_set', null=True) - creation_date = models.DateTimeField(null=True) - user = models.ForeignKey('User', related_name='Comment2Vote_by_user_set', null=True) - ip_address = models.CharField(max_length=40, null=True) - user_display_name = models.CharField(max_length=40, null=True) - deletion_date = models.DateTimeField(null=True) - -class FlatPage(models.Model): - id = models.IntegerField(primary_key=True) - name = models.CharField(max_length=50, null=True) - url = models.CharField(max_length=128, null=True) - value = models.TextField(null=True) - content_type = models.CharField(max_length=50, null=True) - active = models.NullBooleanField(null=True) - use_master = models.NullBooleanField(null=True) - -class Message(models.Model): - id = models.IntegerField(primary_key=True) - user = models.ForeignKey('User', related_name='Message_by_user_set', null=True) - message_type = models.ForeignKey('MessageType', related_name='Message_by_message_type_set', null=True) - is_read = models.NullBooleanField(null=True) - creation_date = models.DateTimeField(null=True) - text = models.TextField(null=True) - post = models.ForeignKey('Post', related_name='Message_by_post_set', null=True) - -class MessageType(models.Model): - id = models.IntegerField(primary_key=True) - name = models.CharField(max_length=50, null=True) - description = models.CharField(max_length=300, null=True) - -class ModeratorMessage(models.Model): - id = models.IntegerField(primary_key=True) - message_type = models.ForeignKey('MessageType', related_name='ModeratorMessage_by_message_type_set', null=True) - creation_date = models.DateTimeField(null=True) - creation_ip_address = models.CharField(max_length=40, null=True) - text = models.TextField(null=True) - user = models.ForeignKey('User', related_name='ModeratorMessage_by_user_set', null=True) - post = models.ForeignKey('Post', related_name='ModeratorMessage_by_post_set', null=True) - deletion_date = models.DateTimeField(null=True) - deletion_user = models.ForeignKey('User', related_name='ModeratorMessage_by_deletion_user_set', null=True) - deletion_ip_address = models.CharField(max_length=40, null=True) - user_display_name = models.CharField(max_length=40, null=True) - -class PostComment(models.Model): - id = models.IntegerField(primary_key=True) - post = models.ForeignKey('Post', related_name='PostComment_by_post_set', null=True) - text = models.TextField(null=True) - creation_date = models.DateTimeField(null=True) - ip_address = models.CharField(max_length=15, null=True) - user = models.ForeignKey('User', related_name='PostComment_by_user_set', null=True) - user_display_name = models.CharField(max_length=30, null=True) - deletion_date = models.DateTimeField(null=True) - deletion_user = models.ForeignKey('User', related_name='PostComment_by_deletion_user_set', null=True) - score = models.IntegerField(null=True) - -class PostHistoryType(models.Model): - id = models.IntegerField(primary_key=True) - name = models.CharField(max_length=50, null=True) - description = models.CharField(max_length=300, null=True) - -class PostHistory(models.Model): - id = models.IntegerField(primary_key=True) - post_history_type = models.ForeignKey('PostHistoryType', related_name='PostHistory_by_post_history_type_set', null=True) - post = models.ForeignKey('Post', related_name='PostHistory_by_post_set', null=True) - revision_guid = models.CharField(max_length=64, null=True) - creation_date = models.DateTimeField(null=True) - ip_address = models.CharField(max_length=40, null=True) - user = models.ForeignKey('User', related_name='PostHistory_by_user_set', null=True) - comment = models.CharField(max_length=400, null=True) - text = models.TextField(null=True) - user_display_name = models.CharField(max_length=40, null=True) - user_email = models.CharField(max_length=100, null=True) - user_website_url = models.CharField(max_length=200, null=True) - -class Post2Vote(models.Model): - id = models.IntegerField(primary_key=True) - post = models.ForeignKey('Post', related_name='Post2Vote_by_post_set', null=True) - user = models.ForeignKey('User', related_name='Post2Vote_by_user_set', null=True) - vote_type = models.ForeignKey('VoteType', related_name='Post2Vote_by_vote_type_set', null=True) - creation_date = models.DateTimeField(null=True) - deletion_date = models.DateTimeField(null=True) - target_user = models.ForeignKey('User', related_name='Post2Vote_by_target_user_set', null=True) - target_rep_change = models.IntegerField(null=True) - voter_rep_change = models.IntegerField(null=True) - comment = models.CharField(max_length=150, null=True) - ip_address = models.CharField(max_length=40, null=True) - linked_post = models.ForeignKey('Post', related_name='Post2Vote_by_linked_post_set', null=True) - -class Post(models.Model): - id = models.IntegerField(primary_key=True) - post_type = models.ForeignKey('PostType', related_name='Post_by_post_type_set', null=True) - creation_date = models.DateTimeField(null=True) - score = models.IntegerField(null=True) - view_count = models.IntegerField(null=True) - body = models.TextField(null=True) - owner_user = models.ForeignKey('User', related_name='Post_by_owner_user_set', null=True) - last_editor_user = models.ForeignKey('User', related_name='Post_by_last_editor_user_set', null=True) - last_edit_date = models.DateTimeField(null=True) - last_activity_date = models.DateTimeField(null=True) - last_activity_user = models.ForeignKey('User', related_name='Post_by_last_activity_user_set', null=True) - parent = models.ForeignKey('self', related_name='Post_by_parent_set', null=True) - accepted_answer = models.ForeignKey('self', related_name='Post_by_accepted_answer_set', null=True) - title = models.CharField(max_length=250, null=True) - tags = models.CharField(max_length=150, null=True) - community_owned_date = models.DateTimeField(null=True) - history_summary = models.CharField(max_length=150, null=True) - answer_score = models.IntegerField(null=True) - answer_count = models.IntegerField(null=True) - comment_count = models.IntegerField(null=True) - favorite_count = models.IntegerField(null=True) - deletion_date = models.DateTimeField(null=True) - closed_date = models.DateTimeField(null=True) - locked_date = models.DateTimeField(null=True) - locked_duration = models.IntegerField(null=True) - owner_display_name = models.CharField(max_length=40, null=True) - last_editor_display_name = models.CharField(max_length=40, null=True) - bounty_amount = models.IntegerField(null=True) - bounty_closes = models.DateTimeField(null=True) - bounty_closed = models.DateTimeField(null=True) - last_owner_email_date = models.DateTimeField(null=True) - -class PostType(models.Model): - id = models.IntegerField(primary_key=True) - name = models.CharField(max_length=50, null=True) - description = models.CharField(max_length=300, null=True) - -class SchemaVersion(models.Model): - version = models.IntegerField(null=True) - -class Setting(models.Model): - id = models.IntegerField(primary_key=True) - key = models.CharField(max_length=256, null=True) - value = models.TextField(null=True) - -class SystemMessage(models.Model): - id = models.IntegerField(primary_key=True) - user = models.ForeignKey('User', related_name='SystemMessage_by_user_set', null=True) - creation_date = models.DateTimeField(null=True) - text = models.TextField(null=True) - deletion_date = models.DateTimeField(null=True) - deletion_user = models.ForeignKey('User', related_name='SystemMessage_by_deletion_user_set', null=True) - -class Tag(models.Model): - id = models.IntegerField(primary_key=True) - name = models.CharField(max_length=50, null=True) - count = models.IntegerField(null=True) - user = models.ForeignKey('User', related_name='Tag_by_user_set', null=True) - creation_date = models.DateTimeField(null=True) - is_moderator_only = models.NullBooleanField(null=True) - is_required = models.NullBooleanField(null=True) - aliases = models.CharField(max_length=200, null=True) - -class ThemeResource(models.Model): - id = models.IntegerField(primary_key=True) - name = models.CharField(max_length=50, null=True) - value = models.TextField(null=True) - content_type = models.CharField(max_length=50, null=True) - version = models.CharField(max_length=6, null=True) - -class ThemeTextResource(models.Model): - id = models.IntegerField(primary_key=True) - name = models.CharField(max_length=50, null=True) - value = models.TextField(null=True) - content_type = models.CharField(max_length=50, null=True) - -class ThrottleBucket(models.Model): - id = models.IntegerField(primary_key=True) - type = models.CharField(max_length=256, null=True) - ip_address = models.CharField(max_length=64, null=True) - tokens = models.IntegerField(null=True) - last_update = models.DateTimeField(null=True) - -class UserHistoryType(models.Model): - id = models.IntegerField(primary_key=True) - name = models.CharField(max_length=50, null=True) - description = models.CharField(max_length=300, null=True) - -class UserHistory(models.Model): - id = models.IntegerField(primary_key=True) - user_history_type = models.ForeignKey('UserHistoryType', related_name='UserHistory_by_user_history_type_set', null=True) - creation_date = models.DateTimeField(null=True) - ip_address = models.CharField(max_length=40, null=True) - user = models.ForeignKey('User', related_name='UserHistory_by_user_set', null=True) - comment = models.CharField(max_length=400, null=True) - user_display_name = models.CharField(max_length=40, null=True) - moderator_user = models.ForeignKey('User', related_name='UserHistory_by_moderator_user_set', null=True) - reputation = models.IntegerField(null=True) - -class User2Badge(models.Model): - id = models.IntegerField(primary_key=True) - user = models.ForeignKey('User', related_name='User2Badge_by_user_set', null=True) - badge = models.ForeignKey('Badge', related_name='User2Badge_by_badge_set', null=True) - date = models.DateTimeField(null=True) - comment = models.CharField(max_length=50, null=True) - -class User2Vote(models.Model): - id = models.IntegerField(primary_key=True) - user = models.ForeignKey('User', related_name='User2Vote_by_user_set', null=True) - vote_type = models.ForeignKey('VoteType', related_name='User2Vote_by_vote_type_set', null=True) - target_user = models.ForeignKey('User', related_name='User2Vote_by_target_user_set', null=True) - creation_date = models.DateTimeField(null=True) - deletion_date = models.DateTimeField(null=True) - ip_address = models.CharField(max_length=40, null=True) - -class User(models.Model): - id = models.IntegerField(primary_key=True) - user_type = models.ForeignKey('UserType', related_name='User_by_user_type_set', null=True) - open_id = models.CharField(max_length=200, null=True) - reputation = models.IntegerField(null=True) - views = models.IntegerField(null=True) - creation_date = models.DateTimeField(null=True) - last_access_date = models.DateTimeField(null=True) - has_replies = models.NullBooleanField(null=True) - has_message = models.NullBooleanField(null=True) - opt_in_email = models.NullBooleanField(null=True) - opt_in_recruit = models.NullBooleanField(null=True) - last_login_date = models.DateTimeField(null=True) - last_email_date = models.DateTimeField(null=True) - last_login_ip = models.CharField(max_length=15, null=True) - open_id_alt = models.CharField(max_length=200, null=True) - email = models.CharField(max_length=100, null=True) - display_name = models.CharField(max_length=40, null=True) - display_name_cleaned = models.CharField(max_length=40, null=True) - website_url = models.CharField(max_length=200, null=True) - real_name = models.CharField(max_length=100, null=True) - location = models.CharField(max_length=100, null=True) - birthday = models.DateTimeField(null=True) - badge_summary = models.CharField(max_length=50, null=True) - about_me = models.TextField(null=True) - preferences_raw = models.TextField(null=True) - timed_penalty_date = models.DateTimeField(null=True) - guid = models.CharField(max_length=64, null=True) - phone = models.CharField(max_length=20, null=True) - password_id = models.IntegerField(null=True) - -class UserType(models.Model): - id = models.IntegerField(primary_key=True) - name = models.CharField(max_length=50, null=True) - description = models.CharField(max_length=300, null=True) - -class VoteType(models.Model): - id = models.IntegerField(primary_key=True) - name = models.CharField(max_length=50, null=True) - description = models.CharField(max_length=300, null=True) - diff --git a/stackexchange/parse_models.py b/stackexchange/parse_models.py deleted file mode 100644 index 64796e57..00000000 --- a/stackexchange/parse_models.py +++ /dev/null @@ -1,225 +0,0 @@ -from xml.etree import ElementTree as et -import sys -import re -import os -if __name__ != '__main__':#hack do not import models if run as script - from django.db import models -from datetime import datetime - -table_prefix = ''#StackExchange or something, if needed -date_time_format = '%Y-%m-%dT%H:%M:%S' #note that fractional part of second is lost -time_re = re.compile(r'(\.[\d]+)?$') -loader_app_name = os.path.dirname(__file__) - -types = { - 'unsignedByte':'models.IntegerField', - 'FK':'models.ForeignKey', - 'PK':'models.IntegerField', - 'string':'models.CharField', - 'text':'models.TextField', - 'int':'models.IntegerField', - 'boolean':'models.NullBooleanField', - 'dateTime':'models.DateTimeField', - 'base64Binary':'models.TextField', - 'double':'models.IntegerField', -} - -def camel_to_python(camel): - """http://stackoverflow.com/questions/1175208/ - """ - s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', camel) - return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() - -def singular(word): - if word.endswith('s'): - return word[:-1] - else: - return word - -def get_table_name(name): - """Determine db table name - from the basename of the .xml file - """ - out = table_prefix - if name.find('2') == -1: - out += singular(name) - else: - bits = name.split('2') - bits = map(singular, bits) - out += '2'.join(bits) - return out - -class DjangoModel(object): - def __init__(self, name): - self.name = get_table_name(name) - self.fields = [] - def add_field(self,field): - field.table = self - self.fields.append(field) - def __str__(self): - out = 'class %s(models.Model):\n' % self.name - for f in self.fields: - out += ' %s\n' % str(f) - return out - -class DjangoField(object): - def __init__(self, name, type, restriction = None): - self.name = camel_to_python(name) - if self.name == 'class': - self.name = 'class_type'#work around python keyword - self.type = type - self.table = None - self.restriction = restriction - self.relation = None - - def __str__(self): - out = '%s = %s(' % (self.name, types[self.type]) - if self.type == 'FK': - out += "'%s'" % self.relation - out += ", related_name='%s_by_%s_set'" % (self.table.name, self.name) - out += ', null=True'#nullable to make life easier - elif self.type == 'PK': - out += 'primary_key=True' - elif self.restriction != -1: - if self.type == 'string': - out += 'max_length=%s' % self.restriction - out += ', null=True' - else: - raise Exception('restriction (max_length) supported only for string type') - else: - out += 'null=True' - out += ')' - return out - - def get_type(self): - return self.type - -class DjangoPK(DjangoField): - def __init__(self): - self.name = 'id' - self.type = 'PK' - -class DjangoFK(DjangoField): - def __init__(self, source_name): - bits = source_name.split('Id') - if len(bits) == 2 and bits[1] == '': - name = bits[0] - super(DjangoFK, self).__init__(name, 'FK') - self.set_relation(name) - - def set_relation(self, name): - """some relations need to be mapped - to actual tables - """ - self.relation = table_prefix - if name.endswith('User'): - self.relation += 'User' - elif name.endswith('Post'): - self.relation += 'Post' - elif name in ('AcceptedAnswer','Parent'): - self.relation = 'self' #self-referential Post model - else: - self.relation += name - def get_relation(self): - return self.relation - -def get_col_type(col): - type = col.get('type') - restriction = -1 - if type == None: - type_e = col.find('.//simpleType/restriction') - type = type_e.get('base') - try: - restriction = int(type_e.getchildren()[0].get('value')) - except: - restriction = -1 - if restriction > 400: - type = 'text' - restriction = -1 - return type, restriction - -def make_field_from_xml_tree(xml_element): - """used by the model parser - here we need to be detailed about field types - because this defines the database schema - """ - name = xml_element.get('name') - if name == 'LinkedVoteId':#not used - return None - if name == 'Id': - field = DjangoPK() - elif name.endswith('Id') and name not in ('OpenId','PasswordId'): - field = DjangoFK(name) - elif name.endswith('GUID'): - field = DjangoField(name, 'string', 64) - else: - type, restriction = get_col_type(xml_element) - field = DjangoField(name, type, restriction) - return field - -def parse_field_name(input): - """used by the data reader - - The problem is that I've scattered - code for determination of field name over three classes: - DjangoField, DjangoPK and DjangoFK - so the function actually cretes fake field objects - many time over - """ - if input == 'Id': - return DjangoPK().name - elif input in ('OpenId', 'PasswordId'): - return DjangoField(input, 'string', 7).name#happy fake field - elif input.endswith('Id'): - return DjangoFK(input).name#real FK field - else: - return DjangoField(input, 'string', 7).name#happy fake field - -def parse_value(input, field_object): - if isinstance(field_object, models.ForeignKey): - try: - id = int(input) - except: - raise Exception('non-numeric foreign key %s' % input) - related_model = field_object.rel.to - try: - return related_model.objects.get(id=id) - except related_model.DoesNotExist: - obj = related_model(id=id) - obj.save()#save fake empty object - return obj - elif isinstance(field_object, models.IntegerField): - try: - return int(input) - except: - raise Exception('expected integer, found %s' % input) - elif isinstance(field_object, models.CharField): - return input - elif isinstance(field_object, models.TextField): - return input - elif isinstance(field_object, models.BooleanField): - try: - return bool(input) - except: - raise Exception('boolean value expected %s found' % input) - elif isinstance(field_object, models.DateTimeField): - input = time_re.sub('', input) - try: - return datetime.strptime(input, date_time_format) - except: - raise Exception('datetime expected "%s" found' % input) - -print 'from django.db import models' -for file in sys.argv: - if '.xsd' in file: - tname = os.path.basename(file).replace('.xsd','') - tree = et.parse(file) - - model = DjangoModel(tname) - - row = tree.find('.//sequence') - for col in row.getchildren(): - field = make_field_from_xml_tree(col) - if field: - model.add_field(field) - print model -- cgit v1.2.3-1-g7c22 From 1eadbe31fc08f32f3fc082f9f4474951e9f68abd Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sat, 24 Apr 2010 21:40:09 -0400 Subject: first pass on mysql full text and relaxed search stickiness --- forum/middleware/view_log.py | 2 +- .../0004_install_full_text_indexes_for_mysql.py | 389 +++++++++++++++++++++ forum/models/question.py | 16 +- forum/search/state_manager.py | 21 +- forum/views/readers.py | 16 +- 5 files changed, 436 insertions(+), 8 deletions(-) create mode 100644 forum/migrations/0004_install_full_text_indexes_for_mysql.py diff --git a/forum/middleware/view_log.py b/forum/middleware/view_log.py index 6472322b..bf0b9fbb 100644 --- a/forum/middleware/view_log.py +++ b/forum/middleware/view_log.py @@ -10,7 +10,7 @@ from forum.views.readers import question, question_revisions, answer_revisions #trigger reset of sarch state? IGNORED_VIEWS = (serve, vote, delete_comment, question_comments, answer_comments, - question, question_revisions, answer_revisions) + question_revisions, answer_revisions) class ViewLog(object): """must be modified only in this middlware diff --git a/forum/migrations/0004_install_full_text_indexes_for_mysql.py b/forum/migrations/0004_install_full_text_indexes_for_mysql.py new file mode 100644 index 00000000..0c52c442 --- /dev/null +++ b/forum/migrations/0004_install_full_text_indexes_for_mysql.py @@ -0,0 +1,389 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import DataMigration +from django.db import models +from forum.models import Question, Answer + +Q_INDEX_NAME = 'askbot_question_full_text_index' +A_INDEX_NAME = 'askbot_answer_full_text_index' +Q_TABLE_NAME = Question._meta.db_table +A_TABLE_NAME = Answer._meta.db_table + +def get_create_full_text_index_sql(index_name, table_name, column_list): + column_sql = '(%s)' % ','.join(column_list) + sql = 'CREATE FULLTEXT INDEX %s on %s %s' % (index_name, table_name, column_sql) + return sql + +def get_drop_index_sql(index_name, table_name): + return 'ALTER TABLE %s DROP INDEX %s' % (table_name, index_name) + +class Migration(DataMigration): + + def forwards(self, orm): + """install fulltext indices for mysql + will work only for MyISAM engine + and will probably fail otherwise + """ + if db.backend_name == 'mysql': + #todo: extract column names by introspection + question_index_sql = get_create_full_text_index_sql( + Q_INDEX_NAME, + Q_TABLE_NAME, + ('title','text','tagnames',) + ) + db.execute(question_index_sql) + + answer_index_sql = get_create_full_text_index_sql( + A_INDEX_NAME, + A_TABLE_NAME, + ('text',) + ) + db.execute(answer_index_sql) + + def backwards(self, orm): + "code for removal of full text indices in mysql" + if db.backend_name == 'mysql': + db.execute( + get_drop_index_sql( + Q_INDEX_NAME, + Q_TABLE_NAME, + ) + ) + db.execute( + get_drop_index_sql( + A_INDEX_NAME, + A_TABLE_NAME, + ) + ) + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'about': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'bronze': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'date_of_birth': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'email_isvalid': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'email_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'gold': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'gravatar': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), + 'hide_ignored_questions': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), + 'is_approved': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'location': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'questions_per_page': ('django.db.models.fields.SmallIntegerField', [], {'default': '10'}), + 'real_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), + 'reputation': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}), + 'silver': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'tag_filter_setting': ('django.db.models.fields.CharField', [], {'default': "'ignored'", 'max_length': '16'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}), + 'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'forum.activity': { + 'Meta': {'object_name': 'Activity', 'db_table': "u'activity'"}, + 'active_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'activity_type': ('django.db.models.fields.SmallIntegerField', [], {}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_auditted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.anonymousanswer': { + 'Meta': {'object_name': 'AnonymousAnswer'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'ip_addr': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'anonymous_answers'", 'to': "orm['forum.Question']"}), + 'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), + 'text': ('django.db.models.fields.TextField', [], {}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}) + }, + 'forum.anonymousquestion': { + 'Meta': {'object_name': 'AnonymousQuestion'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'ip_addr': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}), + 'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'text': ('django.db.models.fields.TextField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}) + }, + 'forum.answer': { + 'Meta': {'object_name': 'Answer', 'db_table': "u'answer'"}, + 'accepted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'accepted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['auth.User']"}), + 'comment_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_answers'", 'null': 'True', 'to': "orm['auth.User']"}), + 'html': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'last_edited_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_edited_answers'", 'null': 'True', 'to': "orm['auth.User']"}), + 'locked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'locked_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'locked_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'locked_answers'", 'null': 'True', 'to': "orm['auth.User']"}), + 'offensive_flag_count': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['forum.Question']"}), + 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'text': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'vote_down_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'vote_up_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'wikified_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) + }, + 'forum.answerrevision': { + 'Meta': {'object_name': 'AnswerRevision', 'db_table': "u'answer_revision'"}, + 'answer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'revisions'", 'to': "orm['forum.Answer']"}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answerrevisions'", 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'revised_at': ('django.db.models.fields.DateTimeField', [], {}), + 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}), + 'text': ('django.db.models.fields.TextField', [], {}) + }, + 'forum.authkeyuserassociation': { + 'Meta': {'object_name': 'AuthKeyUserAssociation'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'provider': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'auth_keys'", 'to': "orm['auth.User']"}) + }, + 'forum.award': { + 'Meta': {'object_name': 'Award', 'db_table': "u'award'"}, + 'awarded_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'badge': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'award_badge'", 'to': "orm['forum.Badge']"}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'notified': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'award_user'", 'to': "orm['auth.User']"}) + }, + 'forum.badge': { + 'Meta': {'unique_together': "(('name', 'type'),)", 'object_name': 'Badge', 'db_table': "u'badge'"}, + 'awarded_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'awarded_to': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'badges'", 'through': "'Award'", 'to': "orm['auth.User']"}), + 'description': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'multiple': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), + 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '50', 'blank': 'True'}), + 'type': ('django.db.models.fields.SmallIntegerField', [], {}) + }, + 'forum.book': { + 'Meta': {'object_name': 'Book', 'db_table': "u'book'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {}), + 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'cover_img': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {}), + 'pages': ('django.db.models.fields.SmallIntegerField', [], {}), + 'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}), + 'publication': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'published_at': ('django.db.models.fields.DateTimeField', [], {}), + 'questions': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'book'", 'db_table': "'book_question'", 'to': "orm['forum.Question']"}), + 'short_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.bookauthorinfo': { + 'Meta': {'object_name': 'BookAuthorInfo', 'db_table': "u'book_author_info'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {}), + 'blog_url': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Book']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.bookauthorrss': { + 'Meta': {'object_name': 'BookAuthorRss', 'db_table': "u'book_author_rss'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {}), + 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Book']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'rss_created_at': ('django.db.models.fields.DateTimeField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'url': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.comment': { + 'Meta': {'object_name': 'Comment', 'db_table': "u'comment'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'comment': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'comments'", 'to': "orm['auth.User']"}) + }, + 'forum.emailfeedsetting': { + 'Meta': {'object_name': 'EmailFeedSetting'}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'feed_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'frequency': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '8'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'reported_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), + 'subscriber': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.favoritequestion': { + 'Meta': {'object_name': 'FavoriteQuestion', 'db_table': "u'favorite_question'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Question']"}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_favorite_questions'", 'to': "orm['auth.User']"}) + }, + 'forum.flaggeditem': { + 'Meta': {'unique_together': "(('content_type', 'object_id', 'user'),)", 'object_name': 'FlaggedItem', 'db_table': "u'flagged_item'"}, + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'flagged_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'flaggeditems'", 'to': "orm['auth.User']"}) + }, + 'forum.markedtag': { + 'Meta': {'object_name': 'MarkedTag'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'reason': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'user_selections'", 'to': "orm['forum.Tag']"}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tag_selections'", 'to': "orm['auth.User']"}) + }, + 'forum.question': { + 'Meta': {'object_name': 'Question', 'db_table': "u'question'"}, + 'added_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'answer_accepted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'answer_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'questions'", 'to': "orm['auth.User']"}), + 'close_reason': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'}), + 'closed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'closed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'closed_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'closed_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'comment_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'favorited_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'favorite_questions'", 'through': "'FavoriteQuestion'", 'to': "orm['auth.User']"}), + 'favourite_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'followed_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'followed_questions'", 'to': "orm['auth.User']"}), + 'html': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_activity_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_activity_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'last_active_in_questions'", 'to': "orm['auth.User']"}), + 'last_edited_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'last_edited_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_edited_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'locked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'locked_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'locked_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'locked_questions'", 'null': 'True', 'to': "orm['auth.User']"}), + 'offensive_flag_count': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '180'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'questions'", 'to': "orm['forum.Tag']"}), + 'text': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'vote_down_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'vote_up_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'wiki': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'wikified_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) + }, + 'forum.questionrevision': { + 'Meta': {'object_name': 'QuestionRevision', 'db_table': "u'question_revision'"}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'questionrevisions'", 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'revisions'", 'to': "orm['forum.Question']"}), + 'revised_at': ('django.db.models.fields.DateTimeField', [], {}), + 'revision': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'summary': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}), + 'tagnames': ('django.db.models.fields.CharField', [], {'max_length': '125'}), + 'text': ('django.db.models.fields.TextField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}) + }, + 'forum.questionview': { + 'Meta': {'object_name': 'QuestionView'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'viewed'", 'to': "orm['forum.Question']"}), + 'when': ('django.db.models.fields.DateTimeField', [], {}), + 'who': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'question_views'", 'to': "orm['auth.User']"}) + }, + 'forum.repute': { + 'Meta': {'object_name': 'Repute', 'db_table': "u'repute'"}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'negative': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'positive': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), + 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Question']"}), + 'reputation': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'reputation_type': ('django.db.models.fields.SmallIntegerField', [], {}), + 'reputed_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.tag': { + 'Meta': {'object_name': 'Tag', 'db_table': "u'tag'"}, + 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'created_tags'", 'to': "orm['auth.User']"}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'deleted_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deleted_tags'", 'null': 'True', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'used_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}) + }, + 'forum.validationhash': { + 'Meta': {'unique_together': "(('user', 'type'),)", 'object_name': 'ValidationHash'}, + 'expiration': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2010, 4, 25, 19, 13, 13, 325125)'}), + 'hash_code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'seed': ('django.db.models.fields.CharField', [], {'max_length': '12'}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '12'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'forum.vote': { + 'Meta': {'unique_together': "(('content_type', 'object_id', 'user'),)", 'object_name': 'Vote', 'db_table': "u'vote'"}, + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'votes'", 'to': "orm['auth.User']"}), + 'vote': ('django.db.models.fields.SmallIntegerField', [], {}), + 'voted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}) + } + } + + complete_apps = ['forum'] diff --git a/forum/models/question.py b/forum/models/question.py index fa1dd257..7b70f538 100755 --- a/forum/models/question.py +++ b/forum/models/question.py @@ -82,10 +82,18 @@ class QuestionManager(models.Manager): qs = qs.filter(tags__name = tag) if search_query: - qs = qs.filter(deleted=False).extra( - where=['title like %s'], - params=['%' + search_query + '%'] - ) + try: + qs = qs.filter( Q(title__search = search_query) \ + | Q(text__search = search_query) \ + | Q(tagnames__search = search_query) \ + | Q(answers__text__search = search_query) + ) + except: + #fallback to dumb title match search + qs = qs.extra( + where=['title like %s'], + params=['%' + search_query + '%'] + ) if scope_selector: if scope_selector == 'unanswered': diff --git a/forum/search/state_manager.py b/forum/search/state_manager.py index 8a66deb3..cb1908c6 100644 --- a/forum/search/state_manager.py +++ b/forum/search/state_manager.py @@ -4,6 +4,19 @@ from forum import const import logging +ACTIVE_COMMANDS = ( + 'sort', 'search', 'query', + 'reset_query', 'reset_author', 'reset_tags', + 'tags', 'scope', 'page_size', 'start_over', + 'page' +) + +def some_in(what, where): + for element in what: + if element in where: + return True + return False + class SearchState(object): def __init__(self): self.scope= const.DEFAULT_POST_SCOPE @@ -50,7 +63,13 @@ class SearchState(object): setattr(self, key, new_value) self.reset_page() - def update_from_user_input(self,input, raw_input = {}): + def relax_stickiness(self, input, view_log): + if view_log.get_previous(1) == 'questions': + if not some_in(ACTIVE_COMMANDS, input): + self.reset() + #todo also relax if 'all' scope was clicked twice + + def update_from_user_input(self,input,raw_input = {}): #todo: this function will probably not #fit the case of multiple parameters entered at the same tiem if 'start_over' in input: diff --git a/forum/views/readers.py b/forum/views/readers.py index 7fd30a25..89a9550b 100644 --- a/forum/views/readers.py +++ b/forum/views/readers.py @@ -78,10 +78,12 @@ def questions(request):#a view generating listing of questions, used by 'unanswe if request.method == 'POST': raise Http404 + #todo: redo SearchState to accept input from + #view_log, session and request parameters search_state = request.session.get('search_state', SearchState()) view_log = request.session['view_log'] - #print view_log + if view_log.get_previous(1) != 'questions': if view_log.get_previous(2) != 'questions': #print 'user stepped too far, resetting search state' @@ -91,8 +93,18 @@ def questions(request):#a view generating listing of questions, used by 'unanswe search_state.set_logged_in() form = AdvancedSearchForm(request.GET) + #todo: form is used only for validation... if form.is_valid(): - search_state.update_from_user_input(form.cleaned_data, request.GET) + search_state.update_from_user_input( + form.cleaned_data, + request.GET, + ) + #todo: better put these in separately then analyze + #what neesd to be done, otherwise there are two routines + #that take request.GET I don't like this use of parameters + #another weakness is that order of routine calls matters here + search_state.relax_stickiness( request.GET, view_log ) + request.session['search_state'] = search_state request.session.modified = True -- cgit v1.2.3-1-g7c22 From ea6d19233238120fbf6f2c9ed173e2b51fba21c1 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sat, 24 Apr 2010 21:51:05 -0400 Subject: updated documentation --- forum/documentation/INSTALL | 8 ++++++-- forum/documentation/UPGRADE | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 forum/documentation/UPGRADE diff --git a/forum/documentation/INSTALL b/forum/documentation/INSTALL index c1a41544..6ac9ea68 100644 --- a/forum/documentation/INSTALL +++ b/forum/documentation/INSTALL @@ -74,6 +74,10 @@ and is significantly modified. http://code.google.com/p/django-authopenid/ no need to install this library B. INSTALLATION + +NOTE: If you want to upgrade software, not install from scratch - + take a look into forum/documentation/UPGRADE + ----------------------------------------------- 0. Make sure you have all above python libraries installed. @@ -257,7 +261,7 @@ WSGIPythonEggs /var/python/eggs #must be readable and writable by apache edit paths in the file forum/cron/send_email_alerts set up a cron job to call forum/cron/send_email_alerts once or twice a day subscription sender may be tested manually in shell - by calling foru/cron/send_email_alerts + by calling forum/cron/send_email_alerts 7. Sitemap Sitemap will be available at /sitemap.xml @@ -271,7 +275,7 @@ https://www.google.com/webmasters/tools/ 8. Miscellaneous -There are some demo scripts under foru/sql_scripts folder, +There are some demo scripts under forum/sql_scripts folder, including badges and test accounts for CNProg.com. You don't need them to run your sample. diff --git a/forum/documentation/UPGRADE b/forum/documentation/UPGRADE new file mode 100644 index 00000000..538b75a0 --- /dev/null +++ b/forum/documentation/UPGRADE @@ -0,0 +1,24 @@ +if you are upgrading this software, then + +* first download the newer version and write it over the old one. + +for the database migrations you will need to use django package called "south" + +Install it (if you don't have it yet) with: + + easy_install South + +* 'south' must already be in the list of INSTALLED_APPS + otherwise you must have downloaded wrong version of Askbot + +if you are using south the very first time, then type: + + python manage.py migrate forum 0001_initial --fake + +otherwise skip above step. + +Finally run + + python manage.py migrate forum --auto + +then all relevant schema and data migrations will be applied -- cgit v1.2.3-1-g7c22 From 02510a462392dd2e9e46e945d51efb374e0dc06f Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sun, 25 Apr 2010 16:46:34 -0400 Subject: fixed error in denormalization - missed first time b/c it has to be done in two places for each Q and A! --- forum/models/answer.py | 1 + forum/models/question.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/forum/models/answer.py b/forum/models/answer.py index 8910ea39..3de6cfc4 100755 --- a/forum/models/answer.py +++ b/forum/models/answer.py @@ -16,6 +16,7 @@ class AnswerManager(models.Manager): author = author, added_at = added_at, wiki = wiki, + text = text, html = sanitize_html(markdowner.convert(text)), ) if answer.wiki: diff --git a/forum/models/question.py b/forum/models/question.py index 7b70f538..683f7a3c 100755 --- a/forum/models/question.py +++ b/forum/models/question.py @@ -34,15 +34,16 @@ class QuestionManager(models.Manager): html = sanitize_html(markdowner.convert(text)) summary = strip_tags(html)[:120] question = Question( - title = title, - author = author, - added_at = added_at, + title = title, + author = author, + added_at = added_at, last_activity_at = added_at, last_activity_by = author, - wiki = wiki, - tagnames = tagnames, - html = html, - summary = summary + wiki = wiki, + tagnames = tagnames, + html = html, + text = text, + summary = summary ) if question.wiki: question.last_edited_by = question.author -- cgit v1.2.3-1-g7c22