Gist 9766998
✓ Published0🌍 Public
Aandybak
Last edited Mar 25, 2014
Created on Mar 25, 2014
This example shows how a Django-based website displays news activities either as a full list or as a single detail page, depending on whether an extra URL segment is provided. It queries the `Activity` model from the `alban_way` app, rendering all activities into an `activities.html` template or a specific activity into `activity.html`. The code uses Django’s `render_to_response` with `RequestContext`, `Http404` for missing items, and `HttpResponsePermanentRedirect` for URL handling, while relying on the CMS’s `Page` model for context. The data source is the Django ORM, with templates chosen dynamically based on URL structure.
AI-generated description