Login

Tag "address"

Snippet List

Add get_addr() method to request object

I thought it would be useful to have a `get_addr()` method available on request objects, similar to the `get_host()` provided by Django. This middleware will add a `get_addr()` method to requests which uses the `X-Forwarded-For` header (useful if you're behind a proxy) if it's present and you have the `USE_X_FORWARDED_FOR` header set to `True` (default is `False`) and otherwise will use the `REMOTE_ADDR` environment variable. Note that if you are *not* behind a proxy and have `USE_X_FORWARDED_FOR` set to `True`, then clients can spoof their IP by simply setting the `X-Forwarded-For header`.

  • request
  • ip
  • header
  • address
  • client
  • remote-addr
  • x-forwarded-for
  • get-addr
Read More

Google map on admin address field

Who never wished to have valid address data by showing a little google map with a marker near the address input text ? Using js only it gets quite easy.

  • gmap
  • address
  • googlemap
Read More

Link TemplateTag that checks for permissions and url address

This template tag was built to be used in web applications that are permission based. It renders the html for an html link tag if the user has permissions to access the view (if not, returns an empty string). It also checks if the current token is the active url address and, if so, adds class="active" to the html link for presentation purposes. Example usage: 1. {% url home as home_url %} {% get_link_if_allowed home_url "Home" %} 2. {% url project_dashboard project.id as project_dashboard_url %} {% get_link_if_allowed project_dashboard_url "Projects" %}

  • template
  • url
  • permissions
  • address
Read More

MAC address field

Supported MAC formats: aa:bb:cc:dd:ee:ff, separator : or - aabbccddeeff both lower case and upper case

  • model
  • field
  • custom-field
  • address
  • mac
Read More

Address model

This is standart address model. Must match US / GB / French address and other... Specifics locales fields are notice by comments.

  • model
  • address
Read More

6 snippets posted so far.