Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you want a database-backed CRUD with extra business logic then it's hard to beat the Django admin. You get support for common cases out of the box and extending/overriding the normal behaviour is fairly straightforward.

It looks fairly presentable and has a non-awful UI. Certainly not state of the art but good enough for non-public facing stuff.



I have used the Django admin as a way to get non-technical users entering data for basic CRUD, which is pretty much what it was developed for originally as I understand it. Its appearance sends the right message (non-threatening, but obviously not public-facing), and they seem to take to it readily.


For Django, the trick is to implement an MVC pattern: let a class sit in-between a model and its set of views and pilot the views from there, like the admin, drf and others.

However, the admin does not leverage the Django ecosystem, django-tables2, django-filter, and so on. Also, it's kind of moving slowly because they must try to respect backward compatibility.

I maintain CRUDLFA+ and I love it:

- lets each view define its own url generation method: the controller will use that to generate the urls for a model - each controller defines a get_queryset method which has a request parameter, allowing you to define what objects a user may see

- each view defines a has_perm method, as such a user may see a bunch of objects, but not necessarily execute all views on it,

- the default list view wraps django-tables2, django-filter, django-search, and generates a per-object menu, by iterating over each view of the controller and testing it with has_perm, as such a user will see an object menu with each view it can execute on an object, with no overhead

- allows you to override views in many ways

- works with non-managed models (models that are not backed with a database table)

- can be used for frontend pages too (admin is really limited to being a back-office),

Clearly, CRUDLFA+ goes beyond "basic crud", but I would never code a Django view without it ever again though.

However, so far I make it for my personal use and even though it's been in use on governmental production for a couple of years now, I wouldn't recommend it for beginners. If you're a Django expert and get your kicks out of trying new patterns then you might spend some good times with it.

https://yourlabs.io/oss/yourlabs https://gitpitch.com/yourlabs/crudlfap

We're in the (slow) process of replacing Jinja2 in it with Ryzom ( https://yourlabs.io/oss/ryzom ) , a component-based HTML renderer which supports data-binding and that we are looking forward to integrate or isomorphic research (from https://yourlabs.io/oss/chp ) into. When that's over we will release v1.


This is really interesting. Will take a look on how this works for me!


I'm really interested to try, but the yourlabs.io repo is locked down. Where can I see the CRDLFA+ codebase?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: