-
Notifications
You must be signed in to change notification settings - Fork 117
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
Flatpages per page SEO data editing #33
Comments
You're going to have to unregister the FlatPage from the admin site, and re-register your own ModelAdmin, configured for integration with this app. What i tend to do is import a custom admin overrides module immediately following the admin.autodiscover()
# import admin overrides
import myproject.admin The myproject/admin.py file looks something like this: from django.contrib import admin
from django.contrib.flatpages.admin import FlatPageAdmin
from django.contrib.flatpages.models import FlatPage
from rollyourown.seo.admin import get_inline
from myproject.myapp.seo import Metadata # your custom metadata model
class CustomFlatPageAdmin(FlatPageAdmin):
inlines = [get_inline(Metadata)]
admin.site.unregister(FlatPage)
admin.site.register(FlatPage, CustomFlatPageAdmin) While you're at it, use CustomFlatPage admin to make all those FlatPage ModelAdmin modifications you always wanted to do. |
Thank you, smcoll, for your helpful comment. I'm trying to do the exact same thing as what pythonpro is trying to do. I think I understand what you are suggesting in your comment, but could you provide more details on how to actually write the rollyourown.seo.admin model and the myproject.myapp.seo model? I'm a Django noob, so I don't know exactly how to write those models. I do understand how this whole works in theory, though. Thanks. |
The rollyourown.seo.admin module is part of the django-seo package- you don't have to write it. See the Django SEO docs for help in constructing the metadata model: http://django-seo.readthedocs.org/en/latest/introduction/tutorial.html#metadata-definition |
Thanks for your response! |
Pls, clarify (here or in docs) how to add SEO fields inline to Flatpage creation/editing page without flatpages app admin.py file monkeypatching. Thnx.
The text was updated successfully, but these errors were encountered: