Skip to content

Commit

Permalink
Added Project-level Overrides How-To to docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
carltongibson committed Jul 22, 2024
1 parent b116036 commit a92ad4b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/source/how-tos.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
=======
How Tos
=======


Project-level Overrides
=======================

Maybe ``CRUDView`` doesn't work exactly how you want. Maybe you need to
override something whilst experimenting.

You can add a base-class of your own to add project-level overrides.

In your ``views.py``::

from neapolitan.views import CRUDView as BaseCRUDView


class CRUDView(BaseCRUDView):
# Add your overrides here.


class MyModelCRUDView(CRUDView):
model = "MyModel"
fields = ["name", "description"]

By defining your base-class like this, you can revert to Neapolitan's class
simply by commenting it out, or deleting it, and adjusting the import.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Contents
tutorial
crud-view
templates
how-tos


A quick look
Expand Down

0 comments on commit a92ad4b

Please sign in to comment.