Hacker News new | ask | show | jobs
by matsemann 1601 days ago
While a better interface is welcome, relying too much on Django admin panel is a path best avoided.

Great for small stuff, but far too often one end up using it for too much. Extending it with more widgets, custom logic, fine grained access. Quick in the beginning, very hard to maintain in the end compared to a custom made view.

5 comments

Django admin has 2 modes of operation:

In scope operation and extension: - Incredibly smooth and effortless

Slightly out of scope: - F U, buddy.

It’s amazing for so much stuff that it’s honestly a superpower for a tech or tech leveraged company, and great for prototyping internal process automation.

The trick is knowing when to throw in the towel and go purpose built. I’ve definitely missed that boat at least once in my career.

You can easily scale a company beyond 50 employees while still using the admin and an occasional extra dashboard.

It's definitely in my top 5 most valuable skills, and seems like an open secret in the industry.

I'm curious: what would your other top 4 most valuable skills be? I'm asking because I was genuinely unaware of django admin despite being a developer for several years and I wonder how many more "open secrets" I'm oblivious to
* Having extreme fluency in one data wrangling tool for text and tabular data. Could be bash + awk + grep/sed/cut and other shell tools, Python + numPy, Ruby, etc. The point being that given a table or a text file you should be able to extract whatever information you want quickly without thinking.

* Fluency in Postgres, specifically its aggregate functions, window functions, and CTAs. Again, given a company's dataset you should be able to write complex queries to answer business-critical questions in a few minutes to be able to drive decisions. As an aside, knowing that UNIX system usually has sqlite installed and is the fastest way to analyze local tabular data.

* Being a competent writer. Some people command clear thinking, gravitas, and vision when they write. It is easily the most important skill when remote working, and a definite shibboleth when you want to sound convincing to overeducated knowledge workers. Being able to explain complex topics to a lay audience had gotten me many jobs.

* Knowing how to use AdWords, Google Trends and mailing lists to quickly validate product ideas. This is one of the easiest ways to discard or validate ideas. It's so useful and quick and such a simple way to avoid months of wasteful work.

* Knowing the basics of Western philosophy and psychology. Everything humans do fits within a system of values a loosely consistent logics. 99% of people rarely think outside of those value systems, and if you understand the history of philosophy you'll see that we're quite predictable in our wants and desires. It helps you be more persuasive, choose the right work for your own preferences, put people to work where they'll feel useful and fulfilled, and will help you see the pitfalls of certain group dynamics for whatever institution you're working for.

It's not a binary choice. You can gradually replace the admin at various levels of abstraction. The only risk is the same risk all programmers face - creating unmaintainable code. You can do that with or without the admin.

Use the admin more where it's most useful. Use it less where it's not. You don't have to go cold turkey.

Agreed.

A Django-specific skillset I found very important is to know where that limit/line of the admin sits - you can push it very far, but there's absolutely a point where it becomes unmaintainable and more costly than building it yourself. The line itself can be a bit of a moving target depending on the project though.

The Django admin is simultaneously one of the greatest tools of the past two decades while also being a massive footgun if you're not careful.

I agree. With the current state of Django admin, it is better not to build complex stuff on top of it. A few tweaks and customization here and there are fine, but anything more will likely break on Django and/or third-party package updates.

I'd like to see Django gradually redesigning parts of the Admin to allow for more modular extensibility in future versions.

I only use Django because of the admin.
I only use Python because I use Django because of the admin.
For I think 80% of the projects I worked on the admin panel was fine.

And when it wasn't, we just provided api's through DRF for users with elevated privilege, and some kind of CLI interface for people to use it.

Hell, even the DRF web interface is fine for people who know how to do REST queries.

Then it is a very limited scope. The first thing I do on a new Django project is to ensure the admin portal is long gone. If you can't understand or work with your models from the Django shell, something is not right.
When you put your application in production and some non-tech want's to create or modify an entity, do you give them access to a production django shell?
No, and you don't do that with the admin portal either.
This guy. Has it all sorted out. We're just a bunch of headless chicken running around with an admin to manage our business. Meanwhile, he's all bare hands, manipulating the shell, showing the snowflakes how it's done, telling his non-technical co-founders to learn the models, bash, sql and a god-dam shell. Such an inspiration, much envy, so wow!
Talk for yourself.
Yep it's a fantastic crud gui for the database, which frankly covers a lot of use cases for a small business.

But it's not a substitute for being comfortable working with forms, templates, urls, requests and building custom views. Time spent learning the django-admin DSL would be better spent here, or learning the CBV DSL...

My approach was at first nothing but admin, but then i found places where i must make custom views.

I'm kind of at a spot where I want to replace all admin with custom but this comes up against an important rule. Dont fix what's not broken.