Re: Dynamic settings variables (dynamic global variable)

2012-02-08 Thread Doug Ballance
I made an error when I changed a variable name just before posting. Replace "self._age" with "self._last_updated". -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To

Re: Dynamic settings variables (dynamic global variable)

2012-02-08 Thread Doug Ballance
A method similar to what Anssi describes is what we use for local caching of data that is too large to comfortably fetch from cache/ parse from file every time we need it. A Doing a lazy fetch with a maximum age like that also helps with load times since it is only fetched when accessed. Of

Re: MySQL Query

2012-02-08 Thread 常 剑
seems like you have no module MySQLdb in your python site-packages, install it and try again 在 2012-2-9,AM2:15, Bill 写道: > Hello > > I am completing the Django tutorials, however I am having a problem > when syncing the DB to Django. I am getting the following message. > Any help would be

Re: Speficy a Database for Testing

2012-02-08 Thread Andy McKay
You can define a custom test runner to do this. For example: https://docs.djangoproject.com/en/dev/topics/testing/#django.test.simple.DjangoTestSuiteRunner.setup_databases On Wed, Feb 8, 2012 at 7:42 AM, xina towner wrote: > Yes, but django makes a new testDatabase and

Re: Dynamic settings variables (dynamic global variable)

2012-02-08 Thread Andy McKay
You can define multiple caches: https://docs.djangoproject.com/en/1.3/topics/cache/#django-s-cache-framework You could then use a file system cache or your own local memcache. https://docs.djangoproject.com/en/1.3/topics/cache/#filesystem-caching You can then get that cache and access it in

Re: Django (and Python) speakers

2012-02-08 Thread Andy McKay
> The Django crowd seems to prefer PostgreSQL collectively, but I know > there are a million sites out there using MySQL, so that would > probably resonate with people. Sort of the "frank Wiles of the mySQL > world"? +1 on good MySQL speakers, whilst its not preferred by many, its very under

Can anyone please explain the following settings?

2012-02-08 Thread John Yeukhon Wong
# Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = os.path.join(PROJECT_ROOT, "site_media", "media") # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other

Re: Django (and Python) speakers

2012-02-08 Thread Steve Holden
We can ask, I suppose. I understood that one of the reasons he didn't make the last DjangoCon US was our tardiness in putting the schedule together. I don't know what other factors may have played into that decision. The speaker expenses bill would, of course, be high ... regards Steve On Feb

Re: Django (and Python) speakers

2012-02-08 Thread Steve Holden
Thanks for your ideas! On Feb 7, 9:29 pm, Jeremy Dunck wrote: > The original musketeers, Jacob, Simon, and Adrian, are all great > speakers, of course. > Indeed, though they are all so busy we can't rely on them having time to speak to us. > I thought Jeff Balough, Mike

site_media and media

2012-02-08 Thread John Yeukhon Wong
I am working on someone's legacy code. We do testings on virtual machine (like virtulabox). The virtual machine image contains a working version of our project, and under the directory we have this: project - media/ - site_media - static -- You received this message because you are

Re: Dynamic settings variables (dynamic global variable)

2012-02-08 Thread bfrederi
I'm already using memcached over http so I can have multiple memcached instances. But there isn't any way to set priority or which cache the item goes to or is pulled from. So if I had a local memcached instance, there's no way I could be sure which memcached instance the data was coming from. I

Re: Dynamic settings variables (dynamic global variable)

2012-02-08 Thread Brett Epps
I'd recommend caching the data using Django's caching framework and either the local memory or memcached backend. To update the cache, write a management command that runs periodically as a cron job. (If you find yourself needing more sophisticated background task management, check out Celery.)

Re: Dynamic settings variables (dynamic global variable)

2012-02-08 Thread bfrederi
So would I put that class in my settings.py? Where would I put that class to make sure that the data is frequently retrieved from local memory? On Feb 8, 4:47 pm, akaariai wrote: > On Feb 9, 12:14 am, bfrederi wrote: > > > I have some data that I

Re: Dynamic settings variables (dynamic global variable)

2012-02-08 Thread akaariai
On Feb 9, 12:14 am, bfrederi wrote: > I have some data that I retrieve using urllib and then cache on a > different server that I frequently use through my site. Since it gets > used so frequently, I was wondering why it might be a good/bad idea to > make the urllib

Re: localize custom commands

2012-02-08 Thread ScOut3R
Dear Anssi, thank you for the quick answer. It worked like a charm! I've used translation.activate(). Best regards, Mate On Feb 8, 10:50 pm, akaariai wrote: > On Feb 8, 10:44 pm, ScOut3R wrote: > > > Dear Django users, > > > i'm trying to figure out

Dynamic settings variables (dynamic global variable)

2012-02-08 Thread bfrederi
I have some data that I retrieve using urllib and then cache on a different server that I frequently use through my site. Since it gets used so frequently, I was wondering why it might be a good/bad idea to make the urllib request in the settings.py. It's data that gets changed infrequently, but

Re: localize custom commands

2012-02-08 Thread akaariai
On Feb 8, 10:44 pm, ScOut3R wrote: > Dear Django users, > > i'm trying to figure out how to localize strings in a custom command. > My command sends out emails with static strings defined in the > [command].py file. Makemessages picks up these strings but the > outgoing

Re: UnboundLocalError: local variable 'full_path' referenced before assignment

2012-02-08 Thread akaariai
Quickly looking through the code it seems this is a bug in Django. The full_path variable is used in a place where it is not guaranteed to be initialized. In fact, the whole loaddata.py file seems like a good candidate for some cleanup. 9 levels of indentation in a method and this sort of bug is

localize custom commands

2012-02-08 Thread ScOut3R
Dear Django users, i'm trying to figure out how to localize strings in a custom command. My command sends out emails with static strings defined in the [command].py file. Makemessages picks up these strings but the outgoing email's contents are in the original locale not the one which is set in

Re: Translation inside the database

2012-02-08 Thread Thorsten Sanders
Am 08.02.2012 21:35, schrieb akaariai: On Feb 8, 9:33 pm, Thorsten Sanders wrote: Hello, I have tables having translation like this: name_en,name_de,name_fr... With google I found 2 solutions which support that, but they dont allow to use those fields then with

Re: Translation inside the database

2012-02-08 Thread akaariai
On Feb 8, 9:33 pm, Thorsten Sanders wrote: > Hello, > > I have tables having translation like this: > > name_en,name_de,name_fr... > > With google I found 2 solutions which support that, but they dont allow > to use those fields then with order,filter, values etc...so

UnboundLocalError: local variable 'full_path' referenced before assignment

2012-02-08 Thread rok
When executing the "manage.py syncdb" I get the following error: Creating tables ... Installing custom SQL ... Installing indexes ... Traceback (most recent call last): File "./manage.py", line 26, in execute_from_command_line(sys.argv) File

Translation inside the database

2012-02-08 Thread Thorsten Sanders
Hello, I have tables having translation like this: name_en,name_de,name_fr... With google I found 2 solutions which support that, but they dont allow to use those fields then with order,filter, values etc...so its kinda useless. With some trying arround, I came up with the following: from

Re: MySQL Query

2012-02-08 Thread Bill
Many thanks it is now working!! On Feb 8, 6:21 pm, Sandro Dutra wrote: > Probably you've to install python-mysqldb. > > 2012/2/8 Bill : > > > > > > > > > Hello > > > I am completing the Django tutorials, however I am having a problem > > when syncing the

Re: MySQL Query

2012-02-08 Thread Bill
Many thanks it is now working!! On Feb 8, 6:21 pm, Anoop Thomas Mathew wrote: > Hi, > Make sure that you have installed MySQL-python package for python bindings > to mysql. > > Thanks, > Anoop Thomas Mathew > > ___ > Life is short, Live it hard. > > On 8 February 2012 23:45,

Re: could i use a select?

2012-02-08 Thread Javier Guerra Giraldez
On Wed, Feb 8, 2012 at 9:53 AM, Dennis Lee Bieber wrote: > I don't > think the slice is "present" early enough to be turned into an "offset x > limit y" query yes, it is; and yes, it does -- Javier -- You received this message because you are subscribed to the Google

Re: Models inheritance in django: how to change PK "_ptr_id" on "id"?

2012-02-08 Thread Artyom Chernetzov
Thanks, everybody, problem was: I add ForeignKey field in object after dbsync. I just needed to reset database, it solve problem. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit

Re: MySQL Query

2012-02-08 Thread Sandro Dutra
Probably you've to install python-mysqldb. 2012/2/8 Bill : > Hello > > I am completing the Django tutorials, however I am having a problem > when syncing the DB to Django.  I am getting the following message. > Any help would be appreciated. > >

MySQL Query

2012-02-08 Thread Bill
Hello I am completing the Django tutorials, however I am having a problem when syncing the DB to Django. I am getting the following message. Any help would be appreciated. C:\Python27\Django-131\django\bin\mysite>manage.py syncdb Traceback (most recent call last): File

Re: how to make a small change for apps installed under /site-packages dir

2012-02-08 Thread Tom Lesters
> Generally speaking, using virtualenv (no-site-packages) + pip (with a > requirement file you keep in your project) is a GoodPractice(tm) when > it comes to dependencies. I'm actually using virtuallenv + pip now, thanks for advice anyways! > Daniel already provided the simplest solution for

Re: Foreign Key + Primary key

2012-02-08 Thread akaariai
On Feb 8, 7:01 pm, Sandeep kaur wrote: > Is there any way of having a field in table, declared both as foreign > key as well as primary key? > I want something like this in models: >      publisher = models.ForeignKey(Publisher,primary_key=True) If the above doesn't work,

Re: Foreign Key + Primary key

2012-02-08 Thread yati sagade
Even if there was provision for that(I don't know), it really wouldn't make sense. A parent relation tuple can be referenced by multiple child relation tuples - thereby breaking the uniqueness constraint that comes with a primary key. On Wed, Feb 8, 2012 at 10:31 PM, Sandeep kaur

Re: Foreign Key + Primary key

2012-02-08 Thread Joel Goldstick
On Wed, Feb 8, 2012 at 12:01 PM, Sandeep kaur wrote: > Is there any way of having a field in table, declared both as foreign > key as well as primary key? > I want something like this in models: >     publisher = models.ForeignKey(Publisher,primary_key=True) > > -- >

Re: [Session] [Bangalore - India] Python & Django – Introduction & Demo

2012-02-08 Thread yati sagade
Sorry, That is, do you guys *have* any similar plans for Kolkata? On Wed, Feb 8, 2012 at 11:21 PM, yati sagade wrote: > Great news! would love to be there - Do you plans for something similar in > Kolkata? > > > On Wed, Feb 8, 2012 at 8:31 PM, Sivasubramaniam Arunachalam

Re: [Session] [Bangalore - India] Python & Django – Introduction & Demo

2012-02-08 Thread yati sagade
Great news! would love to be there - Do you plans for something similar in Kolkata? On Wed, Feb 8, 2012 at 8:31 PM, Sivasubramaniam Arunachalam < sivasubramania...@gmail.com> wrote: > Hi All, > > There is a Django introduction session with demo scheduled in Bar Camp > 2012. > > *Venue : SAP Labs

Foreign Key + Primary key

2012-02-08 Thread Sandeep kaur
Is there any way of having a field in table, declared both as foreign key as well as primary key? I want something like this in models: publisher = models.ForeignKey(Publisher,primary_key=True) -- Sandeep Kaur E-Mail: mkaurkha...@gmail.com Blog: sandymadaan.wordpress.com -- You received

Re: Generic relationships between existing entities, many2many

2012-02-08 Thread arkai...@gmail.com
Hi, Maybe I focused too much on the type of solution I was looking for and not on the problem itself. Let's try with music: I have a Bands application with a Band model that can be used for CRUD of band entity and for voting bands, commenting on them etc.. I have a Venue application with a

Re: Speficy a Database for Testing

2012-02-08 Thread Mark Furbee
I'm not sure that you can specify a different existing database. I think (not certain) that Django's testing is built to have no effect on real data, hence creating a blank test database. You can, however, use fixtures to create data in the test database after it is created and before the unit

Re: Speficy a Database for Testing

2012-02-08 Thread xina towner
Yes, but django makes a new testDatabase and that's my problem, I want django to use a database I've previously done. On 8 February 2012 16:34, Mark Furbee wrote: > Denis Darii already answered this on February 1st: > > "You can redefine your database connection by adding

Re: could i use a select?

2012-02-08 Thread J. Cliff Dyer
On Wed, 2012-02-08 at 09:53 -0500, Dennis Lee Bieber wrote: > On Tue, 7 Feb 2012 21:23:58 -0800 (PST), akaariai > wrote: > > >I think you could do > >Customer.objects.annotate(tot_invoice=Sum(invoice_set__total_invoice)).order_by('tot_invoice') > >[0:10]. > > NOTE: the

Re: Speficy a Database for Testing

2012-02-08 Thread Mark Furbee
Denis Darii already answered this on February 1st: "You can redefine your database connection by adding somewhere at the end of your settings.py something like: import sys if 'test' in sys.argv: DATABASES = ... hope this helps." Did you try this? On Wed, Feb 8, 2012 at 7:19 AM, xina

Speficy a Database for Testing

2012-02-08 Thread xina towner
Can I create a Database manually and then specify to the testing unit to use that? -- Gràcies, Rubén -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this

[Session] [Bangalore - India] Python & Django – Introduction & Demo

2012-02-08 Thread Sivasubramaniam Arunachalam
Hi All, There is a Django introduction session with demo scheduled in Bar Camp 2012. *Venue : SAP Labs India , Bangalore, India* *Date : 11-Feb-2012* More details @ http://barcampbangalore.org/bcb/bcb11/python-django-introduction-demo Thanks & Regards, Sivasubramaniam Arunachalam -- You

Custom times in admin time selector

2012-02-08 Thread Sebastian Goll
Hi all, For DateTimeFields, the admin presents selector widgets for both the date and time form fields. The default choices for the time selector are: Now, Midnight, 6 a.m., Noon. I'd like to replace those default choices with something different, depending on the ModelAdmin instance in

Re: Error with test database

2012-02-08 Thread xina towner
It does not work U_U On 8 February 2012 14:19, Renne Rocha wrote: > The order in which the tables are created depends on the order in which > you have them in your INSTALLED_APPS. > Try moving the app you want to be created first before the others. > > Renne Rocha >

Re: Error with test database

2012-02-08 Thread Renne Rocha
The order in which the tables are created depends on the order in which you have them in your INSTALLED_APPS. Try moving the app you want to be created first before the others. Renne Rocha http://rennerocha.com/ On Wed, Feb 8, 2012 at 11:07 AM, xina towner wrote:

Re: Error with test database

2012-02-08 Thread xina towner
Can I specify to test tool to use an specific database? On 8 February 2012 14:07, xina towner wrote: > I've already done that, > this works with databases, but with tables too? > > > On 8 February 2012 14:04, Renne Rocha wrote: > >> You can

Fail to load media files in Django(on Windows7)

2012-02-08 Thread 530056...@qq.com
When i'm trying to load http://127.0.0.1:8000/media/javascripts/bg-input.png(This PNG file exists) I get a 500 http response saying: UnicodeDecodeError at /media/javascripts/bg-input.png 'ascii' codec can't decode byte 0xca in position 0: ordinal not in range(128) Request Method: GET Request

Re: Error with test database

2012-02-08 Thread xina towner
I've already done that, this works with databases, but with tables too? On 8 February 2012 14:04, Renne Rocha wrote: > You can configure the setting TEST_DEPENDENCIES. See the docs for more > info: > > >

Re: Error with test database

2012-02-08 Thread Renne Rocha
You can configure the setting TEST_DEPENDENCIES. See the docs for more info: https://docs.djangoproject.com/en/1.3/topics/testing/#controlling-creation-order-for-test-databases Renne Rocha http://rennerocha.com/ On Wed, Feb 8, 2012 at 10:57 AM, xina towner

Error with test database

2012-02-08 Thread xina towner
Hello, I've a problem, I have to created a script that makes my database in a specifically order but when I want to make test django do it in a different order. How can I solve this? because it can't create the database so I can't test my app. Can I change the order how django initiates the

Re: How to submit tests and docs while submitting patches

2012-02-08 Thread akaariai
On Feb 8, 1:06 pm, Karthik Abinav wrote: > Hi, > >  I would like to contribute to django. But I am not clear as to how to > submit the tests and docs while submitting my patches. Or does every patch > need a tests and docs. Help would be appreciated. In general, new

How to submit tests and docs while submitting patches

2012-02-08 Thread Karthik Abinav
Hi, I would like to contribute to django. But I am not clear as to how to submit the tests and docs while submitting my patches. Or does every patch need a tests and docs. Help would be appreciated. Thanks, Karthik Abinav -- You received this message because you are subscribed to the Google

Re: same code runs on two machines and barfs on the third

2012-02-08 Thread akaariai
On Feb 8, 11:27 am, kenneth gonsalves wrote: > On Wed, 2012-02-08 at 00:15 -0800, akaariai wrote: > > On Feb 8, 9:15 am, kenneth gonsalves wrote: > > > On Tue, 2012-02-07 at 19:29 +1100, Mike Dewhirst wrote: > > > > On 7/02/2012 6:14pm, kenneth

Re: same code runs on two machines and barfs on the third

2012-02-08 Thread kenneth gonsalves
On Wed, 2012-02-08 at 00:15 -0800, akaariai wrote: > On Feb 8, 9:15 am, kenneth gonsalves wrote: > > On Tue, 2012-02-07 at 19:29 +1100, Mike Dewhirst wrote: > > > On 7/02/2012 6:14pm, kenneth gonsalves wrote: > > > > On Tue, 2012-02-07 at 08:06 +0100, Babatunde Akinyanmi

Re: Finding It Hard To Make It Work!

2012-02-08 Thread coded kid
Thanks bro. Will do. But do you know about a specific Topic I should learn? On Feb 8, 10:18 am, Thomas Weholt wrote: > Google "ajax tutorial" or even better just google jquery and take it > from there. There are several tutorials on how to integrate jquery and > django

Re: Finding It Hard To Make It Work!

2012-02-08 Thread Thomas Weholt
Google "ajax tutorial" or even better just google jquery and take it from there. There are several tutorials on how to integrate jquery and django as well. Thomas On Wed, Feb 8, 2012 at 10:11 AM, coded kid wrote: > How bro? Don't know Ajax. Can you please put me through?

Re: Finding It Hard To Make It Work!

2012-02-08 Thread coded kid
How bro? Don't know Ajax. Can you please put me through? I'm a Nigerian bro! On Feb 8, 10:02 am, Babatunde Akinyanmi wrote: > Use AJAX or asynchronous programming > > On 2/8/12, coded kid wrote: > > > > > > > > > > > Hello, I want to make the below

Re: Finding It Hard To Make It Work!

2012-02-08 Thread Babatunde Akinyanmi
Use AJAX or asynchronous programming On 2/8/12, coded kid wrote: > Hello, I want to make the below codes let users update their status in > the Django . And their update should display on the same template. But > it’s not working. E.g when a user type in “To be a hacker

Re: same code runs on two machines and barfs on the third

2012-02-08 Thread akaariai
On Feb 8, 9:15 am, kenneth gonsalves wrote: > On Tue, 2012-02-07 at 19:29 +1100, Mike Dewhirst wrote: > > On 7/02/2012 6:14pm, kenneth gonsalves wrote: > > > On Tue, 2012-02-07 at 08:06 +0100, Babatunde Akinyanmi wrote: > > >> Perhaps you made a change to a model and