[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

Leave a comment