-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display of fields on the same line #25
Comments
I wonder if flexbox is a potential solution? We could combine that with the 'classes' parameter to fieldsets:
You could then set up a pseudo-table layout so that fields on the same row aligned in columns correctly even though they weren't in the same group of fields. |
@andybak The problem is that label has fixed width, so obvious solution is to add class for the row if fields declared as tuple, I believe. Then we can control label width to set it in So what if we just add divider as you suggested? It's easy CSS fix. Makes sense? The gap is still big between label and input but it looks less messy in terms of UX I think. |
Is it really a grid once you have a few tuple rows? It just looks like a mess on most of my changeforms. If you have mostly single field rows and a couple of tuple rows then maybe having the first input field on each row lining up looks moderately neat but it breaks down fairly quickly. Look how two tuple rows next to each other looks: I'm trying to work out how a moderately complex form with a reasonable number of tuple rows could look better. Is it possible to get something closer to a real grid working where the 2nd and 3rd columns also line up with each other? |
I'm making a bit of progress:
As you can see - I get something fairly close to a grid layout. The read-only fields currently mess it up but that shouldn't be hard to fix: I'm not sure whether this is something that should be fixed in Django core right now but the fact that complex admin forms look a mess has been bothering me for a while. What are your thoughts? |
Flexbox might make some of this a bit easier to handle - i.e. we would probably remove the need to mess around with margins and box-sizing. |
I went the route of an explicit opt-in:
This seems to work. I'm still testing but let me know if this is of any interest. I'll stop posting here if it's out of scope for your work.
|
Add this rule to get dividers:
|
@andybak looks good, I'll check this on one of my real projects |
Any updates on this? |
From: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.fieldsets
As you can see the labels are closer to the preceeding input than they are to their own: https://drive.google.com/file/d/0B_afp8i9IOxeNDZlcWZ5ZDdvTTg/view?usp=drivesdk
I think this was also an issue with the old admin css but now might be a good time to address it.
I'm not sure what the best fix is. However - it should be possible to target form-rows with multiple fields using a variant of this technique: http://stackoverflow.com/questions/8720931/can-css-detect-the-number-of-children-an-element-has
I suggest either:
The text was updated successfully, but these errors were encountered: