Giter Site home page Giter Site logo

Comments (2)

timmyomahony avatar timmyomahony commented on June 15, 2024

The plugin is using the same approach to generate attributes as the Django:

https://github.com/django/django/blob/master/django/forms/templates/django/forms/widgets/attrs.html

So I'm curious as to why rows and cols aren't being rendered. I'll have to investigate further.

from django-pagedown.

timmyomahony avatar timmyomahony commented on June 15, 2024

Just to follow up on this. I tested and the attributes are getting applied for me, but the admin css styling is overwriting their values.

For example, In my form I tried:

example = forms.CharField(
        widget=AdminPagedownWidget(attrs={'rows': 2}), max_length=500)

Which rendered:

<textarea name="example" cols="40" rows="2" class="vLargeTextField wmd-input" maxlength="500" required="" id="wmd-input-id_example"></textarea>

You'll see that rows=2 is included.

The issue is that the height of the input is actually set in the demo.css that is included in the widget. This demo.css file is coming from the official Pagedown repo that I've included as a submodule. You can see it here:

https://github.com/StackExchange/pagedown/blob/32c0bdb121de04e0e956ddde0391022644ff1a76/demo/browser/demo.css#L27

We're also adding our own local stylesheet to add to that default stylesheet here:

https://github.com/timmyomahony/django-pagedown/blob/master/pagedown/static/admin/css/pagedown.css

This file deals with styling it for Django admin

The solution is to either overwrite the widget and add your own additional stylesheets, or maybe just copy and overwrite the /pagedown/static/admin/css/pagedown.css file mentioned above so that your version is copied instead of the library version

from django-pagedown.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.