Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model fallback #20

Open
aaloy opened this issue Mar 1, 2011 · 5 comments
Open

Model fallback #20

aaloy opened this issue Mar 1, 2011 · 5 comments

Comments

@aaloy
Copy link

aaloy commented Mar 1, 2011

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
Copy link
Owner

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
Copy link
Author

aaloy commented Mar 1, 2011

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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Author

aaloy commented Mar 9, 2011

Let me know if I can help in anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants