Add DatePickerInput widget to dashboard reviews sorting form
from django import forms
from django.utils.translation import gettext_lazy as _
-from oscar.core.loading import get_model
+from oscar.core.loading import get_model, get_class
+
ProductReview = get_model('reviews', 'productreview')
+DatePickerInput = get_class('oscar.forms.widgets', 'DatePickerInput')
class DashboardProductReviewForm(forms.ModelForm):
@@ -25,8 +27,10 @@ class ProductReviewSearchForm(forms.Form):
keyword = forms.CharField(required=False, label=_("Keyword"))
status = forms.ChoiceField(required=False, choices=STATUS_CHOICES,
label=_("Status"))
- date_from = forms.DateTimeField(required=False, label=_("Date from"))
- date_to = forms.DateTimeField(required=False, label=_('to'))
+ date_from = forms.DateTimeField(required=False, label=_("Date from"),
+ widget=DatePickerInput)
+ date_to = forms.DateTimeField(required=False, label=_('to'),
+ widget=DatePickerInput)
name = forms.CharField(required=False, label=_('Customer name'))
def get_friendly_status(self):
