I am learning Django and my first program is a drill-down type page similar to what I see at http://chicagocrime.org. I am using generic views and have run into confusion about how to handle a URL like this:
http://www.chicagocrime.org/types/armed_violence/245/ I have two models, programs and counties, where each county can contain any number of programs. My urls.py and models.py are included at the end. What I can't figure out is exactly how to handle this when a drill-down is more than one level deep. My attempt below with the URL /program/county/12345/ produces the following error messages: Exception Type: TypeError Exception Value: object_list() got multiple values for keyword argument 'queryset' which I can tell is because the URL parameter is getting passed to object_list(). So my question is, how do I take advantage of a URL parameter and suppress it getting passed to object_list()? What would be a better way to handle this and still take advantage of generic views? My program will probably end up allowing drilling-down multiple levels deep and ideally with a lot of cross relations. Thanks! Tim == urls.py == *from django.conf.urls.defaults import ** from drill.models import county, program program_info_dict = { 'queryset': program.objects.order_by('programname'), } urlpatterns = patterns('', (r'^county/$', 'django.views.generic.list_detail.object_list', dict(queryset=county.objects.all(), paginate_by=40)), (r'^county/(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', dict(queryset=county.objects.all())), (r'^program/$', 'django.views.generic.list_detail.object_list', dict(program_info_dict, paginate_by=40)), (r'^program/(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', program_info_dict), (r'^program/county/(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_list', dict(queryset=program.objects.filter(fips='object_id'), paginate_by=40)), ) == models.py == from django.db import models class county(models.Model): fips = models.IntegerField(blank=False) countyname = models.CharField(maxlength=210) class Meta: ordering = ('countyname',) def __str__(self): return self.countyname class program(models.Model): programname = models.CharField(blank=True, maxlength=219) fips = models.ForeignKey(county) ) def __str__(self): return self.programname --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---