-
-
Save rtpm/129c15e940001281a0d2421a936617f6 to your computer and use it in GitHub Desktop.
django admin inline problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#models.py | |
class Gallery(models.Model): | |
name = models.CharField("My Gallery", max_length=100) | |
class Photo(models.Model): | |
photo = models.ImageField("Photo", upload_to="/some/location/") | |
gallery = models.ForeignKey(Gallery) | |
#admin.py | |
class PhotoInlineOptions(admin.TabularInline) | |
model = Photo | |
class GalleryAdminOptions(admin.modelAdmin): | |
inlines = [PhotoInlineOptions] | |
Solved. The problem was a custom save() Gallery method not mentioned in this gist.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem:
In a gallery instance changeView, when I add a new inline file (Photo) in the inlines, a new Gallery is created when "save and continue" button,
instead of adding new Photo to existing Gallery.