[Fixed]-ModelForm field not showing

0đź‘Ť

âś…

managed to skip the rendering. I’m able to access the primary key via the “inital” attribute when I’m iterating all the devices:

{{ device.modbus_devices.initial.ixModbusDevice }}
👤john

1đź‘Ť

Because it’s an AutoField. Your can’t set those; they are automatically assigned by the database, hence the name. Therefore there’s no point in showing then on the form.

0đź‘Ť

Try change the return to :

return render(
    request,
    'app/create_bacnet.html',
    {
         'title':'Create BACnetDevice',
         'tag':'create_bacnet',
         'devices': devices
    }
)

render() is the same as a call to render_to_response() with a
context_instance argument that forces the use of a RequestContext.

Render Shortcut

👤Paulo Pessoa

Leave a comment