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
|
||||
|
||||
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.
|
||||
|
||||
# Usage
|
||||
@@ -56,16 +57,18 @@ class SearchView(generics.CachedListRetrieveAPIView):
|
||||
```
|
||||
|
||||
### New class attributes that are used
|
||||
cache_prefix: defines the prefix that the module will use when saving values in the cache
|
||||
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_timeout_mins: the cache key timeout
|
||||
filter_backends: the filters that you want the view to have, each can be configured with view class attributes
|
||||
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
|
||||
search_fields: if you use the TrigramSearchFilter you must indicate the fields to search through
|
||||
paged: your generic view can have a pager for the user to choose pages or it can be a full listing
|
||||
default_page_size: the default size of the pages if a user has not indicated a page size
|
||||
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
|
||||
```python
|
||||
cache_prefix = defines the prefix that the module will use when saving values in the cache
|
||||
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_timeout_mins = the cache key timeout
|
||||
filter_backends = the filters that you want the view to have, each can be configured with view class attributes
|
||||
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
|
||||
search_fields = if you use the TrigramSearchFilter you must indicate the fields to search through
|
||||
paged = your generic view can have a pager for the user to choose pages or it can be a full listing
|
||||
default_page_size = the default size of the pages if a user has not indicated a page size
|
||||
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
|
||||
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