Reference

This section comtains documentation to module internals, useful for django-geoip developers.

GeoLocationFascade

class django_geoip.models.GeoLocationFascade(*args, **kwargs)

Interface for custom geographic models. Model represents a fascade pattern for concrete GeoIP models.

classmethod get_available_locations()

Return all locations available for users to select in frontend

Returns:GeoLocationFascade
classmethod get_by_ip_range(ip_range)

Return single model instance for given IP range. If no location matches the range, raises DoesNotExist exception.

Parameters:ip_range (IpRange) – User’s IpRange to search for.
Returns:GeoLocationFascade single object
classmethod get_default_location()

Return default location for cases where ip geolocation fails.

Returns:GeoLocationFascade

Locator

class django_geoip.base.Locator(request)

A helper class that automates user location detection.

is_store_empty()

Check whether user location will be detected by ip or fetched from storage.

Useful for integration with django-hosts.

locate()

Find out what is user location (either from his IP or cookie).

Returns:Custom location model

location_model

django_geoip.base.location_model – SimpleLazyObject to get current location model.

Project Versions

Table Of Contents

Previous topic

Settings

Next topic

Integrating with django-hosts

This Page