django-components 0.67__tar.gz → 0.70__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. {django_components-0.67/src/django_components.egg-info → django_components-0.70}/PKG-INFO +168 -95
  2. {django_components-0.67 → django_components-0.70}/README.md +166 -90
  3. {django_components-0.67 → django_components-0.70}/pyproject.toml +2 -5
  4. {django_components-0.67 → django_components-0.70}/src/django_components/__init__.py +15 -2
  5. django_components-0.70/src/django_components/app_settings.py +119 -0
  6. {django_components-0.67 → django_components-0.70}/src/django_components/component.py +90 -56
  7. django_components-0.70/src/django_components/context.py +64 -0
  8. {django_components-0.67 → django_components-0.70}/src/django_components/logger.py +2 -2
  9. {django_components-0.67 → django_components-0.70}/src/django_components/middleware.py +21 -0
  10. {django_components-0.67 → django_components-0.70}/src/django_components/node.py +13 -6
  11. django_components-0.70/src/django_components/slots.py +534 -0
  12. {django_components-0.67 → django_components-0.70}/src/django_components/templatetags/component_tags.py +3 -117
  13. {django_components-0.67 → django_components-0.70}/src/django_components/utils.py +8 -1
  14. {django_components-0.67 → django_components-0.70/src/django_components.egg-info}/PKG-INFO +168 -95
  15. django_components-0.70/src/django_components.egg-info/requires.txt +1 -0
  16. {django_components-0.67 → django_components-0.70}/tests/test_autodiscover.py +5 -5
  17. {django_components-0.67 → django_components-0.70}/tests/test_component.py +399 -174
  18. {django_components-0.67 → django_components-0.70}/tests/test_component_as_view.py +19 -7
  19. {django_components-0.67 → django_components-0.70}/tests/test_context.py +193 -34
  20. {django_components-0.67 → django_components-0.70}/tests/test_dependency_rendering.py +2 -3
  21. {django_components-0.67 → django_components-0.70}/tests/test_settings.py +3 -3
  22. {django_components-0.67 → django_components-0.70}/tests/test_templatetags.py +520 -37
  23. django_components-0.70/tests/testutils.py +77 -0
  24. django_components-0.67/src/django_components/app_settings.py +0 -146
  25. django_components-0.67/src/django_components/context.py +0 -122
  26. django_components-0.67/src/django_components/slots.py +0 -492
  27. django_components-0.67/src/django_components.egg-info/requires.txt +0 -1
  28. django_components-0.67/tests/testutils.py +0 -47
  29. {django_components-0.67 → django_components-0.70}/LICENSE +0 -0
  30. {django_components-0.67 → django_components-0.70}/setup.cfg +0 -0
  31. {django_components-0.67 → django_components-0.70}/src/django_components/apps.py +0 -0
  32. {django_components-0.67 → django_components-0.70}/src/django_components/component_registry.py +0 -0
  33. {django_components-0.67 → django_components-0.70}/src/django_components/management/__init__.py +0 -0
  34. {django_components-0.67 → django_components-0.70}/src/django_components/management/commands/__init__.py +0 -0
  35. {django_components-0.67 → django_components-0.70}/src/django_components/management/commands/startcomponent.py +0 -0
  36. {django_components-0.67 → django_components-0.70}/src/django_components/management/commands/upgradecomponent.py +0 -0
  37. {django_components-0.67 → django_components-0.70}/src/django_components/py.typed +0 -0
  38. {django_components-0.67 → django_components-0.70}/src/django_components/safer_staticfiles/__init__.py +0 -0
  39. {django_components-0.67 → django_components-0.70}/src/django_components/safer_staticfiles/apps.py +0 -0
  40. {django_components-0.67 → django_components-0.70}/src/django_components/template_loader.py +0 -0
  41. {django_components-0.67 → django_components-0.70}/src/django_components/templatetags/__init__.py +0 -0
  42. {django_components-0.67 → django_components-0.70}/src/django_components/types.py +0 -0
  43. {django_components-0.67 → django_components-0.70}/src/django_components.egg-info/SOURCES.txt +0 -0
  44. {django_components-0.67 → django_components-0.70}/src/django_components.egg-info/dependency_links.txt +0 -0
  45. {django_components-0.67 → django_components-0.70}/src/django_components.egg-info/top_level.txt +0 -0
  46. {django_components-0.67 → django_components-0.70}/tests/test_registry.py +0 -0
  47. {django_components-0.67 → django_components-0.70}/tests/test_startcomponent_command.py +0 -0
@@ -1,15 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django_components
3
- Version: 0.67
3
+ Version: 0.70
4
4
  Summary: A way to create simple reusable template components in Django.
5
5
  Author-email: Emil Stenström <emil@emilstenstrom.se>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/EmilStenstrom/django-components/
8
8
  Keywords: django,components,css,js,html
9
9
  Classifier: Framework :: Django
10
- Classifier: Framework :: Django :: 3.2
11
- Classifier: Framework :: Django :: 4.0
12
- Classifier: Framework :: Django :: 4.1
13
10
  Classifier: Framework :: Django :: 4.2
14
11
  Classifier: Framework :: Django :: 5.0
15
12
  Classifier: Operating System :: OS Independent
@@ -23,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.12
23
20
  Requires-Python: <4.0,>=3.8
24
21
  Description-Content-Type: text/markdown
25
22
  License-File: LICENSE
26
- Requires-Dist: Django>=3.2
23
+ Requires-Dist: Django>=4.2
27
24
 
28
25
  # <img src="logo/logo-black-on-white.svg" alt="django-components" style="max-width: 100%; background: white; color: black;">
29
26
  <a href="https://github.com/EmilStenstrom/django-components/actions?query=workflow%3A%22Run+tests%22"><img align="right" src="https://github.com/EmilStenstrom/django-components/workflows/Run%20tests/badge.svg" alt="Show test status"></a>
@@ -47,7 +44,12 @@ Read on to learn about the details!
47
44
 
48
45
  ## Release notes
49
46
 
50
- **Version 0.67** CHANGED the default way how context variables are resolved in slots. See the [documentation](#isolate-components-slots) for more details.
47
+ 🚨📢 **Version 0.70**
48
+
49
+ - `{% if_filled "my_slot" %}` tags were replaced with `{{ component_vars.is_filled.my_slot }}` variables.
50
+ - Simplified settings - `slot_context_behavior` and `context_behavior` were merged. See the [documentation](#context-behavior) for more details.
51
+
52
+ **Version 0.67** CHANGED the default way how context variables are resolved in slots. See the [documentation](https://github.com/EmilStenstrom/django-components/tree/0.67#isolate-components-slots) for more details.
51
53
 
52
54
  🚨📢 **Version 0.5** CHANGES THE SYNTAX for components. `component_block` is now `component`, and `component` blocks need an ending `endcomponent` tag. The new `python manage.py upgradecomponent` command can be used to upgrade a directory (use --path argument to point to each dir) of components to the new syntax automatically.
53
55
 
@@ -99,7 +101,7 @@ Both routes are described in the official [docs of the _staticfiles_ app](https:
99
101
 
100
102
  Install the app into your environment:
101
103
 
102
- > ```pip install django_components```
104
+ > `pip install django_components`
103
105
 
104
106
  Then add the app into INSTALLED_APPS in settings.py
105
107
 
@@ -145,7 +147,7 @@ STATICFILES_DIRS = [
145
147
 
146
148
  ### Optional
147
149
 
148
- To avoid loading the app in each template using ``` {% load django_components %} ```, you can add the tag as a 'builtin' in settings.py
150
+ To avoid loading the app in each template using `{% load component_tags %}`, you can add the tag as a 'builtin' in settings.py
149
151
 
150
152
  ```python
151
153
  TEMPLATES = [
@@ -171,10 +173,10 @@ Django-components supports all supported combinations versions of [Django](https
171
173
 
172
174
  | Python version | Django version |
173
175
  |----------------|--------------------------|
174
- | 3.8 | 3.2, 4.0, 4.1, 4.2 |
175
- | 3.9 | 3.2, 4.0, 4.1, 4.2 |
176
- | 3.10 | 3.2, 4.0, 4.1, 4.2, 5.0 |
177
- | 3.11 | 4.1, 4.2, 5.0 |
176
+ | 3.8 | 4.2 |
177
+ | 3.9 | 4.2 |
178
+ | 3.10 | 4.2, 5.0 |
179
+ | 3.11 | 4.2, 5.0 |
178
180
  | 3.12 | 4.2, 5.0 |
179
181
 
180
182
  ## Create your first component
@@ -201,19 +203,26 @@ First you need a CSS file. Be sure to prefix all rules with a unique class so th
201
203
 
202
204
  ```css
203
205
  /* In a file called [project root]/components/calendar/style.css */
204
- .calendar-component { width: 200px; background: pink; }
205
- .calendar-component span { font-weight: bold; }
206
+ .calendar-component {
207
+ width: 200px;
208
+ background: pink;
209
+ }
210
+ .calendar-component span {
211
+ font-weight: bold;
212
+ }
206
213
  ```
207
214
 
208
215
  Then you need a javascript file that specifies how you interact with this component. You are free to use any javascript framework you want. A good way to make sure this component doesn't clash with other components is to define all code inside an anonymous function that calls itself. This makes all variables defined only be defined inside this component and not affect other components.
209
216
 
210
217
  ```js
211
218
  /* In a file called [project root]/components/calendar/script.js */
212
- (function(){
213
- if (document.querySelector(".calendar-component")) {
214
- document.querySelector(".calendar-component").onclick = function(){ alert("Clicked calendar!"); };
215
- }
216
- })()
219
+ (function () {
220
+ if (document.querySelector(".calendar-component")) {
221
+ document.querySelector(".calendar-component").onclick = function () {
222
+ alert("Clicked calendar!");
223
+ };
224
+ }
225
+ })();
217
226
  ```
218
227
 
219
228
  Now you need a Django template for your component. Feel free to define more variables like `date` in this example. When creating an instance of this component we will send in the values for these variables. The template will be rendered with whatever template backend you've specified in your Django settings file.
@@ -257,6 +266,7 @@ By default, the Python files in the `components` app are auto-imported in order
257
266
  Autodiscovery occurs when Django is loaded, during the `ready` hook of the `apps.py` file.
258
267
 
259
268
  If you are using autodiscovery, keep a few points in mind:
269
+
260
270
  - Avoid defining any logic on the module-level inside the `components` dir, that you would not want to run anyway.
261
271
  - Components inside the auto-imported files still need to be registered with `@component.register()`
262
272
  - Auto-imported component files must be valid Python modules, they must use suffix `.py`, and module name should follow [PEP-8](https://peps.python.org/pep-0008/#package-and-module-names).
@@ -287,15 +297,23 @@ The output from the above template will be:
287
297
  ```html
288
298
  <!DOCTYPE html>
289
299
  <html>
290
- <head>
300
+ <head>
291
301
  <title>My example calendar</title>
292
- <link href="/static/calendar/style.css" type="text/css" media="all" rel="stylesheet">
293
- </head>
294
- <body>
295
- <div class="calendar-component">Today's date is <span>2015-06-19</span></div>
302
+ <link
303
+ href="/static/calendar/style.css"
304
+ type="text/css"
305
+ media="all"
306
+ rel="stylesheet"
307
+ />
308
+ </head>
309
+ <body>
310
+ <div class="calendar-component">
311
+ Today's date is <span>2015-06-19</span>
312
+ </div>
296
313
  <script src="/static/calendar/script.js"></script>
297
- </body>
298
- <html>
314
+ </body>
315
+ <html></html>
316
+ </html>
299
317
  ```
300
318
 
301
319
  This makes it possible to organize your front-end around reusable components. Instead of relying on template tags and keeping your CSS and Javascript in the static directory.
@@ -507,7 +525,7 @@ Then, to use this component as a view, you should create a `urls.py` file in you
507
525
  ```python
508
526
  # In a file called [project root]/components/urls.py
509
527
  from django.urls import path
510
- from calendar import Calendar
528
+ from components.calendar.calendar import Calendar
511
529
 
512
530
  urlpatterns = [
513
531
  path("calendar/", Calendar.as_view()),
@@ -556,11 +574,12 @@ Produces:
556
574
  </div>
557
575
  ```
558
576
 
559
-
560
577
  #### Conditional slots
561
578
 
562
579
  _Added in version 0.26._
563
580
 
581
+ > NOTE: In version 0.70, `{% if_filled %}` tags were replaced with `{{ component_vars.is_filled }}` variables. If your slot name contained special characters, see the section "Accessing slot names with special characters".
582
+
564
583
  In certain circumstances, you may want the behavior of slot filling to depend on
565
584
  whether or not a particular slot is filled.
566
585
 
@@ -593,61 +612,62 @@ explicit fills, the div containing the slot is still rendered, as shown below:
593
612
  This may not be what you want. What if instead the outer 'subtitle' div should only
594
613
  be included when the inner slot is in fact filled?
595
614
 
596
- The answer is to use the `{% if_filled <name> %}` tag. Together with `{% endif_filled %}`,
597
- these define a block whose contents will be rendered only if the component slot with
615
+ The answer is to use the `{{ component_vars.is_filled.<name> }}` variable. You can use this together with Django's `{% if/elif/else/endif %}` tags to define a block whose contents will be rendered only if the component slot with
598
616
  the corresponding 'name' is filled.
599
617
 
600
- This is what our example looks like with an 'if_filled' tag.
618
+ This is what our example looks like with `component_vars.is_filled`.
601
619
 
602
620
  ```htmldjango
603
621
  <div class="frontmatter-component">
604
622
  <div class="title">
605
623
  {% slot "title" %}Title{% endslot %}
606
624
  </div>
607
- {% if_filled "subtitle" %}
625
+ {% if component_vars.is_filled.subtitle %}
608
626
  <div class="subtitle">
609
627
  {% slot "subtitle" %}{# Optional subtitle #}{% endslot %}
610
628
  </div>
611
- {% endif_filled %}
629
+ {% endif %}
612
630
  </div>
613
631
  ```
614
632
 
615
- Just as Django's builtin 'if' tag has 'elif' and 'else' counterparts, so does 'if_filled'
616
- include additional tags for more complex branching. These tags are 'elif_filled' and
617
- 'else_filled'. Here's what our example looks like with them.
633
+ Here's our example with more complex branching.
618
634
 
619
635
  ```htmldjango
620
636
  <div class="frontmatter-component">
621
637
  <div class="title">
622
638
  {% slot "title" %}Title{% endslot %}
623
639
  </div>
624
- {% if_filled "subtitle" %}
640
+ {% if component_vars.is_filled.subtitle %}
625
641
  <div class="subtitle">
626
642
  {% slot "subtitle" %}{# Optional subtitle #}{% endslot %}
627
643
  </div>
628
- {% elif_filled "title" %}
644
+ {% elif component_vars.is_filled.title %}
629
645
  ...
630
- {% else_filled %}
646
+ {% elif component_vars.is_filled.<name> %}
631
647
  ...
632
- {% endif_filled %}
648
+ {% endif %}
633
649
  </div>
634
650
  ```
635
651
 
636
652
  Sometimes you're not interested in whether a slot is filled, but rather that it _isn't_.
637
- To negate the meaning of 'if_filled' in this way, an optional boolean can be passed to
638
- the 'if_filled' and 'elif_filled' tags.
639
-
640
- In the example below we use `False` to indicate that the content should be rendered
641
- only if the slot 'subtitle' is _not_ filled.
653
+ To negate the meaning of `component_vars.is_filled`, simply treat it as boolean and negate it with `not`:
642
654
 
643
655
  ```htmldjango
644
- {% if_filled subtitle False %}
656
+ {% if not component_vars.is_filled.subtitle %}
645
657
  <div class="subtitle">
646
658
  {% slot "subtitle" %}{% endslot %}
647
659
  </div>
648
- {% endif_filled %}
660
+ {% endif %}
649
661
  ```
650
662
 
663
+ **Accessing slot names with special characters**
664
+
665
+ To be able to access a slot name via `component_vars.is_filled`, the slot name needs to be composed of only alphanumeric characters and underscores (e.g. `this__isvalid_123`).
666
+
667
+ However, you can still define slots with other special characters. In such case, the slot name in `component_vars.is_filled` is modified to replace all invalid characters into `_`.
668
+
669
+ So a slot named `"my super-slot :)"` will be available as `component_vars.is_filled.my_super_slot___`.
670
+
651
671
  ### Setting Up `ComponentDependencyMiddleware`
652
672
 
653
673
  `ComponentDependencyMiddleware` is a Django middleware designed to manage and inject CSS/JS dependencies for rendered components dynamically. It ensures that only the necessary stylesheets and scripts are loaded in your HTML responses, based on the components used in your Django templates.
@@ -673,25 +693,25 @@ COMPONENTS = {
673
693
 
674
694
  ## Component context and scope
675
695
 
676
- By default, components can access context variables from the parent template, just like templates that are included with the `{% include %}` tag. Just like with `{% include %}`, if you don't want the component template to have access to the parent context, add `only` to the end of the `{% component %}` tag):
696
+ By default, components are ISOLATED and CANNOT access context variables from the parent template. This is useful if you want to make sure that components don't accidentally access the outer context.
697
+
698
+ You can set the [context_behavior](#context-behavior) option to `"django"`, to make components behave just like templates that are included with the `{% include %}` tag. Just like with `{% include %}`, if you don't want a specific component template to have access to the parent context, add `only` to the end of the `{% component %}` tag:
677
699
 
678
700
  ```htmldjango
679
- {% component "calendar" date="2015-06-19" only %}{% endcomponent %}
701
+ {% component "calendar" date="2015-06-19" only %}{% endcomponent %}
680
702
  ```
681
703
 
682
704
  NOTE: `{% csrf_token %}` tags need access to the top-level context, and they will not function properly if they are rendered in a component that is called with the `only` modifier.
683
705
 
684
706
  Components can also access the outer context in their context methods by accessing the property `outer_context`.
685
707
 
686
- You can also set `context_behavior` to `isolated` to make all components isolated by default. This is useful if you want to make sure that components don't accidentally access the outer context.
687
-
688
708
  ## Available settings
689
709
 
690
- All library settings are handled from a global COMPONENTS variable that is read from settings.py. By default you don't need it set, there are resonable defaults.
710
+ All library settings are handled from a global `COMPONENTS` variable that is read from `settings.py`. By default you don't need it set, there are resonable defaults.
691
711
 
692
712
  ### Configure the module where components are loaded from
693
713
 
694
- Configure the location where components are loaded. To do this, add a COMPONENTS variable to you settings.py with a list of python paths to load. This allows you to build a structure of components that are independent from your apps.
714
+ Configure the location where components are loaded. To do this, add a `COMPONENTS` variable to you `settings.py` with a list of python paths to load. This allows you to build a structure of components that are independent from your apps.
695
715
 
696
716
  ```python
697
717
  COMPONENTS = {
@@ -723,9 +743,19 @@ COMPONENTS = {
723
743
  }
724
744
  ```
725
745
 
726
- ### Isolate components' context by default
746
+ ### Context behavior
747
+
748
+ > NOTE: `context_behavior` and `slot_context_behavior` options were merged in v0.70.
749
+ >
750
+ > If you are migrating from BEFORE v0.67, set `context_behavior` to `"django"`. From v0.67 and later use the default value `"isolated"`.
751
+
752
+ You can configure what variables are available inside the `{% fill %}` tags. See [Component context and scope](#component-context-and-scope).
753
+
754
+ This has two modes:
755
+
756
+ - `"django"` - Context variables are taken from its surroundings (default before v0.67)
727
757
 
728
- If you'd like to prevent components from accessing the outer context by default, you can set the `context_behavior` setting to `isolated`. This is useful if you want to make sure that components don't accidentally access the outer context.
758
+ - `"isolated"` - Default - Similar behavior to [Vue](https://vuejs.org/guide/components/slots.html#render-scope) or React - variables are taken ONLY from `get_context_data()` method of the component which defines the `{% fill %}` tag. This is useful if you want to make sure that components don't accidentally access the outer context.
729
759
 
730
760
  ```python
731
761
  COMPONENTS = {
@@ -733,26 +763,77 @@ COMPONENTS = {
733
763
  }
734
764
  ```
735
765
 
736
- ### Isolate components' slots
766
+ #### Example "django"
737
767
 
738
- What variables should be available from inside a component slot?
768
+ Given this template
739
769
 
740
- By default, variables inside component slots are preferentially taken from the root context.
741
- This is similar to [how Vue renders slots](https://vuejs.org/guide/components/slots.html#render-scope),
742
- except that, if variable is not found in the root, then the surrounding context is searched too.
770
+ ```django
771
+ {% with cheese="feta" %}
772
+ {% component 'my_comp' %}
773
+ {{ my_var }} # my_var
774
+ {{ cheese }} # cheese
775
+ {% endcomponent %}
776
+ {% endwith %}
777
+ ```
743
778
 
744
- You can change this with the `slot_contet_behavior` setting. Options are:
745
- - `"prefer_root"` - Default - as described above
746
- - `"isolated"` - Same behavior as Vue - variables are taken ONLY from the root context
747
- - `"allow_override"` - slot context variables are taken from its surroundings (default before v0.67)
779
+ and this context returned from the `get_context_data()` method
748
780
 
749
- ```python
750
- COMPONENTS = {
751
- "slot_context_behavior": "isolated",
752
- }
781
+ ```py
782
+ { "my_var": 123 }
783
+ ```
784
+
785
+ Then if component "my_comp" defines context
786
+
787
+ ```py
788
+ { "my_var": 456 }
789
+ ```
790
+
791
+ Then this will render:
792
+
793
+ ```django
794
+ 456 # my_var
795
+ feta # cheese
796
+ ```
797
+
798
+ Because "my_comp" overrides the variable "my_var",
799
+ so `{{ my_var }}` equals `456`.
800
+ And variable "cheese" equals `feta`, because the fill CAN access
801
+ the current context.
802
+
803
+ #### Example "isolated"
804
+
805
+ Given this template
806
+
807
+ ```django
808
+ {% with cheese="feta" %}
809
+ {% component 'my_comp' %}
810
+ {{ my_var }} # my_var
811
+ {{ cheese }} # cheese
812
+ {% endcomponent %}
813
+ {% endwith %}
814
+ ```
815
+
816
+ and this context returned from the `get_context_data()` method
817
+
818
+ ```py
819
+ { "my_var": 123 }
820
+ ```
821
+
822
+ Then if component "my_comp" defines context
823
+
824
+ ```py
825
+ { "my_var": 456 }
826
+ ```
827
+
828
+ Then this will render:
829
+
830
+ ```django
831
+ 123 # my_var
832
+ # cheese
753
833
  ```
754
834
 
755
- For further details and examples, see [SlotContextBehavior](https://github.com/EmilStenstrom/django-components/blob/master/src/django_components/app_settings.py#L12).
835
+ Because both variables "my_var" and "cheese" are taken from the parent's `get_context_data()`.
836
+ But since "cheese" is not defined there, it's empty.
756
837
 
757
838
  ## Logging and debugging
758
839
 
@@ -864,7 +945,6 @@ One of our goals with `django-components` is to make it easy to share components
864
945
 
865
946
  - [django-htmx-components](https://github.com/iwanalabs/django-htmx-components): A set of components for use with [htmx](https://htmx.org/). Try out the [live demo](https://dhc.iwanalabs.com/).
866
947
 
867
-
868
948
  ## Running django-components project locally
869
949
 
870
950
  ### Install locally and run the tests
@@ -906,25 +986,29 @@ How do you check that your changes to django-components project will work in an
906
986
  Use the [sampleproject](./sampleproject/) demo project to validate the changes:
907
987
 
908
988
  1. Navigate to [sampleproject](./sampleproject/) directory:
909
- ```sh
910
- cd sampleproject
911
- ```
989
+
990
+ ```sh
991
+ cd sampleproject
992
+ ```
912
993
 
913
994
  2. Install dependencies from the [requirements.txt](./sampleproject/requirements.txt) file:
914
- ```sh
915
- pip install -r requirements.txt
916
- ```
995
+
996
+ ```sh
997
+ pip install -r requirements.txt
998
+ ```
917
999
 
918
1000
  3. Link to your local version of django-components:
919
- ```sh
920
- pip install -e ..
921
- ```
922
- NOTE: The path (in this case `..`) must point to the directory that has the `setup.py` file.
1001
+
1002
+ ```sh
1003
+ pip install -e ..
1004
+ ```
1005
+
1006
+ NOTE: The path (in this case `..`) must point to the directory that has the `setup.py` file.
923
1007
 
924
1008
  4. Start Django server
925
- ```sh
926
- python manage.py runserver
927
- ```
1009
+ ```sh
1010
+ python manage.py runserver
1011
+ ```
928
1012
 
929
1013
  Once the server is up, it should be available at <http://127.0.0.1:8000>.
930
1014
 
@@ -932,15 +1016,4 @@ To display individual components, add them to the `urls.py`, like in the case of
932
1016
 
933
1017
  ## Development guides
934
1018
 
935
- ### Slot rendering flow
936
-
937
- 1. Flow starts when a template string is being parsed into Django Template instance.
938
-
939
- 2. When a `{% component %}` template tag is encountered, its body is searched for all `{% fill %}` nodes (explicit or implicit). and this is attached to the created `ComponentNode`.
940
-
941
- See the implementation of `component` template tag for details.
942
-
943
- 3. Template rendering is a separate action from template parsing. When the template is being rendered, the `ComponentNode` creates an instance of the `Component` class and passes it the slot fills.
944
-
945
- It's at this point when `Component.render` is called, and the slots are
946
- rendered.
1019
+ - [Slot rendering flot](./docs/slot_rendering.md)