Hi Josh,

Thanks for the reply. I actually already use abstract models in many of my
projects -- very useful feature! Maybe I should have explained my thinking
a bit better. I was describing something more along the lines of the
RichTextPage behaviour. I know the mechanics behind the scences of
RichTextPage is actually more complicated than this, but the behavior that
we see involves a page (eg, class Page(Page, RichTextPage) ) which inherits
RichTextPage. Is it possible to do something like that? For example, I know
I also want my page to have a slider, so I do: class Page(Page, Slider).
Let's say I also want an accordion: class Page(Page, Slider, Accordion).
The level lower than *that *(BaseSlider, BaseAccordion)  would involve the
abstract models you talked about above. Being pretty new to django, I have
some large gaps in my knowledge which may have prevented me from seeing
some glaring error in this thinking --  is this even possible / practical?

Thanks again, I appreciate your help with this!

On Tue, Jan 27, 2015 at 7:58 AM, Josh Cartmell <[email protected]> wrote:

> Hi Avery, you should be able to do this:
>
> class SlideBase(models.Model):
>      # eg
> image = FileField(verbose_name=_("Image"),
>                       upload_to=upload_to("theme.Slide.image", "slider"),
>                       format="Image", max_length=255, null=True, blank=
> True)
> Class Meta:
>    abstract = True
>
>
> Then:
>
> class Slider(Orderable, BaseSlider):
>     pass
>
> The key here is making BaseSlider abstract have a look at the docs if you
> want to dive in more,
> https://docs.djangoproject.com/en/1.7/topics/db/models/#abstract-base-classes
>
> On Mon, Jan 26, 2015 at 10:33 PM, Avery Laird <[email protected]>
> wrote:
>
>> class Slider(Orderable):
>>      # eg
>>
>> image = FileField(verbose_name=_("Image"),
>>                       upload_to=upload_to("theme.Slide.image", "slider"),
>>                       format="Image", max_length=255, null=True, blank=
>> True)
>> Class Meta:
>>    # whatever
>>
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Mezzanine Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mezzanine-users/HVAjvY2ZfCY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> 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