pythonsqlalchemyformalchemy

formalchemy date field rendering


Given a column called 'birthday' in my model that I declare like this:

birthday = Column(Date)

I'm trying to display it as a row in my form. However, I have to respect the French standard that goes like "Year" "Day" "Month" instead of "Month" "Day" "Year".

So far the closest I got to it is :

fs.birthday.set(html=[('lang', 'fr')])

which does display the names of the months in French rather than English, but is there a way to easily change the display order of the elements without witting a custom renderer?


Solution

  • The workaround I found for this was to reorder the fields using JQuery:

     // Reorder date fields
      function reorder( dateFieldId ) {
    
        var grp = $('#'+dateFieldId).children();
        var cnt = grp.length;
    
        var temp = grp[0];
        grp[0] = grp[1];
        grp[1] = temp;
    
        $(grp).remove();
        $('#'+dateFieldId).append($(grp));
      }