|
|
|
|
|
by ensignavenger
573 days ago
|
|
In what ways has Django been a hindrance in your experience? In my experience, I have never felt that way. When i have used a micro framework, sooner or later I always regret it and wish I had Django. When I use Django, and I needed to do somthing different, I have never had a problem with it getting in the way, I have used alternate ORMs, Raw SQL, I by default use Jinja templates, and many other "non-standard" things with Django. Async has been about the only area where I would even consider anything different in the past. |
|
Quick, where would you put a high-level business function that touches multiple models? Where would you put the model-level validation for that? I've seen all of the following: in a view, in a form, in a service-layer function, arbitrarily in one of the models/managers, implicitly in the database schema (just catch the IntegrityErrror!).
There are endless discussions online about where to do this. This isn't a good sign. It should be easy. The business logic should be at the heart of an application. But instead we see Django's ORM at the heart.
Django models are really limiting and totally tied to the database. You can't even have a model that has a list/set of items without getting into ForeignKeys etc. You can't test any of it without having the database present. Why would I need the database to be there to test business logic?! The point of an ORM is to do object persistence, not to do business logic.
So I've seen people do a separate set of ORM models and domain models and then manually mapping between them. This is possible, but it's a whole lot easier with something like SQLAlchemy which is actually designed for that (it's a data mapper rather than active record type ORM).
Then there's stuff like django-admin and ModelForms etc. which are the last thing you want if you're doing more than CRUD.
Tbh it would be utterly remarkable if Django somehow made this stuff easy. But it doesn't and I find myself wishing I just put in the effort to set up the boring stuff like auth etc. but with a proper architecture.