Skip to main content

Simple Django App for location tree

Project description

Simple application for location field as TreeForeignKey (see django-mptt) with form field.


INSTALLED_APPS += ('mptt', 'locationstree')

class Place(models.Model):
  location = TreeForeignKey('locationstree.Location')

class PlaceForm(models.Model):
  location = JustLeafsLocationField(queryset=Location.objects.all())

Context Processor

There is a context processor that sets Locations.objects.all() to context with the variable name by default locations:

CONTEXT_PROCESSORS += ('locationstree.context_processors.locations',)

The variable name is configurable via settings variable:


It uses cache with the key name locationstree.locations and a TTL of 1 week configurable via settings variable:

LOCATIONSTREE_CACHE_TTL = 60 * 60 * 24 # 1 day

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-locationstree- (13.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page