1👍
✅
Change your GalleryAdmin
to this… You need to save()
before the Gallery
instance gets its id
.
def save_model(self, request, Gallery, form, change):
Gallery.save()
if not change:
Gallery.title = str(Gallery.id)
1👍
def save_model(self, request, Gallery, form, change):
if Gallery.id is None:
Gallery.save()
if not change:
Gallery.title = str(Gallery.id)
Gallery.save()
This will do two save()
‘s only the first time.
- [Answered ]-Configuring Django for Netezza database (nzSQL)
- [Answered ]-Making two player chess app with Django– need player's board to update when opponent makes a move
Source:stackexchange.com