That's the idea of get_content_model - to retrieve it without knowing the attribute name.
On Wed, Aug 5, 2015 at 8:19 PM, <[email protected]> wrote: > I have found a workaround, that I hope abides by the 'style guidelines' of > Mezzanine: > > get_content_model can be leveraged for models subclassing Page. This got > my problem fixed for now and I can properly handle my custom page > objects,so as long as I remove the richtextpage reference and use > 'get_content_model' instead. > I wonder if it's just wiser to create specific templates for the custom > pages alone. The problem is that in some cases I need to support a given > page to be either an original RichTextPage or one of the other types. I > looked at how Gallery pages are handled and I still don't understand why I > couldn't get it to work earlier. > > Thanks! > > > On Wednesday, August 5, 2015 at 12:33:18 PM UTC+3, [email protected] > wrote: >> >> Hello! >> >> I've been working on a Mezzanine site with some friends and so far it's >> an excellent framework. However we are a bit stuck with some seemingly >> simple issues: >> >> >> 1. How can we access form fields by name? For example., we have a >> contact form which uses some special styling and we want to render it in a >> 'static' fashion, so we would only need to access, say, 'name', 'email', >> 'subject', 'message' fields, leaving the rest of the logic as it is in >> Mezzanine. I haven't found a way to do this yet but want to avoid creating >> a bonafide Django form model. >> 2. After upgrading the development branch to 4.x, we found out about >> the issues related to field injection and the new migrations system. Since >> we are rather concerned about portability to future Mezzanine versions, we >> decided to implement a custom page type. It subclasses both Page and >> RichText. We want to be able to use the default templates which reference >> 'page.richtextpage'. This obviously breaks when richtextpage is referenced >> from the template and there is no such property in the page object. We >> tried using a property in OurCustomPage model but still didn't get it to >> work (it simply returned its own instance's ourcustompage). >> >> >> Thanks in advance! >> Steve >> > -- > 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. > -- Stephen McDonald http://jupo.org -- 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.
