Sunday, April 19, 2015

Re: How to prevent label wrap in Django Administration

On Sun, Apr 19, 2015 at 7:21 AM, Bernd Wechner <bernd.wechner@gmail.com> wrote:

I'm just playing around with Django and have cut a simple model and all is working fine. The Django administration tool works a charm, and I can move onto some views and forms. But what puzzles me immensely is why editing a tuple looks like this (with crazy label wrap). Can I fix this any way? It's not an impressive use of screen real estate:




You can override the CSS by setting it in the Media class for your form, e.g.:

class MyGameAdminForm(forms.ModelForm):
    class Media:
        css = {custom css here}

class GameAdmin(admin.ModelAdmin):
    form = MyGameAdminForm

It looks like the width for that display is set in forms.css:

.aligned label {
    display: block;
    padding: 3px 10px 0 0;
    float: left;
    width: 8em;
    word-wrap: break-word;
}

If you override the width that should do what you want. 

 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACwCsY5rjN2oRKR1ecEon2hoF1Y%3D3YY_sGcBq44oqkEm2xKPBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment