OpenBlock 1.2 documentation

admin Package

admin Package

forms Module

Forms for use in the openblock admin UI.

class obadmin.admin.forms.PickShapefileLayerForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>, label_suffix=':', empty_permitted=False)

Bases: django.forms.forms.Form

Once a layer is chosen from a shapefile, does the work of actually loading the Locations.

class obadmin.admin.forms.UploadShapefileForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>, label_suffix=':', empty_permitted=False)

Bases: django.forms.forms.Form

Upload a shapefile, from which you can use PickShapefileLayerForm to choose a layer to import.

obadmin.admin.forms.import_items_from_spreadsheets(items_file, schema, mapping_file=None, unique_fields=None)

Imports NewsItems from the given files; returns (number added, number changed, number skipped).

models Module

sites Module

class obadmin.admin.sites.OpenblockAdminSite(name=None, app_name='admin')

Bases: django.contrib.admin.sites.AdminSite

A custom AdminSite.

This admin site specialized to use the openblock login methods instead of the django.contrib.auth methods.

get_urls()

Add some extra URLs to the admin site, as per https://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-views-to-admin-sites

login_form

alias of AdminLoginForm

tasks Module

views Module

obadmin.admin.views.import_items_from_spreadsheets(items_file, schema, mapping_file=None, unique_fields=None)

Imports NewsItems from the given files; returns (number added, number changed, number skipped).

obadmin.admin.views.jobs_status(request, appname, modelname)

Returns HTML fragment about current background tasks, intended for use via AJAX.

obadmin.admin.views.newsitem_details(request, news_item_id)

Shows all of the raw values in a NewsItem for debugging.