Simple Django application for the management of a lists of links. Originally designed for managing a dynamic list of links in a footer but can be used wherever a named set of links is required. Also provides the ability to reorder a existing list of links.
First install the code somewhere on your python path. The packaged setup.py file will let you do this via setuptools is that’s your thing.
python setup.py install
Next add linklist to your INSTALLED_APPS in settings.py for your project.
INSTALLED_APPS += ( 'linklist', )
Next we need to specify a few paths so the application can find templates and assets used for the admin. We’ll do this dynamically so as to avoid having to make local modifications.
import os import linklist # we calculate the file location of the images used for the admin LINKLIST_ROOT = os.path.dirname(os.path.realpath(linklist.__file__)) # we want to append TEMPLATE_DIRS += ( os.path.join(LINKLIST_ROOT, 'templates'), ) LINKLIST_MEDIA_URL = '/assets/' LINKLIST_MEDIA_ROOT = os.path.join(LINKLIST_ROOT, 'assets')
You’ll also want to add a couple of things to urls.py. These are for the admin only and not needed on the front end.
from django.conf import settings
And add an extra rule to your urlpatterns:
(r'^assets/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': settings.LINKLIST_MEDIA_ROOT })
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.