Skip to content

Commit

Permalink
Docs updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
idlesign committed Feb 1, 2020
1 parent f4d4f25 commit 4baf703
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ Hierarchies described as adjacency lists and nested sets are supported.
# admin.py of your application
from django.contrib import admin
from .models import MyModel # Let's say this model represents a hierarchy.
from admirarchy.toolbox import HierarchicalModelAdmin
from .models import MyModel # Let's say this model represents a hierarchy.
# Inherit from HierarchicalModelAdmin instead of admin.ModelAdmin
@admin.register(MyModel)
class MyModelAdmin(HierarchicalModelAdmin):
hierarchy = True # This enables hierarchy handling.
admin.site.register(MyModel, MyModelAdmin)
Done. Go navigate %)

Expand Down
13 changes: 6 additions & 7 deletions docs/source/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ of a field in your model containing parent item identifier (defaults to ``parent
from django.contrib import admin
from .models import MyModel
from admirarchy.toolbox import HierarchicalModelAdmin, AdjacencyList
from .models import MyModel
@admin.register(MyModel)
class MyModelAdmin(HierarchicalModelAdmin):
hierarchy = AdjacencyList('upper') # That says MyModel uses `upper` field to store parent ID.
admin.site.register(MyModel, MyModelAdmin)
Nested sets
-----------
Expand All @@ -40,14 +39,14 @@ of fields containing left and right set limits, and nesting level (defaults to `
from django.contrib import admin
from .models import MyModel
from admirarchy.toolbox import HierarchicalModelAdmin, NestedSet
from .models import MyModel
@admin.register(MyModel)
class MyModelAdmin(HierarchicalModelAdmin):
# That says MyModel uses has 'left_border', 'right_border', 'depth' to describe nesting.
hierarchy = NestedSet('left_border', 'right_border', 'depth')
admin.site.register(MyModel, MyModelAdmin)
9 changes: 4 additions & 5 deletions docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Quickstart

.. note::

Make sure **admirarchy** is listed in INSTALLED_APPS in settings file of your project (usually 'settings.py').
Make sure ``admirarchy`` is listed in INSTALLED_APPS in settings file of your project (usually 'settings.py').


With a few minor changes...
Expand All @@ -13,20 +13,19 @@ With a few minor changes...
# admin.py of your application
from django.contrib import admin
from .models import MyModel # Let's say this model represents a hierarchy.
from admirarchy.toolbox import HierarchicalModelAdmin
from .models import MyModel # Let's say this model represents a hierarchy.
# Inherit from HierarchicalModelAdmin instead of admin.ModelAdmin
@admin.register(MyModel)
class MyModelAdmin(HierarchicalModelAdmin):
hierarchy = True # This enables hierarchy handling.
# and other code as usual...
admin.site.register(MyModel, MyModelAdmin)
...your admin...

Expand Down

0 comments on commit 4baf703

Please sign in to comment.