Python Pyforms : how to use css in Pyforms or html-api in pyforms

772 Views Asked by At

I am using Pyforms for generating forms. But, I have to use stylesheet/css/html-api in my pyforms. I also follow step which have been given on this link. I want to know how to add css and making my layout beautiful. Can you please give me a better solution for that

2

There are 2 best solutions below

0
On

If you're using the PyForms version 3.0, you can do this:

  1. Import the settings

    from pyforms import settings as formSettings
    
  2. Modify the PYFORMS_STYLESHEET variable

    formSettings.PYFORMS_STYLESHEET = cssFilePath
    

It works for me.

0
On

Youu can add a css stylesheet by importing settings and adding a settings.py file where you reference the css file.

from pysettings import conf
import settings
conf+=settings

settings.py

PYFORMS_STYLESHEET = "stylesheet.css"

See the accompany tutorial.