Is it ok to use double quotes instead of single quotes in Field.choices?

2009-12-27 Thread Continuation
I have a model field: my_field = models.IntegerField(choices=MY_CHOICES) One choice in MY_CHOICES is: (1, 'I'm looking for...'), I got a syntax error from that. The word "for" in the string was treated as a reserved word. Now if I change the single quotes to double quotes, it seems to work: (

Re: Is it ok to use double quotes instead of single quotes in Field.choices?

2009-12-27 Thread 夏恺
Hi, Please note that you have close the quotation with a single quote right after the character `I`, so the next few word are treated as python source code instead of string. Probably you would like to try: (1, "I'm looking for..."), or, alternatively: (1, 'I\'m looking for...'), ---

Re: Is it ok to use double quotes instead of single quotes in Field.choices?

2009-12-27 Thread Continuation
Thank you. I totally missed that. On Dec 27, 3:18 am, Xia Kai(夏恺) wrote: > Hi, > > Please note that you have close the quotation with a single quote right > after the character `I`, so the next few word are treated as python source > code instead of string. > > Probably you would like to try: > >

How to test activation email on windows?

2009-12-27 Thread vishy
Hi, I have setup the registration module for a django project.Now, I want to test the that activation email is sent.On windows, how can I test this? How to send the email? Will I have to do any changes in settings.py? thanks -- You received this message because you are subscribed to the Google

Re: How to test activation email on windows?

2009-12-27 Thread 夏恺
Hi, Please consult the documentation: http://docs.djangoproject.com/en/dev/topics/email/#topics-email and your problem will be solved. :) Xia Kai(夏恺) xia...@gmail.com http://blog.xiaket.org -- From: "vishy" Sent: Sunda

Re: Is it ok to use double quotes instead of single quotes in Field.choices?

2009-12-27 Thread Chris Withers
Continuation wrote: > Now if I change the single quotes to double quotes, it seems to work: > (1, "I'm looking for..."), Double quotes are absolutely fine and a lot nicer to look at than 'I\'m hard to read'. cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting

Comparing ManyToMany fields

2009-12-27 Thread Scott Maher
Is it possible to filter by the ManyToMany fields? Suppose I have a Pizza model and a Topping model. Topping has a ManyToManyField pointing to Pizza. I now have an instance of a Pizza called mypizza. I would like to now search for all Pizzas with the EXACT same Toppings as mypizza. Intuitively

Re: Is it ok to use double quotes instead of single quotes in Field.choices?

2009-12-27 Thread Masklinn
On 27 déc. 2009, at 09:12, Continuation wrote: > I have a model field: > > my_field = models.IntegerField(choices=MY_CHOICES) > > One choice in MY_CHOICES is: > > (1, 'I'm looking for...'), > > I got a syntax error from that. The word "for" in the string was > treated as a reserved word. > > No

how to get ManyToMany relations?

2009-12-27 Thread Benjamin W.
Hi there, I've problems to access manyToMany relartions. I got the following model: class ModelType(models.Model): description = models.CharField(max_length=100) def __unicode__(self): return u"%s" % (self.description) class CarModel(models.Model): descrip

[Fwd: Re: how to get ManyToMany relations?]

2009-12-27 Thread Steve Holden
Benjamin W. wrote: > Hi there, > > I've problems to access manyToMany relartions. > I got the following model: > > class ModelType(models.Model): > description = models.CharField(max_length=100) > def __unicode__(self): > return u"%s" % (self.description) > > class CarM

MySQLdb problem in conjunction with MAMP

2009-12-27 Thread Don Fox
I'm trying to setup MySQLdb but mysql is located @ /Applications/MAMP/Library/bin/mysql because of the installation of MAPI. My .profile has: export PATH="/usr/local/bin:/usr/local/sbin:/Applications/MAMP/Library/bin:$PATH" The 'python 'setup.py build' and ' sudo python setup.py inst

Re: MySQLdb problem in conjunction with MAMP

2009-12-27 Thread Raja
You need the Mysql-dev package. Im not familiar with OSX but in Linux, you need the libmysqlclient-dev package that contains the load libraries for python-mysql support. Also, you might have better luck in the http://sourceforge.net/projects/mysql-python/forums/forum/70461 forums as your problem se

Re: Is it ok to use double quotes instead of single quotes in Field.choices?

2009-12-27 Thread Biju Varghese
Dear , Just check how you are creating that string.(1,'i'm looking for...') you are giving it like 'i'm . Effectively your string will be only 'I' and remaining part will be taken as a undefined variable or something like that. if you want to make it correct you have to add escape sequence like 'i\

JavaScript function call

2009-12-27 Thread gilbert F.
Hello, I just wonder if somebody has met this problem. I need to call a javaScript function within "". {% for v in data %} showDomainTable ('{{v.publisher_id}}', '{{v.country_id}}');

Securing your applications with ESAPI

2009-12-27 Thread Craig Younkins
The same group of people that wrote the OWASP Top Tennow bring you ESAPI, the Enterprise Security API, and I've ported it to Python. ESAPI

Re: Null constraint violations when saving objects with ForeignKey relationships

2009-12-27 Thread Gunther Mayer
Ok, not sure why I'm not getting replies, perhaps my problem is too complex or I'm being too silly with my approach. Either way, I found a work around by writing a little function to prepare my objects for saving which ensures that django finds the fkey id's when I issue my save(): def prepare_

Re: Comparing ManyToMany fields

2009-12-27 Thread Michael Jenkinson
Hi a pizza has a one to many relationship with its topping. in a list of pizzas there could be some that have the same topping, like thick, thin etc. the query would look like select pizza from pizzas where topping = xyz cheers michael - Original Message From: Scott Maher To: dj

Twitter API

2009-12-27 Thread Mario
Good afternoon, Is there a Twitter API that would allow me to update a Twitt via Django? If so would you be kind enough to send me the link? _Mario -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us

Re: how to get ManyToMany relations?

2009-12-27 Thread Michael Jenkinson
hi there isnt a many to many relationship here, its down the 'is a ... has a' bit of OO one manufacturer makes (one car design that has a number of (models with a set of features)) class manufacturer { list of designs(cardesign) } class cardesign { list of models(model) } cla

Re: Twitter API

2009-12-27 Thread Christophe Pettus
On Dec 27, 2009, at 12:24 PM, Mario wrote: > Is there a Twitter API that would allow me to update a Twitt via > Django? If so would you be kind enough to send me the link? Not meaning to be too terribly sarcastic, but have you tried using Google to search for "python twitter api"? The results

Re: Twitter API

2009-12-27 Thread Carlos Ricardo Santos
You have python-twitter and pyscrobble. 2009/12/27 Mario > Good afternoon, > > Is there a Twitter API that would allow me to update a Twitt via > Django? If so would you be kind enough to send me the link? > > _Mario > > -- > > You received this message because you are subscribed to the Google

Re: Twitter API

2009-12-27 Thread Carlos Ricardo Santos
Sorry.. scrobble is Last.fm, LOL :D 2009/12/27 Carlos Ricardo Santos > You have python-twitter and pyscrobble. > > > 2009/12/27 Mario > > Good afternoon, >> >> Is there a Twitter API that would allow me to update a Twitt via >> Django? If so would you be kind enough to send me the link? >> >>

Re: Twitter API

2009-12-27 Thread Shawn Milochik
http://code.google.com/p/python-twitter/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.co

Re: Twitter API

2009-12-27 Thread Ovnicraft
2009/12/27 Christophe Pettus > > On Dec 27, 2009, at 12:24 PM, Mario wrote: > > Is there a Twitter API that would allow me to update a Twitt via > > Django? If so would you be kind enough to send me the link? > > Not meaning to be too terribly sarcastic, but have you tried using > Google to sear

Re: Twitter API

2009-12-27 Thread Mario
Christophe, Thank you for replying. Yes, I reviewed python twitter API, but the model or the app is designed to pull down the "twitt". I would like to upload a twitt via Django in lieu of using the Twitter front-end. Any thoughts or suggestions? _Mario On Dec 27, 3:26 pm, Christophe Pettus wrot

Re: how to get ManyToMany relations?

2009-12-27 Thread akaariai
> model = CarModel.objects.filter(pk = modelId) > for m in model.modelTypes.all(): >         data = data+m.description+'|' Your problem is that objects.filter(pk=modelId) gives you a list of one element. You need to use either objects.get(pk=modelId) or objects.filter(pk=modelId)[0]. -- You rec

Re: Twitter API

2009-12-27 Thread Tim Chase
> Is there a Twitter API that would allow me to update a Twitt via > Django? If so would you be kind enough to send me the link? I've used Twyt[1] for both command-line posting and for API usage. It's all pure python and AFAIK doesn't have any dependencies outside of stock python. Also, (near

Re: Twitter API

2009-12-27 Thread Christophe Pettus
On Dec 27, 2009, at 12:31 PM, Mario wrote: > Thank you for replying. Yes, I reviewed python twitter API, but the > model or the app is designed to pull down the "twitt". I would like to > upload a twitt via Django in lieu of using the Twitter front-end. Any > thoughts or suggestions? Perhaps I'm

Re: Null constraint violations when saving objects with ForeignKey relationships

2009-12-27 Thread Łukasz Balcerzak
Hi there, Well, just try to make sure you are passing already saved instance (having primary key set) into related model which has foreign key to the first one. Your approach: > from test.models import A,B > instA = A() > instB = B(a=instA) > > Now I'm done with my parsing and am happy to save

Using django only for request handling work

2009-12-27 Thread Amit Sethi
Hi ,I have a project that is in general written to work with wsgi server except i wish to alter some of the environ variables provided to the app. So I have a function: def __call__(self, environ, start_response): In this I want to change some part of environ So my application looks someth

Re: Twitter API

2009-12-27 Thread Mario
Thank you for you suggestions. Btw, I created a mocked-up app and was testing the functionality of the python-twitter. I read the docs as posted at http://media.jesselegg.com/syncr/syncr.app.tweet.html. I did a small unit testing and could see the results immediately, but I could not create or up

Re: Comparing ManyToMany fields

2009-12-27 Thread akaariai
On 27 joulu, 11:32, Scott Maher wrote: > Is it possible to filter by the ManyToMany fields? > > Suppose I have a Pizza model and a Topping model. Topping has a > ManyToManyField pointing to Pizza. I now have an instance of a Pizza > called mypizza. > > I would like to now search for all Pizzas w

Re: Using django only for request handling work

2009-12-27 Thread Victor Lima
Restful API? Att, Victor Lima Em 27/12/2009, às 18:58, Amit Sethi escreveu: > Hi ,I have a project that is in general written to work with wsgi > server except i wish to alter some of the environ variables provided > to the app. So I have a function: > > def __call__(self, environ, start_

Re: Using django only for request handling work

2009-12-27 Thread Daniel Roseman
On Dec 27, 8:58 pm, Amit Sethi wrote: > Hi ,I have a project that is in general written to work with wsgi server > except i wish to alter some of the environ variables provided to the app. So > I have a function: > > def __call__(self, environ, start_response):   In this I want to change some > pa

Re: Twitter API

2009-12-27 Thread Christophe Pettus
On Dec 27, 2009, at 1:15 PM, Mario wrote: > As I pointed out in > my early email, I want to create/update/delete a twitt in django in > lieu of the Twitter front-end. Every reasonable Twitter API I know of (including the Python ones) allow the full range of Twitter operations, including creatin

mapping url to feed

2009-12-27 Thread neridaj
I'm trying to retrieve blog entries for a specific category and I'm not sure how to generate the correct url in my template. here is what I have: {{ category.title }} feeds = { 'entries': LatestEntriesFeed, 'links': LatestLinksFeed, 'categories': CategoryFeed, 'tweets': LatestTweetsFeed } (r'^f

constraint unique with models.Model

2009-12-27 Thread Marc Aymerich
hi guys! I'm writing my first project with django and I have doubts in how to declare a constraint unique for two fields of the same table using models.Model. In MySQL would be something like: CREATE TABLE `virtual_aliases` ( id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, domainid INT(11) NOT NU

Re: constraint unique with models.Model

2009-12-27 Thread Karen Tracey
On Sun, Dec 27, 2009 at 11:08 PM, Marc Aymerich wrote: > hi guys! > > I'm writing my first project with django and I have doubts in how to > declare a constraint unique for two fields of the same table using > models.Model. > See: http://docs.djangoproject.com/en/1.1/ref/models/options/#unique-

Re: constraint unique with models.Model

2009-12-27 Thread Marc Aymerich
On Mon, Dec 28, 2009 at 5:15 AM, Karen Tracey wrote: > On Sun, Dec 27, 2009 at 11:08 PM, Marc Aymerich wrote: > >> hi guys! >> >> I'm writing my first project with django and I have doubts in how to >> declare a constraint unique for two fields of the same table using >> models.Model. >> > > See:

Re: Comparing ManyToMany fields

2009-12-27 Thread Scott Maher
akaariai wrote: > This is not the easiest query to perform using SQL. Something like the > following query might work, I have tested it only quickly. > > select t2.pizza_id > from (select pizza_id from pizza_toppings group by pizza_id >having count(*) = (select count(*) from pizza_toppings wher