Skip to content

Prefixlen lookups should be handled all in one, rather than three separate lookups #62

@tarkatronic

Description

@tarkatronic

As brought up in #61:

This brought to mind a thought: Instead of having 3 lookups: __prefixlen, __max_prefixlen, and __min_prefixlen, wouldn't it make sense to be able to just have a single __prefixlen and be able to chain other operations onto it? So for example you could have:

  • MyModel.objects.filter(network__prefixlen=24)
  • MyModel.objects.filter(network__prefixlen__gte=24)
  • MyModel.objects.filter(network__prefixlen__lte=24)

I don't recall the exact implementation details for something like this, but what are your thoughts?

Currently, using __gte or __lte produces the following error:

django.core.exceptions.FieldError: Unsupported lookup 'prefixlen' for CidrAddressField or join on the field not permitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions