You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-14Lines changed: 22 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,13 @@ A collection of fearures used in our Django-based web applications
3
3
4
4
[Changelog](CHANGELOG.md)
5
5
6
-
##Installation
6
+
# Installation
7
7
8
8
```bash
9
9
pip install ftw-django-features
10
10
```
11
11
12
-
##Usage
12
+
# Usage
13
13
14
14
Add desired app to `INSTALLED_APPS` in your Django project.
15
15
@@ -19,7 +19,7 @@ django_features.system_message
19
19
django_features.custom_fields
20
20
```
21
21
22
-
##Configuration
22
+
# Configuration
23
23
24
24
If you want to use `django_features`, your base configuration class should inherit from `django_features.settings.BaseConfiguration`.
25
25
@@ -31,7 +31,7 @@ class Base(BaseConfiguration):
31
31
...
32
32
```
33
33
34
-
###Custom Fields
34
+
## Custom Fields
35
35
36
36
To use all features of the `django_features.custom_fields` app, the following steps are required:
37
37
@@ -41,24 +41,32 @@ Add the `django_features.custom_fields.routers.custom_field_router` to your `ROO
41
41
path("api/", include(custom_field_router.urls)),
42
42
```
43
43
44
-
#### Models
44
+
###Create your own custom field and value models
45
45
46
-
Your models should inherit from `django_features.custom_fields.models.CustomFieldBaseModel`.
46
+
1. You need to create a custom field model and a custom value model.
47
+
2. Your custom field model should inherit from `django_features.custom_fields.models.field.AbstractBaseCustomField`.
48
+
3. Your custom value model should inherit from `django_features.custom_fields.models.value.AbstractBaseCustomValue`.
47
49
48
-
#### Swappable
50
+
###Configuration
49
51
50
-
You can swap the models used by the `django_features.custom_fields` app by setting the `CUSTOM_FIELD_MODEL` or `CUSTOM_FIELD_VALUE_MODEL` setting.
51
-
The swapped models should inherit from `django_features.custom_fields.models.field.AbstractBaseCustomField` or `django_features.custom_fields.models.value.AbstractBaseCustomValue`.
52
+
- You can configure the models used by the `django_features.custom_fields` app by setting the `CUSTOM_FIELD_MODEL` or `CUSTOM_FIELD_VALUE_MODEL` setting.
53
+
- The swapped models should inherit from `django_features.custom_fields.models.field.AbstractBaseCustomField` or `django_features.custom_fields.models.value.AbstractBaseCustomValue`.
54
+
55
+
### Models with custom values
56
+
57
+
1. Your models with custom values should inherit from `django_features.custom_fields.models.CustomFieldBaseModel`.
58
+
2. Your models should have a relation to the custom value model. For example:
Your querysets should inherit from `django_features.custom_fields.models.CustomFieldModelBaseManager`.
63
+
Your querysets for the models with custom values should inherit from `django_features.custom_fields.models.CustomFieldModelBaseManager`.
56
64
57
65
#### Serializers
58
66
59
-
Your serializers should inherit from `django_features.custom_fields.serializers.CustomFieldBaseModelSerializer`.
67
+
Your serializers for the models with custom values should inherit from `django_features.custom_fields.serializers.CustomFieldBaseModelSerializer`.
60
68
61
-
###System Message
69
+
## System Message
62
70
63
71
If you want to use `django_features.system_message`, your base configuration class should inherit from `django_features.system_message.settings.SystemMessageConfigurationMixin`.
64
72
@@ -85,15 +93,15 @@ Add the `django_features.system_message.routers.system_message_router` to your `
Installing dependencies, assuming you have poetry installed:
91
99
92
100
```bash
93
101
poetry install
94
102
```
95
103
96
-
##Release
104
+
# Release
97
105
98
106
This package uses towncrier to manage the changelog, and to introduce new changes, a file with a concise title and a brief explanation of what the change accomplishes should be created in the `changes` directory, with a suffix indicating whether the change is a feature, bugfix, or other.
0 commit comments