File: fenced_code_blocks_issue426.text

package info (click to toggle)
python-markdown2 2.5.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,492 kB
  • sloc: python: 6,201; perl: 1,493; php: 865; makefile: 37
file content (26 lines) | stat: -rw-r--r-- 891 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Django Templates

## NOTES

- The name should map to the URL.
- No distro or app name prefix, they are namespaced by their dirs already
- Since templates are made in python, the are `named_with_underscores.html` (not web style dashes).

## URL PARAMETERS IN THE TEMPLATE

- All views (except `generic.View`) from `django.forms.generic` inherit from `ContextMixin`
- `ContextMixin` defines the method `get_context_data`:
    ```python
    def get_context_data(self, **kwargs):
        kwargs.setdefault('view', self)
        if self.extra_context is not None:
            kwargs.update(self.extra_context)
        return kwargs
    ```
    So when overriding one must be careful to extends `super`'s `kwargs`:
    ```py
    def get_context_data(self, **kwargs):
        kwargs = super().get_context_data(**kwargs)
        kwargs['page_title'] = "Documentation"
        return kwargs
    ```