Currently, crudbuilder depends on the presence of an id field in each of the models. Explicitely defining one's own primary key (with primary_key=True in the field definition) wreaks havoc. Instead, the code should reference the pk field, which always represents the primary key, either as set by the user, or id by default.
The first place that needs changing is mixins.BaseListViewMixin.get_queryset (in the return statement), The way it currently stands, it will crash django when the model does not have an id field.
There are more places where the code uses id, notably in tables.TableBuilder. Here a more sensible solution might be required though. Not sure if just replacing id by pk yields the correct behaviour in all cases.
Currently,
crudbuilder
depends on the presence of anid
field in each of the models. Explicitely defining one's own primary key (withprimary_key=True
in the field definition) wreaks havoc. Instead, the code should reference thepk
field, which always represents the primary key, either as set by the user, orid
by default.The first place that needs changing is
mixins.BaseListViewMixin.get_queryset
(in the return statement), The way it currently stands, it will crash django when the model does not have anid
field.There are more places where the code uses
id
, notably intables.TableBuilder
. Here a more sensible solution might be required though. Not sure if just replacing id by pk yields the correct behaviour in all cases.