Is it possible to set the values for the variables in settings.py from a database table?
I'm using endless_pagination
and it has a overwrite-able setting
ENDLESS_PAGINATION_PER_PAGE = 10
,
I need to set this value with a value from my database table, is it possible?
like
config = Config.objects.get(param_name__exact="ENDLESS_PAGINATION_PER_PAGE")
settings.ENDLESS_PAGINATION_PER_PAGE= config.param_value
According to their documentation, this variable can be overwritten by your template tag:
{% paginate objects %}
{% paginate 20 objects %} {# makes it 20 per page #}
Update: using this fact, you can set a variable in your View which gets passed to the template:
{% paginate my_pagination_count objects %}