Hi Malcolm, Thank You very much for your reply. I am completely new to
python and django and trying to learn by using the code from reusuable
apps. I am going to look in to the link you have provided and try to
understand it. Back to the things you asked me,

Since I am having the problem in the person_detail. html template, I
thing the object will be Person.

I have a Person who is a lyricist(PersonType) of Album, composer
(PersonType) of Album and artist(PersonType) of Album. Now on a
person_detail.html page, I want to display all his Albums as a
lyricist, composer and artist.

The following are from my views.py and urls.py

def person_type_detail(request, slug, template_name='people/
persontype_detail.html',  **kwargs):
    return list_detail.object_detail(
        request,
        queryset = PersonType.objects.all(),
        slug = slug,
        template_name = template_name,
        **kwargs
    )
person_type_detail.__doc__ = list_detail.object_detail.__doc__


def person_type_list(request, paginate_by=20, template_name='people/
persontype_list.html',  **kwargs):
    return list_detail.object_list(
        request,
        queryset = PersonType.objects.all(),
        paginate_by = paginate_by,
        template_name = template_name,
        **kwargs
    )
person_type_list.__doc__ = list_detail.object_list.__doc__


def person_detail(request, slug, template_name='people/
person_detail.html'):
    return list_detail.object_detail(
        request,
        queryset = Person.objects.all(),
        slug = slug,
        template_name = template_name,
    )
person_detail.__doc__ = list_detail.object_detail.__doc__


def person_list(request, paginate_by=20, template_name='people/
person_list.html',  **kwargs):
    return list_detail.object_list(
        request,
        queryset = Person.objects.all(),
        paginate_by = paginate_by,
        template_name = template_name,
        **kwargs
    )
person_list.__doc__ = list_detail.object_list.__doc__


def album_detail(request, slug, template_name='music/
album_detail.html'):
  return list_detail.object_detail(
    request,
    queryset = Album.objects.all(),
    slug = slug,
    template_name = template_name,
  )
album_detail.__doc__ = list_detail.object_detail.__doc__


def album_list(request, template_name='music/album_list.html'):
  return list_detail.object_list(
    request,
    queryset = Album.objects.all(),
    paginate_by = 20,
    template_name = template_name,
  )
album_list.__doc__ = list_detail.object_list.__doc__

and from urls.py

urlpatterns = patterns('',

  (r'^admin/', include(admin.site.urls)),

  url(r'^types/(?P<slug>[-\w]+)/$',
    view=mnm_views.person_type_detail,
    name='person_type_detail'),

  url (r'^types/$',
    view=mnm_views.person_type_list,
    name='person_type_list'),

  url(r'^name/(?P<slug>[-\w]+)/$',
    view=mnm_views.person_detail,
    name='person_detail'),

  url (r'^people/$',
    view=mnm_views.person_list,
    name='person_list'),

  url(r'^album/(?P<slug>[-\w]+)/$',
    view    = 'db.mnm.views.album_detail',
    name    = 'music_album_detail',
  ),
  url (r'^albums/$',
    view    = 'db.mnm.views.album_list',
    name    = 'music_album_list',
  ),
)

Regards,
prtamma
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to