Giter Site home page Giter Site logo

pombredanne / django-jumptoadmin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ryanberg/django-jumptoadmin

1.0 1.0 0.0 130 KB

Django templatetag for admins to easily change/delete objects from the public-facing site.

License: BSD 3-Clause "New" or "Revised" License

django-jumptoadmin's Introduction

Django JumpToAdmin

Django JumpToAdmin is a library that offers administrators easy access to the Django admin interface for any object from the public-facing interface.

(See UI screencast and an overview at http://ryanberg.net/blog/2009/sep/10/introducing-django-jumptoadmin/, and screenshots at http://emberapp.com/explore/tags/jumptoadmin)

A Django template tag outputs class names to the template. A Javascript file parses the rendered template in the browser for these classes and adds links to Change or Delete any object.

Links will also be rendered to perform any "Admin actions" specified in your admin.py files.

When clicked, these links load the Django admin pages in an iframe above the current page for easy access.

These links only appear for logged in users with admin permissions on each specified object.

Django JumpToAdmin is very immature software. If you have ideas for other capabilities please fork this project give them a try.

Dependencies

  • Django JumpToAdmin is developed against Django trunk, but should work on Django 1.0 and newer.
  • Django JumpToAdmin requires jQuery be loaded from templates to display any links

Installation

  1. Add the following package to your Python path:

    'jumptoadmin'
    
  2. Add the following to the INSTALLED_APPS list in your settings.py file:

    'jumptoadmin',
    
  3. Add the following to the TEMPLATE_CONTEXT_PROCESSORS list in your settings.py file to add a {{ JUMPTOADMIN_MEDIA_URL }} variable to the context of each template:

    'jumptoadmin.context_processors.media',
    
  4. (Optionally) At the command line, create a symbolic link from your project's media folder to the media folder inside the jumptoadmin package:

    ln -s /path/to/your/media/jumptoadmin/ /path/to/django-jumptoadmin/jumptoadmin/media/jumptoadmin/
    
  5. (Optionally) Specify an JUMPTOADMIN_MEDIA_URL variable in your settings.py file. If not specified, JUMPTOADMIN_MEDIA_URL will default to your MEDIA_URL value + 'jumptoadmin/':

    JUMPTOADMIN_MEDIA_URL = '/URL/to/your/media/jumptoadmin/'
    
  6. In your base.html template (or any specific template you'd like) add the following inside the HTML <head> to bring in the Javascript and CSS needed to show JumpToAdmin links:

    {% if user.is_staff %}<script type="text/javascript" src="{{ JUMPTOADMIN_MEDIA_URL }}js/jumptoadmin.js"></script>{% endif %}
    
    {% if user.is_staff %}<link href="{{ JUMPTOADMIN_MEDIA_URL }}css/jumptoadmin.css" rel="stylesheet" type="text/css" />{% endif %}
    
  7. In your base.html template (or any specific template you'd like) add the following just before the </body> to insert a global Javascript variable named 'jumpFlagList' that contains all the information needed to render links for each item:

    {% render_jumptoadmin_flags %}
    
  8. In any template that contains objects for which you'd like JumpToAdmin, load the "jumptoadmin" templatetag library then pass the desired object to the "jumptoadmin_flag" tag inside an HTML class:

    {% load jumptoadmin %}
    <div id="objectid" class="{% jumptoadmin_flag objectvarhere %}">...</div>
    
    {% for comment in comments %}
            <div id="c{{ comment.id }}" class="comment {% jumptoadmin_flag comment %}">
                    ...
            </div>
    {% endfor %}
    

Credits

  • Django JumpToAdmin is designed and developed by Ryan Berg
  • Django JumpToAdmin uses Thickbox Javascript adapted from ThickBox 3.1

django-jumptoadmin's People

Contributors

jezdez avatar ryanberg avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.