Tumblelog by Soup.io
Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

Mouthful: Custom django admin inline model forms

Disclaimer:  I'm a Django novice.

I'm putting together a Django site that has galleries of pictures.  By inlining the pictures into the gallery form I'm able to manage both types of data on the same page and easily add more pictures to that gallery.  However, I don't want to see all the fields for editing a picture, just the most important stuff.

Django, if I understand this correctly, either wants me to set the inline model's formset variable to an inlineformset_factory class or the form variable to a ModelFormHere's my admin.py (dpaste)

Turns out that didn't have any impact on what fields showed up in the inline forms.  After much googling and frustration I decided for the heck of it to provide a field tuple to the inline model class.  Here's my revised admin.py (also dpaste)

Turns out that works, and isn't part of the Django docs for InlineModelAdmin objects.  Maybe I'm misunderstanding something, but this did do what I wanted it to do and was not able to find any info on it anywhere.  Hopefully this will prove useful to someone who's frustrated with the same problem.
No Soup for you

Don't be the product, buy the product!

YES, I want to SOUP ●UP for ...