Live data from Hacker News

Django 4.0 release candidate 1 released

djangoproject.com

121–126 of 126 posts

Re: Django 4.0 release candidate 1 released

#121
post #5

Last week I was trying develop a quick prototype, and instead of setting up a C# project, I tried Django. At first, everything seemed super easy, but later I hit so many road-blocks that I had to give up (For example defining a self-referential m2m relationship with a custom join table, and getting it working on the admin site). Don't people really have such problems with it? It really feels like a huge burden when y…

OT, but how do you feel C# (w/ ASP and EF, I suppose?) stacks up in productivity and TTM? What's the kind of problem you run into where you start feeling like you're not working on the domain but on side details?

I didn't want to deal with the front-end. It took me, however, less time to create a custom front-end (for a particular task) than dealing with Django-admin. YMMV.

With Entity Framework and Dapper, I don't think I can be more productive at the back-end in any other stack than I'm with .NET. If I have a couple of models, I'm usually done with basic CRUD, including REST controllers under an hour.

For the front-end, I wrote a couple of purpose-built generators for now.

Re: Django 4.0 release candidate 1 released

#122

Earlier quoted context omitted.

That use case has been easily discovered in the docs for several years at least

Could you please point to me where? Custom join table, check. Self-referencing m2m, check. Setting up admin for it?

It's like any other table/model so you'd just go to the docs for the admin stuff and go from there

Re: Django 4.0 release candidate 1 released

#123

Earlier quoted context omitted.

care to elaborate on that "multi-column PK support" please? :)

:) Django currently requires that every table have a _single_ primary key column. You can have a unique multi-column index, but you _also_ need to have a single primary key column, which sometimes makes working with existing databases tricky or inefficient. It's Django's oldest open ticket, from August 2005: https://code.djangoproject.com/ticket/373 The trick is how do you group those columns together in a way that s…

Great explanation. Thanks for taking the time to write it up and link to relevant posts. Any exposure can only help.

Re: Django 4.0 release candidate 1 released

#124

One thing I've never been able to figure out with Django is how to properly handle javascript. How do you all handle stuff like js dependencies? What I do now is just copy and paste a dependency like mapboxjs and keep it in the static folder. Would be great if I could use node or something like that and then have a way to import js dependencies in django templates. I've been using htmx and alpine js to sprinkle some…

Try creating a Django project using the Cookie Cutter Django: https://github.com/cookiecutter/cookiecutter-django/

Select yes when asked if you want "custom_bootstrap_compilation"

That will configure a gulp task runner that is capable of manage your javascript dependencies, bundle your CSS/JS, and minify your HTML, CSS, JS and images. You will still need to install npm etc. as described here. You will also need to become familiar with how to install and update Node packages. https://cookiecutter-django.readthedocs.io/en/latest/develop...

Re: Django 4.0 release candidate 1 released

#125

One thing I've never been able to figure out with Django is how to properly handle javascript. How do you all handle stuff like js dependencies? What I do now is just copy and paste a dependency like mapboxjs and keep it in the static folder. Would be great if I could use node or something like that and then have a way to import js dependencies in django templates. I've been using htmx and alpine js to sprinkle some…

Try creating a Django project using the Cookie Cutter Django: https://github.com/cookiecutter/cookiecutter-django/ Select yes when asked if you want "custom_bootstrap_compilation" That will configure a gulp task runner that is capable of manage your javascript dependencies, bundle your CSS/JS, and minify your HTML, CSS, JS and images. You will still need to install npm etc. as described here. You will also need to be…

Thanks for the tip! Just checked it out. I'm going to give it a go with an existing project. I guess for deploying I nees my build pipeline to have access to node/npm so it can build the right static files right? But I should not need npm in production.

Re: Django 4.0 release candidate 1 released

#126

Earlier quoted context omitted.

Could you please point to me where? Custom join table, check. Self-referencing m2m, check. Setting up admin for it?

It's like any other table/model so you'd just go to the docs for the admin stuff and go from there

You can assume that I have the decency to check the docs before I even ask on Stack Overflow, let alone complain about it on HN :)

I did follow the docs, it gave errors for one reason after another, and I don't have the time to dive into Django internals anymore when stuff like that keeps happening. From there came my opinion that non-happy path is not very much supported.

Post reply on HN