Hello all,

I've been making great strides with my application since returning
from the land of Pylons. Given that the app is all about data entry
I've taken the customise-the-admin-app approach to things and made the
switch to newforms-admin this morning.

So far things are working: data is being entered and I've even got
things rendering into ODT and DOCX.

I've now got a little stuck, however. I have three models: Report,
Section and Pictures. Sections are pieces of boilerplate which are
added to a report and pictures are added to a section. Currently
sections are edited inline with reports and pictures are edited inline
with sections.

What I would like to do is allow users to add sections and pictures to
a report at the same time (effectively nested inlines).

In models:

class Report(...):
    ....fields...

class Section(...):
    report = ForeignKey(Report,  ...)

class Picture(...):
    section = ForeignKey(Section, ...)

I'm trying to decide on the best way to do this. I've come up with a
few possible options and would appreciate any pointers about which
would be the best (or worst).

1. Create a dynamic newform.
This way gets all of the required fields onto the screen but I'd like
to be able to group things in fieldsets and do non-simple layouts. I
tried to create a template but ran into trouble as I didn't know the
number of fields or how to test the name of the fields being looped
over in order to group them.

2. Create the template by hand.
I can just pass my report instance to the template and create the form
manually but then I lose the magic of validation (which would probably
mean I'd end up using formencode or similar).

3. Add a pop up to the current template.
This would allow the user to create the section and then open a pop up
to do the pictures. There are problems with ensuring the section is
valid and saved first, however.

4. Mystery fourth option that I should have been using all along.
I don't know much about this one; anyone any ideas?

If any one's had to implement something similar then I'd appreciate
any advice. Any thoughts or ideas would also be gratefully received.

Regards,

Felix

--~--~---------~--~----~------------~-------~--~----~
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