API Reference¶
This section gives a high-level overview of the main public interfaces. For full details, refer to the docstrings in the code.
Middleware¶
django_ip_access.middleware.IPAccessMiddleware- Main middleware that performs IP and hostname checks for each request.
Models¶
django_ip_access.models.GrantedIPip_address: IP address or CIDR range (e.g.192.168.1.1or192.168.1.0/24).description: Optional description.is_active: Whether this entry is currently enforced.created_at,updated_at: Timestamps.
Mixins¶
django_ip_access.mixins.IPAccessMixin- Mixin for Django class-based views and DRF views/viewsets.
- Optional attribute
ip_access_route_configto customise route matching:pattern: string.type:"regex" | "exact" | "startswith" | "endswith".
Decorators¶
django_ip_access.decorators.ip_access_required(route_config=None)- Decorator for function-based views (including DRF FBVs).
route_confighas the same shape asip_access_route_configon the mixin.