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 like I showed. SQLite example:
>> 
>> > .schema
>> CREATE TABLE a (name varchar, mod int);
>> 
>> e> select * from a;
>> b1|1
>> b1|2
>> b1|3
>> 
>> > select * from a group by name;
>> b1|3
>> 
>> > select * from (select * from a order by mod desc) group by name;
>> b1|1
>> 
> 
> Problem is that is not standard SQL.
> 
> In standard implemetation group by _requires_ aggregation function that is 
> applied to groups so you won't be able to get "last" that way.
> 
> It might work non-standard way in some implementations. And thus Django 
> usually follows standard or smallest common nominator for db backends such a 
> thing is not possible to support.

I didn’t know you could do that in SQLite. I know it doesn’t work in MySQL or 
in PostgreSQL.

The proper ANSI SQL way of doing this is “SELECT name, MIN(mod) FROM a GROUP BY 
name” and the Django way is 
“Model.objects.values('name').annotate(Min('mod'))”. But that only works on a 
table with two fields. If there is more data that you want to include, you’ll 
have to get raw. The SQL will look like “SELECT * FROM a AS t1 WHERE mod = 
(SELECT MIN(mod) FROM a AS t2 WHERE t2.name = t1.name))”. Finding out the exact 
details depends on the specifics of your queryset.

https://docs.djangoproject.com/en/1.3/topics/db/aggregation/

Peter of the Norse
rahmc...@radio1190.org



-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
>
> ….
>
> 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 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 excerpt of
> my settings.py on which I'm hoping for feedback:
>
> SECRET_FILE = "secret.txt"
> if os.path.exists(SECRET_FILE):
> SECRET_KEY = file(SECRET_FILE).read()
> else:
> from random import choice
> SECRET_KEY = ''.join([
> choice(
> 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
> ) for i in range(50)])
> f = file(SECRET_FILE, 'w')
> f.write(SECRET_KEY)
> f.close()
>
> (key generation ripped directly from
> core/management/commands/startproject.py )
>
> As best I can tell, this should allow me to place secret.txt on
> machines I control, while allowing others to freely download the
> code and deploy on their end with minimal trouble.
>
> Any input would be greatly appreciated,
>
> -tkc
>
>
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>  --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 excerpt of  
> my settings.py on which I'm hoping for feedback:
>  
>  SECRET_FILE = "secret.txt"
>  if os.path.exists(SECRET_FILE):
>  SECRET_KEY = file(SECRET_FILE).read()
>  else:
>  from random import choice
>  SECRET_KEY = ''.join([
>  choice(
>  'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
>  ) for i in range(50)])
>  f = file(SECRET_FILE, 'w')
>  f.write(SECRET_KEY)
>  f.close()
>  
> (key generation ripped directly from  
> core/management/commands/startproject.py )
>  
> As best I can tell, this should allow me to place secret.txt on  
> machines I control, while allowing others to freely download the  
> code and deploy on their end with minimal trouble.
>  
> Any input would be greatly appreciated,
>  
> -tkc
>  
>  
>  
> --  
> 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 
> (mailto:django-users@googlegroups.com).
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com 
> (mailto:django-users+unsubscr...@googlegroups.com).
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 excerpt of 
my settings.py on which I'm hoping for feedback:


  SECRET_FILE = "secret.txt"
  if os.path.exists(SECRET_FILE):
SECRET_KEY = file(SECRET_FILE).read()
  else:
from random import choice
SECRET_KEY = ''.join([
  choice(
  'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
  ) for i in range(50)])
f = file(SECRET_FILE, 'w')
f.write(SECRET_KEY)
f.close()

(key generation ripped directly from 
core/management/commands/startproject.py )


As best I can tell, this should allow me to place secret.txt on 
machines I control, while allowing others to freely download the 
code and deploy on their end with minimal trouble.


Any input would be greatly appreciated,

-tkc



--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 BrongerJabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.com

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 
https://groups.google.com/d/msg/django-users/-/umBKRzHS1lYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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! :)
>
> 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 django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 traceback when updating our SVN Django
recently.

I added a function

def unlazy_object(lazy_object):
if lazy_object._wrapped is None:
lazy_object._setup()
return lazy_object._wrapped

user = unlazy_object(request.user)

This works.  But is this the way to go?  Is it possible to make
SimpleLazyObject pickable in the first place?

Tschö,
Torsten.

-- 
Torsten BrongerJabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.com

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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.

-- 
Torsten BrongerJabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.com

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 = Company.objects.select_related().get(pk=pk)
form = CompanyForm(request.POST, instance=a)
if form.is_valid():
form.save()
else:
a = Company.objects.select_related().get(pk=pk)
form = CompanyForm(instance=a)
variables = RequestContext(request, {
'form': form,
'company': a
})
return render_to_response('contacts/update_company.html',
variables)

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 right, there are a lot of template
> > languages already, but this particular wheel is - unlike twig - not a
> > compiled language but implemented in pure PHP as an Iterator, allowing
> > it to blend in as an extension to your existing PHP templates.
>
> I think you misunderstood me - I meant that continually reinventing the
> wheel is a good thing, and leads to better and better wheels of all
> sizes and shapes.
> --
> regards
> Kenneth Gonsalves

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 company object is not iterable. Neither can I
> just do company.first_name to get a person's name.

the template syntax should be something like this:

 {% for p in company.person_set.all %}
{{ p.first_name }}
 {% endfor %}

note that in the 'GET' case, you're not initializing the 'a' variable.
 besides fixing that, you don't need any change in the view.  the
select_related() call i mentioned can reduce the numbe of SQL queries,
but in this case it's just a single extra query, so first make it
work, then worry about optimizations.

-- 
Javier

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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()
else:
company = get_object_or_404(Company, pk=pk)
form = CompanyForm(instance=company)

variables = RequestContext(request, {
'form': form,
'company': a
})
return render_to_response('contacts/update_company.html',
variables)

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 company object is not iterable. Neither can I
just do company.first_name to get a person's name.

Thanks again for any assistance you can offer me.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 company). I don't intend to use
> this information in my form but intend to use it in the template.

just change from:

   a = Company.objects.get(pk=pk)

to:

   a = Company.objects.select_related().get(pk=pk)







-- 
Javier

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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:
company = get_object_or_404(Company, pk=pk)
form = CompanyForm(instance=company)

variables = RequestContext(request, {
'form': form,
'company': a
})
return render_to_response('contacts/update_company.html',
variables)


I would like to fetch the related Person objects that are related to
Company (ie. those who work for said company). I don't intend to use
this information in my form but intend to use it in the template.

Is this possible?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 with an appropriately designed UI,
or it can save on sending or receiving superfluous data; but the net
difference is usually just a few percent.

don't want to sound harsh; but if you want to design a good web UI,
first you have to know HTTP/HTML, and forms are one of the basic
concepts.  please do some reading on that before jumping to
conclusions based on some heardby notions.

oh, and that's not a Django issue, it's a basic web issue.

-- 
Javier

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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... (non-sql). IMHO I should be able to do it via the
>>> orm. If you can do it via the orm - how do I do it ?
>>>
>>
>> Bar.objects.values('foo').annotate(Count('foo'))
>>
>> As written in Django documentation...
>
> Hmm I actually tried this and I wasn't able to get the correct results
> iirc. I'll try it again :)
>

Hmm, I must have put it in wrong before as it works perfectly now ^ ^.
Thank you :)

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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
> contains something in the lines of "sha1$x$xxx..."
>
> Regards,
> Jacco
>
>  P.s. if you are on the "change user" page you can use the "change password
> form" below the password field to modify the current password
>
>
>
>
>
>
>
> On Fri, Sep 16, 2011 at 2:20 PM, 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\)"
> >  wrote:
> > > 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
> > > Tel.: 00431 534521573
> > > Fax: +43 (1) 534 52 - 146
>
> > > -Ursprüngliche Nachricht-
>
> > > Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
> > Im Auftrag von marios
> > > Gesendet: Freitag, 16. September 2011 13:14
> > > An: Django users
> > > Betreff: New user login problem
>
> > > 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 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
> > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group athttp://
> > groups.google.com/group/django-users?hl=en.
>
> > --
> > 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
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 the
> widget param every time?

If the class should be the same for every fields,
What do you think about handler this class into template?
The form or every fields could be inside a div.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
contains something in the lines of "sha1$x$xxx..."

Regards,
Jacco

 P.s. if you are on the "change user" page you can use the "change password
form" below the password field to modify the current password

On Fri, Sep 16, 2011 at 2:20 PM, 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\)"
>  wrote:
> > 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
> > Tel.: 00431 534521573
> > Fax: +43 (1) 534 52 - 146
> >
> > -Ursprüngliche Nachricht-
> >
> > Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
> Im Auftrag von marios
> > Gesendet: Freitag, 16. September 2011 13:14
> > An: Django users
> > Betreff: New user login problem
> >
> > 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 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
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group athttp://
> groups.google.com/group/django-users?hl=en.
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
> 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 this page :
> https://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms...helpsyou
>  ?
> >
> > n [1]: from django import forms
> >
> > In [2]: class CommentForm(forms.Form):
> >...: name = forms.CharField(
> >...:
> widget=forms.TextInput(attrs={'class':'special'}))
> >...:
> >
> > In [3]: MyForm = CommentForm()
> >
> > In [4]: MyForm.as_p()
> > Out[4]: u'Name:  type="text" class="special" name="name" />'
> >
> > Dave
> >
> > On Fri, 16 Sep 2011 02:41:24 -0700 (PDT)
> >
> >
> >
> >
> >
> >
> >
> > "Kevin.X"  wrote:
> > > 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,  > > type="text"> 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 class name when
> > > initial a form. Is that a good way for my purpose? I really do not
> > > want to write html forms for so many Models, and I cannot use selector
> > > like input[type...], cause I need to support IE6.
> > > Thanks
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 things the 'right' way is actually the 'wrong' way, depending
>> on the data you are dealing with, and your indexes.
>> Put simply - Django does have, nor need, a 'group by' method - and if you
>> believe otherwise, it's because you haven't got used to the "Django
>> methology" yet.
>
>
> doesn't have*

Sure and I would like to believe this too(regarding the ORM) :p (this
hasn't been my experience at the moment).


--
Thank you.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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... (non-sql). IMHO I should be able to do it via the
>> orm. If you can do it via the orm - how do I do it ?
>>
>
> Bar.objects.values('foo').annotate(Count('foo'))
>
> As written in Django documentation...

Hmm I actually tried this and I wasn't able to get the correct results
iirc. I'll try it again :)

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 are instances where you either
> need to use a raw SQL, or split the query up into multiple calls. In some
> cases, doing things the 'right' way is actually the 'wrong' way, depending
> on the data you are dealing with, and your indexes.
>
> Put simply - Django does have, nor need, a 'group by' method - and if you
> believe otherwise, it's because you haven't got used to the "Django
> methology" yet.
>

doesn't have*


>
> Just my two cents worth.
>
> Cal
>
> On Fri, Sep 16, 2011 at 1:39 PM, 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 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... (non-sql). IMHO I should be able to do it via the
>>> orm. If you can do it via the orm - how do I do it ?
>>>
>>>
>> Bar.objects.values('foo').**annotate(Count('foo'))
>>
>> As written in Django documentation...
>>
>> --
>>
>> Jani Tiainen
>>
>>
>> --
>> 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 django-users+unsubscribe@**
>> googlegroups.com .
>> For more options, visit this group at http://groups.google.com/**
>> group/django-users?hl=en
>> .
>>
>>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 things the 'right' way is actually the 'wrong' way, depending
on the data you are dealing with, and your indexes.

Put simply - Django does have, nor need, a 'group by' method - and if you
believe otherwise, it's because you haven't got used to the "Django
methology" yet.

Just my two cents worth.

Cal

On Fri, Sep 16, 2011 at 1:39 PM, 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 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... (non-sql). IMHO I should be able to do it via the
>> orm. If you can do it via the orm - how do I do it ?
>>
>>
> Bar.objects.values('foo').**annotate(Count('foo'))
>
> As written in Django documentation...
>
> --
>
> Jani Tiainen
>
>
> --
> 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 django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 +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\)"
> >  wrote:
> >> 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
> >> Tel.: 00431 534521573
> >> Fax: +43 (1) 534 52 - 146
>
> >> -Ursprüngliche Nachricht-
>
> >> Von: django-users@googlegroups.com  
> >> [mailto:django-users@googlegroups.com] Im Auftrag von marios
> >> Gesendet: Freitag, 16. September 2011 13:14
> >> An: Django users
> >> Betreff: New user login problem
>
> >> 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 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  
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group  
> >> athttp://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 stuck on $databases)
... or a loop... (non-sql). IMHO I should be able to do it via the
orm. If you can do it via the orm - how do I do it ?



Bar.objects.values('foo').annotate(Count('foo'))

As written in Django documentation...

--

Jani Tiainen

--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
> requirement that the data store be a relational database. Therefore,
> adding GROUP BY -- a very RDBMS specific construction -- to Django's
> ORM makes no sense.
>
> If you want to write SQL, write SQL. Django's object model provides
> the raw() call for exactly this reason.

Thank you for the insightful answer :)
Hmm so, I don't think that 'group by' needs to be RBDMS specific - why
do you ? (there are other ways to implement it for non-RBDMS db's
(even if it isn't purely done in the database) ).

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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... (non-sql). IMHO I should be able to do it via the
orm. If you can do it via the orm - how do I do it ?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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\)"
 wrote:

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
Tel.: 00431 534521573
Fax: +43 (1) 534 52 - 146

-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com  
[mailto:django-users@googlegroups.com] Im Auftrag von marios

Gesendet: Freitag, 16. September 2011 13:14
An: Django users
Betreff: New user login problem

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 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  
django-users+unsubscr...@googlegroups.com.
For more options, visit this group  
athttp://groups.google.com/group/django-users?hl=en.


--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 to create another user and log in as such.
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
> Ing. Patrick Szabo
>  XSLT Developer
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.sz...@lexisnexis.at
> Tel.: 00431 534521573
> Fax: +43 (1) 534 52 - 146
>
> -Ursprüngliche Nachricht-
>
> Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
> Auftrag von marios
> Gesendet: Freitag, 16. September 2011 13:14
> An: Django users
> Betreff: New user login problem
>
> 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 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 there a "solid" reason for not supporting
> "group by" in the ORM ... (yet) ?

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
requirement that the data store be a relational database. Therefore,
adding GROUP BY -- a very RDBMS specific construction -- to Django's
ORM makes no sense.

If you want to write SQL, write SQL. Django's object model provides
the raw() call for exactly this reason.

Yours,
Russ Magee %-)

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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) ?


--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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) ?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 multiple  
tables what is worse than over one. If you provide more details perhaps  
somebody can give you an optimization advice.


Martin


On Fri, 16 Sep 2011 08:03:07 +0200, deepak gupta   
wrote:



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 I want to create table : tblUser201109 (user table for yr
2011, september) with same schema in oct (tblUser201110). there will
be time stamp field in the schema, and on the basis of timestamp(time
entered) the table should create automatically, means if time stamp is
of nov 2011 and table not exist then it should created tblUser20
first then it should enter the row in that table .

If there is no facility, please tell me where to modify the code in
Django?

Thanks,
DJ


--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 this page 
> :https://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms...helps
>  you ?
>
> n [1]: from django import forms
>
> In [2]: class CommentForm(forms.Form):
>    ...:         name = forms.CharField(
>    ...:                 widget=forms.TextInput(attrs={'class':'special'}))
>    ...:
>
> In [3]: MyForm = CommentForm()
>
> In [4]: MyForm.as_p()
> Out[4]: u'Name:  type="text" class="special" name="name" />'
>
> Dave
>
> On Fri, 16 Sep 2011 02:41:24 -0700 (PDT)
>
>
>
>
>
>
>
> "Kevin.X"  wrote:
> > 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,  > type="text"> 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 class name when
> > initial a form. Is that a good way for my purpose? I really do not
> > want to write html forms for so many Models, and I cannot use selector
> > like input[type...], cause I need to support IE6.
> > Thanks

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von marios
Gesendet: Freitag, 16. September 2011 13:14
An: Django users
Betreff: New user login problem

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 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 deciso di realizzare la mia prima applicazione
partendo dal programma-esempio della Libreria presentato da Beri.
L'idea era realizzare un programmino che salvasse i tempi nelle varie
gare che fanno i miei ragazzini nelle agrette di nuoto. Quindi la
"libreria" diventa "archivio-gare", i "generi" diventano "specialità",
gli "autori" atleti e i libri diventano "risultati-gara". Il
Utilizzando il field tempo = models.TimeField() nel models.py il
programma funziona, ma con l'inconveniente che non posso salvare i
decimi-cenesimi di secondo (indispensabili nelle garette di nuoto dei
miei campioni).

Studiando il problema ho pensato a 2 soluzioni (didatticamente
entrambe molto interessanti):
. la prima e' quella di creare tre campi (minuti,secondi,decimi-
cenesimi) da associare ad ogni risultato (soluzione poco elegante)
. conversando su django-it su irc mi e' stato consigliato di usare un
campo stringa e con una espressione regolare gestire il formato
secondo la regola MM'SS''DC

La prima soluzione credo si risolva raggruppando i fieldsets in
tuple.

La seconda invece si risolve utilizzando magari una cosa del tipo:
tempo = forms.RegexField(regex=r'Espressione-Regolare').

Voi invece quale soluzione adottereste?
vi ringrazio anticipatamente
p.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 I want to create table : tblUser201109 (user table for yr
2011, september) with same schema in oct (tblUser201110). there will
be time stamp field in the schema, and on the basis of timestamp(time
entered) the table should create automatically, means if time stamp is
of nov 2011 and table not exist then it should created tblUser20
first then it should enter the row in that table .

If there is no facility, please tell me where to modify the code in
Django?

Thanks,
DJ

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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(
   ...: widget=forms.TextInput(attrs={'class':'special'}))
   ...: 

In [3]: MyForm = CommentForm()

In [4]: MyForm.as_p()
Out[4]: u'Name: '

Dave

On Fri, 16 Sep 2011 02:41:24 -0700 (PDT)
"Kevin.X"  wrote:

> 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,  type="text"> 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 class name when
> initial a form. Is that a good way for my purpose? I really do not
> want to write html forms for so many Models, and I cannot use selector
> like input[type...], cause I need to support IE6.
> Thanks
> 

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
http://www.freesound.org
http://www.smartelectronix.com
http://www.musicdsp.org

office: +32 (0) 9 335 59 25
mobile: +32 (0) 484 154 730

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
> write a Django app. The sql structure of both the tables is:

Composite fields aren't supported yet. However, it is a GSoC project:

http://people.ksp.sk/~johnny64/GSoC-full-proposal

Read the django-developers@ archives for more details and status.

Cheers

Tom

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 class name when
initial a form. Is that a good way for my purpose? I really do not
want to write html forms for so many Models, and I cannot use selector
like input[type...], cause I need to support IE6.
Thanks

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 TypeMedical(models.Model):
>...
>
> class Symptome(TypeMedical):
> ...
> parent =
> models.ManyToManyField(TypeMedical,related_name='Parent',blank=True)
> ...
>
> Then, I use a ModelForm in order to save data.
>
> class SymptomeForm(ModelForm):
> class Meta:
> model = Symptome
>
> When I create a form, sometimes I want to select a field in "parent".
> How can I do that? I tried many things but nothing works. Ex:
> sform = SymptomeForm(initial={'parent':["Acupuncture",]})
>
> I hope someone can help! Thanks,
>
> Thomas.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 resource like a image?
>
> Thomas
>
> On Thu, Sep 15, 2011 at 4:52 PM, Ilian Iliev  wrote:
> > How about to set correct headers and make the images cached on user side
> > instead
> > of wasting memchached resources?
> > If you are serving tons of thumbs multiple times I bet that the traffic
> will
> > be bigger problem
> > than the time it took for these images to be read from disk.
> >
> > Check this post ->
> > http://ilian.i-n-i.org/caching-web-sites-and-web-applications/ there you
> > can see which headers you need to set to tell the client browser to cache
> a
> > resource.
> >
> >
> > On Thu, Sep 15, 2011 at 4:51 PM, Thomas Weholt 
> > wrote:
> >>
> >> Good point Cliff! I just assumed serving static content would benefit
> >> from caching, but perhaps my effort is more well spent focusing on
> >> other aspects of my app right now.
> >>
> >> Thanks :-)
> >>
> >> Thomas
> >>
> >>
> >> On Thu, Sep 15, 2011 at 3:42 PM, J. Cliff Dyer 
> >> wrote:
> >> > What is your goal in doing this?  You are unlikely to see any
> >> > performance gains from this effort.
> >> >
> >> > It won't render any faster for your users.  Sending bytes over the
> >> > network is far slower than reading them off disk, so it's not likely
> to
> >> > be a bottleneck in terms of page loading.
> >> >
> >> > Your filesystem is likely caching commonly read items for you already.
> >> > Trying to outsmart this system is likely to just waste memory and slow
> >> > things down by caching the wrong things.
> >> >
> >> > Have you determined that this is actually a bottleneck in your app?
>  It
> >> > seems unlikely that serving static thumbnails is actually the thing
> >> > slowing your app down.
> >> >
> >> > Cheers,
> >> > Cliff
> >> >
> >> >
> >> > On Thu, 2011-09-15 at 15:24 +0200, Thomas Weholt wrote:
> >> >> Ok, this might sound a bit off-topic but bear with me.
> >> >>
> >> >> I got a templatetag in an app that generates thumbnails (
> >> >> django-photofile ). In my templates it might look like this
> >> >>
> >> >> 
> >> >>
> >> >> It will generate a thumbnail of the photo in 100x100 in a folder
> >> >> served by nginx for all static content and return an url pointing to
> >> >> the thumbnail, for instance
> >> >> '/static/thumb/4432lkj432kl5k4l26k_100x100.jpg'.
> >> >>
> >> >> This all works nice and dandy, but I want to cache the static photos
> >> >> using memcache, so that when the page is rendered and the templatetag
> >> >> returns the url '/static/thumb/4432lkj432kl5k4l26k_100x100.jpg'
> >> >> nginx will look for it on disk, cache it using memcache and return it
> >> >> so that the next time the page is rendrered it will be read from the
> >> >> cache and not from disk.
> >> >>
> >> >> I got a folder served by nginx with all my static content (js, css,
> >> >> images ), including the thumbnails and I want to cache it all ( using
> >> >> the assigned amount of ram to memcache of course, but I hope this is
> >> >> handled by memcache ).
> >> >>
> >> >> I've read through a few articles about nginx, memcache etc, but still
> >> >> haven't a clue on how to do this.
> >> >>
> >> >> NB! The reason I think/hope this is on topic is the fact I use a
> >> >> templatetag to generate the url etc. Sorry if it's still of topic.
> >> >>
> >> >> --
> >> >> Mvh/Best regards,
> >> >> Thomas Weholt
> >> >> http://www.weholt.org
> >> >>
> >> >
> >> >
> >> > --
> >> > 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
> >> > django-users+unsubscr...@googlegroups.com.
> >> > For more options, visit this group at
> >> > http://groups.google.com/group/django-users?hl=en.
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Mvh/Best regards,
> >> Thomas Weholt
> >> http://www.weholt.org
> >>
> >> --
> >> 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
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/django-users?hl=en.
> >>
> >
> >
> >
> > --
> > eng. Ilian Iliev
> > Web Software Developer
> >
> > Mobile: +359 88 66 08 400
> > Website: http://ilian.i-n-i.org
> >
> > --
> > 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 

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 "manage.py sqlindexes" command to see what
the sql commands are to create the indexes.  You'll need to run the
create index sql for that field manually using psql (assuming
postgres) or some other database client to add the indexes outside of
django.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 planned,
which would be based on Imagekit. I have no idea whether that happened
or not.

As far as I can see the original developer seems to be inactive on
both projects.

On Sep 16, 2:02 am, bedros <2bed...@gmail.com> wrote:
> any idea who's maintaining photologue and if still has a support
> community? and which fork repo supports the latest django release,
> there are bunch of forks on  googlecode, github, bitbucket?
>
> Thanks,
>
> Bedros

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.