|
I'm trying to accomplish two task:
To accomplish the first task I've modified the forum.views.writes "ask" function. Is there a better way to do this? Can I use a post_save signal for example? |
|
For sure there is a better way to extend OSQA than to edit the source code of the core. This approach will not allow you to update to the latest trunk version smoothly in future. For the purpose a separate package called All OSQA modules are located in the forum_modules folder in the root of your installation. There is a bunch of modules you can use for a base and main learning resource during development. Modules allow you to:
For the task you're trying to implement I would suggest you taking a look at the sximporter, updates and exporter modules. Consider using the decorators from the forum.views package and specifically If you want to trigger a specific action after a question has been added, just create a startup.py file in your module root directory, import the AskAction and hook the function you need executed with a syntax similar to the one in the forum.subscriptions package. You can also use decorators. I would say that you have a ready to use example in forum_modules.akismet.startup where the ask view is getting decorated. And you can disable your module anytime. Just edit the DISABLED_MODULES setting from local_settings.py. Perfect, very clean answer and suggested solution, much thanks.
(13 Aug '11, 19:36)
flowx
|