From 397a753ee5add63190bf6d7d3c3b349c31fe4831 Mon Sep 17 00:00:00 2001 From: shobu13 Date: Tue, 24 Oct 2023 23:00:59 +0200 Subject: [PATCH] Update models.md reference: model.model (1251) ```python if not getattr(new_class._meta, "model_key_prefix", None): # Don't look at the base class for this. new_class._meta.model_key_prefix = ( f"{new_class.__module__}.{new_class.__name__}" ) ``` so the property default to the module name + class name instead of just "", current documentation may missleadv :) --- docs/models.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/models.md b/docs/models.md index cf5132d1..31d1c7f7 100644 --- a/docs/models.md +++ b/docs/models.md @@ -120,7 +120,7 @@ Here is a table of the settings available in the Meta object and what they contr | Setting | Description | Default | | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | | global_key_prefix | A string prefix applied to every Redis key that the model manages. This could be something like your application's name. | "" | -| model_key_prefix | A string prefix applied to the Redis key representing every model. For example, the Redis Hash key for a HashModel. This prefix is also added to the redisearch index created for every model with indexed fields. | "" | +| model_key_prefix | A string prefix applied to the Redis key representing every model. For example, the Redis Hash key for a HashModel. This prefix is also added to the redisearch index created for every model with indexed fields. | f"{new_class.__module__}.{new_class.__name__}" | | primary_key_pattern | A format string producing the base string for a Redis key representing this model. This string should accept a "pk" format argument. **Note:** This is a "new style" format string, which will be called with `.format()`. | "{pk}" | | database | A redis.asyncio.Redis or redis.Redis client instance that the model will use to communicate with Redis. | A new instance created with connections.get_redis_connection(). | | primary_key_creator_cls | A class that adheres to the PrimaryKeyCreator protocol, which Redis OM will use to create a primary key for a new model instance. | UlidPrimaryKey |