Skip to content

Commit 3864403

Browse files
committed
fix README.rst
1 parent 29045fc commit 3864403

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Diff for: README.rst

+10-7
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ Installation
3232

3333
1. Requirements: **Django > 3** and **Python > 3**
3434

35-
2. ``pip install django-admin-easy==0.8.0``
35+
``pip install django-admin-easy==0.8.0``
3636

3737

3838
* For **Django < 1.8** or **Python 2.x**
3939

40-
``pip install django-admin-easy==0.4.1``
40+
``pip install django-admin-easy==0.4.1``
4141

4242
* For **Django < 2**
4343

44-
``pip install django-admin-easy==0.7``
44+
``pip install django-admin-easy==0.7.0``
4545

4646

4747
How it Works
@@ -267,10 +267,13 @@ More Examples
267267
# don't forget to use select_related with content-type to avoid N+1 queries like example below
268268
generic = easy.GenericForeignKeyAdminField('generic')
269269
270-
# Example if your model has a field like this:
271-
# content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
272-
def queryset(self, queryset):
273-
return queryset.select_related('content_type')
270+
def get_queryset(self, request):
271+
qs = super().get_queryset(request)
272+
273+
return qs.select_related('content_type')
274+
275+
# or enable cache
276+
generic = easy.GenericForeignKeyAdminField('generic', cache_content_type=True)
274277
275278
# display image of some model
276279
image1 = easy.ImageAdminField('image', {'image_attrs':'attr_value'})

0 commit comments

Comments
 (0)