Trac Custom Field Admin plugin

Description

This plugin is a Web Admin panel for administrating custom fields - adding, modifying and deleting them without editing the trac.ini file directly.

The plugin is available for Trac 0.10 and 0.11/0.12 (0.11 branch is compatible with current 0.12+).

This plugin is a cooperation between CodeResort.com and Optaros.com, and is made freely available under a BSD license.

Bugs/Feature Requests

Existing bugs and feature requests for CustomFieldAdminPlugin are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from here.

Source

You can check out CustomFieldAdminPlugin from here using Subversion, or browse the source with Trac.

easy_install

The plugin can also be installed directly from repos:

easy_install -U -Z http://trac-hacks.org/svn/customfieldadminplugin/0.11

(or substitute 0.11 with 0.10 for older Trac version)

Configuration

This plugin requires Web Admin plugin (wiki:WebAdmin) if you are using the 0.10 version, but not for 0.11 as Web Admin is integrated into main Trac for this version.

Enable the plugin in trac.ini:

[components]
customfieldadmin.* = enabled

API

The plugin also has an API that can be called from other code if you need to create or modify custom fields. Here is an interactive session as example:

from trac.env import Environment
from customfieldadmin.api import CustomFields

myenv = Environment('/path/to/env')
mycfcomp = CustomFields(myenv)

# Get Cusom fields (list of dicts)
myfields = mycfcomp.get_custom_fields()
for item in myfields: print item

# Create a custom field - text box
mycfdict = {                # a template dictionary
    'name': 'test01',       # name of field (alphanumeric only)
    'type': 'text',         # text|checkbox|select|radio|textarea
    'label': 'Test 01',     # description
    'value': 'first test',  # default value for field content
    'options': None,        # options for select and radio types (list, leave first empty for optional)
    'cols': None,           # number of columns for text area
    'rows': None,           # number of rows for text area
    'order': 0 }            # specify sort order for field, 0 for last
mycfcomp.update_custom_field(mycfdict, create=True)

# Updating
mycfdict['type'] = 'select'
mycfdict['options'] = ['', 'one', 'two', 'three']
mycfdict['value'] = None
mycfcomp.update_custom_field(mycfdict)

# And deleting an existing custom field
mycfcomp.delete_custom_field(mycfdict)

Recent Changes

[12166] by osimons on 10/15/12 10:28:26

CustomFieldAdminPlugin: Add 'de' locale. Thanks hasienda. Closes #10360.

[11777] by rjollos on 07/25/12 09:46:39

Added setup.cfg.

[11597] by osimons on 05/26/12 11:17:57

CustomFieldAdminPlugin: The 'locale' directory may not exist in all installations, so need more careful access. Fixes #10053.

[11409] by osimons on 03/21/12 11:36:00

CustomFieldAdminPlugin: Updated 'ja' locale. Thanks Jun. Closes #9916.

Author/Contributors

Authors: osimons, cbalan
Maintainer: osimons
Contributors: