Answer the question
In order to leave comments, you need to log in
What are hooks in django and in general in the context of web development?
Explain clearly what it is and why?
Answer the question
In order to leave comments, you need to log in
Hooks - anchors for code.
I don’t know how in Django, but in many CMS it is used to bind another code to a specific point in the code.
For example in Wordpress: in the footer file you have do_action(footer_hook)
Then you can add add_action(footer_hook, hook_function) in the functions.php file (where all functions are written)
And when the site and footer are loaded, the function that is "attached" will be executed ( hooked) to the action footer_hook
Xs, I remember there were hooks in Drupal. And in dzhang something did not meet such. It's still in the git. Do you mean signals?
In Drupal it looks like this:
function hook_form_alter() {
//code
}
function MYMODULE_form_alter() {
//code
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question