mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-21 01:48:21 +02:00
➕ Add "search transactions page"
This commit is contained in:
@ -23,10 +23,11 @@ class AmountInput(NumberInput):
|
||||
class Autocomplete(TextInput):
|
||||
template_name = "member/autocomplete_model.html"
|
||||
|
||||
def __init__(self, model, attrs=None):
|
||||
def __init__(self, model, resetable=False, attrs=None):
|
||||
super().__init__(attrs)
|
||||
|
||||
self.model = model
|
||||
self.resetable = resetable
|
||||
self.model_pk = None
|
||||
|
||||
class Media:
|
||||
@ -34,6 +35,11 @@ class Autocomplete(TextInput):
|
||||
|
||||
js = ('js/autocomplete_model.js', )
|
||||
|
||||
def get_context(self, name, value, attrs):
|
||||
context = super().get_context(name, value, attrs)
|
||||
context['widget']['resetable'] = self.resetable
|
||||
return context
|
||||
|
||||
def format_value(self, value):
|
||||
if value:
|
||||
self.attrs["model_pk"] = int(value)
|
||||
|
Reference in New Issue
Block a user