Django app zur Ermittlung Website Abschnitt auf Anfrage.
Installation
& Nbsp; 1. In section.context_processors.section zu TEMPLATE_CONTEXT_PROCESSORS in Ihre Einstellungsdatei:
& Nbsp; TEMPLATE_CONTEXT_PROCESSORS = (
& Nbsp; "django.contrib.auth.context_processors.auth",
& Nbsp; "django.core.context_processors.debug",
& Nbsp; "django.core.context_processors.i18n",
& Nbsp; "django.core.context_processors.media",
& Nbsp; "django.contrib.messages.context_processors.messages",
& Nbsp; "section.context_processors.section")
& Nbsp; 2. In SECTIONS Wert für Ihre Einstellungsdatei in der Form:
& Nbsp; # Tuple von Wörterbüchern verwendet, um URL-Muster-Namen, um Website-Bereiche entsprechen.
& Nbsp; # Beispiel: ({'name': '
& Nbsp; SECTIONS = (
& Nbsp; {'name': "Heimat", "matching_pattern_names": ("Heimat",)},
& Nbsp;)
Verwendung
Wenn Sie allgemeine Ansichten sind, werden Sie jetzt auto haben einen Abschnitt Variable auf Kontext und in Ihre Vorlagen hinzugefügt.
Ansonsten haben Sie einen Blick auf Request Objekte und wie man sie benutzt:
http://docs.djangoproject.com/en/dev/ref/templates/api/#id1
Requirements:
- Python
- Django
Kommentare nicht gefunden