Closed gurugeek closed 3 years ago
Hi - sorry this is an issue I came across too, I just forgot to add the solution to the README. You just need to to exclude the field in the ModelForm:
class WorkForm(ModelForm):
class Meta:
model = Work
exclude = ["id"]
This should make the form work properly. I haven't used the RandomIDModel with django admin yet, but I suspect this should make it work there too.
If you can confirm this fixes it, I will update the README.
thanks for your prompt reply, this fixes it for the forms mode (class meta) l but how to handle it in admin ? it still shows if I add it via admin
Hmmm - it's been a while since I've used admin in depth, but I believe you can specify fields to be excluded there too, using something like this. I think if you exclude the id field there too it should work with admin too.
thanks for the reminder, yes this works fine so for admin you need something like
class WorkAdmin(admin.ModelAdmin):
exclude = ('id',)
admin.site.register(Work,WorkAdmin)
thanks again for this very useful package, much appreciated. The django UUID always had some issues!
thanks for your package. I did as per readme 👍
the problem is that now in adming (or add forms) an ID is required so I need to enter it mantually? I am confident that this was not interended behaviour so thanks in advance for your help!