2
0
Эх сурвалжийг харах

Documentation - convert advanced topics docs to markdown

p0lygun 3 жил өмнө
parent
commit
fda36c7343

+ 1 - 0
CHANGELOG.txt

@@ -22,6 +22,7 @@ Changelog
  * Switch focus outlines implementation to `:focus-visible` for cross-browser consistency (Paarth Agarwal)
  * Remove most uppercased text styles from admin UI (Paarth Agarwal)
  * Convert all UI code to CSS logical properties for Right-to-Left (RTL) language support (Thibaud Colas)
+ * Migrate multiple documentation pages from RST to MD (Vibhakar Solanki, LB (Ben Johnston))
  * Fix: When using `simple_translations` ensure that the user is redirected to the page edit view when submitting for a single locale (Mitchel Cabuloy)
  * Fix: When previewing unsaved changes to `Form` pages, ensure that all added fields are correctly shown in the preview (Joshua Munn)
  * Fix: When Documents (e.g. PDFs) have been configured to be served inline via `WAGTAILDOCS_CONTENT_TYPES` & `WAGTAILDOCS_INLINE_CONTENT_TYPES` ensure that the filename is correctly set in the `Content-Disposition` header so that saving the files will use the correct filename (John-Scott Atlakson)

+ 1 - 0
CONTRIBUTORS.rst

@@ -566,6 +566,7 @@ Contributors
 * Sage Abdullah
 * Paarth Agarwal
 * Nicolas Ferrari
+* Vibhakar Solanki
 
 Translators
 ===========

+ 65 - 0
docs/advanced_topics/documents/custom_document_model.md

@@ -0,0 +1,65 @@
+(custom_document_model)=
+
+# Custom document model
+
+An alternate `Document` model can be used to add custom behaviour and
+additional fields.
+
+You need to complete the following steps in your project to do this:
+
+-   Create a new document model that inherits from `wagtail.documents.models.AbstractDocument`. This is where you would add additional fields.
+-   Point `WAGTAILDOCS_DOCUMENT_MODEL` to the new model.
+
+Here's an example:
+
+```python
+# models.py
+from wagtail.documents.models import Document, AbstractDocument
+
+class CustomDocument(AbstractDocument):
+    # Custom field example:
+    source = models.CharField(
+        max_length=255,
+        blank=True,
+        null=True
+    )
+
+    admin_form_fields = Document.admin_form_fields + (
+        # Add all custom fields names to make them appear in the form:
+        'source',
+    )
+```
+
+Then in your settings module:
+
+```python
+# Ensure that you replace app_label with the app you placed your custom
+# model in.
+WAGTAILDOCS_DOCUMENT_MODEL = 'app_label.CustomDocument'
+```
+
+```{note}
+Migrating from the builtin document model
+
+When changing an existing site to use a custom document model, no documents
+will be copied to the new model automatically. Copying old documents to the
+new model would need to be done manually with a
+{ref}`data migration <django:data-migrations>`.
+
+Any templates that reference the builtin document model will still continue
+to work as before.
+```
+
+## Referring to the document model
+
+```{eval-rst}
+.. module:: wagtail.documents
+```
+
+```{eval-rst}
+.. autofunction:: get_document_model
+```
+
+```{eval-rst}
+.. autofunction:: get_document_model_string
+```

+ 0 - 62
docs/advanced_topics/documents/custom_document_model.rst

@@ -1,62 +0,0 @@
-.. _custom_document_model:
-
-=====================
-Custom document model
-=====================
-
-An alternate ``Document`` model can be used to add custom behaviour and
-additional fields.
-
-You need to complete the following steps in your project to do this:
-
-- Create a new document model that inherits from
-  ``wagtail.documents.models.AbstractDocument``. This is where you would
-  add additional fields.
-- Point ``WAGTAILDOCS_DOCUMENT_MODEL`` to the new model.
-
-Here's an example:
-
-.. code-block:: python
-
-    # models.py
-    from wagtail.documents.models import Document, AbstractDocument
-
-    class CustomDocument(AbstractDocument):
-        # Custom field example:
-        source = models.CharField(
-            max_length=255,
-            blank=True,
-            null=True
-        )
-
-        admin_form_fields = Document.admin_form_fields + (
-            # Add all custom fields names to make them appear in the form:
-            'source',
-        )
-
-Then in your settings module:
-
-.. code-block:: python
-
-    # Ensure that you replace app_label with the app you placed your custom
-    # model in.
-    WAGTAILDOCS_DOCUMENT_MODEL = 'app_label.CustomDocument'
-
-.. topic:: Migrating from the builtin document model
-
-    When changing an existing site to use a custom document model, no documents
-    will be copied to the new model automatically. Copying old documents to the
-    new model would need to be done manually with a
-    :ref:`data migration <django:data-migrations>`.
-
-    Any templates that reference the builtin document model will still continue
-    to work as before.
-
-Referring to the document model
-===============================
-
-.. module:: wagtail.documents
-
-.. autofunction:: get_document_model
-
-.. autofunction:: get_document_model_string

+ 9 - 0
docs/advanced_topics/documents/index.md

@@ -0,0 +1,9 @@
+# Documents
+
+```{toctree}
+---
+maxdepth: 2
+---
+custom_document_model
+title_generation_on_upload
+```

+ 0 - 9
docs/advanced_topics/documents/index.rst

@@ -1,9 +0,0 @@
-Documents
-=========
-
-
-.. toctree::
-    :maxdepth: 2
-
-    custom_document_model
-    title_generation_on_upload

+ 1 - 0
docs/releases/2.17.md

@@ -42,6 +42,7 @@ The panel types `StreamFieldPanel`, `RichTextFieldPanel`, `ImageChooserPanel`, `
  * Installing docs extras requirements in CircleCI so issues with the docs requirements are picked up earlier (Thibaud Colas)
  * Remove core usage of jinjalint and migrate to curlylint to resolve dependency incompatibility issues (Thibaud Colas)
  * Switch focus outlines implementation to `:focus-visible` for cross-browser consistency (Paarth Agarwal)
+ * Migrate multiple documentation pages from RST to MD (Vibhakar Solanki, LB (Ben Johnston))
 
 
 ### Bug fixes