Simple Django App for location tree
Project description
Simple application for location field as TreeForeignKey (see django-mptt) with form field.
Usage
# settings.py INSTALLED_APPS += ('mptt', 'locationstree') # models.py class Place(models.Model): location = TreeForeignKey('locationstree.Location') # forms.py 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:
# settings.py CONTEXT_PROCESSORS += ('locationstree.context_processors.locations',)
The variable name is configurable via settings variable:
# settings.py LOCATIONSTREE_CONTEXT_VARIABLE_NAME = 'lugares_comunes'
It uses cache with the key name locationstree.locations and a TTL of 1 week configurable via settings variable:
# settings.py LOCATIONSTREE_CACHE_TTL = 60 * 60 * 24 # 1 day
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-locationstree-0.0.0.3.tar.gz
.
File metadata
- Download URL: django-locationstree-0.0.0.3.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 014d6c3fa1c71205c4992d58046ddf1ba3edd310151c99f3d5adfd67602422a0 |
|
MD5 | b4bab6cb6c22d2037c07a3ada1b7fb89 |
|
BLAKE2b-256 | dd076daeeb5c1c5b64c0a537961133e04ab288f8c41c56168d93074d55af931b |