Snippet List
This middleware uses Django's Geoip support (https://docs.djangoproject.com/fr/2.2/ref/contrib/gis/geoip2/), as well as axes's package helper to retrieve IP address (since Django's REMOTE_ADDR might be wrong when behind a reverse proxy).
Ensure your geolite DB files are up to date (eg. with https://djangosnippets.org/snippets/10674/).
The checker is optional, but ensures that security is not broken due to a misspelled/missing GEOIP_COUNTRY_WHITELIST.
- middleware
- ip
- country
- geoip
- restriction
- blocker
Just a dump of a countries data, including standard codes & dial-codes, based on the following model:
- Country
-- name : CharField
-- code : CharField
-- dial_code : CharField
Note that countries aren't unique, as some may have several intl. dial codes.
You can parse it using script or load it using the loaddata command.
- json
- fixtures
- data
- country
- countries
- codes
- dial_codes
- international
**Adapted from** [CountryField](http://www.djangosnippets.org/snippets/494/) - **Initial thanks to marinho**
Uses the UN country list listed in the source - this provides the 3 character ISO country code.
Ordered by display value and not country code.
Just place anywhere you like and import CountryField to use.
`country = CountryField(verbose_name="Country", help_text="The registrant's country of residence.")`
- forms
- form
- field
- list
- country
- countries
- custom
- custom-field
- countryfield
- countrys
5 snippets posted so far.