compsoc-edinburgh / website-django

The website
1 stars 1 forks source link

before_filter to load nav_pages #15

Closed hmaurer closed 10 years ago

hmaurer commented 10 years ago

Is there a concept of before_filter (rails) in django? Would be better than duplicating code at https://github.com/compsoc-edinburgh/website-django/commit/6a4bd5cea2f15aade6d6206a0c56df011e7ef3f5

R2ZER0 commented 10 years ago

It could simply be abstracted into a separate function, that is then called by the views. Alternatively, a more elegant solution could involve one view inheriting from the other, i wrote code to do that somewhere... Django will likely provide a solution to a problem such as this, it must be common enough.