Getting Started with iAdmin¶
This tutorial assumes that you have a basic understanding of Django. We will only explain the portions of the code that are iAdmin-specific in any kind of depth.
Home Page¶
As installed iAdmin replace the standard home page with a ‘portlets like’ version. The default template use a 5 columns layout, you can move the ‘portlets’ turu the columns and/or collapse them. The layout is saved into a cookie to allow it to be restored.
iAdmin is able to shows the number of rows present in each table, the home page is cached and the cache is invalidated each time a model is added/deleted using django django.db.models.signals.post_save() and django.db.models.signals.post_delete() (see django.db.models.signals). If you want enable this feature, you should set :doc:IADMIN_CONFIG as following:
IADMIN_CONFIG = { 'count_rows': True,}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'unique-snowflake'
}
}
The CACHES configuration is only an example, please refer to Django Cache System for further infos.
Changelist¶
Direct link from list to edit form¶
If you have a column that represent a django.db.models.ForeignKey, you can create a link from each cell in the changelist to the related edit page listing the column name into list_display_rel_links attribute of IModelAdmin:
class LocationAdmin(admin.ModelAdmin):
list_display = ('name', 'country', 'country_continent')
list_display_rel_links = ('country', )
Note
The fields listed into list_display_rel_links MUST be present also in list_display
FileManager¶
- FileManager is a simple files and directories management application that allow you to:
- browse files/directories on your server
- upload files.
- delete/rename files and or directories.
- create .tar archives
Configuring FileManager¶
First of all, you need to set IADMIN_FM_ROOT in your settings, the absolute path of the base directory, by default this value is equal to MEDIA_ROOT.
To limit the visibility of files and directory you can use the settings.IADMIN_FM_CONFIG do set a callback that handle the file list:
def filemanager_file_visibility_manager(fso):
return not fso.hidden
IADMIN_FM_CONFIG = { 'show': filemanager_file_visibility_manager }
the callback is passed a iadmin.plugins.fm.fs.File or iadmin.plugins.fm.fs.Dir and must returns False if the element should not be showed.
Several permissions are provided to restricts access to FM operations:
['can_upload_file',
'can_create_dir',
'can_delete_file',
'can_delete_dir',
'can_rename_dir',
'can_rename_dir']
Info Panel¶
This page show you information about installed django applications, pythonpath and availables packages, python version and OS
Import from CSV¶
This very flexible and high customizable feature allow to load data directly from a CSV file. In the first step of the wizard you have to:
- Choose the main table to load, don’t care if your CSV contains data of multiple table, you cna manage that.
- Upload your CSV file
After submitted the form, if everything is ok and the CSV is well formatted, iAdmin will show you the page to customize the field/column mapping
On the upper right side of the window will be displayed the first 10 rows of the CSV (sample frame), on upper left side you can set some flag and down you can set the rules for field mapping.
Note
Pay attention at the first row of the sample frame, if the CSV contains a header row, you have to advise the importer checking the header flag in the options panel