Re: newbie going through basic tutorial

2011-03-01 Thread Kenneth Gonsalves
On Tue, 2011-03-01 at 23:14 -0500, Alex Hall wrote: > I get a very long traceback, ending with sqlite3.OperationalError: > unable to open database file. looks like a permissions problem. Does the webserver have permissions to write to the parent directory of the sqllite file? btw, it is good pra

newbie going through basic tutorial

2011-03-01 Thread Alex Hall
Hi all, I have been working with Python for quite a while now and I feel pretty comfortable with it. I am in my last semester at college for a computer science degree, so I also have the background behind a lot of what Python does (objects, classes, all that). I am in a databases class and one requ

Django 1.2.5 postgres autocommit and contenttype sites tests failures

2011-03-01 Thread Jason Culverhouse
Hi, It seems that the contenttype framework and the sites contribs conflict with using the autocommit:True database option. I'm not really sure what happens but here is a simple test case that shows that the order of the tests causes a failure. It looks like from the SQL that the save point is be

Re: django, postgresql and eliminating duplicates

2011-03-01 Thread Kenneth Gonsalves
On Tue, 2011-03-01 at 05:05 -0800, DaithiF wrote: > typo, omitted field name in group by: > select member_id, scoredate, count(*) from scoring_record group by > member_id, scoredate having count(*) > 1 I will try that - since I do not have access to the machine, this may take a few weeks. -- re

Re: Custom User Profiles + Signals

2011-03-01 Thread Stefano
why you don't create the profile only if needed ? class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) User.profile = property(lambda u: UserProfile.objects.get_or_create(user=u)[0]) 2011/3/2 Jeremiah : > Hi All, > > I'm going through the help document (http://docs.dj

Re: How to reduce DB queries?

2011-03-01 Thread Tomasz Zieliński
On 27 Lut, 16:26, galago wrote: > In template in main loop I want to display all technologies assigned to the > each site. Technologies are assigned by m2m relation. So I run subloop as > You can see in code above. I want to reduce the number of queries executed > by those subqueries. I want to

Custom User Profiles + Signals

2011-03-01 Thread Jeremiah
Hi All, I'm going through the help document (http://docs.djangoproject.com/en/ 1.2/topics/auth/#storing-additional-information-about-users) and I'm starting to figure out how signals work. What I'm having problems with is getting my signal to trigger (or at least figuring out if the signal is act

Re: db_index=True doesn't create index

2011-03-01 Thread Łukasz Rekucki
On 1 March 2011 20:48, Dario Bertini wrote: > > but i've found no related bug on the bug tracker (except for a not- > very-related and also old and fixed one: > http://code.djangoproject.com/ticket/1828 > ) See http://code.djangoproject.com/ticket/14651 Also, from PostgreSQL's docs: One should

Re: a rookie problem about 'Modules'

2011-03-01 Thread bruno desthuilliers
On 1 mar, 16:30, Bill Liao wrote: > On Tuesday, March 1, 2011, iRick wrote: > > hi,i'm a freshman for python. i got a problem about "Modules" Python-related questions should go to comp.lang.python. > > this is my dir > > A/ > >       a.py > >       __init__.py > >       B/ > >               __i

Re: Django ORM query modelling question

2011-03-01 Thread Jirka Vejrazka
Hi Carsten, this does not seem to me like something you would be able to do using SQL (or Django ORM) only. I would guess that you'll have to write a bit of Python code that will walk through the entries and detect those that are different from "previous" Cheers Jirka -- You received t

Django ORM query modelling question

2011-03-01 Thread Carsten Fuchs
Dear Django list, after a very good start with Django and it's excellent documentation, I've come now across a problem that neither my SQL nor my Django knowledge is sufficient to solve, so I'd like to ask for your kind help. The (simplified) Django model is class Erfasst(models.Model):

db_index=True doesn't create index

2011-03-01 Thread Dario Bertini
this is my models.py: from django.db import models from django.db.models import Model class Word(Model): word = models.CharField(unique=True, db_index=True, max_length=30) num = models.IntegerField(default=0, editable=False) (actually it was much much more complicated, but i redu

Re: python mysqldb installation problem

2011-03-01 Thread draix
Hey Pulkit, I've had this error a couple of times too. Check the location of your MySQL socket, maybe it's different to '/var/run/mysqld/mysqld.sock'. You can do it checking /etc/mysql/my.cnf. After that, just update DATABASE_HOST in settings.py and add the path to the new socket. PS: you can als

Re: Accessing foreign key fields

2011-03-01 Thread Norberto Leite
The reason to use the 2) is to be able access the full info of the user author model. If you are interested in showing more than just the author_id then you should use the article.author (the .id is comes attached :P ) N. On Tue, Mar 1, 2011 at 6:41 PM, ydjango wrote: > In second one- article.a

Re: Accessing foreign key fields

2011-03-01 Thread ydjango
In second one- article.author.id, django does a DB lookup to get author object and then id is attribute of author. In first article.author_id : author_id is direct attribute of article (actually a foreign key field which django generates). Requires one less DB lookup values both way are same. Per

Re: Django+ oracle, working with apache(mod_python, wsgi) and in runserver, ora-03114 in fastcgi

2011-03-01 Thread Ian
On Mar 1, 10:26 am, Ian wrote: > It appears that the error is actually from the previous (working) > request when Django subsequently tries to close the database > connections and fails, and since the error goes uncaught, it kills the > server. > > It's pretty weird that it would fail in this way.

Re: Django+ oracle, working with apache(mod_python, wsgi) and in runserver, ora-03114 in fastcgi

2011-03-01 Thread Ian
On Mar 1, 4:23 am, lipt0n wrote: > Django 1.2.3 > python 2.6 > cx_oracle 5.0.4 > oracle 10 XE > > $ cat /var/log/nginx/localhost.error_log > 2011/02/28 16:52:39 [error] 11159#0: *47 FastCGI sent in stderr: > "Traceback (most recent call last): >   File "/usr/lib/python2.6/site-packages/flup-1.0.3.

Populating charfield with ID's from many to many

2011-03-01 Thread Nick
I am trying to populate a CharField with id's from a many-to-many field. I am doing this by overriding the save method on the model save and using the default django admin for data entry, however, it requires 2 saves in order to get the data from the many-to-many field to populate the varchar fiel

Re: multi model forms

2011-03-01 Thread Pete
Yeah, I bet that lastname is required=True (which is default). You probably want to redefine lastname to avoid that. On Mar 1, 5:25 am, David De La Harpe Golden wrote: > On 28/02/11 23:13, django wrote: > > > hi guys > > I am new to django. > > > I have got two model User(Django built in ) and a

Re: render a list

2011-03-01 Thread Simone Dalla
2011/3/1 luca72 > A stupid question > mylist = ['a','b','c'] > If i need to render it in a template like: > in differnt > like > a > b > c > > how can i do with the {{% for %}} tag? > Thanks > > Luca > {{% for element in mylist %}} {{ element }} {% endfor %} -- Simo - Registered Linux User

render a list

2011-03-01 Thread luca72
A stupid question mylist = ['a','b','c'] If i need to render it in a template like: in differnt like a b c how can i do with the {{% for %}} tag? Thanks Luca -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email t

Re: a rookie problem about 'Modules'

2011-03-01 Thread Bill Liao
On Tuesday, March 1, 2011, iRick wrote: > hi,i'm a freshman for python. i got a problem about "Modules" > this is my dir > A/ >      a.py >      __init__.py >      B/ >              __init__.py >              b.py >      C/ >              __init__.py >              c.py > > and i wrote thi

How to pre-cache model data?

2011-03-01 Thread Helgi Borg
I need my Django app to poll data in DB regularly (say once every 3 minutes) and cache the data. I have some queries that take up to 20 sec. The users must never wait this long for response from my app. What is the must natural way to go about this in Django? I know that I can use memcache, but t

a rookie problem about 'Modules'

2011-03-01 Thread iRick
hi,i'm a freshman for python. i got a problem about "Modules" this is my dir A/ a.py __init__.py B/ __init__.py b.py C/ __init__.py c.py and i wrote this as follows in c.py from A.B import b blablabla but the com

Re: multi model forms

2011-03-01 Thread David De La Harpe Golden
On 28/02/11 23:13, django wrote: > hi guys > I am new to django. > > I have got two model User(Django built in ) and a model customer, user > is foreign key in customer > > class Customer(models.Model): > user = models.ForeignKey(User, related_name='customers') > street = models.CharField(max

Re: eval if an object meets with a queryset.

2011-03-01 Thread Marc Aymerich
On Tue, Mar 1, 2011 at 2:07 PM, Marc Aymerich wrote: > On Tue, Mar 1, 2011 at 1:46 PM, Masklinn wrote: >> On 2011-03-01, at 13:18 , Marc Aymerich wrote: >>> >>> Hi Masklinn, I never use jquey's :( >> Not a problem. The .is method simply takes a CSS selector and returns a >> boolean flag indicati

Re: eval if an object meets with a queryset.

2011-03-01 Thread Marc Aymerich
On Tue, Mar 1, 2011 at 1:46 PM, Masklinn wrote: > On 2011-03-01, at 13:18 , Marc Aymerich wrote: >> >> Hi Masklinn, I never use jquey's :( > Not a problem. The .is method simply takes a CSS selector and returns a > boolean flag indicating whether the selected object(s) match the selector: > $('a

Re: django, postgresql and eliminating duplicates

2011-03-01 Thread DaithiF
typo, omitted field name in group by: select member_id, scoredate, count(*) from scoring_record group by member_id, scoredate having count(*) > 1 -- 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@

Re: django, postgresql and eliminating duplicates

2011-03-01 Thread DaithiF
why not do the check directly on the database? select member_id, scoredate, count(*) from scoring_record group by member_id having count(*) > 1 (update field/table names as required). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: eval if an object meets with a queryset.

2011-03-01 Thread Masklinn
On 2011-03-01, at 13:18 , Marc Aymerich wrote: > > Hi Masklinn, I never use jquey's :( Not a problem. The .is method simply takes a CSS selector and returns a boolean flag indicating whether the selected object(s) match the selector: $('a').is('a') is trivially going to return `true` for instanc

Re: Accessing foreign key fields

2011-03-01 Thread Ankit Rai
I am not getting what is difference between the 1 & 2?Can anyone tell me the difference On Tue, Mar 1, 2011 at 9:16 AM, ydjango wrote: > class Article(models.Model): >author = models.ForeignKey(Author) >title = models.CharField(max_length = 100) > > (assume an article can have only one

Re: eval if an object meets with a queryset.

2011-03-01 Thread Marc Aymerich
On Tue, Mar 1, 2011 at 12:19 PM, Masklinn wrote: > On 2011-03-01, at 12:11 , Marc Aymerich wrote: >> On Tue, Mar 1, 2011 at 12:02 PM, Daniel Hilton >> wrote: >>> On 1 March 2011 10:55, Marc Aymerich wrote: Hi!, I have a model class like this one: class Domain(models.Model):

Re: urls.py usage

2011-03-01 Thread Daniel Roseman
On Monday, February 28, 2011 7:29:17 PM UTC, Vladimir wrote: > > I only followed manuals! Please, Mr. Daniel, give me more details! Well I don't know which manuals you followed. The online documentation (http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#modeladmin-objects) states this cle

Re: eval if an object meets with a queryset.

2011-03-01 Thread Masklinn
On 2011-03-01, at 12:11 , Marc Aymerich wrote: > On Tue, Mar 1, 2011 at 12:02 PM, Daniel Hilton > wrote: >> On 1 March 2011 10:55, Marc Aymerich wrote: >>> Hi!, >>> I have a model class like this one: >>> >>> class Domain(models.Model): >>>active = models.BooleanField() >>>root = models

Re: eval if an object meets with a queryset.

2011-03-01 Thread Marc Aymerich
On Tue, Mar 1, 2011 at 12:02 PM, Daniel Hilton wrote: > On 1 March 2011 10:55, Marc Aymerich wrote: >> Hi!, >> I have a model class like this one: >> >> class Domain(models.Model): >>    active = models.BooleanField() >>    root = models.CharField(max_length=6) >> >> now given a Domain instance I

Re: eval if an object meets with a queryset.

2011-03-01 Thread Marc Aymerich
On Tue, Mar 1, 2011 at 11:55 AM, Marc Aymerich wrote: > Hi!, > I have a model class like this one: > > class Domain(models.Model): >    active = models.BooleanField() >    root = models.CharField(max_length=6) > > now given a Domain instance I need to know if it meets with an > expresion like this

Re: eval if an object meets with a queryset.

2011-03-01 Thread Daniel Hilton
On 1 March 2011 10:55, Marc Aymerich wrote: > Hi!, > I have a model class like this one: > > class Domain(models.Model): >    active = models.BooleanField() >    root = models.CharField(max_length=6) > > now given a Domain instance I need to know if it meets with an > expresion like this one: > >

eval if an object meets with a queryset.

2011-03-01 Thread Marc Aymerich
Hi!, I have a model class like this one: class Domain(models.Model): active = models.BooleanField() root = models.CharField(max_length=6) now given a Domain instance I need to know if it meets with an expresion like this one: active=True and (root='com' or root='net') one way to do that

mysql MySQL-python and libmysqlclient.so.16 hell

2011-03-01 Thread vanderkerkoff
Hi everyone This is completely driving me crazy :-) I've installed(reinstalled many times) mysql5.5.9 from source, followed this guys instructions http://greensysadmin.com/2011/01/24/mysql-5-5-installing-from-source-ubuntu-debian/ Then downloaded and installed django1.2.4 from source Then down

Re: Django+ oracle, working with apache(mod_python, wsgi) and in runserver, ora-03114 in fastcgi

2011-03-01 Thread lipt0n
Django 1.2.3 python 2.6 cx_oracle 5.0.4 oracle 10 XE $ cat /var/log/nginx/localhost.error_log 2011/02/28 16:52:39 [error] 11159#0: *47 FastCGI sent in stderr: "Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/flup-1.0.3.dev_20110111- py2.6.egg/flup/server/fcgi_base.py",

Re: Collaborative text editor with Django

2011-03-01 Thread Piotr Zalewa
On 03/01/11 07:45, Anoop Thomas Mathew wrote: > @piotr zalewa: > jsFiddle is of course a nice > Is jsFiddle open source?? I couldn't find its source anywhere. > http://www.facebook.com/topic.php?uid=183790024998&topic=14241 > This i