Re: [mezzanine-users] Overriding status in class Displayable.

2016-10-13 Thread Eduardo Rivas
Thinking out loud, but maybe you can override the admin form for PageAdmin
to set the default there instead of at the model level.

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Overriding status in class Displayable.

2016-10-13 Thread Andrew Selzer

I'm just trying to set up my project using Mezzanine so when a user 
attempts to create a new page the default is the page will be saved as a 
draft and not published. 

I tried a monkeypatch of Displayable._meta.get_field('status').default=1 
which worked for overriding BlogPost but it doesn't seem to work in this 
case. Any advice of how to get this functionality to work? Thanks!

#blog_ext/models.py

from mezzanine.blog.models import BlogPost
from mezzanine.core.models import Displayable

BlogPost._meta.get_field('featured_image').blank = False
BlogPost._meta.get_field('related_posts').blank = False

# Override so default CONTENT_STATUS is draft (1)
# from 
https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/core/models.py
Displayable._meta.get_field('status').default=1

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.