Thanks, everyone, I have almost gotten things to work now!

One thing I can't quite figure out, though, is the following:

Say that I have Category defined as in
http://code.djangoproject.com/wiki/CookBookCategoryDataModel
(I use Django 0.91), with the exception that these lines

    def get_separator(self):
        return ' :: '

are changed to

    def get_separator(self):
        return '/'


In addition to the Category class I also have a Document definition in
my model:

class Document(meta.Model):
        title = meta.CharField('title', maxlength=200)
        cat = meta.ForeignKey(Category, blank=True, null=True)

        status = meta.CharField(maxlength=10, choices=STATUS_CHOICES)
        body = meta.TextField('Entry body', help_text='Use Restructured text
syntax.')

        def __repr__(self):
                return self.title

        class META:
                admin = meta.Admin(
                        fields = (
                                (None, {'fields': ('title', 'status', 'cat', 
'body')}),
                                )
                )


Now, my question is: how should I write my urls.py and views.py files
so that I can display the correct document given an url that looks like
this: /myappname/cat1/cat2/cat3/article-title

This is what I have now:
def detail(request, doc_id):
        docs = documents.get_list()
        output = ', '.join([d.title for d in docs])
        return HttpResponse("Hello, all available docs are: %s %s" % (doc_id,
output))

from django.conf.urls.defaults import *

urlpatterns = patterns('doccenter.articles.views',
    (r'^$', 'index'),
    (r'^(?P<doc_id>.+)/$', 'detail'),
)

Thanks,
Kristoffer


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to