View metadata doesn't work
django-seo admin.py contains code:
class ViewAdmin(view_admin):
form = get_view_form(metadata_class)
get_view_form() function calls systemviews.get_view_names() function that attempts to load and parse application urls. Problem is that urls file contains call to admin.autodiscover() that loads django-seo admin module, so when get_view_form() is called, application urls are not yet loaded.
Also, there's another problem with get_view_names(), although it is much easier to solve:
diff --git a/rollyourown/seo/systemviews.py b/rollyourown/seo/systemviews.py
index b03a824..d56ca57 100644
--- a/rollyourown/seo/systemviews.py
+++ b/rollyourown/seo/systemviews.py
@@ -32,7 +32,7 @@ def get_view_names(seo_views):
output.append(name)
else:
for url in urls.urlpatterns:
- if url.name:
+ if getattr(url, 'name', None):
output.append(url.name)
return output
The only suggestion I can make for now would be to overload get_form on the model admin and generate it at runtime.
Ideally, the end developer isn't restricted in this way, I'll keep this ticket open so if I ever get the time, I'll look into structuring things so that it just works. At the very least, there should be something in the docs about doing this.
RE problem #2, sounds good, heppy to include it, can you make a pull request?
Cheers,
Will