From 1507e34593d6fcb2d198d4d5c31cd227c11a4d79 Mon Sep 17 00:00:00 2001
From: autodeploy <benoit@startinblox.com>
Date: Fri, 21 Jun 2024 16:09:39 +0200
Subject: [PATCH] adding: command documentation

---
 docs/commands.md     | 41 +++++++++++++++++++++++++++++++++++++++++
 docs/create_model.md |  3 ++-
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 docs/commands.md

diff --git a/docs/commands.md b/docs/commands.md
new file mode 100644
index 00000000..357305d4
--- /dev/null
+++ b/docs/commands.md
@@ -0,0 +1,41 @@
+# Available commands
+
+## generate_static_content
+
+You can generate and make available at a /ssr/xxx URI a static copy of the AnonymousUser view of given models.
+Those models need to be configured with the `static_version` and `static_params` Meta options like:
+
+```python
+class Location(Model):
+    name = models.CharField(max_length=255)
+    address = models.CharField(max_length=255)
+    zip_code = models.IntegerField()
+    visible = models.BooleanField(default=False)
+
+    class Meta:
+        # Allow generating a static version of the container view
+        static_version = 1
+
+        # Add some GET parameters to configure the selection of data
+        static_params = {
+          "search-fields": "visible",
+          "search-terms": True,
+          "search-method": "exact"
+        }
+```
+
+You will need additional settings defined either in your settings.yml or settings.py file:
+
+```yml
+BASE_URL: 'http://localhost:8000/'
+MAX_RECURSION_DEPTH: 10 # Default value: 5
+SSR_REQUEST_TIME: 20 # Default value 10 (seconds)
+```
+
+Then you can try it out by executing the following command:
+
+```sh
+python manage.py generate_static_content
+```
+
+You can also set a cron task or a celery Task to launch this command in a regular basis.
\ No newline at end of file
diff --git a/docs/create_model.md b/docs/create_model.md
index 9297ba52..50fffc9f 100644
--- a/docs/create_model.md
+++ b/docs/create_model.md
@@ -1,5 +1,5 @@
 
-### User model requirements
+# User model requirements
 
 When implementing authentication in your own application, you have two options:
 
@@ -469,3 +469,4 @@ MIDDLEWARE = [
 ```
 
 Notice that it will return only HTTP 200 Code.
+
-- 
GitLab