Skip to content

Commit f51d50a

Browse files
authored
docs: move to mkdocs and write about arrayfield
1 parent 0dbeac8 commit f51d50a

File tree

103 files changed

+247
-10396
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+247
-10396
lines changed

.github/workflows/docs.yml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,45 @@ jobs:
1111
if: github.event_name != 'push'
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v1
15-
- uses: actions/setup-node@v1
14+
- name: Clone Repository
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
1619
with:
17-
node-version: '14.x'
18-
- name: Test Build
19-
run: |
20-
cd docs
21-
if [ -e yarn.lock ]; then
22-
yarn install --frozen-lockfile
23-
elif [ -e package-lock.json ]; then
24-
npm ci
25-
else
26-
npm i
27-
fi
28-
npm run build
20+
python-version: 3.11
21+
22+
- name: Install Dependencies
23+
run: pip install .[docs]
24+
25+
- name: Test build
26+
run: mkdocs build
2927

3028
gh-release:
3129
if: github.event_name != 'pull_request'
3230
runs-on: ubuntu-latest
3331
steps:
34-
- uses: actions/checkout@v3
35-
- uses: actions/setup-node@v3
32+
- name: Clone Repository
33+
uses: actions/checkout@v3
34+
35+
- name: Configure Git Credentials
36+
run: |
37+
git config user.name github-actions[bot]
38+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
39+
40+
- name: Set up Python
41+
uses: actions/setup-python@v5
3642
with:
37-
node-version: 16
38-
cache: yarn
39-
cache-dependency-path: 'docs/yarn.lock'
40-
41-
- name: Install dependencies
42-
run: cd docs && yarn install --frozen-lockfile
43-
- name: Build website
43+
python-version: 3.11
44+
45+
- name: Install Dependencies
46+
run: pip install .[docs]
47+
48+
- name: Build
4449
run: cd docs && yarn build
50+
4551
- name: Deploy to GitHub Pages
4652
uses: peaceiris/actions-gh-pages@v3
4753
with:
4854
github_token: ${{ secrets.GH_PAGES_DEPLOY }}
49-
publish_dir: ./docs/build
55+
publish_dir: ./site

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ media/
66
build
77
*.egg-info
88
dist
9+
site

docs/.gitignore

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/README.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

docs/_stylesheets/extra.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.md-typeset__table,
2+
.md-typeset__table table,
3+
.md-typeset__table table thead,
4+
.md-typeset__table table tbody,
5+
.md-typeset__table tr {
6+
width: 100%;
7+
}
8+
.md-typeset__table th.adr-emoji,
9+
.md-typeset__table td.adr-emoji {
10+
width: 70px;
11+
min-width: 70px !important;
12+
max-width: 70px;
13+
}
14+
.md-typeset__table th.adr-text,
15+
.md-typeset__table td.adr-text {
16+
width: 100%;
17+
}
18+
19+
20+
.images-container {
21+
display: flex;
22+
flex-direction: column;
23+
align-items: center;
24+
justify-content: center;
25+
}

docs/array_field/tutorial.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Use ImageListField to store Multiple Images
2+
3+
!!! warning "Version Information"
4+
5+
Introduced at the 0.5.0 version.
6+
7+
!!! warning "Database Information"
8+
9+
Supported only on PostgreSQL Database's.
10+
11+
The `widget` only supports ImageField and this is a limitation to upload only one image per widget. The `inline admin` support multiple images upload but it is only supported by the `django.contrib.admin` pages.
12+
13+
Some comments, like the [Discussion #97](https://github.com/inventare/django-image-uploader-widget/discussions/97), [Issue #146](https://github.com/inventare/django-image-uploader-widget/issues/146) and [Issue #110](https://github.com/inventare/django-image-uploader-widget/issues/110) make some feature requests and the Issue #146 takes one proposition: uses the `ArrayField`. The `ArrayField` is a `PostgreSQL` specific field and support for storing multiple values into one field.
14+
15+
## Experimental for Now?
16+
17+
Currently, we have added support, addaptating the `inline admin` feature to work widget-like and add support for the `ArrayField` to store images using the `storage` and save it path to an `ArrayField`. This is, really, a little experimental for now, and can contains some bugs. If your found one: open a Issue reporting.
18+
19+
### Attention point
20+
21+
Like various other `multiple` instances or values support, we have an tiny problem at this component, for now: when we save a form with some "unchanged" values, i.e., with the current file path string instead of an uploaded file, this string is used to store in the database. Is planed, in the future, change this to use the original array values to confirm the sended values. But, for this first version, this is a issue that is not resolved.
22+
23+
## Usage
24+
25+
Instead of `widget` or `inline admin` that we only set the `widget` and `inline admin` for the created model, in this part, we need to customize the model.
26+
27+
```python
28+
from django.db import models
29+
from image_uploader_widget.postgres import ImageListField
30+
31+
class TestWithArrayField(models.Model):
32+
images = ImageListField(blank=True, null=True, upload_to="admin_test")
33+
34+
class Meta:
35+
verbose_name = "Test With Array Field"
36+
```
37+
38+
This is really simple and is not needed to create more customizations. The widget and form is automatic created for the custom multiple images widget.

docs/babel.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/docs/customization/colors.md renamed to docs/customization/colors.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
sidebar_position: 1
3-
---
4-
51
# Colors
62

73
To customize the image uploader widget colors you can use your own css file to override the css variables defined by the `image-uploader-inline.css` and `image-uploader-widget.css`. See an example, taken from another personal private project:

docs/versioned_docs/version-0.4.0/customization/text-and-icons.md renamed to docs/customization/text-and-icons.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
sidebar_position: 2
3-
---
4-
51
# Text And Icons
62

73
To customize the image uploader widget or inline you can set some variables (this feature is based on the issue [#77](https://github.com/inventare/django-image-uploader-widget/issues/77)). In this page we talk about how to, easy, change the texts and icons on that lib.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# ADR 0000: Why jQuery?
22

3-
November 2023 . [Eduardo Oliveira](https://github.com/EduardoJM)
3+
| :date: {: .adr-emoji } | November 2023. {: .adr-text} |
4+
| :----------------------------: | :-------------------------------------------------------------- |
5+
| :writing_hand: {: .adr-emoji } | [Eduardo Oliveira](https://github.com/EduardoJM) {: .adr-text } |
46

57
## Context
68

0 commit comments

Comments
 (0)