Code Monkey home page Code Monkey logo

django-seo's People

Contributors

hginer avatar kmike avatar matthewwithanm avatar willhardy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-seo's Issues

File "/usr/local/python3.4/lib/python3.3/site-packages/Django-1.8.11-py3.3.egg/django/db/backends/mysql/base.py", line 27, in <module> raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'

File "/usr/local/python3.4/lib/python3.3/site-packages/Django-1.8.11-py3.3.egg/django/db/backends/mysql/base.py", line 27, in
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module: No module named 'MySQLdb'

environment : python3 django1.8 pymysql

django-seo2 has been released

Hi Everyone!

Seems that this repo is no longer maintained, therefore I created django-seo2, you can use it https://github.com/romansalin/django-seo2.

It includes many bugfixes, python 2 and 3 support, django 1.7-1.9 support and an important performance improve: now it's not need to create metadata instances for all models before using it, it was greatly inefficient and may took a long time in case of having many instances.

Any contributions are welcome.

Model path not found

Hi,

Ok you can forget the 2 previous version of the issue :)

It seems Djgno-seo framework don't find my models path... When I save the fields in the admin the "path" row is blank. But If I fixe the path in the database then it works.

Any idea?

Django version: Django version 1.2.5
Python: Python 2.6.1

Thank you in advance,
Benjamin

Exception when running under pydev debugger

Hi,

I have an error saying "TypeError: 'class Meta' got invalid attribute(s): self,options" when launching my project in debugger (I use pydev debugger). In normal mode (without debugger) this error does not occur. Traceback shows also some dependency with django-cms publisher.

Here's the tracebkack fragment:

 File "ProjectPath\main\seo.py", line 4, in <module>
 class SEOMetadata(seo.Metadata):
 File "build\bdist.win32\egg\rollyourown\seo\base.py", line 200, in __new__
 File "build\bdist.win32\egg\rollyourown\seo\options.py", line 69, in _add_backend
 File "build\bdist.win32\egg\rollyourown\seo\backends.py", line 161, in get_model
 File "c:\python25\lib\site-packages\django_cms-2.1.0.rc1-py2.5.egg\publisher\base.py",   line 50, in publisher_modelbase_new
new_class = _old_new(cls, name, bases, attrs)
File "C:\Python25\lib\site-packages\django\db\models\base.py", line 53, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "C:\Python25\lib\site-packages\django\db\models\base.py", line 213, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Python25\lib\site-packages\django\db\models\options.py", line 93, in contribute_to_class
raise TypeError("'class Meta' got invalid attribute(s): %s" % ','.join(meta_attrs.keys()))
TypeError: 'class Meta' got invalid attribute(s): self,options

Do you have any ideas?

When using i18n_patterns, every path is prefixed with the current language so it can have several versions

If in your Django has several languages configured, and your root URLConf is using the new i18n_patterns, then every path under that urlpatterns setup can have two or more versions. Currently, DjangoSEO assumes that every get_absolute_url call will return an unique URL, when that's not the case for multilingual projects.

For instance, when i18n_patterns is active, a call to get_absolute_url can return /en/objects/myobject_slug/ or /de/objects/myobject_slug/, depending on the current request language.

The result of every call to get_absolute_url (or when using request.path) should be unprefixed from the current language, before using it as "key" to save the metadata instance.

It's hard to migrate an existing Metadata model

When working on a site, now a new requirement is included, support for multiple sites. This is Ok, django.contrib.sites is fine and DjangoSEO supports this via the Metadata.Meta.use_sites attribute. But if the site is initially deployed with Metadata.Meta.use_sites = False, when setting this to True of course there's a missing column _site_id.

Of course, quickly South comes to my mind, but there's a problem: DjangoSEO is not using migration, and migrations are stored in the app directory, so it would be tinkering with a package inside the site-packages directory.

However I can think on associate the Metadata models with the apps that contains the seo.py module, since the models are being created dynamically, and then the migrations would be inside the VCS tracked app. The developer can change settings, inspect changes with South, generate an apply migrations, all under his app scope.

AttributeError: type object 'MyMetadata' has no attribute '_meta'

mmand_line
utility.execute()
File "/usr/local/python3.4/lib/python3.3/site-packages/Django-1.8.11-py3.3.egg/django/core/management/init.py", line 328, in execute
django.setup()
File "/usr/local/python3.4/lib/python3.3/site-packages/Django-1.8.11-py3.3.egg/django/init.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/python3.4/lib/python3.3/site-packages/Django-1.8.11-py3.3.egg/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/usr/local/python3.4/lib/python3.3/site-packages/Django-1.8.11-py3.3.egg/django/contrib/admin/apps.py", line 22, in ready
self.module.autodiscover()
File "/usr/local/python3.4/lib/python3.3/site-packages/Django-1.8.11-py3.3.egg/django/contrib/admin/init.py", line 24, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/usr/local/python3.4/lib/python3.3/site-packages/Django-1.8.11-py3.3.egg/django/utils/module_loading.py", line 74, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/usr/local/python3.4/lib/python3.3/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1584, in _gcd_import
File "", line 1565, in _find_and_load
File "", line 1532, in _find_and_load_unlocked
File "", line 584, in _check_name_wrapper
File "", line 1022, in load_module
File "", line 1003, in load_module
File "", line 560, in module_for_loader_wrapper
File "", line 868, in _load_module
File "", line 313, in _call_with_frames_removed
File "/var/www/html/chouti/app01/admin.py", line 10, in
register_seo_admin(admin.site, MyMetadata)
File "/usr/local/python3.4/lib/python3.3/site-packages/rollyourown/seo/admin.py", line 52, in register_seo_admin
if metadata_class._meta.use_sites:
AttributeError: type object 'MyMetadata' has no attribute '_meta'

vim /usr/local/python3.4/lib/python3.3/site-packages/rollyourown/seo/admin.py

def register_seo_admin(admin_site, metadata_class):
if metadata_class._meta.use_sites:
path_admin = SitePathMetadataAdmin
model_instance_admin = SiteModelInstanceMetadataAdmin
model_admin = SiteModelMetadataAdmin
view_admin = SiteViewMetadataAdmin
else:
path_admin = PathMetadataAdmin
model_instance_admin = ModelInstanceMetadataAdmin
model_admin = ModelMetadataAdmin
view_admin = ViewMetadataAdmin

vim app01/models.py
from rollyourown import seo

class MyMetadata(seo.Metadata):
title = seo.Tag(head=True, max_length=68)
description = seo.MetaTag(max_length=155)
keywords = seo.KeywordTag()
heading = seo.Tag(name="h1")
vim /var/www/html/chouti/app01/admin.py

ecoding:utf-8

from django.contrib import admin
from app01 import models
from app01.models import MyMetadata
from django.db.models.lookups import Search
from rollyourown.seo.admin import register_seo_admin
from django.contrib import admin

from app01.seo import MyMetadata

register_seo_admin(admin.site, MyMetadata)

Register your models here.

class News(admin.ModelAdmin):
list_display=('title','summary','url','favor_count','reply_count','news_type','user','create_date')
list_filter=('create_date',)
search_fields =('title','user')

admin.site.register(models.News,News)
admin.site.register(models.UserType)
admin.site.register(models.Admin)
admin.site.register(models.NewType)
admin.site.register(models.Reply)
admin.site.register(models.Category)
~

populate_from does not populate values

I have the following model:

from django.db import models
from rollyourown import seo
from autoslug import AutoSlugField
from django.core.urlresolvers import reverse
from tagging.fields import TagField

class Post(models.Model):
    slug = AutoSlugField(populate_from = 'title', unique = True)
    title = models.CharField(max_length = 200)
    content = models.TextField(blank = True)
    is_published = models.BooleanField(default = False)
    created_on = models.DateField(auto_now = True)
    published_on = models.DateField()
    tags = TagField()

    def get_absolute_url(self):
        return reverse('post', args = [self.slug])

    def __unicode__(self):
        return self.title

def populate_title(metadata, model_instance = None, **kwargs):
    print metadata
    if model_instance:
        return "Omer Katz - Personal Webstie | %s" % model_instance.title
    else:
        return '321'

def populate_description(metadata, model_instance = None, **kwargs):
    if model_instance:
        return model_instance.content
    else:
        return ''

def populate_keywords(metadata, model_instance = None, **kwargs):
    if model_instance:
        return model_instance.tags
    else:
        return ''

class PostMetadata(seo.Metadata):
    title = seo.Tag(head = True, max_length = 68, populate_from = populate_title)
    description = seo.MetaTag(max_length = 155, populate_from = populate_description)
    keywords = seo.KeywordTag(populate_from = populate_keywords)

    class Meta:
        seo_models = ('blog.Post',)
        verbose_name = "Post Metadata"
        verbose_name_plural = "Post Metadatas"

I can't figure out why the populate_from doesn't populate my metadata fields.
Any idea?

Inline Add not working

When I try to add Metadata inline to an Object I get following error:

duplicate key value violates unique constraint "seo_xyzmetadatamodelinstance__content_type_id_key"

could this be triggered due to the changes made to fix the bug yesterday?


Furthermore I have another bug (I think...or I am doing something wrong):

class XYZMetadata(seo.Metadata):
title = seo.Tag(head=True, max_length=72, populate_from=seo.Literal("xxxxxx"))
description = seo.MetaTag(max_length=155, populate_from=seo.Literal(u"xxxxxx"))
keywords = seo.KeywordTag(populate_from=seo.Literal(u"xxxxxxxx"))
class Meta:
seo_models = ('event.Event', 'profiles.Profile', 'blog.Post')

The populate_from works good when doing {% get_metadata %}, however it returns nothing when I do {% get_metadata for profile %} although it should. It tells me in the Admin that the default values will be displayed, which is never done actually though.

Thanks for the fast fix on the last bug!

Django 1.7 : ImportError cannot import name get_verbose_name

rollyourown/seo/options.py", line 4, in
from django.db.models.options import get_verbose_name

this error is occurred due to some changes in django 1.7
get_verbose_name function is changed from db.models.options.get_verbose_name to utils.text.camel_case_to_spaces
Solution
comment this line
from django.db.models.options import get_verbose_name

Add this line
from django.utils.text import camel_case_to_spaces as get_verbose_name

cannot import rollyourown

Installing the latest commit from git:

$ pip install git+git://github.com/willhardy/django-seo.git@3089686

...results in a package installation where the rollyourown module has no __init__.py file, causing an import error.

Does not work in django v1.8.0

I got this error bellow:

Traceback (most recent call last):
  File "base/seo.py", line 3, in <module>
    from rollyourown import seo
  File "/home/foo/.virtualenvs/retie/local/lib/python2.7/site-packages/rollyourown/seo/__init__.py", line 4, in <module>
    from rollyourown.seo.base import Metadata, Tag, KeywordTag, MetaTag, Raw, Literal, get_metadata, get_linked_metadata
  File "/home/foo/.virtualenvs/retie/local/lib/python2.7/site-packages/rollyourown/seo/base.py", line 17, in <module>
    from django.utils.hashcompat import md5_constructor
ImportError: No module named hashcompat

Unable to use namespacing in view names

To reproduce:

  • Create a list of URLs with a namespace (ie. by using include)
  • Define a metadata in seo.py, with namespace:view_name in its seo_views
  • Create an instance of the metadata for namespace:view_name

Expected: SEO now applies to the view
Actual: SEO missing from the view.

A workaround is to use view_name as the view name, but this will cause problems with multiple namespaces.

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

TemplateSyntaxError when using {% get_metadata %}

Hi again,

I have a problem with get_metadata tag, my template's fragment looks like this:
{% load seo %}
{% get_metadata as seo_data %}
{{seo_data.keywords}}

On my dev box it works fine, but on test server it raises an error:

File "/usr/local/lib/python2.6/dist-packages/Django_SEO-1.0beta1-py2.6.egg/rollyourown/seo/templatetags/seo.py", line 31, in render
raise template.TemplateSyntaxError(msg)

TemplateSyntaxError: {% get_metadata %} needs some path information.
Please use RequestContext with the django.core.context_processors.request context processor.
Or provide a path or object explicitly, eg {% get_metadata for path %} or {% get_metadata for object %}

Any ideas what is wrong?

Cannot input seo data for model instances

Hi again,

I have a problem with assigning seo data for model instances. I configured seo_models section in Meta of my MetaData class, but after this it is not possible to input seo data for instances of given models.

I expected to see (inline) form in edit page for certain model instance and I couldn't find it. Am I doing something wrong?

Swallow `AlreadyRegistered` exception

There is no harm in attempting to register twice (ie in urls.py, which may get called twice under two different names). It's just annoying to have to deal with the exception

Is there any flask SEO?

Hi,
I have developed a product, the backend is python-flask and fronted is Angularjs. Are there any SEO plugins which will make web crawlers to access my site?

ImportError: cannot import name SortedDict (With Django 1.9)

When I tried to make migrations after installing app I suddenly started to get following error

../django1.9/local/lib/python2.7/site-packages/rollyourown/seo/base.py", line 10, in
from django.utils.datastructures import SortedDict
ImportError: cannot import name SortedDict

after readin over Stackoverflow I happened to know SortedDict pack is removed form Django1.9 so the app is not working. Does any body know how to solve the issu ?

`seo_models` and admin inlines

There is currently a problem with models listed in seo_models automatically creating metadata before admin inlines can save their inline metadata.

The current documented approach of not listing the model in seo_models if you wish to use admin inlines works fine, except that the metadata in "model metadata" will never be found because no "model instance metadata" is present.

Ideally, inlines would always create (sometimes empty) metadata for a model instance.

get_inline() should return multiple inlines when Meta.use_sites or Meta.use_i18n are True

When defining a MySEOMetadata metadata model, if it's Meta.use_sites is set to True or it's Meta.use_i18n is set to True, then rollyourown.seo.admin.get_inline(SEOMetadata) should return an inline which allows for adding multiple items, so the webmaster can edit metadata for each site/language right in the item admin page.

In rollyourown.seo.admin, line 111 (as of v1.0, current Pypi's stable version), something like:

def get_inline(metadata_class):
    attrs = {
        'max_num': None if check_if_using_sites_or_i18n(metadata_class) else 1,
        'extra': 1,
        'model': metadata_class._meta.get_model('modelinstance'),
        'ct_field': "_content_type",
        'ct_fk_field': "_object_id",
        'formset': MetadataFormset,
        }
    return type('MetadataInline', (generic.GenericStackedInline,), attrs)

Please remove django from install_requires in setup.py

Hi folks,

''django>=1.1'' is in the install_requires section of setup.py forces the install of latest django release when django is installed from svn and this break things. Can you please remove it from install_requires? I don't think there are many people who want to install django by installing django-seo.

Model fallback

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.

Packaging for PyPi

I would like to package and upload this project to PyPi, but am a little torn on naming and namespaces. The name on github (django-seo) describes what the library does (SEO for Django projects), but the current namespace (rollyourown.seo) doesn't mention django. It is however in line with a series of libraries I would like to write that take a similar approach (letting end developers have their own opinions).

Additionally, there may be problems packaging two-level namespaces separately (eg by having rollyourown.seo and rollyourown.ecommerce in two separate eggs).

I may need to seek advice before making a release, because of course changing the namespace after a release would be evil.

More illustrative documentation

Some of the concepts in django-seo might need a little better explanation in the documentation, including some diagrams or screenshots. This would be useful in the tutorial to provide a clear idea of what the framework does and the various elements.

Perhaps a new section for website administrators would also be useful, including maybe even (automatically generated) help pages in the Django admin. Templating is hardly explained in the documentation and it would be useful to give users an overview of the entire system (model class metadata etc)

Give `populate_from` callables access to model instances

It's useful to have access to the model instance when providing a default value in a populate_from function.

The documentation for this should point out that it's often better to put this logic in the database, using model class linked metadata and template variables.

I imagine it would be best to require all populate_from functions to accept any arguments provided, by using the **kwargs parameter. The system can then provide model_instance, view_name, model_class or whatever else the relevant backend has available. This will help futureproof implementations using the seo library.

Flatpages per page SEO data editing

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.

documentation template context processor

I had to add the following to get django-seo to work maybe i'm using an older settings.py file though

TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.request",

"django.core.context_processors.auth",

"django.core.context_processors.debug",

"django.core.context_processors.i18n",

)

it really only needs the first one but it should be in documentation I think.

Not able to access metadata for model instance.

hi,
i don't know if this is the right place for asking ...but ...here it goes;-)

I'm trying to make this nice piece of code working on a site.
Till now, I’ve managed to display meta information for "paths".
Now I’m trying to display meta associated to a model instance.
I'm not sure what I’m doing wrong, but i can¡t render the meta info in my templates.

Now i'll try to explain in which point i'm:

1-.I've created a Basic seo model in a file named "seo.py" (like in the example).
In this file, i hace Meta definition like this:
seo_views = ('beldemi.web.Promotion', ) (this is my model)
2-. In my admin.py I have added the "metaDataModel" as an inline form my model "Promotion".
Now I’m able to see the MymetaData objects when creating new "Promotion" instances.
3-. From the admin interface now i can see the (model instance, model , path, and views) admin pages.
in the "Model Instance" i can see a record of every "promotion" object i have created.
for each record i see a row like this:
Path: empty
ContentType : promotion
Object_id= [number]

PROBLEM

I'm not able to render the data in the template.
From the template i can access my object like this {{promotion}}
I understand that i should render "METAData" like this: {{get_metadata MyMetaData for promotion}}

If anybody can help.... :D

Error on syncdb: AttributeError: 'tuple' object has no attribute 'index'

Hi,

I have a problem with running syncdb after installing django-seo (I use version from commit: bce453c)

Fragment of traceback:
File "build\bdist.win32\egg\rollyourown\seo\base.py", line 202, in new
File "build\bdist.win32\egg\rollyourown\seo\backends.py", line 309, in validate
AttributeError: 'tuple' object has no attribute 'index'

Before syncdb I have:

  • installed django-seo
  • added 'rollyourown.seo' to installed apps
  • created seo.py with class which inherits MetaData
  • added register_seo_admin call in admin.py file in my app

Any help is much appreciated.

Regards,
Lukasz

TemplateSyntaxError: {% get_metadata %} needs some path information SHOW When set Debug=False,but set to True, no error out.

Traceback (most recent call last):
File "/usr/lib64/python2.6/wsgiref/handlers.py", line 93, in run
self.result = application(self.environ, self.start_response)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 255, in call
response = self.get_response(request)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/core/handlers/base.py", line 178, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/core/handlers/base.py", line 224, in handle_uncaught_exception
return callback(request, *_param_dict)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/utils/decorators.py", line 91, in _wrapped_view
response = view_func(request, *args, *_kwargs)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/views/defaults.py", line 41, in server_error
return http.HttpResponseServerError(template.render(Context({})))
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 140, in render
return self._render(context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 134, in _render
return self.nodelist.render(context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 830, in render
bit = self.render_node(node, context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 844, in render_node
return node.render(context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/loader_tags.py", line 124, in render
return compiled_parent._render(context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 134, in _render
return self.nodelist.render(context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 830, in render
bit = self.render_node(node, context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 844, in render_node
return node.render(context)
File "/home/33pinche/33pinche/project/rollyourown/seo/templatetags/seo.py", line 25, in render
raise template.TemplateSyntaxError(msg)
TemplateSyntaxError: {% get_metadata %} needs some path information.
Please use RequestContext with the django.core.context_processors.request context processor.
Or provide a path or object explicitly, eg {% get_metadata for path %} or {% get_metadata for object %}
[24/May/2013 07:45:56] "GET / HTTP/1.1" 500 59
Traceback (most recent call last):
File "/usr/lib64/python2.6/wsgiref/handlers.py", line 93, in run
self.result = application(self.environ, self.start_response)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 255, in call
response = self.get_response(request)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/core/handlers/base.py", line 178, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/core/handlers/base.py", line 224, in handle_uncaught_exception
return callback(request, *_param_dict)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/utils/decorators.py", line 91, in _wrapped_view
response = view_func(request, *args, *_kwargs)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/views/defaults.py", line 41, in server_error
return http.HttpResponseServerError(template.render(Context({})))
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 140, in render
return self._render(context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 134, in _render
return self.nodelist.render(context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 830, in render
bit = self.render_node(node, context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 844, in render_node
return node.render(context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/loader_tags.py", line 124, in render
return compiled_parent._render(context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 134, in _render
return self.nodelist.render(context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 830, in render
bit = self.render_node(node, context)
File "/home/33pinche/33pinche/lib/python2.6/site-packages/django/template/base.py", line 844, in render_node
return node.render(context)
File "/home/33pinche/33pinche/project/rollyourown/seo/templatetags/seo.py", line 25, in render
raise template.TemplateSyntaxError(msg)
TemplateSyntaxError: {% get_metadata %} needs some path information.
Please use RequestContext with the django.core.context_processors.request context processor.
Or provide a path or object explicitly, eg {% get_metadata for path %} or {% get_metadata for object %}

Nothing displayed when no metadata instance exists

Currently if there is no instance, nothing will be displayed. This shouldn't happen if you are using seo_models or admin inlines from the start, but it may come up if you add the seo app to an existing project and haven't yet edited any model instances.

A way to make this less painful/confusing might be to add a management command to populate the database with empty metadata instances.

Another approach might be to call the populate_from values with any given models. This second approach might be too confusing, as it would only work if you provide the templatetag with an instance. I imagine working in the general case would be extremely difficult.

Doing both might be an acceptable solution, with maybe even an automatic population at syncdb. This makes a stronger case for the system being aware of which models are being used inline in the admin.

ImportError: cannot import name 'SortedDict'

I was trying to integrate this package with my project, I have django v1.10.3 used in my project
I am getting this error "ImportError: cannot import name 'SortedDict'" in file "rollyourown/seo/base.py"
may be you haven't updated your repo for latest version of django , SortedDict deprecated and Removed in Django 1.9

Using dajngo-seo with Model

I'm trying to add some automatic seo tags to model instances.
I have managed to add seo tag as inlines to my model instances, so i can edit the individual data for each instance of my model.

What i really need is that seo tags ar automátically generated from the infor of my model.
Let's say my model is this:

    class Promotion(models.Model):
                name = models.CharField("Nombre", max_length=200)
                content = models.TextField("Contenido", max_length=2000,blank=False)    

And this is my Seo class

   class MyMetadata(seo.Metadata):
     title =    seo.Tag(head = True, max_length = 68, populate_from = populate_title)
     description = seo.MetaTag(head=True,max_length=155)
    keywords    = seo.KeywordTag()
     heading     = seo.Tag(name="h1")

   class Meta:
    verbose_name = "Metadata general"
    seo_models =('web.Promotion',)

and i have defined a the method 'populate_title' as :

         def populate_title(metadata, model_instance = None, **kwargs):                    
            if model_instance:
                    return "PROMOCION ACUTOCREADO EL TITLE "
            else:
                      return '321'        

Now when i create a new "promotion" object and access the view , what i have in the title is

     "123"

I suppouse that "model_instance" should give me access to the instance i'm wroking with.
can anybody show me what should i do.
Thanks in advance.

Automatic admin inline registration

Currently metadata inlines have to be manually added for each Django model. Although this isn't too bad when the admin definitions are heavily customised anyway, this is no doubt a barrier to entry when simply registering using ModelAdmin.

Small Error in templatetags.seo

On line 59 you should insert 'template.' before TemplateSyntaxError(e.msg) and you should removed the e.msg part from the argument

if not metadata:
        # Fetch the metadata
        try:
            metadata = get_metadata(path, self.metadata_name, context, **kwargs)
        except Exception, e:
            raise TemplateSyntaxError(e.msg)

should be

if not metadata:
        # Fetch the metadata
        try:
            metadata = get_metadata(path, self.metadata_name, context, **kwargs)
        except Exception, e:
            raise template.TemplateSyntaxError(e)

based on the way you have done the imports at the top of this file :)

G

Model instance admin

Hi, willhardy.
Thank you for such a great framework.
I have a question related to admin representation of seo model for the model instances:
why are the fields "_content_type" and "_object_id" not editable? They are not visible in the admin. How am i supposed then to add an instance of SEO model for a particular object?

Please, clearify this to me if i didn't notice something.

By the way, Django 1.2.1, Python 2.6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.