model.field.errors doesn't render an unordered list

I have the following in my template

...
<div class="row">
	<div class="col-md-3">
		{% render_field workform.work_key.label_tag %} 
		{% render_field workform.work_key size="12" %}

		{{ workform.work_key.errors }}

	</div>
</div>
<div class="row"><div class="col">&nbsp;</div></div>
<div class="row">
	<div class="col-md-8">
		{% render_field workform.title.label_tag %} 
		{% render_field workform.title size="60" autofocus="" %}

		{{ workform.title.errors }}

	</div>
...

When I run the application from Django dev server, it renders the errors as expected - there’s an error on the first field, and none on the second:

            <div class="row">
                <div class="col-md-3">
                    <label for="id_work_key">Key:</label> 
                    <input type="text" name="work_key" value="P04YE01" maxlength="12" size="12" required aria-invalid="true" id="id_work_key">

                    <ul class="errorlist"><li>Key P04YE01 is already used</li></ul>

                </div>
            </div>
            <div class="row"><div class="col">&nbsp;</div></div>
            <div class="row">
                <div class="col-md-8">
                    <label for="id_title">Title:</label> 
                    <input type="text" name="title" value="Title" maxlength="250" autofocus="" size="60" required id="id_title">
                </div>

But when I serve it up from Apache, I get different results. Instead of giving me an unordered list, I get what looks like a tuple. On a field with no errors I just get the brackets.

...
<div class="row">
	<div class="col-md-3">
		<label for="id_work_key">Key:</label> 
		<input type="text" name="work_key" value="P04YE01" maxlength="12" size="12" required aria-invalid="true" id="id_work_key">

		[&#x27;Work Key P04YE01 is already used&#x27;]

	</div>
</div>
<div class="row"><div class="col">&nbsp;</div></div>
<div class="row">
	<div class="col-md-8">
		<label for="id_title">Title:</label> 
		<input type="text" name="title" value="Title" maxlength="250" autofocus="" size="60" required id="id_title">

		[]

	</div>
...

I’ve done a lot of searching and haven’t found anything that sounds remotely like this. Any clues?

Note: couldn’t figure out how to highlight the differences so I set the difference apart with a blank line.

First, I’m willing to guarantee that this difference is not caused simply by the change from runserver to Apache. There’s some other difference involved here, it’s just a question of finding out what it is. Neither Apache nor the Django server have any responsibility over the rendering of template data. The HttpResponse has been finished before Apache even begins to process it.

For example, did you also change your DEBUG setting during this deployment? What other differences are there between the test environment and deployment? Different version of Django? Python?

There may be other differences as well. (Different middleware, template settings, etc)

1 Like

That was my sense too - that the server probably has nothing to do with it, but that’s the only difference I can identify. I really didn’t “deploy” anything. I don’t even have a virtual environment involved. The Apache server is pointing to the wsgi application in the same directory structure that I’m running the Django server from. I have exactly one version of the code. The only thing I think of that I have touched outside of the that directory is the Apache httpd.conf file

I go to localhost:8000 and get the correct rendering but when I go to localhost:80 I get the weird rendering.

Any wild guesses as to where to look next? I’m pretty good at hunting down problems, but I’ve run out of ideas.

Thank you!

What version of Python and Django are being used?

What does your Apache configuration for this look like? Are you using mod_wsgi or are you proxying through to a separate wsgi container?

This is my first go at using either of these technologies. I just downloaded them both from the most recent stable version in the last months or so. Apache 2.4 and Python 3.12.1. Using mod_wsgi (I believe).

https://github.com/wamuchmore/a1site/ (catalog/catalog_add is the the view in my example)

Here’s a copy of the httpd.conf with most of the comments removed:

[details="Summary"]
Define SRVROOT "c:/Apache24"

ServerRoot "${SRVROOT}"


Listen 80


#LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule auth_form_module modules/mod_auth_form.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_core_module modules/mod_authn_core.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_socache_module modules/mod_authn_socache.so
#LoadModule authnz_fcgi_module modules/mod_authnz_fcgi.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule authz_core_module modules/mod_authz_core.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule brotli_module modules/mod_brotli.so
#LoadModule buffer_module modules/mod_buffer.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule cache_disk_module modules/mod_cache_disk.so
#LoadModule cache_socache_module modules/mod_cache_socache.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
#LoadModule data_module modules/mod_data.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_lock_module modules/mod_dav_lock.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
#LoadModule dumpio_module modules/mod_dumpio.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule filter_module modules/mod_filter.so
#LoadModule http2_module modules/mod_http2.so
#LoadModule headers_module modules/mod_headers.so
#LoadModule heartbeat_module modules/mod_heartbeat.so
#LoadModule heartmonitor_module modules/mod_heartmonitor.so
#LoadModule ident_module modules/mod_ident.so
#LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
#LoadModule ldap_module modules/mod_ldap.so
#LoadModule logio_module modules/mod_logio.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_debug_module modules/mod_log_debug.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
#LoadModule lua_module modules/mod_lua.so
#LoadModule macro_module modules/mod_macro.so
#LoadModule md_module modules/mod_md.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_express_module modules/mod_proxy_express.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so
#LoadModule proxy_html_module modules/mod_proxy_html.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_http2_module modules/mod_proxy_http2.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
#LoadModule ratelimit_module modules/mod_ratelimit.so
#LoadModule reflector_module modules/mod_reflector.so
#LoadModule remoteip_module modules/mod_remoteip.so
#LoadModule request_module modules/mod_request.so
#LoadModule reqtimeout_module modules/mod_reqtimeout.so
#LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule sed_module modules/mod_sed.so
#LoadModule session_module modules/mod_session.so
#LoadModule session_cookie_module modules/mod_session_cookie.so
#LoadModule session_crypto_module modules/mod_session_crypto.so
#LoadModule session_dbd_module modules/mod_session_dbd.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule slotmem_plain_module modules/mod_slotmem_plain.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
#LoadModule socache_dbm_module modules/mod_socache_dbm.so
#LoadModule socache_memcache_module modules/mod_socache_memcache.so
#LoadModule socache_redis_module modules/mod_socache_redis.so
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule ssl_module modules/mod_ssl.so
#LoadModule status_module modules/mod_status.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule unique_id_module modules/mod_unique_id.so
#LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule version_module modules/mod_version.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule watchdog_module modules/mod_watchdog.so
#LoadModule xml2enc_module modules/mod_xml2enc.so
# LoadModule wsgi_module modules/mod_wsgi.so
LoadModule wsgi_module "C:/Python312/Lib/site-packages/mod_wsgi/server/mod_wsgi.cp312-win_amd64.pyd"

WSGIPythonHome "C:/Python312"
WSGIPythonPath "C:/DjangoDev/a1site"
<IfModule unixd_module>

User daemon
Group daemon

</IfModule>


ServerAdmin muchmorebill@gmail.com

<Directory />
    AllowOverride none
    Require all denied
</Directory>


DocumentRoot "${SRVROOT}/htdocs"
<Directory "${SRVROOT}/htdocs">

    Options Indexes FollowSymLinks


    AllowOverride None


    Require all granted
</Directory>


<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>


<Files ".ht*">
    Require all denied
</Files>


ErrorLog "logs/error.log"


LogLevel info

<IfModule log_config_module>

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>


    CustomLog "logs/access.log" common


</IfModule>

<IfModule alias_module>

    ScriptAlias /cgi-bin/ "${SRVROOT}/cgi-bin/"
    
    WSGIScriptAlias / C:/DjangoDev/a1site/a1site/wsgi.py
    Alias /static C:/DjangoDev/a1site/a1site/static


</IfModule>

<IfModule cgid_module>

</IfModule>


<Directory "${SRVROOT}/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>
<Directory C:/DjangoDev/a1site>
    Require all granted
</Directory>

<IfModule headers_module>

    RequestHeader unset Proxy early
</IfModule>

<IfModule mime_module>

    TypesConfig conf/mime.types

  
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz


</IfModule>


<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>


<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
[/details]

What version of Django are you using?

Oops. Answered a question you didn’t ask.
Django v5.0.1

I can’t explain the differences in behavior from the information I can see, but I do see a problem here.

In your WorkForm, you have:

raise ValidationError(
    [
        ValidationError(("Key %(value)s is already used"),code="invalid",params={"value":data})
    ]
)

Your raise statement is passing a list to the ValidationError constructor with an embedded validation error.

You should only be raising the ValidationError.
e.g.:

raise ValidationError(("Key %(value)s is already used"),code="invalid",params={"value":data})

Thank you for that. Slavishly copied from somewhere.

I wondered if that bit might have had some squirrely downstream impact - it was the only validation I added. Unfortunately, changing it didn’t make a difference.

Did you stop and restart Apache after making this change?

If so, can you repost the html being rendered?

Not at first :blush:, but yes, I restarted it and checked.

<!-- catalog/templates/catalog/catalog_add.html -->

<!-- templates/base.html -->

<!DOCTYPE html>   
 <!--  -->

<html lang="en">

<head>
        <meta charset="utf-8">
    <title class="site-title">Studio Catalog</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .catalog-header {
            text-decoration:none;
            color:darkslategray
        }
        .errorlist {
            color: red;
        }

        .tableFixHead {
            overflow-y: auto;
            /* make the table scrollable if height is more than 200 px  */
            height: 100%
        }

        .tableFixHead th {
            position: sticky;
            /* make the table heads sticky */
            top: 0px;
            /* table head will be placed from the top of the table and sticks to it */
        }

        table {
            border-collapse: collapse;
            /* make the table borders collapse to each other */
        }

        th {
            background: #eee;
        }
    </style>
</head>

<body on onload="fix();">
    <div class="catalog-header">
        <a href="/" class="catalog-header"> <h5 align="center">Patty Maly Studio Catalog</h5> </a>
    </div>
    
<h1></h1>
<form method = "post"  id="formId" enctype="multipart/form-data">
    <input type="hidden" name="csrfmiddlewaretoken" value="qvKIloKGKmalPTB0fS9q0lRl9eYwjXFo3pDMG62JtOteCnqZeYDcwnDzNTGxABmJ">

    <!-- catalog/templates/catalog/work_image_conatiner.html -->

    
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-7">
                <div class="row">
                    <div class="col">
                        <label for="id_work_key">Key:</label> 
                        <input type="text" name="work_key" value="P04YE01" maxlength="12" size="12" required aria-invalid="true" id="id_work_key">
                        [&#x27;Key P04YE01 is already used&#x27;]
                    </div>
                </div>
                <div class="row"><div class="col">&nbsp;</div></div>
                <div class="row">
                       
                    <div class="col-md-8">
                        <label for="id_title">Title:</label> 
                        <input type="text" name="title" value="test" maxlength="250" autofocus="" size="60" required id="id_title">
                        []
                    </div>
                    <div class="col-md-4">
                        <label for="id_work_date">Date:</label>
                        <input type="text" name="work_date" value="2222" maxlength="10" size="7" id="id_work_date">
                        [] 
                    </div>

                </div>

                <div class="row"><div class="col">&nbsp;</div></div>
                <div class="row">
                        
                    <div class="col">
                        <label for="id_work_type">Type:</label>
                        <select name="work_type" onchange="buildkey()" required id="id_work_type">
  <option value="">---------</option>

  <option value="painting" selected>painting</option>

  <option value="monotype">monotype</option>

  <option value="tile">tile</option>

  <option value="sculpture">sculpture</option>

</select>
                        []
                    </div>
                    <div class="col">
                        <label for="id_media">Media:</label>
                        <select name="media" required id="id_media">
  <option value="">---------</option>

  <option value="oil on wood" selected>oil on wood</option>

  <option value="oil on canvas">oil on canvas</option>

  <option value="ink on paper">ink on paper</option>

  <option value="watercolor">watercolor</option>

  <option value="ceramic">ceramic</option>

  <option value="oil on canvas">oil on canvas</option>

</select>
                        []
                    </div>

                    <div class="col">
                        <label for="id_price">Price:</label>
                        <input type="number" name="price" step="0.01" size="7" id="id_price">
                        []
                    </div>

                </div>
                
            
                <div class="row"><div class="col">&nbsp;</div></div>
                    
    

                <div class="row"> 
                       
                    <div class="col">
                        <label for="id_dims_height">Height:</label>
                        <input type="number" name="dims_height" step=".25" size="5" id="id_dims_height">
                        []
                    </div>
                    <div class="col">
                        <label for="id_dims_width">Width:</label>
                        <input type="number" name="dims_width" step=".25" size="5" id="id_dims_width">
                        []
                    </div>
                    <div class="col">
                        <label for="id_dims_depth">Depth:</label>
                        <input type="number" name="dims_depth" step=".25" size="5" id="id_dims_depth">
                        []
                    </div>

                </div>

    


        

                <div class="row"><div class="col">&nbsp;</div></div>
              
                <div class="row" >
                    
                    <div class="col">                
                        <label for="id_description">Description:</label> <br>
                        <textarea name="description" cols="30" rows="3" id="id_description">
</textarea>
                        []               
                    </div>
                   
                     
                    <div class="col"> 
                        <label for="id_notes">Notes:</label>  <br>
                        <textarea name="notes" cols="30" rows="3" id="id_notes">
</textarea>
                        []
                    </div>

                    
                    <div class="col">    
                        <label for="id_inscription">Inscription:</label>  <br>
                        <textarea name="inscription" cols="30" rows="3" id="id_inscription">
</textarea>
                        []
                    </div>

                </div>
            
                <div class="row"><div class="col">&nbsp;</div></div>
                <div class="row"  > 
               
                    <div class="col">
                        <label for="id_status">Status:</label>  
                        <select name="status" id="id_status">
  <option value="available" selected>available</option>

  <option value="unavailable">unavailable</option>

  <option value="sold">sold</option>

  <option value="painted over">painted over</option>

</select>
                        []
                    </div>
                    <div class="col">
                        <label for="id_sold_date">Sold date:</label>  
                        <input type="text" name="sold_date" value="" size="7" id="id_sold_date">
                        []
                    </div>
                    <div class="col">
                        <label for="id_sold_to">Sold to:</label>  
                        <input type="text" name="sold_to" maxlength="100" id="id_sold_to">
                        []
                    </div>
                    <div class="col">
                        <label for="id_sale_price">Sale price:</label>  
                        <input type="number" name="sale_price" step="0.01" size="5" id="id_sale_price">
                        []
                    </div>
                    
                  
                </div>
                <div class="row"><div class="col">&nbsp;</div></div>

                <div class="row">
                        

                    <p>
                        <input type="submit" name="action" value="Save" id="saveButton" accesskey="s"> 
                        <input type="submit" name="action" value="Delete" id="deleteButton" onclick="return confirm('Are you sure you want to delete this entry and any associated images?')">
                        <input type="submit" name="action" value="Cancel" id="canceButton" onclick="return confirm('Are you sure you want to cancel?')">
                    </p>
                </div>
            </div>
  
        
            


            <div class="col-md-5">
                []



  <input type="hidden" name="image_set-TOTAL_FORMS" value="2" id="id_image_set-TOTAL_FORMS"><input type="hidden" name="image_set-INITIAL_FORMS" value="0" id="id_image_set-INITIAL_FORMS"><input type="hidden" name="image_set-MIN_NUM_FORMS" value="0" id="id_image_set-MIN_NUM_FORMS"><input type="hidden" name="image_set-MAX_NUM_FORMS" value="1000" id="id_image_set-MAX_NUM_FORMS">
                 
                    <input type="hidden" name="image_set-0-id" id="id_image_set-0-id">
                    <div class="row">
                        <div class="col">
                            <hr>
                        
                            <label for="id_image_set-0-image">Image:</label>  
                            <input type="file" name="image_set-0-image" accept="image/*" accesskey="c" onchange="preview(this)" id="id_image_set-0-image">
                            []

                      

                            <img id="imageframe" src="" width="250px"  name="imageframe"/>
                        <div class="row"><div class="col">&nbsp;</div></div>
                        </div>
                        <div class="row">
                            <div class="col">
                                <label for="id_image_set-0-image_type">Image type:</label>  
                                <select name="image_set-0-image_type" id="id_image_set-0-image_type">
  <option value="" selected>---------</option>

  <option value="primary">primary</option>

  <option value="alternate">alternate</option>

  <option value="documentation only">documentation only</option>

  <option value="detail">detail</option>

  <option value="previous version">previous version</option>

</select>
                                []
                            </div>
                            <div class="col">                                                        
                                <label for="id_image_set-0-image_source">Image source:</label>  
                                <input type="text" name="image_set-0-image_source" maxlength="256" id="id_image_set-0-image_source">
                                []
                            </div>   
                            <div class="col">                            
                                <label for="id_image_set-0-image_file_name">Image file name:</label>  
                                <input type="text" name="image_set-0-image_file_name" maxlength="200" id="id_image_set-0-image_file_name">
                                []   
                            </div>
                        </div>
                        <div class="row"><div class="col">&nbsp;</div></div> 
                        <div class="row">
                            <div class="col">
                                <label for="id_image_set-0-image_notes">Image notes:</label> <br> 
                                <textarea name="image_set-0-image_notes" cols="40" rows="3" id="id_image_set-0-image_notes">
</textarea>
                                []
                            </div>
                            <div class="row"><div class="col">&nbsp;</div></div>
                        <div class="row">
                            <div class="col">
                                <input type="checkbox" name="image_set-0-DELETE" id="id_image_set-0-DELETE"> Check box and Save to delete this image 
                            </div>

                        </div>

                    </div>
                 
                    <input type="hidden" name="image_set-1-id" id="id_image_set-1-id">
                    <div class="row">
                        <div class="col">
                            <hr>
                        
                            <label for="id_image_set-1-image">Image:</label>  
                            <input type="file" name="image_set-1-image" accept="image/*" accesskey="c" onchange="preview(this)" id="id_image_set-1-image">
                            []

                      

                            <img id="imageframe" src="" width="250px"  name="imageframe"/>
                        <div class="row"><div class="col">&nbsp;</div></div>
                        </div>
                        <div class="row">
                            <div class="col">
                                <label for="id_image_set-1-image_type">Image type:</label>  
                                <select name="image_set-1-image_type" id="id_image_set-1-image_type">
  <option value="" selected>---------</option>

  <option value="primary">primary</option>

  <option value="alternate">alternate</option>

  <option value="documentation only">documentation only</option>

  <option value="detail">detail</option>

  <option value="previous version">previous version</option>

</select>
                                []
                            </div>
                            <div class="col">                                                        
                                <label for="id_image_set-1-image_source">Image source:</label>  
                                <input type="text" name="image_set-1-image_source" maxlength="256" id="id_image_set-1-image_source">
                                []
                            </div>   
                            <div class="col">                            
                                <label for="id_image_set-1-image_file_name">Image file name:</label>  
                                <input type="text" name="image_set-1-image_file_name" maxlength="200" id="id_image_set-1-image_file_name">
                                []   
                            </div>
                        </div>
                        <div class="row"><div class="col">&nbsp;</div></div> 
                        <div class="row">
                            <div class="col">
                                <label for="id_image_set-1-image_notes">Image notes:</label> <br> 
                                <textarea name="image_set-1-image_notes" cols="40" rows="3" id="id_image_set-1-image_notes">
</textarea>
                                []
                            </div>
                            <div class="row"><div class="col">&nbsp;</div></div>
                        <div class="row">
                            <div class="col">
                                <input type="checkbox" name="image_set-1-DELETE" id="id_image_set-1-DELETE"> Check box and Save to delete this image 
                            </div>

                        </div>

                    </div>
                
            </div>
                
        </div>

       
    </div>
    
    <div id="usedkeys" style="display:none" data-values=' M04UNT01, P04YE01, P06AL01, P06EE01, P07BB01, P07BC01, P07GM01, P07IP01, P07MB01, P07RC01, P07UT01, P08BB01, P08BR01, P08EG01, P08OE01, P08SI01, P09DA01, P09EUD01, P09IP03, P09IP04, P09IP05, P09MU01, P10BC01, P10BC02, P10BP01, P10BP02, P10DW01, P10HF01, P10HF02, P10MC01, P10PE01, P10RC01, P10RG01, P10RT01, P10SPI01, P10SW01, P10TR01, P10WB01, P10ZC01, P11SS01, P12MH01, P13DR01, P13PM01, P13SA01, P13SB01, P14PB01, P14SV01, P15BF01, P15CD01, P15EC01, P15MP01, P15MU01, P15OR01, P15RC01, P16AF01, P16BB01, P16CG01, P16CO01, P16CY01, P16FC01, P16FEN01, P16FP01, P16GA01, P16GP01, P16LC01, P16MB01, P16MB02, P16MC01, P16NA01, P16NA02, P16NA03, P16NL01, P16OP01, P16OW01, P16SK01, P16ST01, P16TP01, P16WB01, P17DFS05, P17IPO01, P18BY01, P18UPS01, P19FL01, P19SU01, P20NE03, P20WGL01, P21HOT01, P21OIR01, P21UN01, P21VSP01, P22RPS01, P22UW01, P23BS01, P23GRB01, P23OB01, P23OT01, P23SI01, P23WN01, P??????01, P??????02, P??LP02, PxxHE01, PxxSTE01,'> </div>

 
 

Oops, I missed it. Still an extra level of parens in the expression:
raise ValidationError(("Key %(value)s is already used"), code="invalid", params={"value":data})
If you’re not using the _ as the “translation” function (or any other function for that matter, this should be:
raise ValidationError("Key %(value)s is already used", code="invalid", params={"value":data})

Now, as far as the rendering is concerned, I’m going to guess that this widget_tweaks library you are using may be part of the problem. The information that I’m seeing for django-widget-tweaks · PyPI, shows that it has been validated through Django 4.2 / Python 3.11.

The “head” version of the repo has a commit newer than the 1.5.0 version on PyPi that is labeled for Django 5.0 compatibility. You may want to pull the most current version and try it.

That seems really likely the problem. I’ll let you know

Well, no luck.

To make absolutely sure it wasn’t the “widget-tweaks”, I removed it from my installed apps and made a copy of the template using only vanilla Django tags. Still seeing the problem.

What happens if you just render the form as {{ workform }}? (Both ways - apache and runserver)

It appears that you’re running this on Windows using an account named daemon. You might want to verify that the daemon account has appropriate permissions to the entire Django installation directory. Or, you might want to try running Apache as the same account that you are running runserver with.

OK. I’ll have to do some research. I’ll let you know how it goes.