Changed the formatting a bit in README.md
This commit is contained in:
23
README.md
23
README.md
@@ -3,6 +3,7 @@ This repository holds the django library that StarFields uses for the django-res
|
|||||||
# Differences with the DRF generic views
|
# Differences with the DRF generic views
|
||||||
|
|
||||||
It changes the generic lifecycles of all the CRUD operations to fit within them automated caching functionality. Caching and deleting cache keys is handled by the library in a way that the cache keys have no duplicates. The generic views offered include single item CRUD and list-based CRUD.
|
It changes the generic lifecycles of all the CRUD operations to fit within them automated caching functionality. Caching and deleting cache keys is handled by the library in a way that the cache keys have no duplicates. The generic views offered include single item CRUD and list-based CRUD.
|
||||||
|
|
||||||
To manage automated caching this the library replaces (and appends to) the DRF filters. These filters need a get_unique_dict method in order to avoid the duplicate cache keys problem.
|
To manage automated caching this the library replaces (and appends to) the DRF filters. These filters need a get_unique_dict method in order to avoid the duplicate cache keys problem.
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
@@ -56,16 +57,18 @@ class SearchView(generics.CachedListRetrieveAPIView):
|
|||||||
```
|
```
|
||||||
|
|
||||||
### New class attributes that are used
|
### New class attributes that are used
|
||||||
cache_prefix: defines the prefix that the module will use when saving values in the cache
|
```python
|
||||||
cache_vary_on_user: defines whether keys saved in the cache are different for each user, in which case extra user information will be added to the cache prefix
|
cache_prefix = defines the prefix that the module will use when saving values in the cache
|
||||||
cache_timeout_mins: the cache key timeout
|
cache_vary_on_user = defines whether keys saved in the cache are different for each user, in which case extra user information will be added to the cache prefix
|
||||||
filter_backends: the filters that you want the view to have, each can be configured with view class attributes
|
cache_timeout_mins = the cache key timeout
|
||||||
ordering_fields: if you use the OrderingFilter you must indicate what fields the user can order by, the first element is used as the default order
|
filter_backends = the filters that you want the view to have, each can be configured with view class attributes
|
||||||
search_fields: if you use the TrigramSearchFilter you must indicate the fields to search through
|
ordering_fields = if you use the OrderingFilter you must indicate what fields the user can order by, the first element is used as the default order
|
||||||
paged: your generic view can have a pager for the user to choose pages or it can be a full listing
|
search_fields = if you use the TrigramSearchFilter you must indicate the fields to search through
|
||||||
default_page_size: the default size of the pages if a user has not indicated a page size
|
paged = your generic view can have a pager for the user to choose pages or it can be a full listing
|
||||||
logger: you should register a logger in order to get error feedback in your deployments
|
default_page_size = the default size of the pages if a user has not indicated a page size
|
||||||
cache: the main feature of this module is automated and organized caching, you should register your cache here
|
logger = you should register a logger in order to get error feedback in your deployments
|
||||||
|
cache = the main feature of this module is automated and organized caching, you should register your cache here
|
||||||
|
```
|
||||||
|
|
||||||
### Extras
|
### Extras
|
||||||
The source code is similar to the django-rest-framework's generic classes and related objects, it should be eminently readable. A new method is added in each filter named get_unique_dict that aids in fixing the duplicate key problem.
|
The source code is similar to the django-rest-framework's generic classes and related objects, it should be eminently readable. A new method is added in each filter named get_unique_dict that aids in fixing the duplicate key problem.
|
||||||
|
|||||||
Reference in New Issue
Block a user