Django Zinnia url extension in walkthrough?

Following the steps here: http://django-blog-zinnia.com/documentation/how-to/rewriting_entry_url/ it is not clear if I have all the correct steps due to the wording making it difficult to debug my code.

I created the files below, but I get a ViewDoesNotExist error while trying to access anything (note: everything works fine if I switch the main url.py to point to the default Zinnia urls.

Mistake:

Tried entry_shortlink in zinnia.views.entries module. Error: Object 'module' has no attribute 'entry_shortlink'

In the main urls.py ----

url(r'^news/', include('qclick.publisher.urls.entries')),

      

publisher / urls / entries.py (copied from zinnia defaults and only edited below) ----

...

url(r'^(?P<object_id>\d+)/$',
    'qclick.publisher.ext_views.entry_detail',
    name='zinnia_entry_detail'),

      

...

publisher / ext_views.py ----

from zinnia.views.decorators import protect_entry
from django.views.generic.list_detail import object_detail

entry_detail = protect_entry(object_detail)

      

publisher / ext_models.py ----

from django.db import models
from zinnia.models import EntryAbstractClass

class EntryWithNewUrl(EntryAbstractClass):
        """Entry with '/news/<id>/' URL"""

    @models.permalink
    def get_absolute_url(self):
            return ('zinnia_entry_detail', (),
                            {'object_id': self.id})

      


I'm sure the error is creeping in because I'm not extending the entry correctly, where the manual says "just use the method described in the Extended Entry model document to create a new class based on EntryAbstractClass with a new get_absolute_url".

As it is not clear what elements I need to add from the link on http://django-blog-zinnia.com/documentation/how-to/extending_entry_mo ....

I am just trying to run this with the / news / id / url pass and then after that it is decided to change it to my preferred / news / slug /.

I also posted this on a Google group run by author Zinnia, but with no response. All help is appreciated!

+3


source to share





All Articles