Running Python3 code and placing results in a view

39 views
Skip to first unread message

Andrew Stringfield

unread,
Jan 3, 2016, 6:37:50 PM1/3/16
to Django users
Hello all,

    I am interested in running the code of: 
#!/usr/bin/python3
from wifi import Cell, Scheme
ssid
= [cell.ssid for cell in Cell.all('wlan0')]
print(ssids)


with a view in Django and the results displayed in a drop down list.  Here is the information about the WIfi module that I am using: https://wifi.readthedocs.org/en/latest/ 

I am still trying to comprehend how the whole flow goes when creating views and I read that you can define a function in Django views and that should just about do it.  I tried to write a function, but that did not work out so well. lol

Any help would be appreciated.
Thank you.

Daniel Roseman

unread,
Jan 4, 2016, 2:47:24 AM1/4/16
to Django users
Well, then you should show the code you tried and the error you got. Assuming you have the wifi module installed, and you do something with the output other than just printing it, that code would work fine in a view.
--
DR.

aslease...@gmail.com

unread,
Jan 4, 2016, 3:34:47 PM1/4/16
to Django users
First thank you for the reply.  Tonight I will re-apply the code tonight and get back with you.
Reply all
Reply to author
Forward
0 new messages