You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-11Lines changed: 10 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,7 @@ You need to inherit from The Base Document Classes mentioned above to build a do
98
98
99
99
#### Simple Example
100
100
101
-
For Django Model:
101
+
**1. For Django Model:**
102
102
103
103
```python
104
104
# models.py
@@ -114,7 +114,7 @@ class Category(models.Model):
114
114
returnself.name
115
115
```
116
116
117
-
You can create a document class like this:
117
+
**2. You can create a document class like this:**
118
118
119
119
**Note:** Document classes must be stored in `documents.py` file.
120
120
@@ -132,19 +132,19 @@ class CategoryDocument(JsonDocument):
132
132
fields = ["name", "slug"]
133
133
```
134
134
135
-
Run Index Django Management Command to create the index on Redis:
136
-
137
-
**Note:** This will also populate the index with existing data on the database
135
+
**3. Run Index Django Management Command to create the index on Redis:**
138
136
139
137
```bash
140
138
python manage.py index
141
139
```
142
140
141
+
**Note:** This will also populate the index with existing data on the database
142
+
143
143
Now category objects will be indexed on create/update/delete.
144
144
145
145
#### More Complex Example
146
146
147
-
For Django Models:
147
+
**1. For Django Models:**
148
148
149
149
```python
150
150
# models.py
@@ -179,7 +179,7 @@ class Product(models.Model):
179
179
returnself.name
180
180
```
181
181
182
-
You can create a document classes like this:
182
+
**2. You can create a document classes like this:**
183
183
184
184
**Note:** Document classes must be stored in `documents.py` file.
185
185
@@ -263,14 +263,14 @@ class ProductDocument(JsonDocument):
263
263
- Field names must match model field names or define a `prepare_{field_name}` method.
264
264
265
265
266
-
Run Index Django Management Command to create the index on Redis:
267
-
268
-
**Note:** This will also populate the index with existing data on the database
266
+
**3. Run Index Django Management Command to create the index on Redis:**
269
267
270
268
```bash
271
269
python manage.py index
272
270
```
273
271
272
+
**Note:** This will also populate the index with existing data on the database
273
+
274
274
275
275
### Management Command
276
276
@@ -438,7 +438,6 @@ For more details checkout [redis-py docs](https://redis.readthedocs.io/en/stable
438
438
439
439
### Settings
440
440
441
-
442
441
#### Environment Variables
443
442
444
443
-**`REDIS_OM_URL`** (Default: `redis://localhost:6379`): This environment variable follows the `redis-py` URL format. If you are using external redis server
0 commit comments