fix(module_2_filter):removed end date and changed price type

This commit is contained in:
bobbyvish
2024-07-11 12:47:39 +05:30
parent 31e9d5a03c
commit 38fad86990
2 changed files with 13 additions and 4 deletions

View File

@@ -11,9 +11,9 @@ class EventFilter(filters.FilterSet):
location = filters.CharFilter(field_name="venue__address", lookup_expr="icontains")
category = filters.CharFilter(method="filter_category")
start_date = filters.DateFilter(field_name="start_date", lookup_expr="gte")
end_date = filters.DateFilter(field_name="end_date", lookup_expr="lte")
price_from = filters.DateFilter(field_name="entry_fee", lookup_expr="gte")
price_to = filters.DateFilter(field_name="entry_fee", lookup_expr="lte")
# end_date = filters.DateFilter(field_name="end_date", lookup_expr="lte")
price_from = filters.NumberFilter(field_name="entry_fee", lookup_expr="gte")
price_to = filters.NumberFilter(field_name="entry_fee", lookup_expr="lte")
age_group = filters.CharFilter(field_name="age_group", lookup_expr="icontains")
class Meta:
@@ -23,7 +23,7 @@ class EventFilter(filters.FilterSet):
'location',
'category',
'start_date',
'end_date',
# 'end_date',
'price_from',
'price_to',
'age_group',

View File

@@ -34,6 +34,15 @@ class Venue(BaseModel):
def __str__(self):
return self.title
class AgeGroups(BaseModel):
name = models.CharField(max_length=10, unique=True)
class Meta:
db_table = "age_group"
def __str__(self):
return self.name
class EventStatus(models.TextChoices):
UPCOMING = "upcoming", "Upcoming"