Ask Your Question

hjwp's profile - activity

2014-05-25 05:11:12 -0500 received badge  Popular Question (source)
2014-05-13 14:08:47 -0500 received badge  Popular Question (source)
2014-02-26 09:59:44 -0500 received badge  Notable Question (source)
2013-05-14 02:20:18 -0500 received badge  Famous Question (source)
2013-01-23 10:18:56 -0500 received badge  Popular Question (source)
2012-08-11 13:05:41 -0500 received badge  Famous Question (source)
2012-07-28 08:54:47 -0500 received badge  Notable Question (source)
2012-07-28 08:54:47 -0500 received badge  Famous Question (source)
2012-06-29 07:31:10 -0500 received badge  Famous Question (source)
2012-04-23 16:05:32 -0500 received badge  Popular Question (source)
2011-11-24 11:56:01 -0500 asked a question database migration failure

syncdb works fine, but ./manage.py migrate fails at

askbot:0012_delete_some_unused_models

with error:

django.db.utils.IntegrityError: (1217, 'Cannot delete or update a parent row: a foreign key constraint fails')

This is with askbot running as an app alongside our own django app. We also use south, our own migrations work fine.

One worry is that, even during the syncdb, django was reporting:

(1146, "Table 'anywhere.askbot_badgedata' doesn't exist")

But it didn't stop it from doing the syncdb, or the first few migrations. More possibly pertinent traceback:

! Error found during real run of migration! Aborting.                                                 
! Since you have a database that does not support running
! schema-altering statements in transactions, we have had
! to leave it in an interim state between migrations.
 You *might* be able to recover with:   = CREATE TABLE `askbot_authkeyuserassociation`
 [etc etc]
2011-11-24 10:33:51 -0500 commented answer redirect back to askbot after login via own django app

django has a setting for the post-login default redirect, LOGIN_REDIRECT_URL, and we're using it, for when users aren't in the forums. It's easily overridden by using the next= get request. SO: feature suggestion would be to have the "please sign in" link in askbot have a next= parameter set to ASKBOT_URL (I've sent you a pull request).

for people logging in while posting a question, it may just be too hard...

2011-11-24 10:24:16 -0500 asked a question sharing templates between askbot and our own django app

Hey there,

We've been working on customising the askbot skin to fit in with the rest of our site (pythonanywhere.com, if you were getting curious!) and it would be cool to be able to re-use some of our normal django templates, since jinja2 and django are reasonably compatible... eg using {% include %}.

the problem is that askbot/jinja2 looks for its templates in ASKBOT_EXTRA_SKINS_DIR, and our templates are elsewhere. Any ideas?

2011-11-23 12:27:20 -0500 received badge  Student (source)
2011-11-23 12:21:54 -0500 asked a question redirect back to askbot after login via own django app

Next question! We're trying to integrate askbot with our own django app. Currently, after the user logs in, they are not redirected back to the askbot pages.

Normally in django you would use something like

/login/?next=/askbot

to tell your login view to redirect back to a certain page... But it looks like the default Hi there! Please sign in login link in askbot does not do this... More importantly, neither does the "Login/Signup to Post" button on the pre-login "Ask your question" form...

Should we just disable the ability to post before login?

2011-11-23 12:07:39 -0500 received badge  Self-Learner (source)
2011-11-23 12:07:39 -0500 received badge  Teacher (source)
2011-11-23 11:47:25 -0500 answered a question 'WSGIRequest' object has no attribute 'session' - error trying to integrate askbot with our own django app

(is it rude to answer my own question, when Evgeny actually answered it? still hopefully this will help for clarity):

  • you need to make sure your middlewares are loaded in the right order in settings.py

so, MIDDLEWARE_CLASSES should have been:

('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
'askbot.middleware.cancel.CancelActionMiddleware',
'django.middleware.transaction.TransactionMiddleware',
'askbot.middleware.view_log.ViewLogMiddleware',
'askbot.middleware.spaceless.SpacelessMiddleware')
2011-11-23 11:44:57 -0500 commented answer 'WSGIRequest' object has no attribute 'session' - error trying to integrate askbot with our own django app

aha - "incorrect order" was the solution - we've now re-ordered MIDDLEWARE_CLASSES so that they follow the one specified in your settings.py, and that works perfectly now.

2011-11-23 11:44:06 -0500 commented question 'WSGIRequest' object has no attribute 'session' - error trying to integrate askbot with our own django app

aha! the exact ordering of the MIDDLEWARE_CLASSES matters!

2011-11-23 11:36:57 -0500 received badge  Editor (source)
2011-11-23 11:35:16 -0500 commented answer 'WSGIRequest' object has no attribute 'session' - error trying to integrate askbot with our own django app

thanks Evgeny - here is our MIDDLEWARE_CLASSES:

2011-11-23 11:27:08 -0500 asked a question 'WSGIRequest' object has no attribute 'session' - error trying to integrate askbot with our own django app

Currently getting the following error when moving between askbot pages and our own django app:

'WSGIRequest' object has no attribute 'session'

with traceback ending at

/usr/local/lib/python2.6/dist-packages/Django-1.3.1-py2.6.egg/django/contrib/auth/__init__.py in get_user
    107.     user_id = request.session[SESSION_KEY]

Suspect this is because askbot is using different session middleware to our own - any ideas?

Minimal repro is: go to askbot section of our site (not logged in), click on "log in" link.

here is our MIDDLEWARE_CLASSES from settings.py:

('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
 'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
 'askbot.middleware.cancel.CancelActionMiddleware',
 'django.middleware.transaction.TransactionMiddleware',
 'askbot.middleware.view_log.ViewLogMiddleware',
 'askbot.middleware.spaceless.SpacelessMiddleware')

as far as I can tell, this is merged correctly with the askbot settings.py...