Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Flask Dependent Dropdown
#3
(Oct-24-2018, 04:59 PM)j.crater Wrote: Hello,
we would much rather see if you explained the problem here, as well as post the code in Python code tags. Thanks.

Sure no problem:

I was wondering if someone could help me.

I want to be able to click on customer and locations be based off of the certain customer, being a dependent dropdown. This information is coming from a database, hence the queries in the following code.

This is my form function for both customer and location

class CustomerPick(SubForm):
        customer = QuerySelectField(u'Customer',
                            get_label=u'sCustomer',
                            query_factory=lambda : 
                            (TCustomer.query.order_by(TCustomer.sCustomer)),
                            validators=[DataRequired(),])
        location = QuerySelectField(u'Location',
                            get_label=u'sLocation',
                            query_factory=lambda : 
                            (TLocation.query.order_by(TLocation.sLocation)),
                            validators=[DataRequired(),])
Here is the view portion

@route('new/', methods=['GET', 'POST'])
    def new(self):
        form = CustomerPick()
        if form.validate_on_submit():
This is a picture of the dropdown also for reference, if there is anything else needed for you guys to have a go please let me know. Thanks in advance! https://i.stack.imgur.com/Nzf5J.png
Reply


Messages In This Thread
Python Flask Dependent Dropdown - by Anfaa - Oct-24-2018, 04:37 PM
RE: Python Flask Dependent Dropdown - by j.crater - Oct-24-2018, 04:59 PM
RE: Python Flask Dependent Dropdown - by Anfaa - Oct-24-2018, 05:22 PM
RE: Python Flask Dependent Dropdown - by nilamo - Oct-24-2018, 09:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Generating dynamic dropdown list test 1 1,537 Aug-30-2023, 08:00 AM
Last Post: blessinguvula
  Python Selenium (Dropdown-) data Robin_at_Cantelli 2 6,229 Dec-29-2021, 03:16 AM
Last Post: ondreweil
  Selenium Python for Dropdown not working gj31980 1 2,719 Oct-27-2020, 02:02 AM
Last Post: gj31980
  python 3.7 on windows using flask and flask-sqlalchemy. Alpy 2 4,031 Aug-12-2020, 07:24 PM
Last Post: Alpy
  Dropdown interact moisesfelipee 0 1,710 May-04-2020, 01:11 AM
Last Post: moisesfelipee
  While loop skips multiple dropdown menu options and then works as intended newbie_programmer 1 2,925 Dec-23-2019, 10:26 PM
Last Post: keuninkske
  How can i scrape dropdown value ? caca 0 3,019 Nov-03-2019, 11:24 PM
Last Post: caca
  Click dropdown menu option with Selenium PyChrome AcszE 3 5,980 Oct-26-2017, 10:07 PM
Last Post: metulburr
  Create Dictionary List (From a webpage dropdown) for Comparison to a CSV File Guttmann 5 5,966 Mar-31-2017, 01:29 AM
Last Post: Guttmann

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020