Tagged Questions
0
votes
1answer
15 views
Returning HTML codes in django models for admin site
I'm a beginner in Django and am trying to use the code below to show me how much time has passed since something has been submitted onto my site, but am getting a KeyError probably because not a ...
1
vote
2answers
27 views
Get redirected to a div automatically without user's intervention
I am new to JavaScript.
The problem goes as follows: I have 10 div in my html file. I am using links to go from one to another. Now, I want to test a condition which if satisfied (I am using python ...
1
vote
1answer
16 views
When scraping image url src, get data:image/jpeg;base64
I was trying to scrape the image url from a website using python urllib2.
Here is my code to get the html string:
req = urllib2.Request(url, headers = urllib2Header)
htmlStr = urllib2.urlopen(req, ...
0
votes
1answer
15 views
Webpage links grabbing
Why it is showing the error that I'm not getting in function:
import HTMLParser
from urllib2 import urlopen
from urllib2 import urlparse
class LinkParser(HTMLParser):
def handle_starttag(self, ...
0
votes
1answer
30 views
Python http server (csv to html/js)
I am trying to create a script that acts as a local web-service. I am making an inventory management for my own materials and I would like a python script to host a small server or something where I ...
0
votes
1answer
22 views
Django views.py Version of SQL Join with Multi Table Query
Need some help with Django version of SQL multi table query. The query is using 3 tables to retrieve restaurant name, address from Restaurants table and Cuisine type from Cuisinetypes table. All based ...
0
votes
2answers
25 views
Python: Parse all elements under a div
I am trying to parse all elements under div using beautifulsoup the issue is that I don't know all the elements underneath the div prior to parsing. For example a div can have text data in paragraph ...
-2
votes
1answer
37 views
How can I added some sub html project to a django project
Now I have a django project and some small html project (in fact, some html5 games). How can I added the html site to the django project?
For the each html project has ref a lot of css, img and ...
-1
votes
0answers
28 views
C API for displaying HTML content in terminal [on hold]
I am writing a http client in C. In which I want to show the html file content in the terminal. I can receive the html file content from server in the form of
<html>
<body>Hello ...
0
votes
1answer
16 views
Scraping XML with Python module BeautifulSoup, need a specific tag in the tree
So I've been working on this python script for a while and I'm trying to scrape the Duration and Distance tags under the Leg tag. The problem is that in the Step tag, there is also a sub tag called ...
0
votes
3answers
41 views
Delete a html DIV with Python
I'm trying to delete a div by its id in an html page using BeautifulSoup with Python, and I need also to add some attributes in a specific tag inside the same html page.
My code is like this:
...
-1
votes
0answers
29 views
create html table from sqlite table
I have a database named "seinfeldFood.sqlite" and it has 4 tables: "episodes", "foods", "foods_episodes", and "food_types". I want to write a program so that users can choose one of the tables from ...
0
votes
1answer
24 views
Python Get Random Choice From Text File Then Repeat That Choice
This may seem rudimentary but I'm drawing a blank on how to accomplish this. It's basically for a href link and anchor text. I need to go get a random line from a text file, create the html code and ...
0
votes
1answer
19 views
RTF Text editor widget for django that does NOT use HTML [on hold]
I'm working on a django based website where I would like users to be able to input rich text (i.e. bullets, bold, italic, strikethrough, hyperlinks, etc)
My problem is that all the solutions I've ...
1
vote
3answers
33 views
Application not picking up .css file (flask/python)
I am rendering a template, that I am attempting to style with an external style sheet. File structure is as follows.
/app
- app_runner.py
/services
- app.py
/templates
- ...
1
vote
1answer
20 views
How to extract python's list variable's value in html?
This is a python in html related problem.
I have a python script with a list named scalar_not_adv_row and tpdob.scalar_not_adv.
Both the lists have same number of rows. But the code below is throwing ...
0
votes
1answer
30 views
closing a window popup based on result
I am trying to open a window from a click then after the response in the url that consist of a confirmation page if is success it will close the window.
I opened my window with this:
url = ...
0
votes
0answers
52 views
Cannot resolve keyword 'i' into field
I am trying to do a product search, and ran into this error
FieldError at /Catalog/search/
Cannot resolve keyword 'i' into field. Choices are: SKU, active, averageCost, category, commissionRate, ...
0
votes
0answers
34 views
BeautifulSoup and HTML page source don't match - how to remove nth </table> in list of BeautifulSoup?
I'm trying to pull play-by-play data from www.basketball-reference.com. Specifically: http://www.basketball-reference.com/teams/HOU/2014_games.html for the Houston Rocket's play by play data. I've ...
0
votes
0answers
19 views
Generate a page based on an autocomplete result from a text box (Flask/Python backend)
I've got a text box which is being filled with an autocomplete result
$("#job_names").autocomplete({source : data});
//later on in the html
<input id="job_names" type= "text"/>
<input ...
0
votes
1answer
27 views
Python and Selenium - Scrape data from multiple siblings
Okay so I'm new to python and of course Selenium. I'm trying to scrape a page for data and then work with that data in python and have selenium click links and store times etc...
The issue I've come ...
0
votes
1answer
22 views
html css example in django
I wanted to use a third-party html/css example in Django, but it doesn't work.
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
<link rel="stylesheet" ...
0
votes
2answers
30 views
Saving the order of items
My model:
class Category(models.Model):
name = models.CharField(max_length=50, unique=True)
order = models.SmallIntegerField()
My template:
{% for c in categories %}
{{ c }} -- ...
0
votes
2answers
36 views
Python text to HTML link [closed]
Is there any way to convert plain text from my python shell into a HTML link?.
For example the string http://bura.brunel.ac.uk/handle/2438/7216 should be converted to a link such that when I click it ...
1
vote
2answers
25 views
Dynamically add a placeholder to a form field
I have a Django form with a few typical fields:
first_name = forms.CharField(label=_("First Name"))
last_name = forms.CharField(label=_("Last Name"))
phone = USPhoneNumberField(label=_("Phone ...
0
votes
2answers
30 views
My web scraped code currently works, I want to be more specific, can I choose what data to scrape by telling it what specific header that is above it?
Here is my current code which works great, it extracts all the <li> from the specific div.
from scrapy.spider import BaseSpider
from project.items import QualificationItem
from scrapy.selector ...
1
vote
1answer
27 views
Get value from URL in another app.route
I have a Flask application that shows text under the URL http://<webroot>/idea/<idea_id>, e.g. http://localhost/idea/123. The idea_id is requested from a database
...
-1
votes
1answer
24 views
How to transform file from python to html or javascript
I am creating a UI. My back end code is in python. Python handlers are called by the javascript(using ajax). I am creating a csv file using python like below.
Results = []
filename = ...
1
vote
1answer
19 views
BadValueError thrown when entering Integer in html form
Am working with Python to create a Google App Engine application.To test my app, i am using html forms to enter data.
In my form i have a line:
<tr><td>Age</td><td><input ...
0
votes
1answer
21 views
How to use *args to create multiple html tables from lists?
I'd like to create a function that can take in an arbitrary number of lists that would be turned into HTML tables that would be separated by breaks for the purposes of sending an email with multiple ...
1
vote
1answer
14 views
How to insert a blank space( ) into a Beautifulsoup tag?
I'm trying to add a ' ' into a Beautifulsoup tag. BS converts the tag.string to \&amp;nbsp; instead of  . It has to be some encoding issue but I can't figure it out.
PLEASE ...
0
votes
1answer
22 views
jquery .load with python flask
I am trying to use jquery .load in my flask app to add a div every time the user presses a button to add a new div, but it can't find the html file.
The function in question.
...
0
votes
1answer
27 views
Django - trouble handling inclusion_tag
I'm having some trouble understanding the behaviour of inclusion tags.
I have the following relevant files
base.html (the base template)
<!DOCTYPE html>
<html lang="en">
{% load ...
-2
votes
1answer
33 views
Include a Python script in my html code (using BlueGriffon or any other HTML editor) [closed]
I would like to create a webpage on my website including some python scripts for performance scripting. how and which editor can help me simply on that?
Thanks,
Lx
0
votes
1answer
37 views
Jinja button not working after putting in login functionality
The button below used to work when I click on it to get to the addcontact page. Since I've added a login to my web app I cant seem to get the button to work. If I just have a link it does work. Any ...
0
votes
0answers
32 views
Flask app not reading template from /templates file [closed]
I had asked a question like this yesterday, but I have since changed up my file structure to make it more like the demo version found here
http://flask.pocoo.org/docs/quickstart/#quickstart
file ...
0
votes
1answer
18 views
URL embed images in Django
Is there any simple way to embed image in URL in Django like this?
<img alt="Embedded Image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." />
I have to render many little ...
0
votes
0answers
17 views
Generating HTML tables where more items have one key asnd must fit on the same row
In Django, I am trying to generate a table. The first column is a timestamp. The next 5 columns need to be filled with my data.
However, my data table has 5 entries for each related timestamp. How ...
0
votes
0answers
30 views
Converting HTML markup to a RTF document
I have an XML document containing embedded HTML content that I am attempting to convert to an RTF output file. I have the XML elements decorated with <li>, <p>, <b> and other HTML ...
0
votes
0answers
18 views
includes with SimpleHTTPServer?
I have begun using the Python SimpleHTTPServer in Mac OS X Bash to help with front-end templating rather than MAMP. I like the simplicity but wondered if there is a way to use includes for embedding ...
0
votes
2answers
27 views
Display all model data inside html page
I'm trying to build a website that has products and categories.
When you are on the page of a product, you can click a button to see a list of all the categories it falls under.
You can click ...
0
votes
1answer
19 views
Format terminal text output as table
I've managed to get to a point where I have used to BeautifulSoup to extract a table from a url. At this point I want to format the output as a table so that I can use it in GeekTool.
from bs4 import ...
1
vote
1answer
44 views
Save user info in HTML python anywhere [closed]
I am making my first django web app. HERE:
http://joebuty.pythonanywhere.com/
CODE:
<!DOCTYPE html>
<head><style>
body{
text-align:center;
...
0
votes
1answer
27 views
yet another django url redirection issue
The following view is supposed to load a page, 'learn.html', but it simply returns to the index for some reason.
def learn(request):
try:
... # everything goes smoothly here, the else ...
0
votes
2answers
39 views
How to insert links in Python
Is it possible to add Links into Python script and print it out? Like in HTML,once it was clicked,we will be redirected to the URL.
<a href="URL">Click Here To Login</a>
0
votes
1answer
27 views
HTML Page Loads, but shows up blank
I'm working on a project in Python, and I have part of the project working (where the user submits a post). I'm trying to make it so that when the user submits their entry, they get redirected to ...
1
vote
2answers
38 views
This code should use the links its scraped from scrapy to extract the second paragraph in the first div but I'm getting this error
exceptions.TypeError: Request url must be str or unicode, got list:
Above is the error I'm receving, is it my indentation?
And here is my code.
from scrapy.spider import BaseSpider
from ...
0
votes
0answers
16 views
lxml.html parsing and utf-8 with requests
i used requests to retrieve a url which contains some unicode characters, and want to do some processing with it , then write it out.
r=requests.get(url)
...
1
vote
1answer
23 views
How to extract text from html conditionally in beautifulsoup
I am trying to extract specific text from a website with the following html:
...
<tr>
<td>
<strong>
...
2
votes
1answer
38 views
In scrapy I'm trying to retrieve a list of links then scrape data from these links in a single scrapy file. My csv file returns a list of xpaths.
I tried using igaggini's example on this page but can;t seem to get it to work with my code. Scrapy: Follow link to get additional Item data?
I'm pretty sure I have the right xpaths, the output ...