Reorder all fields in Trac

We decided to add a business justification field to our Trac instance today, but needed to put it directly below the description field so that it was in a more logical position for the users. It is not possible to intermingle custom ticket fields with standard ones (from within Trac), so editing the ticket template file will be required.

**Note: This has been developed and tested for Trac-1.0.1dev_r11400, and may not work on other versions without modifications**

**Another Note: This process is overkill in most scenarios, and is really only useful if you also need to change the ordering of default ticket fields. If you are just trying to order custom fields, please take a look at the `order` property in [[|Trac’s documentation]]**

# Copy `ticket.html` to your local Trac environment’s templates directory (`/var/local/trac/templates` in my case)
# Ubuntu
sudo cp /usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11400-py2.7.egg/trac/ticket/templates/ticket.html /var/local/trac/templates/
# RedHat/CentOS
sudo cp /usr/local/lib/python2.7/site-packages/Trac-1.0.1dev_r11400-py2.7.egg/trac/ticket/templates/ticket.html /var/local/trac/templates/
# Add the below code to the top of the copied template file (/var/local/trac/templates/ticket.html). Note – `summary`, `reporter`, and `description` are hard coded into Trac and cannot be modified using this method. You can manually alter them further down in this template if necessary (not covered here).
{{{ #!python

# Restart tracd (or restart the web server if WSGI, uWSGI, etc.)







4 responses to “Reorder all fields in Trac”

  1. M. Bearden Avatar
    M. Bearden

    Wondering, what version of Trac was this patch developed using?

    1. dlasley Avatar

      This patch was developed for Trac-1.0.1dev_r11400. I went ahead and updated the post too. Thanks for reading my blog!

  2. Steffen Hoffmann Avatar
    Steffen Hoffmann has information about the .order from [ticket-custom] section of trac.ini. IMHO this should be the way to go for most user requirements, but I confess, that it is somewhat hidden in the current official wiki documentation.

    1. dlasley Avatar

      Good call out; you are very right that the best way to order fields is by using the `.order` property while defining custom fields. This didn’t work in my case because I needed the ability to mix custom fields in with the standardized ones. I’ve added a note with the link into this article in order to point users in the correct direction. Thanks for the comment, and for reading my blog!

Leave a Reply

Your email address will not be published. Required fields are marked *