Skip to content

Repository files navigation

App Engine Datastore Admin

appengine_admin is a flexible datastore admin for app engine. MIT licensed.

This is a fork from the original mirror that is now different enough to justify not being an official fork :)

Getting Started

  1. Download this repository's source and copy the appengine_admin/ folder at the root of your App Engine project directory.

  2. Install gae_paginator and gae_csrf and configure their settings:

    importappengine_adminappengine_admin.admin_settings.PAGINATOR_PATH='path.to.paginator.Paginator'appengine_admin.admin_settings.CSRF_HANDLER_PATH='path.to.gae_csrf.handlers.CSRFRequestHandler'
  3. Update your app.yaml to add the URLs:

    -url: /appengine_admin_mediastatic_dir: appengine_admin/media# Your custom handler goes here (see next step)-url: /admin/models.*script: handlers.admin.appsecure: always
  4. Use it in your handlers (full working example):

    importappengine_adminfromwebapp2importRequestHandler, WSGIApplication# Declare your models.fromgoogle.appengine.extimportdbclassArtist(db.Expando):
    name=db.StringProperty()
    birthday=db.DateTimeProperty()
    classAlbum(db.Expando):
    name=db.StringProperty()
    release_year=db.StringProperty(default='2012')
    price=db.IntegerProperty()
    classSong(db.Expando):
    title=db.StringProperty()
    genre=db.StringProperty()
    album=db.ReferenceProperty(Album)
    artist=db.ReferenceProperty(Artist)
    # Register the appengine admin models.classAdminSong(appengine_admin.ModelAdmin):
    model=Songlist_fields= ['title', 'genre', 'album']
    readonly_fields= ['artist']
    paginate_on= ['title']
    appengine_admin.admin_settings.PAGINATOR_PATH='path.to.paginator.Paginator'appengine_admin.register(AdminSong)
    app=WSGIApplication(
    routes=appengine_admin.get_application_routes(),
    config=app_config,
    debug=DEBUG)
  5. To configure your settings, look at admin_settings.py

Custom settings below (TODO: move to separate doc).

ModelAdmin.pre_init, ModelAdmin.pre_save, ModelAdmin.post_save

Allow custom actions before initializing or saving the form, or after saving the form.

ModelAdmin.custom_clean

You can have a custom callback function to validate an individual field, example:

```python
from django import forms
class AdminSong(ModelAdmin):
# ...
def clean_title(self):
title = self.cleaned_data.get('title')
# do something here
if len(title) < 5:
raise forms.ValidationError('Title too short, must be at least 5 characters.')
return title
custom_clean = {
'title': clean_title,
}
```
  1. Remember to update your index.yaml for each model class you are paginating. If you're just paginating by key, this should work:

    -kind: Songproperties:
    -name: __key__direction: desc

Features

TODO: add features

Most features are the ones listed on the now too-outdated-to-be-genuine-fork fork Appengine Admin project page.

There may be more to come.

Dependencies

FAQ

  1. Why use it? To get a nice admin to manage your data on production. And because it's better than updating your data from the remote shell or the built-in datastore viewer. And because it's hopefully gonna get even better :)

TODO

See the Issues on GitHub for details. And help out!

About

Automatic administration interface for the Google Appengine Datastore

Resources

Stars

5 stars

Watchers

17 watching

Forks

Releases

Packages

Used by

Contributors

Languages