Hi Josh, thanks for getting back so soon! If I'm being fully honest, my 
django chops aren't good enough to understand how to implement your 
suggestion. I'm sure it's a much more streamlined approach than my actual 
solution, which was to relate sections to subsections through a many-to-one 
relationship (eg, create a section and add subsections kind of like adding 
tags to a blog post). Then, in pages/index.html I created a series of for 
and if statements to render each subsection depending on the context of the 
section (basically used the "section" attribute of each subsection to 
determine where it should be rendered). Although it took a bit of typing, 
at least it's dry (which is more than I can say for some of my projects). 
Thanks again!

On Monday, 22 December 2014 10:43:03 UTC-8, Josh Cartmell wrote:
>
> Hey Avery, you do make sense and I've done something similar.  In the 
> models of the first section (that has sub sections) I would add something 
> like:
>
>     def edit_subsections(self):        '''        Returns a link to this 
> items change form        '''        if self.id:            return '<a 
> onclick="return showAddAnotherPopup(this);" href="%s">Edit documents</a>' % 
> admin_url(self.__class__, "change", self.id)        return ''    
> edit_subsections.allow_tags = True
>
>
> Then inside the admin class for that you can add edit_subsections to the 
> fields (or fieldsets).  It also needs to be added to readonly_fields.  That 
> will use Django's normal admin popups, but you could update the 
> edit_subsections method to work in any way you want.
>
> Hopefully that's a good start!
>
> On Sun, Dec 21, 2014 at 1:11 AM, Avery Laird <[email protected] 
> <javascript:>> wrote:
>
>> Hi,
>>
>> I'm building one of those one page sites (that all the cool kids seem to 
>> have) and I have run into a bit of a problem. I have a custom Page class, 
>> with a few orderable classes that inherit from that, but I'm not sure what 
>> the best course of action to take is for the individual sections. I'm 
>> thinking about making another Orderable class, which inherits from the Page 
>> class, but has other orderable classes nested underneath it to form the 
>> sections of the site. For example, each "section" orderable has a heading 
>> and subheading, with other orderables nested within that can be added in 
>> the admin much like orderables can be added to pages. If there was a 
>> section with 3 icon blurbs, then there would be a "section" orderable, and 
>> an "icon blurb" orderable that inherits from that class. Then, in the 
>> admin, it can be added to every section class that is added to a page 
>> class. The only problem is, I have no idea where to start, whether this is 
>> even possible, or if I'm making any sense at all. I'd appreciate any 
>> insight anyone may have.
>>
>> Cheers,
>>
>> Avery 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to