Ask Your Question

What is the best way to extend askbot?

asked 2013-04-16 14:25:17 -0600

xaph gravatar image

updated 2013-05-10 21:42:34 -0600

Evgeny gravatar image

We want to customize the question pages of askbot. Our process will add a new integer field to question. What is the best way to do it?

1- Using askbot as a python package: override view, template, urls of asking question and also migrate post model. 2- Getting and customizing askbot-develop.

which way is better and maintenable?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-16 14:45:08 -0600

Evgeny gravatar image

If you want to be able to upgrade Askbot and still have your customizations, I would try using the custom extra context generators. They are not documented yet, but several view functions including the questions load extra template context, take a look at the source.

In that case I would probably create an additional table related to askbot_thread where I would store extra data. You could also patch the askbot's tables - but then you might need to fork askbot repo, but lose possibility of easier upgrades.

edit flag offensive delete link more


I want to store extra data in askbot_post not in thread. I can handle model and template but couldn't save my new item to db because views.writers.ask don't make mass assignment. How could I save my item without create a new view?

also did you mention this questions with extra content generators?

thanks for your reply :)

xaph gravatar imagexaph ( 2013-04-16 17:01:01 -0600 )edit

Not sure what you mean about the mass assignment. Take a look at the ask view - there is a hook to save extra data and use custom form, if necessary. In general we'll be taking this path - by injecting custom hooks via configuration.

Evgeny gravatar imageEvgeny ( 2013-04-16 17:05:48 -0600 )edit

Using a custom form and saving extra data is exactly what i want but I couldn't see such a hook. this line takes attributes one by one and I don't know where extra data is going.

I can override ask view and write my own but I don't want lose future updates.

xaph gravatar imagexaph ( 2013-04-16 17:23:45 -0600 )edit

Ah, ok. We did not implement that in the ask view, take a look at the answer. Do you want to implement the same pattern? If you do it - send me a pull request and I'll merge. Thanks.

Evgeny gravatar imageEvgeny ( 2013-04-16 17:28:06 -0600 )edit

thanks for your interest :) I'm inspecting answer view now, I'll implement same pattern and send it to you soon.

xaph gravatar imagexaph ( 2013-04-17 15:31:34 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-04-16 14:25:17 -0600

Seen: 365 times

Last updated: Apr 16 '13