Re: order by + group by

2011-09-16 Thread Peter of the Norse
On Sep 14, 2011, at 7:19 AM, Jani Tiainen wrote: > 14.9.2011 12:46, Jonas H. kirjoitti: >> On 09/14/2011 11:37 AM, Иван Иванов wrote: >>> The problem here is, like Peter said, that you cannot order before >>> grouping. And that's very annoying. >> >> Of course you can, using a subselect just

Re: Removing SECRET_KEY from settings.py

2011-09-16 Thread Rafael Durán Castañeda
In addition you can add a local_settings.py.template on repository instead of local_settings.py, so for developtment you can add some fixed fake values for testing and edit with production suitable values when needed. 2011/9/17 Donald Stufft > $ cat settings.py > > ….

Re: Removing SECRET_KEY from settings.py

2011-09-16 Thread Donald Stufft
$ cat settings.py …. try: from local_settings import * except ImportError: pass $ cat local_settings.py …. SECRET_KEY = "blah" On Friday, September 16, 2011 at 8:54 PM, Tim Chase wrote: > Just returning to some Django work after a time away, I > (re)started an old project in 1.3 and

Removing SECRET_KEY from settings.py

2011-09-16 Thread Tim Chase
Just returning to some Django work after a time away, I (re)started an old project in 1.3 and hit an early issue. I'd like to keep my settings.py under revision-control that is somewhat publicly accessible, but don't want my SECRET_KEY exposed. The solution I've opted for is the following

Re: request.user not pickable anymore

2011-09-16 Thread Łukasz Rekucki
On 16 September 2011 22:05, Torsten Bronger wrote: > this means that we don't have to do anything. Not really. To 1.4 not be affected, someone needs to write a patch for that ticket. This can be you ;) -- Łukasz Rekucki -- You received this message because you

Re: request.user not pickable anymore

2011-09-16 Thread Torsten Bronger
Hallöchen! Tim Shaffer writes: > Looks like there might already be a ticket open to fix this: > > https://code.djangoproject.com/ticket/16563 Wow, thank you! Since 1.3 is not affected and 1.4 won't be probably, this means that we don't have to do anything. Tschö, Torsten. -- Torsten Bronger

Re: request.user not pickable anymore

2011-09-16 Thread Tim Shaffer
Looks like there might already be a ticket open to fix this: https://code.djangoproject.com/ticket/16563 -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit

Re: When is a good time to use db_index? Rule of thumb?

2011-09-16 Thread Andre Terra
Wow, great question and even better answers! Amazing help indeed. Thanks everyone, I learned a bunch from this too. Enjoy the weekend! Cheers, AT On Fri, Sep 16, 2011 at 1:52 PM, Micky Hulse wrote: > Thank you Micah, Donald and Doug! I really appreciate the help! :) > >

Re: When is a good time to use db_index? Rule of thumb?

2011-09-16 Thread Micky Hulse
Thank you Micah, Donald and Doug! I really appreciate the help! :) That really helps to clear things up for me. Have a great weekend. Cheers, Micky -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

request.user not pickable anymore

2011-09-16 Thread Torsten Bronger
Hallöchen! Since , request.user is a SimpleLazyObject. This means that def my_simple_test_view(request): import pickle pickle.dumps(request.user) fails. Since we put objects in the cache which contain request.user, we saw a

Re: memcached problems with cache.clear()

2011-09-16 Thread Torsten Bronger
Hallöchen! Torsten Bronger writes: > Sometimes, we experience a massive increase in active connections > to the memcached server when calling cache.clear(). I think https://code.djangoproject.com/ticket/15324 is our problem, so I will upgrade from SVN-15005 to Django 1.3. Tschö, Torsten. --

Re: Populating form and having access to related objects

2011-09-16 Thread David
Javier That's great and working, thank you. I have modified my code and it appears to be working now. Does what I have done now account for the GET scenario please? Thanks again! def companyedit(request, pk): if request.method == 'POST': a =

Re: Port of Django Template Language to PHP

2011-09-16 Thread Rune Kaagaard
@Kenneth Heh, no understood what you meant, but guess I could have separated my answer better. Sorry about that! cheers Rune Kaagaard On Aug 22, 9:10 am, kenneth gonsalves wrote: > On Sun, 2011-08-21 at 16:22 +0200, Rune Kaagaard wrote: > > @Kenneth+@Masklinn: You are

Re: Populating form and having access to related objects

2011-09-16 Thread Javier Guerra Giraldez
On Fri, Sep 16, 2011 at 10:57 AM, David wrote: > I had imagined therefore I would be able to iterate through the > Person's that belong to the Company using the following syntax: > > {% for p in person %} >        {{ p.first_name }} > {% endfor %} > > But I'm told that the

Re: Populating form and having access to related objects

2011-09-16 Thread David
Is this because my Company model contains no foreign keys as the relationship is from Person to company and Person contains the foreign key? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Populating form and having access to related objects

2011-09-16 Thread David
Hi Javier Thanks for your reply. I have modified my view like this: def companyedit(request, pk): if request.method == 'POST': a = Company.objects.select_related().get(pk=pk) form = CompanyForm(request.POST, instance=a) if form.is_valid(): form.save()

Re: Populating form and having access to related objects

2011-09-16 Thread David
I should add that Person has the foreign key relationship to Company. I know how to do this in SQL but not in the ORM. Thanks for any assistance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Populating form and having access to related objects

2011-09-16 Thread Javier Guerra Giraldez
On Fri, Sep 16, 2011 at 10:35 AM, David wrote: > def companyedit(request, pk): >    if request.method == 'POST': >        a = Company.objects.get(pk=pk) .. > I would like to fetch the related Person objects that are related to > Company (ie. those who work for said

Populating form and having access to related objects

2011-09-16 Thread David
Hello This is my view @login_required @transaction.commit_on_success def companyedit(request, pk): if request.method == 'POST': a = Company.objects.get(pk=pk) form = CompanyForm(request.POST, instance=a) if form.is_valid(): form.save() else:

Re: sending and receiving data using ajax/html

2011-09-16 Thread Javier Guerra Giraldez
On Thu, Sep 15, 2011 at 10:51 AM, jay K. wrote: > I do not know anything about send and receiving data using forms in html > django, > I just heard that ajax was good for receiving and sending data (it was > faster) no, it's not. it can create the illusion if used

Re: ann: freesound and django

2011-09-16 Thread Bram de Jong
> http://www.assembla.com/code/freesound My appologies: https://www.assembla.com/code/freesound/git/nodes - bram -- 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: Is it possible to use required_css_class with ModelForm?

2011-09-16 Thread David
Answered my own question. It's fine in the class, I had it in META :-) -- 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 group, send email to

Is it possible to use required_css_class with ModelForm?

2011-09-16 Thread David
Hi I'm using ModelForm but cannot attach a class="required" to the labels of my form. Is this possible? or would I have to construct my form? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: When is the django orm going to get a "group by" function ?

2011-09-16 Thread dave bl
On 16 September 2011 22:57, dave bl wrote: > On 16 September 2011 22:39, Jani Tiainen wrote: >> 16.9.2011 15:27, dave bl kirjoitti: >>> >>> Hmm no I am not missing the point... I think the django devs are... >>> sqlalchemy _has_ a group by. >>> >>> So I

Re: New user login problem

2011-09-16 Thread marios
OK, thank you. The problem is already solved. Mario On 16 sep, 09:44, Jacco Flenter wrote: > How did you set the password? There is a password field in the "change user" > form in the admin, but it does not contain the user's password in clear > text: it is the result

Re: how to customize a form field, CSS style things.

2011-09-16 Thread Dave
On Fri, 16 Sep 2011 04:58:00 -0700 (PDT) "Kevin.X" wrote: > Dave, > Thanks for your reply. But I want a more general way to specify the > class of a widget. Is that a little boring when you want a text input > with class 'text', but you have to call forms.CharField with

Re: New user login problem

2011-09-16 Thread Jacco Flenter
How did you set the password? There is a password field in the "change user" form in the admin, but it does not contain the user's password in clear text: it is the result of some cryptography on the password. It might be a good idea to go to the change user form and check if the password field

Re: how to customize a form field, CSS style things.

2011-09-16 Thread Jacco Flenter
Hi Kevin, For this you might want to use something like django-uni-form: http://readthedocs.org/docs/django-uni-form/en/latest/ Regards, Jacco On Fri, Sep 16, 2011 at 1:58 PM, Kevin.X wrote: > Dave, > Thanks for your reply. But I want a more general way to specify the

Re: When is the django orm going to get a "group by" function ?

2011-09-16 Thread dave bl
On 16 September 2011 22:50, Cal Leeming [Simplicity Media Ltd] wrote: > > > On Fri, Sep 16, 2011 at 1:50 PM, Cal Leeming [Simplicity Media Ltd] > wrote: >> >> Dave - I think you are having the same problem I had to begin

Re: When is the django orm going to get a "group by" function ?

2011-09-16 Thread dave bl
On 16 September 2011 22:39, Jani Tiainen wrote: > 16.9.2011 15:27, dave bl kirjoitti: >> >> Hmm no I am not missing the point... I think the django devs are... >> sqlalchemy _has_ a group by. >> >> So I simply want to do this sql statement(using the django orm): >> >> select

Re: When is the django orm going to get a "group by" function ?

2011-09-16 Thread Cal Leeming [Simplicity Media Ltd]
On Fri, Sep 16, 2011 at 1:50 PM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > Dave - I think you are having the same problem I had to begin with. > > Using the ORM means you have to change your way of thinking. > > Remember - the ORM isn't perfect, and there

Re: When is the django orm going to get a "group by" function ?

2011-09-16 Thread Cal Leeming [Simplicity Media Ltd]
Dave - I think you are having the same problem I had to begin with. Using the ORM means you have to change your way of thinking. Remember - the ORM isn't perfect, and there are instances where you either need to use a raw SQL, or split the query up into multiple calls. In some cases, doing

Re: New user login problem

2011-09-16 Thread marios
OK now. I missed set is_staff=True. Thank you. Mario (A doubt: Is it OK ask support questions in this forum or its purpose is another? On 16 sep, 09:22, Martin Tiršel wrote: > Hi, > > did you set is_staff to True? > > Martin > > > > > > > > On Fri, 16 Sep 2011 14:20:14

Re: When is the django orm going to get a "group by" function ?

2011-09-16 Thread Jani Tiainen
16.9.2011 15:27, dave bl kirjoitti: Hmm no I am not missing the point... I think the django devs are... sqlalchemy _has_ a group by. So I simply want to do this sql statement(using the django orm): select foo, count(foo), from bar group by foo; I _could_ use a .extra method to do this(and get

Re: When is the django orm going to get a "group by" function ?

2011-09-16 Thread dave bl
> Yes, there is. > > Asking for a GROUP BY function in Django's ORM misses the point > entirely of why an ORM exists. Django's ORM isn't SQL. Django's ORM > provides an abstraction layer that is able to make an arbitrary data > store appear like a collection of related objects. There's no >

Re: When is the django orm going to get a "group by" function ?

2011-09-16 Thread dave bl
Hmm no I am not missing the point... I think the django devs are... sqlalchemy _has_ a group by. So I simply want to do this sql statement(using the django orm): select foo, count(foo), from bar group by foo; I _could_ use a .extra method to do this(and get stuck on $databases) ... or a loop...

Re: New user login problem

2011-09-16 Thread Martin Tiršel
Hi, did you set is_staff to True? Martin On Fri, 16 Sep 2011 14:20:14 +0200, marios wrote: Thank you. I did what you are saying. And I have tried creating several new users, but the error message is the same. On 16 sep, 08:49, "Szabo, Patrick \(LNG-VIE\)"

Re: New user login problem

2011-09-16 Thread marios
Thank you. I did what you are saying. And I have tried creating several new users, but the error message is the same. On 16 sep, 08:49, "Szabo, Patrick \(LNG-VIE\)" wrote: > Are you sure you've used the right credentials ?! > Can you log as the admin ?! > If so try

Re: When is the django orm going to get a "group by" function ?

2011-09-16 Thread Russell Keith-Magee
On Fri, Sep 16, 2011 at 8:05 PM, dave bl wrote: > When is the django orm going to get a "group by" function ? (this is > srs buz ... Y NO HAZ?). I see that there have been various > changes(getting closer! - with aggregates and annotate) ... and > attempts in the past. Is

Re: When is the django orm going to get a "group by" function ?

2011-09-16 Thread Martin Tiršel
You mean that? https://docs.djangoproject.com/en/1.2/topics/db/aggregation/#values Martin On Fri, 16 Sep 2011 14:05:13 +0200, dave bl wrote: When is the django orm going to get a "group by" function ? (this is srs buz ... Y NO HAZ?). I see that there have been

When is the django orm going to get a "group by" function ?

2011-09-16 Thread dave bl
When is the django orm going to get a "group by" function ? (this is srs buz ... Y NO HAZ?). I see that there have been various changes(getting closer! - with aggregates and annotate) ... and attempts in the past. Is there a "solid" reason for not supporting "group by" in the ORM ... (yet) ? --

Re: How to create Time Series Tables In DJango

2011-09-16 Thread Martin Tiršel
Hi, I think, that your app has a bad design if you need to do such things. You can have a hundred millions of records and be just fine and you can have a thousands of records and have problems if you do a bad design. If you split data over multiple tables, you will do the lookups over

Re: how to customize a form field, CSS style things.

2011-09-16 Thread Kevin.X
Dave, Thanks for your reply. But I want a more general way to specify the class of a widget. Is that a little boring when you want a text input with class 'text', but you have to call forms.CharField with the widget param every time? On Sep 16, 7:21 pm, Dave wrote: > Does

AW: New user login problem

2011-09-16 Thread Szabo, Patrick (LNG-VIE)
Are you sure you've used the right credentials ?! Can you log as the admin ?! If so try to create another user and log in as such. . . . . . . . . . . . . . . . . . . . . . . . . . . Ing. Patrick Szabo XSLT Developer LexisNexis Marxergasse 25, 1030 Wien mailto:patrick.sz...@lexisnexis.at

Gestione dei millisecondi in Django

2011-09-16 Thread physio
Salve a tutto il gruppo, e' la prima volta che scrivo e faccio i complimenti a tutti quanti per le risorse che si possono trovare all'interno del gruppo. Ho cominciato a studiare django leggendo alcuni articoli in rete ma soprattutto sto partendo dal libro di Marco Beri. A fini didattici ho

New user login problem

2011-09-16 Thread marios
I am a new user of Django with not much experience in programming. I am following the tutorial. In the Administration module I have created a new user with some permissions, but when I try to logging in as this new user appear an error message ("Wrong user or password") Could you help me? -- You

How to create Time Series Tables In DJango

2011-09-16 Thread deepak gupta
Hi All, Is there any facility in Django to create time series table. My Req. is : I want to create one table monthly or Daily basis as my data is huge so I want to distribute the load monthly or daily basis, so I wan to use same schema name and need to create table regularly. for ex: for monthly

Re: how to customize a form field, CSS style things.

2011-09-16 Thread Dave
Does this page : https://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.Widget.attrs helps you ? n [1]: from django import forms In [2]: class CommentForm(forms.Form): ...: name = forms.CharField( ...:

ann: freesound and django

2011-09-16 Thread Bram de Jong
hello everyone, just a small message to say that htp://www.freesound.org now runs on django :) all the code is gpl and can be found here: http://www.assembla.com/code/freesound For those interested, our stack is: nginx, postgres, solr, ... bram -- http://www.samplesumo.com

Re: Composite OneToOneFields in Django?

2011-09-16 Thread Tom Evans
On Thu, Sep 15, 2011 at 5:02 PM, RedBaron wrote: > I am fairly new to Django and I think I pretty much get the basic idea > of ORM. However, there is a peculiar situation to which I do not see a > plausible solution. I have a legacy database for which I am trying to >

how to customize a form field, CSS style things.

2011-09-16 Thread Kevin.X
Hi, folks Is there any simple way to customize a form filed's style? I want to add CSS class to a filed according to it's type. Say, should have a class named 'text', tag should have a class 'select', and so on. The way I want to try is that added class attribute to widget according to widget's

Re: Initial data for ManyToMany field

2011-09-16 Thread Danfi
this initial can be a queryset or a list, but the list must use its primary key like sform = SymptomeForm(initial={'parent':[1,2]}) On 9月7日, 上午4时30分, Thomas49 wrote: > Hello, > > I have two models, and the second contains a ManyToMany relationship: > > class

Re: Caching static images using memcache/nginx

2011-09-16 Thread Ilian Iliev
I am not 100% sure. It is better to check it I think it is configurable but I am not sure what is the default behavior. On Thu, Sep 15, 2011 at 9:52 PM, Thomas Weholt wrote: > Aha! That's briliant, but doesn't nginx set those headers for me when > returning a static

Re: When is a good time to use db_index? Rule of thumb?

2011-09-16 Thread Doug Ballance
Another clarification: It tells django to create an index on that field when you run syncdb to create the tables for your apps. Adding it to an existing model won't change anything by itself. If you decide a field needs an index you can add it to the model definition, and then you can use the

Re: is photologue still maintained?

2011-09-16 Thread graeme
It may or may not help you, but ImageKit seems actively maintained: https://github.com/jdriscoll/django-imagekit http://groups.google.com/group/django-photologue/browse_thread/thread/4b37b40721a30fcb/f0620ebe8672a34c#f0620ebe8672a34c As far as I understand it, a new version of Photologue was