3

Following the steps here: http://django-blog-zinnia.com/documentation/how-to/rewriting_entry_url/ it's not clear if I've got all the correct steps due to the wording which is making it hard for me to debug my code.

I've created the below files, but I get a ViewDoesNotExist error trying to access anything (note: all works fine if I switch the main url.py to point back to Zinnia's default URLs.

The Error:

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

In main urls.py ----

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

publisher/urls/entries.py (copied from zinnia defaults and only edited to 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 model correctly where the guide says: "simply use the method explained in the Extending Entry model document to create a new class based on EntryAbstractClass with the new get_absolute_url method."

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

I'm simply trying to get this up and running with the walkthrough's / news/id/ URL, then after that will tackle changing it to my preferred /news/slug/.

I've also posted this on the Google Group run by the Zinnia author, but with no response. All help appreciated!

shuttle87
  • 15,466
  • 11
  • 77
  • 106
Chris
  • 153
  • 1
  • 3
  • 15

0 Answers0