Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ workflows:
jobs:
- py-qa
- docs
- py27-dj111
- py36-dj20

jobs:
Expand Down Expand Up @@ -67,27 +66,6 @@ jobs:
~/.local/bin/tox -e py36-dj20
PATH=.tox/py36-dj20/bin:$PATH codecov -e $TOXENV

py27-dj111:
docker:
- image: circleci/python:2.7
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- test-dependencies-{{ checksum "tox.ini" }}
- run:
name: Tox environment setup
command: pip install --user tox && ~/.local/bin/tox -r -e py27-dj111 --notest
- save_cache:
paths: [~/.local, ~/.cache/pip]
key: test-dependencies-{{ checksum "tox.ini" }}
- run:
name: TEST tox -e py27-dj111
command: |
~/.local/bin/tox -e py27-dj111
PATH=.tox/py27-dj111/bin:$PATH codecov -e $TOXENV

js-qa:
docker:
- image: circleci/node:8
Expand Down
24 changes: 24 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[run]
branch = True
omit =
.tox

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:

ignore_errors = True
69 changes: 38 additions & 31 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,57 @@ What it is

- remove need of urls.py in favor of nested views,
- nested security checking support,
- take DRY to another level with nested views.
- takes DRY to another level with view route parenting,
- django can you generate a menu is: yes,
- modern pattern for creating your own admin-like CRUD,

Extracted from CRUDLFA+, re DDD'd, under TDD.

Target:

.. code-block:: python

# yourapp.views
urlpatterns = xcbv.View(
menus=('global', 'footer'),
views=(
xcbv.ModelView.factory(
model=YourModel,
# updates views.list, views.update
children=xcbv.ModelView.views.update(
YourListView.factory(
# by default only staff sees new views, this opens for all
allows=lambda self: True
),
YourUpdateView.factory(
# could be set here or inside the view
path='specialupdate/<slug0>/<slug1>',
),
YourDetailView.factory(
# just adding a sub object list view inside URL and
# permission tree like a Poney, is this going to be a
# list of child models from the above ModelView model ?
views=xcbv.ModelListView(
model=YourChildModel,
)
)
),
icon="fa-love",
urlpatterns = xcbv.Router(
xcbv.TemplateView.factory(
name='index', # default /index to index.html
),
YourOtherView,
xcbv.Router(
YourCreateView(url='/absolute/url'),
YourListView(
# by default only staff sees new views, this opens for all
allows=lambda self: True
),
YourUpdateView(
# could be set here or inside the view
path='specialupdate/<slug0>/<slug1>',
),
ObjectFormView(
form_class=YourCustomForm
key='custom',
),
YourDetailView(
# just adding a sub object list view inside URL and
# permission tree like a Poney, is this going to be a
# list of child models from the above ModelView model ?
views=xcbv.ListView(
model=YourChildModel,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's where I left it off. Turns out this is not necessary, for this kind of use cases just add list views to the router and set them with menus = ['details'] in crudlfap

)
),
YourOtherView,
# the above should replace CRUD views defined in setting
# XCBV['MODELVIEW_DEFAULT_CHILDREN'] and add object action
# "custom"
model=YourModel,
menus=('global', 'footer'),
icon="fa-love",
),
# some default overrides
# Router always takes a namespace or class (ie. model) arg
namespace='yourapp',
prefix='you/',
).as_urlpatterns()
).urlpatterns()

# yourproject.urls
urlpatterns += path('yourmodel/', yourapp.views.router.as_urlpatterns())
urlpatterns += path('yourmodel/', yourapp.views.router.urlpatterns())

# in templates
# menu for navigation
Expand Down
4 changes: 4 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sphinx
sphinx-js
django
-r ../src/facond_examples/requirements.txt
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def read(fname):
'xcbv = xcbv_examples.manage:main',
],
},
requires=['six'],
extras_require=dict(
django=['django>=2.0'],
demo=['django>=2.0'],
Expand Down
Empty file added src/xcbv/__init__.py
Empty file.
20 changes: 20 additions & 0 deletions src/xcbv/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@


class xcbvException(Exception):
pass


class RouterNamespaceNotResolvable(xcbvException):
pass


class NamespaceCollision(xcbvException):
pass


class RoutePathNotResolvable(xcbvException):
pass


class RouteNameNotResolvable(xcbvException):
pass
Loading