When using Django "out-of-the-box" administration forms, the "change form" pages can be rather long for complex models (with a lot of fields).
I would like to use tabs in the "change form", so things can be more readable (group fields by tabs...)
Instead of doing it all by myself, by modifiying the 'change_form.html' admin template, I ...
How to find out what week number is this year on June 16th (wk24) with Python?
...
Thanks to some great folks on SO, I discovered the possibilities offered by collections.defaultdict, notably in readability and speed. I have put them to use with success.
Now I would like to implement three levels of dictionaries, the two top ones being defaultdict and the lowest one being int. I don't find the appropriate way to do th...
Getting a bit peeved now;
I have a model and a class thats just storing a get request in the database; basic tracking.
class SearchRec(db.Model):
WebSite = db.StringProperty()#required=True
WebPage = db.StringProperty()
CountryNM = db.StringProperty()
PrefMailing = db.BooleanProperty()
DateStamp = db.DateTimeProperty(auto_now...
A while back I wrote a simple python program to brute-force the single solution for the drive ya nuts puzzle.
The puzzle consists of 7 hexagons with the numbers 1-6 on them, and all pieces must be aligned so that each number is adjacent to the same number on the next piece.
The puzzle has ~1.4G non-unique possibilities: you have 7! o...
given a URL like www.mysampleurl.com is it possible to crawl through the site and extract links for all PDFs that might exist?
I've gotten the impression that Python is good for this kind of stuff. but is this feasible to do? how would one go about implementing something like this?
also, assume that the site does not let you visit som...
Is it possible to let the users choose / change dynamically the columns displayed in a object list in Django administration ?
Things can surely be implemented "from scratch" by modifying the 'change_list.html' template but I was wondering if somebody has already had the same problem and/or if any django-pluggin can do that.
Thanks in a...
I have a file called foobar (without .py extension). In the same directory I have another python file that tries to import it:
import foobar
But this only works if I rename the file to foobar.py. Is it possible to import a python module that doesn't have the .py extension?
Update: the file has no extension because I also use it as a ...
Hi,
I'm trying to put some sites i crawled into a shelve, but the shelve won't accept any Site-objects. It will accept lists, strings, tuples, what have you, but as soon as i put in a Site-object, it crashes when i try to get the contents of the shelve
So when i fill up my shelve like this:
def add_to_shelve(self, site):
db = sh...
Hi
ive been trying to create a simple program with python which utilises opencv to get a video feed from my webcam and display it on the screen. I know im partly there because the window is created and the light on my webcam flicks on, but it just doesnt seem to show anything in the window. hopefully someone can explain what im doing wr...
I am extending Python with some C++ code.
One of the functions I'm using has the following signature:
int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,
char *format, char **kwlist, ...);
(link: http://docs.python.org/release/1.5.2p2/ext/parseTupleAndKeywords.html)
The parameter of inter...
In python, there is no way to differentiate between arguments, local variables, and global variables. The easy way to do so might be have some coding convention such as
Global variables start with _ and capital letter
arguments end with with _
_Gvariable = 10
def hello(x_, y_):
z = x_ + y_
Is this a Pythonian way to go? I mean...
Hi
I have an old C# program that is being ported to Python 3 for different reasons. Basically, what the program does is to fetch a website and search its content (and process it, but that is not really relevant). I have never really had any issues with the actual fetch-and-search routine, but once I ported it to Python it started compla...
Hi!
I have a small webapp that runs Python on the server side and javascript (jQuery) on the client side.
Now upon a certain request my Python script returns a unicode string and the client is supposed to put that string inside a div in the browser. However i get a unicode encode error from Python.
If i run the script from the shell (b...
Can anybody help me how to run a python script through command line?
My python script http://buffis.com/2007/07/25/getting-info_hash-for-xbt-tracker/comment-page-1/
I am using this command /var/www/hash_info.py /var/www/Muha_Album.7912.torrent
I have copied dependency file bencode.py mentioned in article link above. When I execute the...
Hey everyone,
I am trying to use SWIG to wrap some C++ code for the use with Python. As described here it seems to be necessary to link my C++ code against an .so file, not a .dylib file. The thread suggests to use libtool in combination with the -module flag to link, but I am using qmake and need more precise instructions on how I do t...
is there a way to call a program from python without waiting for it to return? i created a script which copies a program to a directory and runs that program. but when i call the program from python, the python script does not exit until the program i launched exits. i have tried os.system and Popen. is there another way to do this?
Add...
Hello,
I have written a python script with methods in it. Now I want to use methods from that script in ipython. How do I import it for use in ipython?
Cheers
...
I am trying to extract Meta Description for fetched webpages. But here I am facing the problem of case sensitivity of BeautifulSoup.
As some of the pages have <meta name="Description and some have <meta name="description.
My problem is very much similar to that of Question on Stackoverflow
The only difference is that I can't use lxm...
Form, Redirect and Forward all send an unauthenticated user to a Form on a login page specified within an Authkit middleware application. I'd like to allow a client application to request a service via XHR and then present a custom 'client side' form if a HTTP status code of 401 is returned, which would then post to Authkit for authentic...