i am setting up a virtualenv for django deployment. i want an isolated env without access to the global site-packages. i used the option --no-site-packages, then installed a local pip instance for that env.
after using pip and a requirements.txt file i noticed that most packages were installed in a "build" folder that is not in sys.pa...
What would be a way to have date range based rss feeds in Django. For instance if I had the following type of django rss feed model.
from django.contrib.syndication.feeds import Feed
from myapp.models import *
class PopularFeed(Feed):
title = '%s : Latest SOLs' % settings.SITE_NAME
link = '/'
description = 'Latest entries t...
r_dict={'answer1': "value1",'answer11': "value11",'answer2': "value2",'answer3': "value3",'answer4': "value4",}
for i in r_dict:
if("answer" in i.lower()):
print i
Result is answer11,answer2,snswer4,answer3
I am using python 2.4.3 I there any way to get the order in which it is populated
Or is there a wa...
from django.db.models.signals import post_save
class MyModel(models.Model):
int = models.PositiveIntegerField(unique=True)
def added (sender, instance, **kwargs):
print 'Added'
post_save.connect(added,MyModel)
When I do:
MyModel.objects.create(int=12345).save()
nothing happened
Am i lose something?
After Edit:
Not ...
Hi i m using haystack with a woosh as search engine:
my model looks as follows
class Person(models.Model):
personid = models.IntegerField(primary_key = True, db_column = 'PID')
firstname = models.CharField(max_length = 50, db_column = 'FIRSTNAME')
lastname = models.CharField(max_length = 50, db_column = 'LASTNAME')
...
Are there any python packages that help generating SQL queries from variables and classes?
For example, instead of writing create query manually, the developer will create a create table (as an object maybe), with desired columns in a list for instance. Then the object will return a string that will be used as a query. It would be a plu...
I have a Django web application that's similar to the typical Q&A system.
A user asks a question. other users submit answers to that question:
Each user is allowed to submit up to N answers to each question,
where N > 1 (so, say each user can submit no more than 3 answers to
each question)
A user can edit his existing answers, or sub...
I'm working with django, i need send a mail to many emails, i want to do this with a high level library like python-mailer, but i need use bcc field, any suggestions?
...
Hello,
I'm trying to link one table to itself. I have media groups which can contain more media group. I created a relation many to many:
media_group_groups = Table(
"media_group_groups",
metadata,
Column("groupA_id", Integer, ForeignKey("media_groups.id")),
Column("groupB_id", Integer, F...
I've obviously misunderstood something fundamental about a Python Thread object's daemon attribute.
Consider the following:
daemonic.py
import sys, threading, time
class TestThread(threading.Thread):
def __init__(self, daemon):
threading.Thread.__init__(self)
self.daemon = daemon
def run(self):
x = 0
...
I have seen this in a lot of python code what does this do? What is it useful for?
logging.basicConfig(level=loglevel,format=myname)
Please and thank you.
...
Hi, I'm writing a simple game with python, pygame and py2app. (I use python 2.6) When I build my game in alias mode, it works fine, but when I build for deployment, the app I get crashes immediately after lunching. Anyone know what's going on?
...
I have a list of integer ascii values that I need to transform into a string (binary) to use as the key for a crypto operation. (I am re-implementing java crypto code in python)
This works (assuming an 8-byte key):
key = struct.pack('BBBBBBBB', 17, 24, 121, 1, 12, 222, 34, 76)
However, I would prefer to not have the key length and un...
opt=[]
opt=["opt3","opt2","opt7","opt6","opt1"]
for i in range(len(opt)):
print opt[i]
Output for the above is
opt3,opt2,opt7,opt6,opt1
How to sort the above array in ascending order..
...
Hi, guys, I got a following peace of base64 encoded data, and I want to use python base64 module to extract information from it? It seems that module does not work. Anyone tells me how?
Q5YACgAAAABDlgAbAAAAAEOWAC0AAAAAQ5YAPwAAAABDlgdNAAAAAEOWB18AAAAAQ5YHcAAAAABDlgeCAAAAAEOWB5QAAAAAQ5YHpkNx8H9Dlge4REqBx0OWB8pEpZ10Q5YH3ES2lxFDlgfuRIuPbEO...
I am using SWIG to access C++ code from Python. How do I elegantly wrap a function that returns values in variables passed by reference like
void set(double&a) {
a = 42.;
}
I could not find out how to do this. In the best case I'd be able to use the function in Python with Python floats:
>>> b = 2.
>>> set(b)
>>> print b
42.0
At ...
Hi all. I have the following XML document:
<x>
<a>Some text</c>
<b>Some text 2</b>
<c>Some text 3</c>
</x>
I want to get the text of all the tags, so I decided to use getiterator().
My problem is, it adds up blank lines for a reason I can't understand. Consider this:
>>> for text in document_root.getiterator():
... print t...
I want to save the MessageID of a sent email, so I can later use it in a References: header to facilitate threading.
I see in root/django/trunk/django/core/mail.py (line ~55) where the MessageID is created.
I'm trying to think of the best way to collect this value, other than just copy/pasting into a new backend module and returning it...
Python evangelists will say the reason Python doesn't have a switch statement is because it has dictionaries. So... how can I use a dictionary to solve this problem here?
The problem is that all values are being evaluated some and raising exceptions depending on the input.
This is just a dumb example of a class that stores a number or ...
Hello,
Building a Django app.
Class Company(models.Model):
trucks = models.IntegerField()
multiplier = models.IntegerField()
#capacity = models.IntegerField()
The 'capacity' field is actually the sum of (trucks * multiplier). So I don't need a database field for it since I can calculate it.
However, my admin user wants ...