description_from_content

100 views
Skip to first unread message

step

unread,
Mar 7, 2012, 9:30:34 AM3/7/12
to mezzani...@googlegroups.com
1. Any objections to moving description_from_content() to the MetaData model?
2. Adding a management command that runs description_from_content() for all models using MetaData so description_from_content is optionally tied to save...

Stephen McDonald

unread,
Mar 7, 2012, 2:50:19 PM3/7/12
to mezzani...@googlegroups.com
Makes sense since description is part of Meta.

But description_from_content relies on drawing the content from somewhere, falling back to the title, which is defined in Slugged.

So perhaps title belongs on Meta, which makes sense to me, and Slugged then subclasses Meta, then displayable need only subclass Slugged rather than both.

How does this sound?

Management command sounds good too.


On Thu, Mar 8, 2012 at 1:30 AM, step <ste...@gmail.com> wrote:
1. Any objections to moving description_from_content() to the MetaData model?
2. Adding a management command that runs description_from_content() for all models using MetaData so description_from_content is optionally tied to save...



--
Stephen McDonald
http://jupo.org

step

unread,
Mar 7, 2012, 5:14:36 PM3/7/12
to mezzani...@googlegroups.com
Makes sense....  can't have Meta without Slugged anyway... I mean you could... but I can't think of any reason why... 

On another note...  if i remember correctly (have to look at it again)... currently every time the object is saved ... description is gleaned from existing content...  could this be toggled by a boolean in settings?  I could see this causing issues especially when using custom descriptions... 
Message has been deleted

Stephen McDonald

unread,
Mar 7, 2012, 5:51:55 PM3/7/12
to mezzani...@googlegroups.com
No you're right it happens every time. I think it was originally only when the description didn't have a value. It's a fine line, sometimes you'll want it to automatically update, and when you add your own custom description, you obviously won't. I wonder if there's a way of detecting a custom description without needing a bool to toggle.

On Thu, Mar 8, 2012 at 9:16 AM, step <ste...@gmail.com> wrote:
Never mind... it's only when there's no publish_date

Stephen McDonald

unread,
Mar 9, 2012, 10:23:35 AM3/9/12
to mezzani...@googlegroups.com
Done here: https://github.com/stephenmcd/mezzanine/commit/52a2257f29d103efa1890aafbe099a0360c4de1e

Didn't quite work out the way I proposed. Slugged can't subclass MetaData since Keyword subclasses Slugged, and MetaData contains Keywords - it might be doable but it'd be pretty messy I think.

Anyway the above commit achieves the desired effect - description_from_content is now on MetaData along with a few other small tweaks.

Didn't look at the management command or controlling when the description gets set.

step

unread,
Mar 14, 2012, 10:57:23 AM3/14/12
to mezzani...@googlegroups.com
Hmm,  I'm not sure how you could see if there's been custom input...  what would happen if they wanted to use automatic descriptions again... maybe it's one way or the other... There could a use_auto_description checkbox in Metadata, default to True...  might be ugly, but follows the UI for in_nav in Page...

Stephen McDonald

unread,
Mar 14, 2012, 6:11:00 PM3/14/12
to mezzani...@googlegroups.com
Yeah I think the checkbox is actually right, explicit vs implicit etc.

Josh Cartmell

unread,
Mar 14, 2012, 11:17:47 PM3/14/12
to mezzani...@googlegroups.com
I think it's worth noting here that search results are displayed using a truncated description so if the description was not set to auto-update you could end up with results with stale descriptions.  I know it used to be the case that descriptions did not auto update and this was an issue I ran into then.

Stephen McDonald

unread,
Mar 24, 2012, 10:30:50 PM3/24/12
to mezzani...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages