wiki:CustomFieldAdminPlugin

Trac Custom Field Admin plugin

Description

This plugin is a Web Admin panel for administering 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/1.0 (0.11 branch is compatible with current 0.12+). The plugin will be integrated into Trac for release 1.2 (trac:#11469).

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.

defect

36 / 38

enhancement

15 / 17

task

0 / 1

Download

Download the zipped source from here.

Source

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

Installation

The plugin can also be installed directly from the code repository:

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

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. For more recent versions the Web Admin panel is integrated into Trac core.

Enable the plugin in your trac.ini file:

[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

14567 by rjollos on 2015-05-04 20:37:40
0.12.2: Fixed regression in [14562]. Refs #12217, #12299.

Only check that custom field doesn't match an existing field when creating the field, not when saving changes to the field.

14563 by rjollos on 2015-04-30 19:11:03
0.2.12: tag_svn_revision is not supported in recent versions of setuptools.
14562 by rjollos on 2015-04-30 19:03:17
0.2.12: Prevent creating custom field with name matching built-in.

Patch by Nick Piper. Fixes #12217.

(more)

Author/Contributors

Authors: osimons, cbalan
Maintainer: Odd Simon Simonsen
Contributors:

Last modified 4 months ago Last modified on Mar 22, 2016, 11:13:52 PM