willhardy/django-seo — Issue #27: View metadata doesn't work
Author: emorozov
Created: 2011-11-20 08:38:14+00:00
State: open

django-seo `admin.py` contains code:

```python
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
```