django-attachments

A generic Django application to attach Files (Attachments) to any model
Download

django-attachments Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Martin Mahner
  • Publisher web site:
  • http://www.mahner.org/

django-attachments Tags


django-attachments Description

A generic Django application to attach Files (Attachments) to any model django-attachments is a generic set of template tags for the Django framework to attach any kind of files to models.Installattion:Put attachments to your INSTALLED_APPS in your settings.py within your django project. This app provides a additional permission delete_foreign_attachments which enables that users with it can delete foreign attachments. Normally only users who uploaded the attachment, can delete it.Usage:In contrib.admin:django-attachments provides a inline object to add a list of attachments to any kind of model in your admin app.Simply add AttachmentInlines to the admin options of your model. Example:from django.contrib import adminfrom attachments.admin import AttachmentInlinesclass MyEntryOptions(admin.ModelAdmin) inlines = In your frontend templates:django-attachments comes with some templatetags to add or delete attachments for your model objects in your frontend.1. ``get_attachments_for ``: Fetches the attachments for the given model instance. You can optionally define a variable name in which the attachment list is stored in the template context. The default context variable name is attachments Example: {% get_attachments_for entry as "attachments_list" %}2. ``attachment_form``: Renders a upload form to add attachments for the given model instance. Example: {% attachment_form %} It returns an empty string if the current user is not logged in.3. ``attachment_delete_link``: Renders a link to the delete view for the given attachment. Example: {% for att in attachment_list %} {{ att }} {% attachment_delete_link att %} {% endfor %}This tag automatically checks for permission. It returns only a html link if the give n attachment's creator is the current logged in user or the user has the delete_foreign_attachments permission. Requirements: · Python What's New in This Release: · Added a note to the README that you should secure your static files.


django-attachments Related Software