First time here? Check out the FAQ!
2

What is the best way to extend askbot?

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?

xaph's avatar
1
xaph
asked 2013-04-16 14:25:17 -0600
Evgeny's avatar
13.2k
Evgeny
updated 2013-05-10 21:42:34 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

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.

Evgeny's avatar
13.2k
Evgeny
answered 2013-04-16 14:45:08 -0600
edit flag offensive 0 remove flag delete link

Comments

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 https://github.com/ASKBOT/askbot-devel/blob/master/askbot/views/readers.py#L71 this questions with extra content generators?

thanks for your reply :)

xaph's avatar xaph (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 settings.py configuration.

Evgeny's avatar Evgeny (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. https://github.com/ASKBOT/askbot-devel/blob/master/askbot/views/writers.py#L244 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's avatar xaph (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's avatar Evgeny (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's avatar xaph (2013-04-17 15:31:34 -0600) edit
add a comment see more comments