Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #29 #30

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ dist/
coverage.xml
pytest.xml
docs/images/*.mov
__pycache__
10 changes: 5 additions & 5 deletions src/adminfilters/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,23 @@ def queryset(self, request, queryset):
m_list = self.re_list.match(raw_value)
m_unlike = self.re_unlike.match(raw_value)
if m_unlike and m_unlike.groups():
match = "%s__exact" % self.field.name
match = "%s__exact" % self.field_path
op, value = self.re_unlike.match(raw_value).groups()
queryset = queryset.exclude(**{match: value})
else:
if m1 and m1.groups():
op, value = self.rex1.match(raw_value).groups()
match = "%s__%s" % (self.field.name, self.map[op or "="])
match = "%s__%s" % (self.field_path, self.map[op or "="])
self.filters = {match: value}
elif m_range and m_range.groups():
start, end = self.re_range.match(raw_value).groups()
self.filters = {
f"{self.field.name}__gte": start,
f"{self.field.name}__lte": end,
f"{self.field_path}__gte": start,
f"{self.field_path}__lte": end,
}
elif m_list and m_list.groups():
value = raw_value.split(",")
match = "%s__in" % self.field.name
match = "%s__in" % self.field_path
self.filters = {match: value}
# elif m_unlike and m_unlike.groups():
# match = '%s__exact' % self.field.name
Expand Down
Loading