willhardy / django-seo

Provides a set of tools for managing Search Engine Optimisation (SEO) for Django sites.
BSD 3-Clause "New" or "Revised" License
251 stars 117 forks source link

Model fallback #20

Open aaloy opened 13 years ago

aaloy commented 13 years ago

Hi!

I've created a test project to see how django-seo works. I've create a seo path without problems and I'd like to create seo content linked to my models. What I want is to have a fallback content for most of my models, so I defied a Model Metadata entry.

In the template I have add {% get_metadata for myobj as metadata %} but I can't get the default value defined en the Model detadata.

Tracing the code I have seen that when a value is not supplied goes to the populate_from fallback but first it should go to the model content.

willhardy commented 13 years ago

This is an interesting point. The populate_from argument is a fallback for developers to determine, while the Model metadata is a fallback for the site administrator to determine. I'm not sure which one should win where there is a conflict. I'll write a couple more tests to check it is working correctly.

I have a feeling your idea is a better approach, because that's what the site administrator may expect, but I'll have a look at some examples first.

Thanks for the report!

aaloy commented 13 years ago

Well, I see populate_from as the "last line of defense" so it would be the last fallback. I think this guarantees the minimum suprise for the site developer and for the site administrator.

willhardy commented 13 years ago

Well argued! I'm convinced you're right, the populate_from was originally intended for generic placefiller metadata, I think the administrator should be able to override it, which is the point of the Model metadata.

willhardy commented 13 years ago

Hmm, this is a little more difficult to change than I thought, but I think it's for the better. My first attempt failed a number of other tests, so I'll have to have another look at it over the next few days.

aaloy commented 13 years ago

Let me know if I can help in anyway.