Skip to content

Commit

Permalink
⚡🔨📚 refactor(README): Improve settings section structure
Browse files Browse the repository at this point in the history
  • Loading branch information
MEHRSHAD-MIRSHEKARY committed Oct 12, 2024
1 parent 3f90aa3 commit 583d733
Showing 1 changed file with 67 additions and 70 deletions.
137 changes: 67 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ curl -X GET http://localhost:8000/notification/notifications/
This will return a list of notifications created for the authenticated user.


With the setup complete, the `django_notification` is ready for use in your project. For further customizations and settings, refer to the [API Guide](api_guide) and [Settings](settings) sections.
With the setup complete, the `django_notification` is ready for use in your project. For further customizations and settings, refer to the [API Guide](#api-guide) and [Settings](#settings) sections.

---

Expand Down Expand Up @@ -1126,169 +1126,168 @@ Below is a detailed description of each setting, so you can better understand an

### `DJANGO_NOTIFICATION_API_INCLUDE_SOFT_DELETE`

**Type**: `bool`
**Default**: `True`
**Description**: Enables soft delete, allowing notifications to be excluded from API views without removing them from the database. If enabled, the `clear_activities` and `clear_notification` actions will be available in the `activities` API.
- **Type**: `bool`
- **Default**: `True`
- **Description**: Enables soft delete, allowing notifications to be excluded from API views without removing them from the database. If enabled, the `clear_activities` and `clear_notification` actions will be available in the `activities` API.

----

### `DJANGO_NOTIFICATION_API_INCLUDE_HARD_DELETE`

**Type**: `bool`
**Default**: `False`
**Description**: Enables hard delete, allowing notifications to be permanently removed from the database. If enabled, the `delete_activities` and `delete_notification` actions will be available in the `activities` API.
- **Type**: `bool`
- **Default**: `False`
- **Description**: Enables hard delete, allowing notifications to be permanently removed from the database. If enabled, the `delete_activities` and `delete_notification` actions will be available in the `activities` API.

----

### `DJANGO_NOTIFICATION_ADMIN_HAS_ADD_PERMISSION`

**Type**: `bool`
**Default**: `False`
**Description**: Controls whether the admin interface allows adding new notifications. Set this to `True` to enable Admin users to create new notifications.
- **Type**: `bool`
- **Default**: `False`
- **Description**: Controls whether the admin interface allows adding new notifications. Set this to `True` to enable Admin users to create new notifications.

----

### `DJANGO_NOTIFICATION_ADMIN_HAS_CHANGE_PERMISSION`

**Type**: `bool`
**Default**: `False`
**Description**: Controls whether the admin interface allows modifying existing notifications. Set this to `True` to allow Admin users to edit notifications.
- **Type**: `bool`
- **Default**: `False`
- **Description**: Controls whether the admin interface allows modifying existing notifications. Set this to `True` to allow Admin users to edit notifications.

----

### `DJANGO_NOTIFICATION_ADMIN_HAS_DELETE_PERMISSION`

**Type**: `bool`
**Default**: `False`
**Description**: Controls whether the admin interface allows deleting notifications. Set this to `True` to enable Admin users to delete notifications.
- **Type**: `bool`
- **Default**: `False`
- **Description**: Controls whether the admin interface allows deleting notifications. Set this to `True` to enable Admin users to delete notifications.

----

### `DJANGO_NOTIFICATION_ADMIN_SITE_CLASS`

**Type**: `Optional[str]`
**Default**: `None`
**Description**: Optionally specifies A custom AdminSite class to apply on Admin interface. This allows for more customization on Admin interface, enabling you to apply your AdminSite class into `dj-notification-api` Admin interface.
- **Type**: `Optional[str]`
- **Default**: `None`
- **Description**: Optionally specifies A custom AdminSite class to apply on Admin interface. This allows for more customization on Admin interface, enabling you to apply your AdminSite class into `dj-notification-api` Admin interface.

----

### `DJANGO_NOTIFICATION_SERIALIZER_INCLUDE_FULL_DETAILS`

**Type**: `bool`
**Default**: `False`
**Description**: When set to `True`, API responses will include all notification fields. By default, only essential fields are returned.
- **Type**: `bool`
- **Default**: `False`
- **Description**: When set to `True`, API responses will include all notification fields. By default, only essential fields are returned.

----

### `DJANGO_NOTIFICATION_SERIALIZER_EXCLUDE_NULL_FIELDS`

**Type**: `bool`
**Default**: `False`
**Description**: When set to `True`, API responses will exclude any fields that it's value is `null`.
- **Type**: `bool`
- **Default**: `False`
- **Description**: When set to `True`, API responses will exclude any fields that it's value is `null`.

----

### `DJANGO_NOTIFICATION_API_ALLOW_LIST`

**Type**: `bool`
**Default**: `True`
**Description**: Allows the listing of notifications via the API. Set to `False` to disable this feature.
- **Type**: `bool`
- **Default**: `True`
- **Description**: Allows the listing of notifications via the API. Set to `False` to disable this feature.

----

### `DJANGO_NOTIFICATION_API_ALLOW_RETRIEVE`

**Type**: `bool`
**Default**: `True`
**Description**: Allows retrieving individual notifications via the API. Set to `False` to disable this feature.
- **Type**: `bool`
- **Default**: `True`
- **Description**: Allows retrieving individual notifications via the API. Set to `False` to disable this feature.

----

### `DJANGO_NOTIFICATION_USER_SERIALIZER_FIELDS`

**Type**: `List[str]`
**Default**: `USERNAME_FIELD` and `REQUIRED_FIELDS` from user model
**Description**: Defines the fields to be included in the user serializer in API.
- **Type**: `List[str]`
- **Default**: `USERNAME_FIELD` and `REQUIRED_FIELDS` from user model
- **Description**: Defines the fields to be included in the user serializer in API.

----

### `DJANGO_NOTIFICATION_USER_SERIALIZER_CLASS`

**Type**: `str`
**Default**: `"django_notification.api.serializers.UserSerializer"`
**Description**: Specifies the serializer class used for user objects in the API. Customize this if you need a different user serializer.
- **Type**: `str`
- **Default**: `"django_notification.api.serializers.UserSerializer"`
- **Description**: Specifies the serializer class used for user objects in the API. Customize this if you need a different user serializer.

----

### `DJANGO_NOTIFICATION_GROUP_SERIALIZER_CLASS`

**Type**: `str`
**Default**: `"django_notification.api.serializers.group.GroupSerializer"`
**Description**: Specifies the serializer class used for group objects in the API. You can change this to use a different group serializer.
- **Type**: `str`
- **Default**: `"django_notification.api.serializers.group.GroupSerializer"`
- **Description**: Specifies the serializer class used for group objects in the API. You can change this to use a different group serializer.

----

### `DJANGO_NOTIFICATION_AUTHENTICATED_USER_THROTTLE_RATE`

**Type**: `str`
**Default**: `"30/minute"`
**Description**: Sets the throttle rate (requests per minute, hour or day) for authenticated users in the API.
- **Type**: `str`
- **Default**: `"30/minute"`
- **Description**: Sets the throttle rate (requests per minute, hour or day) for authenticated users in the API.

----

### `DJANGO_NOTIFICATION_STAFF_USER_THROTTLE_RATE`

**Type**: `str`
**Default**: `"100/minute"`
**Description**: Sets the throttle rate (requests per minute, hour or day) for staff (Admin) users in the API.
- **Type**: `str`
- **Default**: `"100/minute"`
- **Description**: Sets the throttle rate (requests per minute, hour or day) for staff (Admin) users in the API.

----

### `DJANGO_NOTIFICATION_API_THROTTLE_CLASS`

**Type**: `str`
**Default**: `"django_notification.api.throttlings.role_base_throttle.RoleBasedUserRateThrottle"`
**Description**: Specifies the throttle class used to limit API requests. Customize this or set it to `None` if no throttling is needed or want to use rest_framework `DEFAULT_THROTTLE_CLASSES`.
- **Type**: `str`
- **Default**: `"django_notification.api.throttlings.role_base_throttle.RoleBasedUserRateThrottle"`
- **Description**: Specifies the throttle class used to limit API requests. Customize this or set it to `None` if no throttling is needed or want to use rest_framework `DEFAULT_THROTTLE_CLASSES`.

----

### `DJANGO_NOTIFICATION_API_PAGINATION_CLASS`

**Type**: `str`
**Default**: `"django_notification.api.paginations.limit_offset_pagination.DefaultLimitOffSetPagination"`
**Description**: Defines the pagination class used in the API. Customize this if you prefer a different pagination style or set to `None` to disable pagination.
- **Type**: `str`
- **Default**: `"django_notification.api.paginations.limit_offset_pagination.DefaultLimitOffSetPagination"`
- **Description**: Defines the pagination class used in the API. Customize this if you prefer a different pagination style or set to `None` to disable pagination.

----

### `DJANGO_NOTIFICATION_API_EXTRA_PERMISSION_CLASS`

**Type**: `Optional[str]`
**Default**: `None`
**Description**: Optionally specifies an additional permission class to extend the base permission (`IsAuthenticated`) for the API. This allows for more fine-grained access control, enabling you to restrict API access to users with a specific permission, in addition to requiring authentication.
- **Type**: `Optional[str]`
- **Default**: `None`
- **Description**: Optionally specifies an additional permission class to extend the base permission (`IsAuthenticated`) for the API. This allows for more fine-grained access control, enabling you to restrict API access to users with a specific permission, in addition to requiring authentication.

----

### `DJANGO_NOTIFICATION_API_PARSER_CLASSES`

**Type**: `List[str]`
**Default**:
- **Type**: `List[str]`
- **Default**:
```python
DJANGO_NOTIFICATION_API_PARSER_CLASSES = [
"rest_framework.parsers.JSONParser",
"rest_framework.parsers.MultiPartParser",
"rest_framework.parsers.FormParser",
]
```
**Description**: Specifies the parsers used to handle API request data formats. You can modify this list to add your parsers or set `None` if no parser is needed.
- **Description**: Specifies the parsers used to handle API request data formats. You can modify this list to add your parsers or set `None` if no parser is needed.

---

### `DJANGO_NOTIFICATION_API_FILTERSET_CLASS`

**Type**: `Optional[str]`
**Default**: `None`

**Description**: Specifies the filter class for API queries. If you want to use this, you need to add `django_filters` to your `INSTALLED_APPS` and provide the path to the `NotificationFilter` class (`"django_notification.api.filters.notification_filter.NotificationFilter"`). Alternatively, you can use a custom filter class if needed.
- **Type**: `Optional[str]`
- **Default**: `None`
- **Description**: Specifies the filter class for API queries. If you want to use this, you need to add `django_filters` to your `INSTALLED_APPS` and provide the path to the `NotificationFilter` class (`"django_notification.api.filters.notification_filter.NotificationFilter"`). Alternatively, you can use a custom filter class if needed.

In your `settings.py`:

Expand All @@ -1309,18 +1308,16 @@ DJANGO_NOTIFICATION_API_FILTERSET_CLASS = "django_notification.api.filters.notif
```

### `DJANGO_NOTIFICATION_API_ORDERING_FIELDS`
**Type**: `List[str]`
**Default**: `["id", "timestamp", "public"]`

**Description**: Specifies the fields available for ordering in API queries, allowing the API responses to be sorted by these fields. You can see all available fields [here](#all-available-fields).
- **Type**: `List[str]`
- **Default**: `["id", "timestamp", "public"]`
- **Description**: Specifies the fields available for ordering in API queries, allowing the API responses to be sorted by these fields. You can see all available fields [here](#all-available-fields).

---

### `DJANGO_NOTIFICATION_API_SEARCH_FIELDS`
**Type**: `List[str]`
**Default**: `["verb", "description"]`

**Description**: Specifies the fields that are searchable in the API, allowing users to filter results based on these fields.
- **Type**: `List[str]`
- **Default**: `["verb", "description"]`
- **Description**: Specifies the fields that are searchable in the API, allowing users to filter results based on these fields.


## All Available Fields:
Expand Down

0 comments on commit 583d733

Please sign in to comment.