-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Project-level Overrides How-To to docs.
- Loading branch information
1 parent
b116036
commit a92ad4b
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ Contents | |
tutorial | ||
crud-view | ||
templates | ||
how-tos | ||
|
||
|
||
A quick look | ||
|