Closed ipamo closed 2 years ago
This is really neat, thank you.
I'm afraid I'm going to have to revert this change back out again - I couldn't get the test suite to pass with it, and when I manually tested I got errors like this one:
I tracked that down to a KeyError
being thrown in this block of code: https://github.com/simonw/django-sql-dashboard/blob/486736fbeaae08a6cc91fafa9ffefaeeef3e05e2/django_sql_dashboard/views.py#L244-L257
Refactor parsing of (and access to) named parameters into a single extensible
Parameter
class. The feature remains the same but the implementation is cleaner.In addition, the actual
Parameter
class used by the library may be changed using a setting namedDASHBOARD_PARAMETER_CLASS
. This allows users of the library to implement custom parameter parsings without changing the default behaviour of the libary.See issue #149 for extension ideas (
%(value)d
,%(flag:true)b
, etc).Note: I changed the
id
of theinput
HTML fields (from numericalqpX
toqp_{parameterName}
) so that these fields may be generated directly from instances of theParameter
class.All tests pass.