News for hackers. Stuff that matters.
Re:Ask HN: What stack would you use to build a CRUD web app ... by golergka on Saturday March 03, 2018 @01:40PM (#16510779)
I always had a question I wanted to ask an experienced Django dev. After trying this framework for a couple of hobby projects (I'm a client game developer primarily and never worked on "serious" web project), I kinda got the impression that it's architecture is created for two main user roles: admins who create most of the content and have marvelous admin forms in front of them to input all the data, and users, who mostly consume the content and only occasionally input some data. When I tried to create complex input forms with a lot of complicated, relational data that users would be able to input and modify, it felt so much harder than exposing the data models in the admin panel — it really felt that this wasn't the use case this framework was designed for.

Did I get the right impression, or may be I just didn't learn to use Django correctly?

Re:Ask HN: What stack would you use to build a CRUD web app ... by ioddly on Saturday March 03, 2018 @05:45PM (#16512131)
From the Django tutorial:

> Generating admin sites for your staff or clients to add, change, and delete content is tedious work that doesn’t require much creativity. For that reason, Django entirely automates creation of admin interfaces for models.

> Django was written in a newsroom environment, with a very clear separation between “content publishers” and the “public” site. Site managers use the system to add news stories, events, sports scores, etc., and that content is displayed on the public site. Django solves the problem of creating a unified interface for site administrators to edit content.

> The admin isn’t intended to be used by site visitors. It’s for site managers.

https://docs.djangoproject.com/en/2.0/intro/tutorial02/

Re:Ask HN: What stack would you use to build a CRUD web app ... by bennylope on Sunday March 11, 2018 @11:29AM (#16563311)
It sounds like the "out-of-the-box" expectations created by the admin app are the problem. I mean, hey, Django makes exposing data models in the admin interface trivial! You can certainly create more complicated forms for relational data, but in those cases you can't rely on Django's default functionality to do as much for you. I've written or worked on more than a few serious apps including those with more complex user facing data and Django's worked beautifully. Happy to answer any specific questions you might have.
Re:Ask HN: What stack would you use to build a CRUD web app ... by theli0nheart on Saturday March 03, 2018 @04:40PM (#16511761)
> When I tried to create complex input forms with a lot of complicated, relational data that users would be able to input and modify, it felt so much harder than exposing the data models in the admin panel

Hmm, really interesting. I can't say I've ever run into this, and maybe it's just that Django is so good at the admin stuff, it makes everything else look hard in comparison.

Most forms I have start off as subclasses as ModelForm. If I need to combine two forms on one page, I just give the form a prefix and populate them both within the same <form> tag. I'm not sure if this is the sort of more "complicated" use case you were thinking of, but y4mi's suggestion of breaking forms into sections with wizards is another great way to go about it.

Re:Ask HN: What stack would you use to build a CRUD web app ... by y4mi on Saturday March 03, 2018 @02:24PM (#16511019)
i'm not an experienced django dev but i asked the same question some time ago. The answer i got back then was essentially 'one form per object, if you want to create two interdependent objects, just chain the forms into a "wizard"'

it kinda makes sense, considering how easy it is to create form views