- remove need of urls.py in favor of nested views,
- nested security checking support,
- take DRY to another level with nested views.
- 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.
# 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",
),
YourOtherView,
),
# some default overrides
namespace='yourapp',
prefix='you/',
).as_urlpatterns()
# yourproject.urls
urlpatterns += path('yourmodel/', yourapp.views.router.as_urlpatterns())
# in templates
# menu for navigation
{% for view in |views_in_menu:''|views_allowing:request %}
<a
href={{ view.absolute_url }}
title={{ view.title }}
><span class="fa-icon {{ view.fa_icon }}"></span>
{% endfor %}
# menu for model
{% for view in self|views_in_menu:'model'|views_allowing:request %}
<a
href={{ view.absolute_url }}
title={{ view.title }}
><span class="fa-icon {{ view.fa_icon }}"></span>
{% endfor %}
# menu for object
{% for view in self|views_in_menu:'object'|views_allowing:request %}
<a
href={{ view.absolute_url }}
title={{ view.title }}
><span class="fa-icon {{ view.fa_icon }}"></span>
{% endfor %}
Run the demo which uses Django server side:
pip install --user xcbv[demo] ~/.local/bin/xcbv runserver
- **Documentation** graciously hosted by RTFD
- Mailing list graciously hosted by Google
- For Security issues, please contact yourlabs-security@googlegroups.com
- Git graciously hosted by GitHub,
- Package graciously hosted by PyPi,
- Continuous integration graciously hosted by CircleCI
- **Online paid support** provided via HackHands,