Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yourlabs/django-xcbv

UNUSABLE heavy research around cbv for the lulz, see crudlfap for usable code
https://github.com/yourlabs/django-xcbv

Last synced: 3 months ago
JSON representation

UNUSABLE heavy research around cbv for the lulz, see crudlfap for usable code

Awesome Lists containing this project

README

        

.. image:: https://img.shields.io/readthedocs/xcbv.svg?style=for-the-badge
:target: https://xcbv.readthedocs.io
.. image:: https://img.shields.io/circleci/project/github/yourlabs/xcbv/master.svg?style=for-the-badge
:target: https://circleci.com/gh/yourlabs/xcbv
.. image:: https://img.shields.io/codecov/c/github/yourlabs/xcbv/master.svg?style=for-the-badge
:target: https://codecov.io/gh/yourlabs/xcbv
.. image:: https://img.shields.io/npm/v/xcbv.svg?style=for-the-badge
:target: https://www.npmjs.com/package/xcbv
.. image:: https://img.shields.io/pypi/v/xcbv.svg?style=for-the-badge
:target: https://pypi.python.org/pypi/xcbv

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.
- 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.

.. 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//',
),
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 %}

{% endfor %}

# menu for model
{% for view in self|views_in_menu:'model'|views_allowing:request %}

{% endfor %}

# menu for object
{% for view in self|views_in_menu:'object'|views_allowing:request %}

{% endfor %}

Demo
====

Run the demo which uses Django server side::

pip install --user xcbv[demo]
~/.local/bin/xcbv runserver

Resources
=========

- `**Documentation** graciously hosted
`_ by `RTFD
`_
- `Mailing list graciously hosted
`_ by `Google
`_
- For **Security** issues, please contact
[email protected]
- `Git graciously hosted
`_ by `GitHub
`_,
- `Package graciously hosted
`_ by `PyPi
`_,
- `Continuous integration graciously hosted
`_ by `CircleCI
`_
- `**Online paid support** provided via HackHands
`_,