Re: "Pro Django" book still up to date

2010-02-01 Thread Massimiliano della Rovere
Hi Achim, the book, as many told you, is for Django 1.0 The book content is not outdated, at least with django 1.1 The meat of the book are insights about django structure, how components work together and hidden movements behind the scenes you could exploit or hook to. It'snot a beginner's book

postgres exception

2010-02-01 Thread knight
I have django application and I'm using postgres. I try to execute the bollowing line in one of my tests: print BillingUser.objects.all() and I get the following error: "current transaction is aborted, commands ignored until end of transaction block." My postresql log is here: http://slexy.org/vi

Re: Cannot authenticate ...

2010-02-01 Thread tsmets
well, I think no, it is not the problem. The problem can be examplified like this : >>> username = 'tsmets' >>> pwd = '123456' # Is the user created in the console (when doing "synchdb") >>> user = authenticate(username=username, password=pwd) >>> print user tsmets >>> username = 'root' >>> pw

filtering query on a function

2010-02-01 Thread Kenneth Gonsalves
hi, I have a model Player which has a function called getcoursehandicap() defined in the model. I need to get all the Players in a Match with course handicap in a certain range. The query should look like this: players = Matchentry.objects.filter(player__getcoursehandicap()__in= [0..16]) of co

Re: filtering query on a function

2010-02-01 Thread Daniel Roseman
On Feb 1, 9:28 am, Kenneth Gonsalves wrote: > hi, > > I have a model Player which has a function called getcoursehandicap() defined > in the model. I need to get all the Players in a Match with course handicap in > a certain range. The query should look like this: > > players = Matchentry.objects.

Re: Dynamic URL for representatives DB

2010-02-01 Thread Daniel Roseman
On Feb 1, 4:30 am, Nick wrote: > I'm definitely going to continue looking into this. But if you have > any advice on how I can store the rest of the fields from the DB to > call up on the individual reps pages I would greatly appreciate it. > Right now I am only pulling in the last name and first

Re: Display most popular video from each category

2010-02-01 Thread grimmus
I am still experiencing issues with this. Anyone any idea what i am doing wrong ? Thanks ! On Jan 28, 3:28 pm, Daniel Roseman wrote: > On Jan 28, 2:18 pm, grimmus wrote: > > > > > Thanks for the reply. I am having some issues outputting the fields > > now though. > > > It seems 4 objects are b

Re: filtering query on a function

2010-02-01 Thread Kenneth Gonsalves
On Monday 01 Feb 2010 3:08:57 pm Daniel Roseman wrote: > > players = Matchentry.objects.filter(player__getcoursehandicap()__in= > > [0..16]) > > > > of course this doesnt work - any clue how to do this? or do I fall back > > on raw sql? > > This is impossible to answer without knowing what getcour

Re: Display most popular video from each category

2010-02-01 Thread grimmus
When i write out just {{video}} it outputs the id of the object, but when i try {{video.id}} or {{video.title}} i get nothing. On Feb 1, 11:03 am, grimmus wrote: > I am still experiencing issues with this. > > Anyone any idea what i am doing wrong ? > > Thanks ! > > On Jan 28, 3:28 pm, Daniel Ros

Re: filtering query on a function

2010-02-01 Thread James Bennett
On Mon, Feb 1, 2010 at 3:59 AM, Kenneth Gonsalves wrote: > Anyway, player.getcoursehandicap() works - but not within 'filter' Why would you expect it to? Python method definitions are not legal SQL, so you can't pass a Python method into a SQL query and expect it to work. If you want to further f

Re: filtering query on a function

2010-02-01 Thread Kenneth Gonsalves
On Monday 01 Feb 2010 4:03:26 pm James Bennett wrote: > On Mon, Feb 1, 2010 at 3:59 AM, Kenneth Gonsalves wrote: > > Anyway, player.getcoursehandicap() works - but not within 'filter' > > Why would you expect it to? Python method definitions are not legal > SQL, so you can't pass a Python method

Re: Django Test Server and threading

2010-02-01 Thread Ramiro Morales
On Sat, Jan 30, 2010 at 11:04 AM, Cristiano Paris wrote: > Hi, > > can you explain why this doesn't work: > > - > import os, sys, thread, time > > sys.path.append('/mysite') > os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' > > from django.core.handlers.wsgi import WSGIHandler() > fro

Re: filtering query on a function

2010-02-01 Thread Alexandru Nedelcu
On Mon, 2010-02-01 at 04:33 -0600, James Bennett wrote: > On Mon, Feb 1, 2010 at 3:59 AM, Kenneth Gonsalves wrote: > > Anyway, player.getcoursehandicap() works - but not within 'filter' > > Why would you expect it to? Python method definitions are not legal > SQL, so you can't pass a Python metho

Re: postgres exception

2010-02-01 Thread Shawn Milochik
Do you have any messages coming from prior to that? The error you're receiving comes when something else has blown up with your database transaction, and then your code tries to execute something else against the database while your transaction is already 'broken.' So, the problem is probably no

Re: filtering query on a function

2010-02-01 Thread Dennis Vermeulen
On 1-2-2010 10:59, Kenneth Gonsalves wrote: > On Monday 01 Feb 2010 3:08:57 pm Daniel Roseman wrote: > >>> players = Matchentry.objects.filter(player__getcoursehandicap()__in= >>> [0..16]) >>> >>> of course this doesnt work - any clue how to do this? or do I fall back >>> on raw sql? >>>

Re: Display most popular video from each category

2010-02-01 Thread Daniel Roseman
On Feb 1, 10:06 am, grimmus wrote: > When i write out just {{video}} it outputs the id of the object, but > when i try {{video.id}} or {{video.title}} i get nothing. > Exactly what code are you now running? Please post it. -- DR. -- You received this message because you are subscribed to the Go

Re: filtering query on a function

2010-02-01 Thread Daniel Roseman
On Feb 1, 11:29 am, Kenneth Gonsalves wrote: > On Monday 01 Feb 2010 4:03:26 pm James Bennett wrote: > > > On Mon, Feb 1, 2010 at 3:59 AM, Kenneth Gonsalves wrote: > > > Anyway, player.getcoursehandicap() works - but not within 'filter' > > > Why would you expect it to? Python method definitions

test fixtures

2010-02-01 Thread knight
Hi, I want to use some fixtures in my tests. I have cms_sample app and a fixtures folder inside with cms_sample_data.xml I use the following in my test.py: class Funtionality(TestCase): fixtures = ['cms_sample_data'] But the fixtures are not loaded. What am I missing? Thanks, Arshavski Ale

Re: postgres exception

2010-02-01 Thread knight
Thanks. I solved the problem. I added transaction.rollback() to one of the exceptions. Thanks On Feb 1, 2:27 pm, Shawn Milochik wrote: > Do you have any messages coming from prior to that? The error you're > receiving comes when something else has blown up with your database > transaction, and

Re: test fixtures

2010-02-01 Thread Russell Keith-Magee
On Mon, Feb 1, 2010 at 10:01 PM, knight wrote: > Hi, > > I want to use some fixtures in my tests. > I have cms_sample app and a fixtures folder inside with > cms_sample_data.xml > > I use the following in my test.py: > > class Funtionality(TestCase): >    fixtures = ['cms_sample_data'] There are

Re: Display most popular video from each category

2010-02-01 Thread Alexey
I guess that video is a dictionary with one element. But dictionary. Try video[0].id On Feb 1, 1:06 pm, grimmus wrote: > When i write out just {{video}} it outputs the id of the object, but > when i try {{video.id}} or {{video.title}} i get nothing. > > On Feb 1, 11:03 am, grimmus wrote: > > > I

Static files in development and deployment

2010-02-01 Thread Eugene Wee
Hi, Currently, I develop using the development server provided, with MEDIA_URL = '/static/' and the static files served using django.views.static.serve(). In production, I have nginx serving static files and proxying to Apache with mod_wsgi, with MEDIA_URL = 'http://static.example.com/' (substitut

Multiple databases - syncdb

2010-02-01 Thread Klemens Mantzos
hi list, checked out the new multidb feature (http://docs.djangoproject.com/en/dev/topics/db/multi-db/). i assumed that syncdb would only sync those models in the database when calling allow_syncdb() of the database routers return True. is that true? my problem: syncdb syncs the complete model i

Re: Cannot authenticate ...

2010-02-01 Thread tsmets
Apparently, extending the "User" is not the right way (since 2006). I believe this seems to explain it all : http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/ \T, On Feb 1, 10:21 am, tsmets wrote: > well, > I think no, it is not the problem. > The problem can be examplif

Re: Static files in development and deployment

2010-02-01 Thread David De La Harpe Golden
On 01/02/10 14:48, Eugene Wee wrote: This works very well for admin media, uploaded files, and static files referenced from within templates (as I pass MEDIA_URL to the templates), Just in case: note 'django.core.context_processors.media' exists to do that for you. but for static files refe

Re: Generic templates

2010-02-01 Thread esatterwh...@wi.rr.com
I see what you are saying. your template would become somewhat complex and hard to maintain if you had a lot of permissions. However you can create whatever permissions you want in the meta class of your model and use those instead of the ACCESS_CHOICES and number checks class Meta: permission

Extended table relations

2010-02-01 Thread Zbigniew Braniecki
Hi, I'm developing django based apps for over a year now and from time to time I encounter a roadblack that I don't know how to approach. Usually I somehow workaround it and go forward, but this time, I have two of those problems in a single case, so I decided to describe them here looking for an e

eProcurement

2010-02-01 Thread Alessandro Ronchi
Is there any GPL eProcurement software made in django? -- Alessandro Ronchi http://www.soasi.com SOASI - Sviluppo Software e Sistemi Open Source http://hobbygiochi.com Hobby & Giochi, l'e-commerce del divertimento -- You received this message because you are subscribed to the Google Groups "

Re: Static files in development and deployment

2010-02-01 Thread Eugene Wee
Hi, On Mon, Feb 1, 2010 at 11:20 PM, David De La Harpe Golden wrote: > Just in case: note 'django.core.context_processors.media' exists to do that > for you. Good guess: I was passing it manually. > Um. You can use relative paths in css url(), so if you keep the css in the > same location relat

Overriden Model.save causes TabularInline save error

2010-02-01 Thread Henning Kage
Hello together, I have overriden the models.Model.save method and added a parameter called 'user', so that each save-call of an object will store the creation date/author and update date/user: class Model(models.Model): class Meta: abstract = True def save(self, user, force_ins

Re: What's the going rate for a Django developer?

2010-02-01 Thread Astley Le Jasper
Hey Dougal. That's a great site. Thanks for that On Jan 29, 3:16 pm, Dougal Matthews wrote: > I think the answer to that is probably "it depends". > >    1. Permanent or contractor? >    2. What country? >    3. Often it even matters what city? >    4. How much experience do they have? > > It's p

Re: Overriden Model.save causes TabularInline save error

2010-02-01 Thread Daniel Roseman
On Feb 1, 4:11 pm, Henning Kage wrote: > Hello together, > > I have overriden the models.Model.save method and added a parameter > called 'user', so that each save-call of an object will store the > creation date/author and update date/user: > > class Model(models.Model): > >     class Meta: >    

Re: Django Test Server and threading

2010-02-01 Thread Cristiano Paris
On Mon, Feb 1, 2010 at 12:33 PM, Ramiro Morales wrote: > ... > Are you using sqlite3? Yes but, isn't the test server always using sqlite3? Cristiano -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-u

Re: Dynamic URL for representatives DB

2010-02-01 Thread Nick
You are exactly right. Thanks, this was a learning curve I was having trouble getting over. You have been an immense help and are a credit to this online community. On Feb 1, 3:42 am, Daniel Roseman wrote: > On Feb 1, 4:30 am, Nick wrote: > > > I'm definitely going to continue looking into thi

any suggestion about how to build Continuous testing for django project?

2010-02-01 Thread pyleaf
I am new for django. any suggestion about how to build Continuous testing for django project? -- Believing is Everything. -- 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 un

Template-Include and block.super

2010-02-01 Thread Daishy
Hi, i'm pretty new to django and just stumbled upon a question i didnt found a solution to, despite the good docs :). I have a base-template which defines a block calles js and css. Now i can extend that template and use these blocks and block.super, to add javascript or css-files to those already

Best way to handle "this obj relates to one of these three types of objects" ?

2010-02-01 Thread Tom von Schwerdtner
I have a Resource, which can either be an image, a link or a document. What is the cleanest way to handle this? My thoughts are either, have them be attributes on the Resource object: class Resource(models.Model): name = models.CharField(...) # One of these image = m

Re: TemplateSyntaxError at /admin/ - 'module' object has no attribute 'rindex'

2010-02-01 Thread John Abraham
I get the same error in the admin interface after manually removing a field from one of my classes. I removed it in models.py and in the database. The class in question works fine, but for some reason a dependent class (one that refers to the other with a foreign key) has it's admin form broken.

Re: Best way to handle "this obj relates to one of these three types of objects" ?

2010-02-01 Thread Shawn Milochik
Poof, magic! http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1 Django has this baked-in. Shawn -- 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

Rebuild admin site after dropping field from models.py?

2010-02-01 Thread John Abraham
Hi. I changed models.py to remove a foreign key (user_id field in table Client), and reran syncdb, but now if I try to create a record of that type in the admin interface I get an error when I try to save a new object. Any idea on how to get rid of this error? It seems the admin site is caching

Re: Best way to handle "this obj relates to one of these three types of objects" ?

2010-02-01 Thread Tom von Schwerdtner
Shawn Milochik wrote: > Poof, magic! > > http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1 > > Django has this baked-in. Aha, awesome, thank you. -Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Rebuild admin site after dropping field from models.py?

2010-02-01 Thread Shawn Milochik
Running syncdb on an already-existing model won't make the changes in the database. For that, you should employ the fine services of South. south.aeracode.org/ At this point, you might be best served by the following procedures: 1. Put the field back in your model. 2. Install South, add it to in

Re: Rebuild admin site after dropping field from models.py?

2010-02-01 Thread John Abraham
I figured this out. I my __unicode__(self) still refered to the field! Doh! I changed it, reran syncdb, and restarted the server and it worked. Not sure if rerunning syncdb was necessary. -- John On Feb 1, 12:44 pm, John Abraham wrote: > Hi. > > I changed models.py to remove a foreign key (use

actions and/or customizing the admin best practices

2010-02-01 Thread bax...@gretschpages.com
I have some admin-y type functions like "import articles from blog" that currently are called when a particular URL is visited, and I'd like to integrate them into the admin. My first thought, since this is on 1.1, was to use actions, but it appears actions can only work when applied to selected it

Re: any suggestion about how to build Continuous testing for django project?

2010-02-01 Thread Phlip
pyleaf wrote: > I am new for django. > any suggestion about how to build Continuous testing for django project? install fabric - and don't worry about its remote options yet. Then create a fabfile.py at the root of your app. Create 3 targets; pull, test, and int. They pull from Git (you _are_ us

Re: Django Test Server and threading

2010-02-01 Thread Cristiano Paris
On Mon, Feb 1, 2010 at 12:33 PM, Ramiro Morales wrote: > ... > Are you using sqlite3? I think I understand why you're asking this. Here's a little test I ran: - import sqlite3,thread from time import sleep conn = sqlite3.connect(':memory:') c = conn.cursor() c.execute('''create table stock

CheddarGetter module for Django/Python - easy recurring billing

2010-02-01 Thread Jason Ford
We just released pychedder, an open source module for integrating CheddarGetter with Django and Python: http://www.feedmagnet.com/blog/cheddargetter-for-python-and-django/ Anyone who's built commercial web app knows that payment processing can be one of the toughest pieces to put in place - and i

Re: Matplotlib with Django

2010-02-01 Thread jarraneil
Did you ever figure out how to do this? I am stuck with exactly the same problem that you first described i.e. how to allow the user to control the chart they are presented with. In my case I want to give them the ability to zoom, pan and select visible traces On Dec 26 2009, 12:27 pm, heaviside x

Re: Django Test Server and threading

2010-02-01 Thread schinckel
On Feb 2, 3:05 am, Cristiano Paris wrote: > On Mon, Feb 1, 2010 at 12:33 PM, Ramiro Morales wrote: > > ... > > Are you using sqlite3? > > Yes but, isn't the test server always using sqlite3? > No. The test server uses (unless told otherwise) the same db backend as the regular server. Matt. --

Gathering performance statistics

2010-02-01 Thread gkelly
Hello, I'm wondering if anyone knows of an existing middleware that does the following: - collects usage and performance statistics (i.e. logs each request to a URL and its response time) - performs some simple summaries of logged data Or, if anyone knows how to do this with Google Analytics, pl

django admin interface

2010-02-01 Thread Andy Cottell
I am new to django, and have started building a project in it. I have tried to use the admin interface with the project am having issues logging in. I have setup the interface as instruced in the django tutorial part 2, and created a new superuser and cannot use it to log in. The user is always rej

Default Selection in ChoiceField

2010-02-01 Thread Sumanth
Hi all, I have a basic form class AssumptionsForm(forms.Form): writedownoper = forms.ChoiceField( required=True, choices = [('1','1'),('2',2='),('3','3')]) Now in my view after I create the form I want to set value 2 as default. How can I do it? Is there set default API that I can use.

Re: django admin interface

2010-02-01 Thread bedros
make sure you do syncdb to create database tables before you can actually use the admin interface for the first time. try python ./manage.py syncdb On Feb 1, 4:41 pm, Andy Cottell wrote: > I am new to django, and have started building a project in it. I have > tried to use the admin interface

Re: django admin interface

2010-02-01 Thread Andy Cottell
I have done this, and created an superuser when prompted. However the login still fails with the same error. Here is the urls.py: from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patte

How to except a TranslationError

2010-02-01 Thread mf
I'm translating a db from english to spanish with the Google translator API. The problem is when a TranslationError occurs. I can except the first one, but I don't know how to except again. It must be a pythonic way to solve this, but I failed to find it. Here's a snippet from the code: english_f

Re: Default Selection in ChoiceField

2010-02-01 Thread Rishabh Manocha
On Tue, Feb 2, 2010 at 8:56 AM, Sumanth wrote: > Hi all, > > I  have a basic form > > class AssumptionsForm(forms.Form): >       writedownoper  = forms.ChoiceField( required=True, choices = > [('1','1'),('2',2='),('3','3')]) > > Now in my view after I create the form I want to set value 2 as > def

Re: filtering query on a function

2010-02-01 Thread Kenneth Gonsalves
On Monday 01 Feb 2010 6:26:16 pm Daniel Roseman wrote: > > as already mentioned, I am doing it - just hoped that maybe there was a > > shortcut somewhere ... > > Maybe you could denormalize a bit, to store the value of > getcoursehandicap() in the Player model and update it on save. Then > you can

Re: filtering query on a function

2010-02-01 Thread Kenneth Gonsalves
On Monday 01 Feb 2010 4:34:22 pm Dennis Vermeulen wrote: > > probably - but anyway I do not think django allows functions to be used > > on the left hand side of filters. > > > > Isn't this possible by using > player__handicap__handicapindex__range=[0..16] as filter? > well, the handicapinde

Re: any suggestion about how to build Continuous testing for django project?

2010-02-01 Thread pyleaf
what about bitten? On Tue, Feb 2, 2010 at 4:12 AM, Phlip wrote: > pyleaf wrote: > > > I am new for django. > > any suggestion about how to build Continuous testing for django project? > > install fabric - and don't worry about its remote options yet. Then > create a fabfile.py at the root of you

Re: Default Selection in ChoiceField

2010-02-01 Thread Shawn Milochik
You can do it in your view after creating the form, if you like. form = SomeForm() form.fields['meal_pref'].initial = 2 Shawn -- 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. T

where can i see the tables created in sqlite database

2010-02-01 Thread pyrocks
This s pyrocks a new programmer to django. i am doing test application polls by reading the django tutorial. when i run the command python manage.py syncdb it was created all tables related applications mentioned in InstalledApps of settings.py and i created one superuser also in the tutorial

Re: Initial data fixtures and auto_now_add=True

2010-02-01 Thread Andrew Turner
On Jan 19, 1:36 pm, Andrew Turner wrote: > I have an initial_data.json file which provides some, er, initial data > whenever I run syncdb. One of my models has a DateTimeField with > auto_now_add=True. The data is loaded first time round, but on > subsequent syncdbs, I get "IntegrityError: posts_e

Applications disapearing from admin at random

2010-02-01 Thread CreativeConvergence
Hi, I have a django-mingus blog I modified a bit and it's running perfectly under django integrated development web server. Once deployed with flup and cherokee there is a lot of odd beaviour. Sometimes the site load OK and sometimes the appearance of the site is not ok like if it didn't find the