Add documentation and source

Added documentation, source and extra files.
This commit is contained in:
2025-07-02 20:26:50 +02:00
parent 4fc1d36a10
commit e3ebf6bf4f
295 changed files with 24986 additions and 0 deletions

View File

@ -0,0 +1,3 @@
from .index import *
from .basic import *
from .inheritance import *

View File

@ -0,0 +1,55 @@
from annoying.decorators import render_to
from django.http import HttpRequest, HttpResponse
from django.views.generic import TemplateView
from pytz import UTC
def view_untemplated(request: HttpRequest) -> HttpResponse:
"""Return a base view for demonstration purposes."""
return HttpResponse("Page content returned")
@render_to("demonstration/basic/plain.txt")
def view_basic_plain(request: HttpRequest) -> dict:
"""Show a plain text rendered as a template."""
return {}
@render_to("demonstration/basic/variables.html")
def view_basic_variables(request: HttpRequest) -> dict:
"""Show a template using variable interpolation."""
return {"variable1": "Text number 1.", "variable2": 599.31}
@render_to("demonstration/basic/control.html")
def view_basic_control(request: HttpRequest) -> dict:
"""Use control structures."""
return {"values": [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]}
@render_to("demonstration/basic/filters.html")
def view_basic_filters(request: HttpRequest) -> dict:
"""Use template filters."""
from datetime import datetime
return {"strings": ["text in lowercase", "basic text."], "moment": datetime(2020, 1, 1, tzinfo=UTC)}
@render_to("demonstration/basic/tags.html")
def view_basic_tags(request: HttpRequest) -> dict:
"""Use template tags."""
return {"numbers": [1, 2, 3, 4, 5, 6, 7, 8]}
class BasicTemplateView(TemplateView):
"""
Equivalent of the `view_basic_control` view.
See Also:
Documentation to know how to use class-based views:
- https://docs.djangoproject.com/fr/3.2/topics/class-based-views/
"""
template_name = "demonstration/basic/control.html"
extra_context = {"values": [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]}

View File

@ -0,0 +1,8 @@
from annoying.decorators import render_to
from django.http import HttpRequest
@render_to("demonstration/index.html")
def view_index(request: HttpRequest) -> dict:
"""Show the list of all sections."""
return {}

View File

@ -0,0 +1,8 @@
from annoying.decorators import render_to
from django.http import HttpRequest
@render_to("demonstration/inheritance/base.html")
def view_inheritance_base(request: HttpRequest) -> dict:
"""Show the list of all sections."""
return {}