Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
adambirds opened this issue Jan 18, 2024 · 4 comments
Open

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

adambirds opened this issue Jan 18, 2024 · 4 comments

Comments

@adambirds
Copy link

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.

@mmcardle
Copy link
Owner

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?

@adambirds
Copy link
Author

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!

@mmcardle
Copy link
Owner

mmcardle commented Feb 5, 2024

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?

@adambirds
Copy link
Author

A preference seems the best way for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants