• This repository has been archived on 13/Oct/2018
  • Stars
    star
    188
  • Rank 204,965 (Top 5 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created about 16 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Not in active development; see README -- django-frontendadmin is a set of templatetags to allow an easy and unobstrusive way to edit model-data in the frontend of your page. See wiki for screencast!

Warning

This package is not in active development. It's likely not functional with the latest Python and/or Django version. If you like to take over the project please contact me.

django-frontendadmin

django-frontendadmin is a set of templatetags to allow an easy and unobstrusive way to edit model-data in the frontend of your page.

Example project

This package provides an easy example project, a weblog with comments. Here is a quick step-by-step guide how to get this running quickly:

  1. Open your terminal and cd to the django-frontendadmin/example_project/ directory.
  2. $ ./manage.py syncdb and create a superuser.
  3. $ ./manage.py runserver and point your browser to http://127.0.0.1:8000/admin/.
  4. Authenticate yourself with the username/password you provided in step 2.
  5. Go to the frontpage http://127.0.0.1:8000/ and start playing.
  6. Put some beer in your fridge and call me. :-)

Quick installation instruction

  1. Put frontendadmin in your INSTALLED_APPS in the settings.py of your django project.

  2. Add django.core.context_processors.request to your TEMPLATE_CONTEXT_PROCESSORS in the settings.py of your django project. If this is not available (default since some days) put this snippet into your settings:

    TEMPLATE_CONTEXT_PROCESSORS = (
        'django.core.context_processors.request',
        'django.core.context_processors.auth',
        'django.core.context_processors.debug',
        'django.core.context_processors.i18n',
        'django.core.context_processors.media',
    )
    
  3. Include frontendadmin urls in your urlsconf:

    (r'^frontendadmin/', include('frontendadmin.urls')),
    
  4. Load the frontendadmin_tags library in every template you want to use the frontendamin links. (see below):

    {% load frontendadmin_tags %}
    
  5. There are three templatetags to either create, change or delete objects:

    {% frontendadmin_add queryset_of_objects label_for_link %}
    {% frontendadmin_change object_to_change label_for_link %}
    {% frontendadmin_delete object_to_delete label_for_link %}
    

    Assumed that you have a weblog application and using generic-views, your template might look so:

    {% for entry in object_list %}
    <div>
      <h2>{{ entry.title }}</h2>
      {{ entry.body }}
    <div>
    {% endfor %}
    

    A proper implementation of frontendadmin would be:

    {% frontendadmin_add object_list %}
    {% for entry in object_list %}
    <div>
      <h2>{{ entry.title }}</h2>
      {{ entry.body }}
      {% frontendadmin_change entry %}
      {% frontendadmin_delete entry %}
    <div>
    {% endfor %}
    

    Custom labels can be used as the last argument to any tag:

    {% frontendadmin_add object_list 'Post an entry' %}
    {% for entry in object_list %}
    <div>
      <h2>{{ entry.title }}</h2>
      {{ entry.body }}
      {% frontendadmin_change entry 'Edit this entry' %}
      {% frontendadmin_delete entry 'Remove it permanently' %}
    <div>
    {% endfor %}
    
  6. Thats all. Frontendadmin will automatically check whether the current user has add/change/delete permissions for the given model.

    Frontendadmin has build-in ajax support using the jquery library. See the template-sources for details.

Custom Configuration

  1. Admin forms will be used if registered with the model you are trying to use. If you have a model admin called EntryAdmin registered with django.contrib.admin.site then frontendadmin will use any form associated with, specified in EntryAdmin.Meta.form.

  2. You can also set which forms will be used for a specific model. The forms may be in your codebase, or anywhere on your python path. This is handy for custom widgets like split datetime fields and WYSIWYG editors. Set the following settings directives to see custom forms in action:

    FRONTEND_FORMS = {
        'blog.entry': 'blog.forms.EntryForm',
    }
    

    In this example, the entry model in the blog app will be rendered with the EntryForm within the blog.forms module. The key for the dictionary is app_label . model_name and must be all lower case. The value of the dictionary is module_name . form_class and must match the capitalization of the actual module.

  3. You may define which fields to include or exclude on a per model basis from inside your settings. Here is a snippet that blocks a user from being able to change the user field on their profile and limits them to only information that they should be able to edit:

    FRONTEND_EXCLUDES = {
        'profiles.userprofile': ('user',)
    }
    FRONTEND_INCLUDES = {
        'profiles.userprofile': ('address1','address2','avatar')
    }
    

    This will include the address1, address2, and avatar fields and exclude the user field from the form. Notice the key for both dictionaries is app_label . model_name and must be all lower case.

  4. Custom form templates will be used by default if they exist. For a model named entry in the app blog the frontendadmin will try to use frontendadmin/blog_entry_form.html for the full form and frontendadmin/blog_entry_form_ajax.html for the ajax form. If they do not exist, the defaults will be used.

License

The application is licensed under the New BSD License. See the LICENSE File for details.

More Repositories

1

django-attachments

A generic Django application to attach Files (Attachments) to any model.
Python
288
star
2

django-memcache-status

Django admin extension that displays statistics about your memcached instances.
Python
269
star
3

pip-check

pip-check gives you a quick overview of all installed packages and their update status.
Python
156
star
4

django-markup

Convert text markup to html. Markdown, rST, Textile etc.
Python
143
star
5

django-wakawaka

A simple wiki app written in Python using the Django framework.
Python
114
star
6

django-generic-flatblocks

A flatpages/flatblock application using generic relations to content models.
Python
67
star
7

django-templatesadmin

Not in active development. See readme. A Django app to make minor changes to your templates on the fly.
Python
54
star
8

django-eventlog

django-eventlog is a very simple event logger you can use to track certain actions in your code. Events are stored in a Django model and can be viewed in the Django Admin.
Python
29
star
9

django-comments-spamfighter

Not in active development; see README -- A Django app that contributes Akismet and Keyword blocking to your django comments.
Python
17
star
10

dpasteGUI

The OS X gui to quickly paste snippets to the dpaste.de pastebin.
Objective-C
10
star
11

django-staticinline

Django template tag to load static files inline with your template.
Python
9
star
12

SubDpaste

Paste code snippets on dpaste.de.
Python
8
star
13

tab

Opens a new OS X Terminal window with the current directory and runs an optional command in it.
Python
5
star
14

starcel

Starcel is a static page generator that helps you to transforms HTML/CSS/JS using ParcelJS.
HTML
3
star
15

fetch-sitemap

Python
1
star
16

go-like

It's like a Facebook Like button, but without Facebook.
Go
1
star