django_builder icon indicating copy to clipboard operation
django_builder copied to clipboard

It would be great create models with a UUID as the pk by default.

Open adambirds opened this issue 1 year ago • 4 comments

It would be great to create models with a UUID as the pk by default. Ot at least have a checkbox for setting a primary key when creating a field.

adambirds avatar Jan 18 '24 02:01 adambirds

Hi @adambirds ,

Thanks for the feedback, Yes I have often thought of adding as an explicit config when creating a model, but never got around to it. It would be a great time saver if you create a lot of models like that

I am assuming you are currently choosing UUID field from the Field Type dropdown and entering primary_key=True for the args? And then django will pick that up automatically as the primary key? https://docs.djangoproject.com/en/4.2/topics/db/models/#automatic-primary-key-fields

But having this done automatically in the UI would be a useful feature?

mmcardle avatar Jan 23 '24 21:01 mmcardle

Yes that's the way I was doing it, just manually adding the primary key to the field, but yeah would just make things quicker to have an option in the GUI!

adambirds avatar Jan 23 '24 21:01 adambirds

Hey @adambirds I added an option for this on model creation. Was thinking it might be good to save a preference for this field, or use the last value used. Thoughts?

mmcardle avatar Feb 05 '24 20:02 mmcardle

A preference seems the best way for me.

adambirds avatar Feb 05 '24 20:02 adambirds