Skip to content

Commit 57acaf9

Browse files
committed
Update the documentation and formatting
1 parent a7e4d51 commit 57acaf9

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ A collection of fearures used in our Django-based web applications
33

44
[Changelog](CHANGELOG.md)
55

6-
## Installation
6+
# Installation
77

88
``` bash
99
pip install ftw-django-features
1010
```
1111

12-
## Usage
12+
# Usage
1313

1414
Add desired app to `INSTALLED_APPS` in your Django project.
1515

@@ -19,7 +19,7 @@ django_features.system_message
1919
django_features.custom_fields
2020
```
2121

22-
## Configuration
22+
# Configuration
2323

2424
If you want to use `django_features`, your base configuration class should inherit from `django_features.settings.BaseConfiguration`.
2525

@@ -31,7 +31,7 @@ class Base(BaseConfiguration):
3131
...
3232
```
3333

34-
### Custom Fields
34+
## Custom Fields
3535

3636
To use all features of the `django_features.custom_fields` app, the following steps are required:
3737

@@ -41,24 +41,32 @@ Add the `django_features.custom_fields.routers.custom_field_router` to your `ROO
4141
path("api/", include(custom_field_router.urls)),
4242
```
4343

44-
#### Models
44+
### Create your own custom field and value models
4545

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`.
4749

48-
#### Swappable
50+
### Configuration
4951

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:
59+
- `custom_values = models.ManyToManyField(blank=True, to=CustomValue, verbose_name=_("Benutzerdefinierte Werte"))`
5260

5361
#### Querysets
5462

55-
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`.
5664

5765
#### Serializers
5866

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`.
6068

61-
### System Message
69+
## System Message
6270

6371
If you want to use `django_features.system_message`, your base configuration class should inherit from `django_features.system_message.settings.SystemMessageConfigurationMixin`.
6472

@@ -85,15 +93,15 @@ Add the `django_features.system_message.routers.system_message_router` to your `
8593
path("api/", include(system_message_router.urls)),
8694
```
8795

88-
## Development
96+
# Development
8997

9098
Installing dependencies, assuming you have poetry installed:
9199

92100
``` bash
93101
poetry install
94102
```
95103

96-
## Release
104+
# Release
97105

98106
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.
99107

0 commit comments

Comments
 (0)