Hi,

thanks for replying, but I tried that at first, expecting to be able
to do that on the inline, but I couldn't get it working. It was a
little while back, so I'm not sure I remember correctly, but I think I
got some sort of AlreadyRegistered error (might be wrong about that
though).

Also, looking at the docs there is not a "fieldsets"-option for the
Inline admin classes, only for ModelAdmin subclasses, but you seem to
be correct in that there isn't a fieldsets-option for ModelForm. I
guess I assumed it (admin.InlineStacked) somehow inherited from
ModelForm.

Anyhow, I'm still confused about this: In my updated admin.py, I still
reference the formset in my admin.StackedInline-class options, and in
the inlineformset_factory function call specify the fields (trying to
simplify a little - if I can't get a custom fieldset, I thought I'd
just try limiting the fields), but still no change, no errors, just
the same form.

Anyone have any more help/tips? I'm trying to get a grip on this
stuff, read the docs a bunch of times, but it's still a bit confusing
and not doing what I hoped it would... I think I've been staring
myself blind on it now. :-(

//emil

On 13 Okt, 12:47, gearheart <[EMAIL PROTECTED]> wrote:
> hi,
> fieldsets is not a form's attribute
> you should put them in ImageInline
>
> V.
>
> On Oct 12, 10:27 pm, Emil <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm trying to figure out how to use a custom form for when editing
> > objects inline in the admin. The case is something like this:
> > I have Images that have foreign keys to image galleries. When editing
> > a gallery, the images associated with it are edited inline. The image
> > model has quite a few options, so the listing on each gallery page
> > gets pretty long. Images also have a field for sorting weight. I would
> > like to implement simons snippet for sorting inline objects with drag
> > and drop (fromhttp://www.djangosnippets.org/snippets/1053/), which is
> > pretty unusable with a very long page. I would therefore like the
> > image form to collapse, showing only the ordering field, title and
> > hopefully a thumbnail of the image.
>
> > I know I could probably do this via a custom template, but that felt a
> > bit messy for some reason. So, I decided to take a shot at learning a
> > bit about customizing the admin form stuff via formset factories.
>
> > I tried reading the docs, googled a bit but couldn't get it working.
> > So far I've done the following:
>
> > 1. Create a normal ModelAdmin-subclass for both Image and ImageGallery
> > 2. Created a ModelForm-subclass for the galleries to get the extra JS
> > stuff in to get the draggable stuff working
> > 3. Created an ImageInline (subclass of admin.StackedInline)
> > 4. Pointed to the ImageInline from the ModelAdmin options for
> > ImageGallery
> > 5. In the ImageInline-class, I specified the formset-option, pointing
> > to...
> > 6. ...the ImageInlineFormset, which a formset created with
> > inlineformset_factory, that in turn specifies a form in the function
> > call, namely...
> > 7. ...ImageInlineForm, which is a subclass of ModelForm. There, I've
> > specified exactly how I want my fieldsets laid out.
>
> > My admin.py is up athttp://dpaste.com/83994/
>
> > Nothing seems to take in changing the inline form for the image
> > though. I get no errors, but the form stays the same... I'm not 100%
> > sure about everything I'm doing every step of the way here, so... Have
> > I got all this backwards? I just assumed that since I can specify a
> > formset-option on the inline, I should be able to use a formset
> > created through inlineformset_factory, and, in creating that, pointing
> > to a custom ModelForm...
>
> > //emil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to