You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
503 B
18 lines
503 B
from copy import copy
|
|
from django import forms
|
|
from django.urls import reverse_lazy
|
|
|
|
|
|
class QueryFormBase(forms.Form):
|
|
form_action = 'products:product_list'
|
|
query_params = {}
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
self.form_action = kwargs.pop('product_form_action','products:product_list')
|
|
self.query_params = copy(kwargs.pop('query_params', {}))
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
|
|
def get_form_action_url(self):
|
|
return reverse_lazy(**self.form_action)
|
|
|