Trying to use order_by on a list object

2007-09-18 Thread Greg

Hello,
I have the following code 's2 = s.sandp.all()'  When I do a 'assert
False, s2' I get the following:

[, )>, , )>, , )>, , )>]

I want to be able to sort the list by the Price.

///

I tried the following code

s2 = s.sandp.order_by('price')
assert False, s2

And this is what I get:

[, )>, , )>, , )>, , )>]

Notice the last element has a price of 59.99.  Is there anyway that I
can sort the list so that it's ordered by price?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



python autolink that doesnt mangle html

2007-09-18 Thread John

Hello guys
I m looking for a library or a scrip that autolinks html + non html
content such as

i love...
Spin the bottle
Redneck hoe
 http://den.com;>A
http://www.google.com loves ICP songs

and the result should be

i love...
Spin the bottle
Redneck hoe
 http://den.com;>A
http://www.google.com;>http://www.google.com loves ICP
songs


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Change display value of null in form

2007-09-18 Thread Catriona

Hello

I have nullable foreign keys in my model and would like to change the
display value of some of them to things like 'unknown' or 'NA' in my
forms. How do I do this. I am not using the admin screens at the
moment.

Thanks

Catriona


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Change display value of null in form

2007-09-18 Thread Catriona

Hello

I have nullable foreign keys in my model and would like to change the
display value of some of them to things like 'unknown' or 'NA' in my
forms. How do I do this. I am not using the admin screens at the
moment.

Thanks

Catriona


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Form field value

2007-09-18 Thread Oleg Korsak
this will work only for case if some_field is blank=True,null=True. in
any other case it will fail at f.save(commit=False) because of invalid
form data (some_field is empty and still required)

Nathaniel Whiteinge пишет:
> Your best bet is probably to use ``save(commit=False)`` [1]_ to get a
> Profile instance, then set the user fk and call ``save()`` again. This
> is the example from the newforms docs::
> 
> # Create a form instance with POST data.
> >>> f = AuthorForm(request.POST)
> 
> # Create, but don't save the new author instance.
> >>> new_author = f.save(commit=False)
> 
> # Modify the author in some way.
> >>> new_author.some_field = 'some_value'
> 
> # Save the new instance.
> >>> new_author.save()
> 
> .. [1] http://www.djangoproject.com/documentation/newforms/#the-save-method
> 
> Cheers.
> - whiteinge
> 
> 
> --~--~-~--~~~---~--~~
> 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 [EMAIL PROTECTED]
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en
> -~--~~~~--~~--~--~---
> 
> 



signature.asc
Description: OpenPGP digital signature


regroup on a foregin key of a foreign key

2007-09-18 Thread makebelieve

A simplified version of model is this:

class Category(models.Model):
category = models.CharField(maxlength=100)

class Program(models.Model):
name = models.CharField(maxlength=100)
category = models.ForeignKey(Category)

class Message(models.Model):
program = models.ForeignKey(Program)
msgstr = models.TextField(null=True)

My question is if I have a list of Message objects how can I regroup
them based on their programs category?

Is there a way to look through the relationships and do this?

Obviously,
{% regroup messages by messages.program.category as grouped %}

doesn't work.  Any thoughts?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: reassessing our Operating System

2007-09-18 Thread Kenneth Gonsalves


On 19-Sep-07, at 12:38 AM, Chris Brand wrote:

>> and one to run django on. (I believe I had to run 2.3 and 2.5) It can
>> make configuration for deployment to be a bit of a pain.
> I've had no such problems with my Fedora Core 6 box. Just installed
> everything using yum and it worked fine. I think it uses python 2.4.4
> throughout.

but if you want to use 2.5 for django, you *must* retain 2.4.4 also

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: reassessing our Operating System

2007-09-18 Thread Chris Lee-Messer

We use RHEL4 in our datacenter.  I've used ubuntu, debian and CentOS 5
on development servers. Choice of Redhat was based on what other boxes
were running on before I arrived.  I do indeed need to install
separate packages for python and postgresql.

So far it's been near zero maintenance after setting things up. I
don't update automatically but do it manually when I receive alerts
but I could probably update via the update demon.

Out of curiousity: Is anyone using vmware or zen to containerize (is
that a word?) their django deployments?

On Sep 18, 12:08 pm, Chris Brand <[EMAIL PROTECTED]> wrote:
> Justin Lilly wrote:
> > Actually there is a reason why debian based OS's are preferred (in my
> > opinion). Having installed Django on CentOS, I found that you have to
> > run two concurrent versions of python. One for the OS and its tools
> > and one to run django on. (I believe I had to run 2.3 and 2.5) It can
> > make configuration for deployment to be a bit of a pain.
>
> I've had no such problems with my Fedora Core 6 box. Just installed
> everything using yum and it worked fine. I think it uses python 2.4.4
> throughout.
>
> Chris


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 'str' has no attribute 'strftime'

2007-09-18 Thread Russell Keith-Magee

On 9/19/07, jacoberg2 <[EMAIL PROTECTED]> wrote:
>
> Hey, I am trying to read a string from a file and then save it to the
> database. In doing so I get the error message 'str' has no attribute
> 'strftime'. the string is a a dat that i am trying to save to the
> datetimefield in my database. The parser i used returned a string but
> hen it tries to save this string tothe appropiate place it send that
> error back. any suggestions? Thanks for your time.

What version of Django are you using? This bug (or something very much
like it) was fixed over the weekend sprint, so it shouldn't be a
problem any more in the SVN trunk version. If it is, we may need to
reopen a ticket.

As a side note - part of the problem is that datetime fields are
supposed to accept DateTime objects, not strings. As a result of the
change on the weekend, strings that are correctly formatted (by which
I mean 'ready for DB-API insertion', in the format '%Y-%m-%d
%H:%M:%S') are also accepted, but any other format will still cause
difficulties.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem using newforms cleaned_data with Oracle and DateField

2007-09-18 Thread Catriona

Hi Ian

In my model, I have specified db_table = "Survey" so I don't think
that is the problem

I'll have another play with it and see if I can get further.

Thanks

Catriona

On Sep 19, 9:50 am, Ian <[EMAIL PROTECTED]> wrote:
> I'm unable to reproduce the error you're getting.  The default table
> name would be app_survey rather than just survey, where app is the
> name of the application, so you might check that the table you listed
> is the same table that Django is using.
>
> Hope that helps,
> Ian
>
> On Sep 18, 5:03 pm, Catriona <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi Ian
>
> > Sorry I should have given you this info.
>
> > I am using Python 2.5.1 and Django 6051.
>
> > I get the following when I run a describe on the table - sorry it is a
> > bit messy
>
> > Object Type   TABLE Object   SURVEY
>
> > Table Column Data Type Length Precision Scale Primary Key Nullable
> > Default Comment
> > SURVEY ID Number -  11 0 1 -  -  -
> >   COMPANY_ID Number -  11 0 -  -  -  -
> >   OPERATOR_ID Number -  11 0 -   -  -
> >   CONTRACTOR_ID Number -  11 0 -   -  -
> >   VESSEL_ID Number -  11 0 -   -  -
> >   SURVEY_NAME Nvarchar2 100 -  -  -   -  -
> >   LOCATION Nvarchar2 60 -  -  -   -  -
> >   START_DATE Date 7 -  -  -  -  -  -
> >   END_DATE Date 7 -  -  -   -  -
> >   1 - 9- Hide quoted text -
>
> - Show quoted text -


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is there a TRIM feature for templates in Django 0.91

2007-09-18 Thread Tim Chase

>> I looked over the docs
>> http://www.djangoproject.com/documentation/0_91/templates/
>>
>> but the closest thing was SPACELESS
> 
> - What does a TRIM filter do? Perhaps it change the colour of the trim
> on your website?

I suspect what some languages call Trim is the Python
function/method "strip()".  Since this is a method of all string
objects, and Django calls callables, just using {{
story.tease.strip }} may do what the OP wanted.

> - Why doesn't SPACELESS 'work'? It works fine for me, and there are an
> extensive set of tests that demonstrate all the ways it works. What
> should it be doing that it isn't doing?

I suspect that the OP misunderstood "spaceless" to mean strip()
which of course doesn't work as strip() :)

> Secondly - Django 0.91 is extremely old; I _really_ wouldn't recommend
> building new sites on this version if you can possibly avoid doing so.

Seconded.  .95 or .96 at a minimum :)

-tim



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is possible to only select the specified fields?

2007-09-18 Thread Russell Keith-Magee

On 9/19/07, James <[EMAIL PROTECTED]> wrote:
>
> You matter-of-factly suggest that a ValuesQuerySet is as good as
> QuerySet.  However, the ValuesQuerySet has some fundamental
> limitations.  In particular, the ValuesQuerySet does not have
> attributes corresponding to the fields in the QuerySet.  This makes a
> ValuesQuerySet completely useless in a template -- quite unlike a
> regular QuerySet.

It was said matter-of-factly because it's true. How is ValuesQuerySet
useless in a template? It returns a list of dictionaries; the template
syntax can iterate over lists, and dictionary keys are one of the
lookup schemes. As long as you're not referencing an attribute that
isn't contained in the ValueQuerySet, moving from a QuerySet to a
ValuesQuerySet shouldn't even require a change in template.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Shared hosting question

2007-09-18 Thread eedok

I have a shared hosting account at my current host with shell access,
and I have my own python installation at ~/python which works fine for
plain cgi programs. I'm pretty sure my host doesn't have mod_python
but they're using litespeed web server so I thought fcgi would work. I
copy+pasted the fcgi & .htaccess on the section for shared hosts on
the django site, made the changes that would change my script and ran
the fcgi file through the shell(./mysite.fcgi) and it outputted the
web page with some warnings on how server name, port, etc were not
set, but trying to access it through a web browser I got a 404.


Is there a way to test whether or not django sites will work on this
host or should I look on to moving to a VPS?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: null ForeignKey and INNER JOIN

2007-09-18 Thread Russell Keith-Magee

On 9/19/07, olivier <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> Is there a way to switch django's relationship building from INNER
> JOIN to LEFT OUTER JOIN ?
> It causes unexpected behaviour when filtering on both parent and child
> tables.

Not really. There is a limited ability to control the join behaviour
with Q objects, but this isn't documented, and isn't particularly
robust.

Adding the ability to control joins is one of the principal reasons
behind the queryset refactor, which now has a branch for development.
The branch isn't really ready for prime-time yet, but it may give you
an idea of where we are heading.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is there a TRIM feature for templates in Django 0.91

2007-09-18 Thread Russell Keith-Magee

On 9/19/07, Frank Peterson <[EMAIL PROTECTED]> wrote:
>
> I looked over the docs
> http://www.djangoproject.com/documentation/0_91/templates/
>
> but the closest thing was SPACELESS
>
> I tried to use it like this:
> {% block data %}{% spaceless %}{{ story.tease }}{% endspaceless %}{%
> endblock %}
>
> But it didnt work.

First off - you're going to need to help us out a bit:

- What does a TRIM filter do? Perhaps it change the colour of the trim
on your website?

- Why doesn't SPACELESS 'work'? It works fine for me, and there are an
extensive set of tests that demonstrate all the ways it works. What
should it be doing that it isn't doing?

Secondly - Django 0.91 is extremely old; I _really_ wouldn't recommend
building new sites on this version if you can possibly avoid doing so.
If there _was_ a problem with SPACELESS in v0.91, it has almost
certainly been fixed in the two years since 0.91 was released; if it
hasn't been fixed, we won't be making a point release of 0.91 to
include the change.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem using newforms cleaned_data with Oracle and DateField

2007-09-18 Thread Ian

I'm unable to reproduce the error you're getting.  The default table
name would be app_survey rather than just survey, where app is the
name of the application, so you might check that the table you listed
is the same table that Django is using.

Hope that helps,
Ian

On Sep 18, 5:03 pm, Catriona <[EMAIL PROTECTED]> wrote:
> Hi Ian
>
> Sorry I should have given you this info.
>
> I am using Python 2.5.1 and Django 6051.
>
> I get the following when I run a describe on the table - sorry it is a
> bit messy
>
> Object Type   TABLE Object   SURVEY
>
> Table Column Data Type Length Precision Scale Primary Key Nullable
> Default Comment
> SURVEY ID Number -  11 0 1 -  -  -
>   COMPANY_ID Number -  11 0 -  -  -  -
>   OPERATOR_ID Number -  11 0 -   -  -
>   CONTRACTOR_ID Number -  11 0 -   -  -
>   VESSEL_ID Number -  11 0 -   -  -
>   SURVEY_NAME Nvarchar2 100 -  -  -   -  -
>   LOCATION Nvarchar2 60 -  -  -   -  -
>   START_DATE Date 7 -  -  -  -  -  -
>   END_DATE Date 7 -  -  -   -  -
>   1 - 9


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem using newforms cleaned_data with Oracle and DateField

2007-09-18 Thread Catriona

Hi Ian

Sorry I should have given you this info.

I am using Python 2.5.1 and Django 6051.

I get the following when I run a describe on the table - sorry it is a
bit messy


Object Type   TABLE Object   SURVEY

Table Column Data Type Length Precision Scale Primary Key Nullable
Default Comment
SURVEY ID Number -  11 0 1 -  -  -
  COMPANY_ID Number -  11 0 -  -  -  -
  OPERATOR_ID Number -  11 0 -   -  -
  CONTRACTOR_ID Number -  11 0 -   -  -
  VESSEL_ID Number -  11 0 -   -  -
  SURVEY_NAME Nvarchar2 100 -  -  -   -  -
  LOCATION Nvarchar2 60 -  -  -   -  -
  START_DATE Date 7 -  -  -  -  -  -
  END_DATE Date 7 -  -  -   -  -
  1 - 9


Thanks

Catriona




On Sep 19, 3:39 am, Ian <[EMAIL PROTECTED]> wrote:
> Catriona,
>
> What versions of Python and Django are you using?
> What output do you get from running a describe on the Survey model's
> table?
>
> Ian
>
> On Sep 17, 5:07 pm, Catriona <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello
>
> > I'm a newbie to Django and Python so sorry if this is a dumb mistake
> > on my behalf.
>
> > I have a model (using anOracleXE backend):
>
> > class Survey(models.Model):
>
> > company = models.ForeignKey(Company, null = False, blank = False)
> > survey_name = models.CharField(max_length = 50, null = False, blank 
> > =
> > False)
> > location = models.CharField(max_length = 30, null = False, blank =
> > False)
> > start_date = models.DateField(null = False, blank = False)
> > end_date = models.DateField(null = True, blank = True)
>
> > and have a view
>
> > def addEditSurvey(request, id=None):
>
> > if id is None:
> > SurveyForm = forms.models.form_for_model(Survey)
> > else:
> > survey = Survey.objects.get(id=id)
> > SurveyForm = forms.models.form_for_instance(survey)
>
> > if request.POST:
> > f = SurveyForm(request.POST)
> > if f.is_valid():
> > newItem = Survey(company_id=1,
> > survey_name=f.cleaned_data['survey_name'],
> > location=f.cleaned_data['location'],start_date=f.cleaned_data['start_date']-,
> > end_date=f.cleaned_data['end_date'])
> > newItem.save()
> > else:
> > f = SurveyForm()
>
> > return render_to_response('add_survey.html', {'form':f})
>
> > The problem is that I am getting "ORA-01722: invalid number" when
> > trying to save the form.
>
> > Any help would be greatfully appreciated.
>
> > Catriona- Hide quoted text -
>
> - Show quoted text -


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Acredite!!!

2007-09-18 Thread fly

QUER GANHAR MUITO DINHEIRO?


GENTE FUNCIONA DE VERDADE.. EU FIZ UMA VEZ.. JÁ TÔ
FAZENDO DENOVO



VAMOS NOS AJUDAR...FUNCIONA!!!

Olá... pessoal, a seguir está todo o relato de um programa que está
mudando a vida de muita gente através da internet... o programa é
honesto, constitucionalmente legal e que se seguido corretamente,
irá te fazer mudar de vida rapidamente. A seguir segue o texto de
como o programa funciona, esse texto não foi escrito por mim, mas
veja com calma e depois julgue se vale a pena ou não investir apenas
6 reais, dinheiro que vc gasta em qualquer esquina por ai,
arriscando ganhar milhares de reais...



GENTE, EU SEI QUE É DIFÍCIL ACREDITAR PQ ATÉ EU COMEÇAR A GANHAR
TAMBÉM NÃO ACREDITAVA, JÁ TINHA RECEBIDO ALGUNS EMAILS SOBRE ESSE
ASSUNTO, MAS TINHA OS IGNORADO, ATÉ QUE LI O TEXTO DISPOSTO EM UM
SITE E RESOLVI TENTAR, AFINAL, COMO O PRÓPRIO AUTOR DO TEXTO FALA,
SÃO SÓ 6,00 REAIS, ALÉM DO MAIS, EU NÃO ESTARIA PERDENDO MEU TEMPO
AKI SE NÃO ESTIVESSE GANHANDO, JÁ GANHEI EM UM MÊS CERCA DE 2 MIL
REAIS, SIGAM DIREITINHO O TEXTO ABAIXO (ELE NÃO É DE MINHA AUTORIA,
MAS ESSE AQUI SIM) E SEJAM HONESTOS, POR FAVOR ASSIM TODOS
PODEREMOS CRESCER COM ESSA COOPERATIVA!!!


segue o texto:



Por favor, siga estas diretrizes EXATAMENTE como descritas e você
poderá ganhar muito dinheiro num espaço de 15 a 30 dias. Este
programa permanece próspero por causa da HONESTIDADE, obediência e
integridade dos participantes.Aqui estão os 3 passos fáceis para
sucesso:



Primeiro Passo - Deposite R$ 1,00 (UM REAL) na conta de cada um dos
seis participantes abaixo;



1º) Gerson Marçal do Monte (Banco Itaú) Agencia: 3175 Conta
Poupança: 10774-1

2º)Artur Marçal Alexandrino de Oliveira (Banco Itaú) Agencia: 3175
Conta Poupança: 10776-6

3º)Sidnei Salvador de Melo (Banco Unibanco)Agencia: 0181 c/c:
106370-8

4º)Selma Tripiciano ( B.Brasil Ag.3559-9 C/C 14665-x)

5º)Cristiane Correia Oliveira (unibanco Ag. 0795 c/c 113597-4)

6º)Priscila de Souza Silva Oliveira (banco Real Ag. 0386 c/c 4999344-3

LEMBRE-SE: Seu "Único Investimento" são apenas "R$ 6,00" (SEIS
REAIS) é um valor muito pequeno para a "GRANDE POSSIBILIDADE"
de "Você GANHAR muito DINHEIRO!!!"



Segundo Passo - Agora tire o nome do 1º participante da lista e
eleve uma posição acima, O 2º vai para o primeiro da lista, o
terceiro vai para o 2º e assim sucessivamente, e coloque seu nome,
seu banco, sua agencia e conta corrente no 6º da lista.



Terceiro Passo - Mude o que você quiser, mas tente manter a sua
mensagem o mais parecido possível com essa. Agora, poste seu artigo
modificado (ou esse meu mesmo, não esquecendo de mudar a ordem dos
nomes e acrescentar o seu) para pelo menos 200 fóruns ou newsgroups
diferentes (A UOL diz em sua homepage que existem mais de 20,000
newsgroups, informe-se lá na parte de fórum se você não souber)(Você
pode usar também os fóruns da Google, Bol, Ubbi, Hotmail, Terra
etc...) ou mande emails para seus amigos, divulgue em uma homepage,
divulgue no orkut, escreva MUITAS CARTASTudo que você necessita
é 200, mas lembre-se, quanto mais você mandar, mais DINHEIRO você
ganhará!!

IMPORTANTE: Você não adquirirá muito a menos que você poste como
louco SIGA tudo corretamente para funcionar!



NÃO PARE DE LER ESTE ARTIGO, NO FINAL VC QUEM DECIDE.

___

Para copiar esta mensagem: Selecione o texto (Ctrl + T) e após
selecionar, copiar o texto (Ctrl + C). Abra o word ou bloco de notas
ou wordpad e colar o texto (Ctrl + V) altere os dados na relação de
depósitos (tirando o 1º da lista e subindo os de baixo e colocando o
seu NOME, BANCO, AGENCIA E CONTA na 6º lugar da lista.) para
finalizar salve este arquivo.

Para colocar o texto deste arquivo no FORUM e NEWGROUPS é só copiar
(Ctrl + C) e colar (Ctrl + V) na mensagem a ser enviada para os
FORUM e NEWGROUPS. (Simples e Fácil né!!!). Lembre-se que este
programa funciona sempre, quando você precisar de

dinheiro, você pode usar ele novamente. A BASE DESTE PROGRAMA:
Compromisso, Responsabilidade, Honestidade, Integridade e Rapidez,
estes são os fundamentos principais para "Nosso Sucesso".

Agora você pode se perguntar de onde é que saí o dinheiro que
receberei!!! Pois bem, entenda o seguinte: Milhares e milhares de
pessoas estão plugadas diariamente na internet e receberão direta e
indiretamente esta mesma proposta. Elas desejarão como você ganhar
esta dinheirama toda.

Atenderão aos requisitos e depositarão os R$6,00. Este sistema de
cooperativismo acumulativo lucra com os novos integrantes que
aceitam participar do esquema. Após ter enviado os R$6,00 você
manteve aqueles que começaram antes de você em lucratividade e passa
a fazer parte do ciclo.

É algo que se baseia na inteligência, bom senso e honestidade.
Nossos integrantes possuem contato na WEB via IP e todas coordenadas
relativas a esse programa de cooperativismo acumulativo são lançadas
num gerenciador fidedigno de credibilidade. Aqueles que não cumprem
com sua parcela de R$6,00 são 

Re: ORM / Performance

2007-09-18 Thread Jeremy Dunck

On 9/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I have an app (0.96 so no select_related) that had a large initial

To be clear, select_related has existed for quite a while in Django --
0.91 at least.

>  I got a lot of mileage by caching just in a dictionary
> the foreign keys so that the ORM wasn't doing lots of redundant
> queries.

Hmm, maybe you'd be interested in this:
http://www.davidcramer.net/code/50/django-cachemanager.html#comments

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django-admin-uploads now has YouTube support and image editing

2007-09-18 Thread Peter Baumgartner

I've been tinkering some more on this project and added on the fly
image editing via snipshot.com as well as preliminary support for
browsing and inserting YouTube videos

http://code.google.com/p/django-admin-uploads/

-- 
Pete

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM / Performance

2007-09-18 Thread [EMAIL PROTECTED]

I have an app (0.96 so no select_related) that had a large initial
data load consisting of a couple core tables and several foreign key
relationships.  I got a lot of mileage by caching just in a dictionary
the foreign keys so that the ORM wasn't doing lots of redundant
queries.  I found the same strategy to work well when serving up the
pages that viewed this data.  In my case it was foods that had lots of
nutrient entries but the basic nutrient info (name, symbol etc) was
the same across each food.  The actual nutrient value per serving is
in a different table and not as easily "cached".

Since this data is unlikely to change, it is also a good candidate for
memcached but I haven't gotten their yet.

Also make sure you have your indexes tuned.  For me it was something I
thought of when working in pgAdmin and not while creating my model
definitions.  You can easily turn a 20 second query into a .2 second
one when you eliminate table scans.

On Sep 18, 3:43 pm, yezooz <[EMAIL PROTECTED]> wrote:
> hi all,
>
> I'm sure many of you run high traffic websites in Django and I'm very
> curious how you're avoiding performance hit caused by built-in ORM.
> Select_related not always working and it's still might generate dozens
> of select's.
> Are you just running custom SQL queries with joins ?
>
> greetings


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM / Performance

2007-09-18 Thread Tim Chase

> Between caching, profiling, and having a good sense of what your

Profiling...the #1 thing to do.

Without profiling the app under "normal usage" (common actions & 
browsing patterns gleaned from the current deployment) scaled to 
high loads, you're just twiddling knobs and wasting time.

If the problem is in the queries, page-caching isn't going to 
help.  If each individual query is fine, but you have too many of 
them, caching database queries may help.  If it's bad python 
code, DB caching and twiddling your queries isn't going to save 
you either.

Until you know _where_ the problem resides, you can't fix it.

And it's also good to profile under load in a testing lab, rather 
than waiting for real-world load to drag your production 
machine(s) to their knees :)

-tim




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM / Performance

2007-09-18 Thread yezooz



On Sep 18, 11:06 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I want to say one word to you. Just one word.
>
> http://en.wikipedia.org/wiki/Denormalization

That's the word I'm familiar with :)
I'm using it, but not as often as I probably should.

So in your opinion Djano's ORM is good enough for large websites if
caching and denormalization are planned well ?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM / Performance

2007-09-18 Thread [EMAIL PROTECTED]

I want to say one word to you. Just one word.

http://en.wikipedia.org/wiki/Denormalization

On Sep 18, 10:57 pm, yezooz <[EMAIL PROTECTED]> wrote:
> On Sep 18, 10:34 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
>
> > Without knowing a hell of a lot more of the details of you site, what
> > you're trying to do, etc - nobody can reasonably answer this question.
> > The ORM is fine, but if it's not as fast as you need for certain
> > queries, you can always drop back to RAW sql to see if that will give
> > you speed. At the level of activity you're citing, you'll have to make
> > some serious choices between how personalized you'd like the site and
> > how much resource you can throw at the problem.
>
> > Between caching, profiling, and having a good sense of what your
> > current hardware can run to, you can scale out Django horizontally to
> > achieve the scale you need.
>
> To be more specific the site is can be compared to social networking
> site so there are some common elements for every user, but mostly it's
> user-specific data. At the moment the traffic is fairly low, but I'm
> expecting it to be close to numbers I've mentioned within few months.
> Do you guys know how ie. Pownce is solving this problem ?
>
>
>
> > -joe
>
> > On 9/18/07, yezooz <[EMAIL PROTECTED]> wrote:
>
> > > On Sep 18, 10:23 pm, yezooz <[EMAIL PROTECTED]> wrote:
> > > > On Sep 18, 10:14 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
>
> > > > > two words: intelligent caching
>
> > > > > Know what you're asking for commonly, and cache it up with memcache.
> > > > > That will do you a world of benefit.
>
> > > > Well of course caching will solve some of the problems, but cache
> > > > still needs to regenerated sometime...
>
> > > I should say that I'm thinking about few millions of pageviews a day
>
> > > > > -joe
>
> > > > > On 9/18/07, yezooz <[EMAIL PROTECTED]> wrote:
>
> > > > > > hi all,
>
> > > > > > I'm sure many of you run high traffic websites in Django and I'm 
> > > > > > very
> > > > > > curious how you're avoiding performance hit caused by built-in ORM.
> > > > > > Select_related not always working and it's still might generate 
> > > > > > dozens
> > > > > > of select's.
> > > > > > Are you just running custom SQL queries with joins ?
>
> > > > > > greetings


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM / Performance

2007-09-18 Thread yezooz



On Sep 18, 10:34 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
> Without knowing a hell of a lot more of the details of you site, what
> you're trying to do, etc - nobody can reasonably answer this question.
> The ORM is fine, but if it's not as fast as you need for certain
> queries, you can always drop back to RAW sql to see if that will give
> you speed. At the level of activity you're citing, you'll have to make
> some serious choices between how personalized you'd like the site and
> how much resource you can throw at the problem.
>
> Between caching, profiling, and having a good sense of what your
> current hardware can run to, you can scale out Django horizontally to
> achieve the scale you need.

To be more specific the site is can be compared to social networking
site so there are some common elements for every user, but mostly it's
user-specific data. At the moment the traffic is fairly low, but I'm
expecting it to be close to numbers I've mentioned within few months.
Do you guys know how ie. Pownce is solving this problem ?

>
> -joe
>
> On 9/18/07, yezooz <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Sep 18, 10:23 pm, yezooz <[EMAIL PROTECTED]> wrote:
> > > On Sep 18, 10:14 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
>
> > > > two words: intelligent caching
>
> > > > Know what you're asking for commonly, and cache it up with memcache.
> > > > That will do you a world of benefit.
>
> > > Well of course caching will solve some of the problems, but cache
> > > still needs to regenerated sometime...
>
> > I should say that I'm thinking about few millions of pageviews a day
>
> > > > -joe
>
> > > > On 9/18/07, yezooz <[EMAIL PROTECTED]> wrote:
>
> > > > > hi all,
>
> > > > > I'm sure many of you run high traffic websites in Django and I'm very
> > > > > curious how you're avoiding performance hit caused by built-in ORM.
> > > > > Select_related not always working and it's still might generate dozens
> > > > > of select's.
> > > > > Are you just running custom SQL queries with joins ?
>
> > > > > greetings


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM / Performance

2007-09-18 Thread Joseph Heck

Without knowing a hell of a lot more of the details of you site, what
you're trying to do, etc - nobody can reasonably answer this question.
The ORM is fine, but if it's not as fast as you need for certain
queries, you can always drop back to RAW sql to see if that will give
you speed. At the level of activity you're citing, you'll have to make
some serious choices between how personalized you'd like the site and
how much resource you can throw at the problem.

Between caching, profiling, and having a good sense of what your
current hardware can run to, you can scale out Django horizontally to
achieve the scale you need.

-joe

On 9/18/07, yezooz <[EMAIL PROTECTED]> wrote:
>
>
>
> On Sep 18, 10:23 pm, yezooz <[EMAIL PROTECTED]> wrote:
> > On Sep 18, 10:14 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
> >
> > > two words: intelligent caching
> >
> > > Know what you're asking for commonly, and cache it up with memcache.
> > > That will do you a world of benefit.
> >
> > Well of course caching will solve some of the problems, but cache
> > still needs to regenerated sometime...
>
> I should say that I'm thinking about few millions of pageviews a day
>
> >
> >
> >
> > > -joe
> >
> > > On 9/18/07, yezooz <[EMAIL PROTECTED]> wrote:
> >
> > > > hi all,
> >
> > > > I'm sure many of you run high traffic websites in Django and I'm very
> > > > curious how you're avoiding performance hit caused by built-in ORM.
> > > > Select_related not always working and it's still might generate dozens
> > > > of select's.
> > > > Are you just running custom SQL queries with joins ?
> >
> > > > greetings
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM / Performance

2007-09-18 Thread yezooz



On Sep 18, 10:23 pm, yezooz <[EMAIL PROTECTED]> wrote:
> On Sep 18, 10:14 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
>
> > two words: intelligent caching
>
> > Know what you're asking for commonly, and cache it up with memcache.
> > That will do you a world of benefit.
>
> Well of course caching will solve some of the problems, but cache
> still needs to regenerated sometime...

I should say that I'm thinking about few millions of pageviews a day

>
>
>
> > -joe
>
> > On 9/18/07, yezooz <[EMAIL PROTECTED]> wrote:
>
> > > hi all,
>
> > > I'm sure many of you run high traffic websites in Django and I'm very
> > > curious how you're avoiding performance hit caused by built-in ORM.
> > > Select_related not always working and it's still might generate dozens
> > > of select's.
> > > Are you just running custom SQL queries with joins ?
>
> > > greetings


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Directed graph implementations for Django

2007-09-18 Thread paul.dorman

Thanks very much for your help Doug. Do you think there is value in
having a generic DAG implementation for Django? Seems to me like it
might be a useful addition, but I'm curious as to how useful it would
be given that most non-Django implementations I have come across are
as you describe 'very domain specific'.

I also wonder how much a DAG implementation should rely on RDMS
functions to minimize the chatter between the application and
database. For instance, it would be terrible to get a node from the
DB, determine it's parent(s), fetch each parent from the DB, determine
*its* parents, etc. etc. Now I could serialize the parents into the
node data, but don't know if that is going to be effective because if
the parent relationships change you're going to have a lot of
processing to update all your nodes.

I know that a DAG is a subset of a digraph, which is what an RDBMS is,
so I'm sure that there's a very elegant way of doing it. But the
problem for me is (a)determining how to do it from the database
perspective, and (b)how to do it in Django.

Cheers,
Paul

On Sep 18, 8:34 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> We use a Tree for the navigation bar (not a true DAG, but there are
> circular 
> checks):https://pycon.coderanger.net/browser/django/trunk/pycon/navbar/models.py
>
> There is a validator IsNotCircular, which does the obvious.
>
> There is code to do serialization (currently just a pickle), but there
> are plans to add json to communicate to the client.
> The (poor) documentation on using the navbar is 
> here:https://pycon.coderanger.net/wiki/PyCon08/NavBar
>
> I have other examples of true DAG's in DB form, but they are very
> domain specific and take advantage of the
> limitations in the data. (like the divided room problem where a
> conference room might have 3 parts which can
> make a total of 6 'rooms', but have special meaning for room
> scheduling). But the NavBar is closest to what
> you are trying to do.
>
> On Sep 17, 4:08 pm, "paul.dorman" <[EMAIL PROTECTED]> wrote:
>
> > Thanks for your response Julio,
>
> > something similar yes. What I'm after is an Django implementation of
> > andirectedacyclic graph. I understand there's some complexity
> > involved to ensure no cycles can be created (which I understand is the
> > graph equivalent of an endless loop). There's plenty of good examples
> > of DAG out there, but I'm not sure how to implement one that works
> > with RDMS (or Django for that matter!)
>
> > Paul
>
> > On Sep 17, 4:56 pm, Julio César Carrascal Urquijo
>
> > <[EMAIL PROTECTED]> wrote:
> > > I'm a newbie on Django my self but maybe this is what you are looking
> > > for:
>
> > > class Category(models.Model):
> > > code = models.CharField(maxlength=200, unique=True)
> > > products = models.ManyToManyField('Product')
>
> > > class Product(models.Model):
> > > parent = models.ForeignKey('Post')
> > > code = models.CharField(maxlength=200, unique=True)
>
> > > I've also read that you can specify signals for most operations on a
> > > model (Like when a model is inserted, updated or deleted from the
> > > database) though I can't find the URL right now. There's some mention
> > > of it here:
>
> > >http://www.djangoproject.com/documentation/db-api/
>
> > > On Sep 16, 9:54 pm, "Paul Dorman" <[EMAIL PROTECTED]> wrote:
>
> > > > Hi all,
>
> > > > definite newbie here. I'd like to implement a category type system in
> > > > Django. I've looked in the cookbook and Googled a bit, but to no avail. 
> > > > What
> > > > I'm after should be pretty simple: adirectedgraph for categories, where
> > > > objects and perhaps categories can be a member of one or more 
> > > > categories.
> > > > For example, a 'server' is an 'infrastructure component' (for the 
> > > > techies),
> > > > as well as an 'asset' (for the financial types). In my grand scheme 
> > > > when an
> > > > object is associated with one or more categories (one is the minimum), 
> > > > the
> > > > application will  execute method calls stored (with optional 
> > > > parameters) in
> > > > the database (serialized as JSON or XML). With the 'server' example, it
> > > > might be that being in the 'infrastructure component' category triggers 
> > > > an
> > > > email to be sent to the system administrator, and the existence in the
> > > > 'asset' category would trigger an automated update to the asset 
> > > > register.
> > > > The methods are stored according to the standard CRUD set of 
> > > > operations, so
> > > > that a user can create a new category in the view, and then specify 
> > > > actions
> > > > which occur when an object is created, read, updated, or deleted 
> > > > (provided
> > > > by the application itself). Actions are triggered for both objects (the
> > > > things that are categorized) and for child categories (so for example 
> > > > it may
> > > > be that a parent category can be locked in such a way as to prevent any 
> > > > more
> > > > child 

Re: ORM / Performance

2007-09-18 Thread yezooz



On Sep 18, 10:14 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
> two words: intelligent caching
>
> Know what you're asking for commonly, and cache it up with memcache.
> That will do you a world of benefit.

Well of course caching will solve some of the problems, but cache
still needs to regenerated sometime...

>
> -joe
>
> On 9/18/07, yezooz <[EMAIL PROTECTED]> wrote:
>
>
>
> > hi all,
>
> > I'm sure many of you run high traffic websites in Django and I'm very
> > curious how you're avoiding performance hit caused by built-in ORM.
> > Select_related not always working and it's still might generate dozens
> > of select's.
> > Are you just running custom SQL queries with joins ?
>
> > greetings


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is possible to only select the specified fields?

2007-09-18 Thread James

You matter-of-factly suggest that a ValuesQuerySet is as good as
QuerySet.  However, the ValuesQuerySet has some fundamental
limitations.  In particular, the ValuesQuerySet does not have
attributes corresponding to the fields in the QuerySet.  This makes a
ValuesQuerySet completely useless in a template -- quite unlike a
regular QuerySet.

-james

On Aug 30, 5:15 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 8/29/07, Diego pylorca <[EMAIL PROTECTED]> wrote:
>
> > ok, but this not return aquerySet, return a  dictionary :S
>
> Read the documentation more carefully. Specifically:
>
> > Returns a ValuesQuerySet - aQuerySetthat evaluates to a list
> > of dictionaries instead of model-instance objects.
>
> And:
>
> > Finally, note a ValuesQuerySet is a subclass ofQuerySet, so it has all
> > methods ofQuerySet. You can call filter() on it, or order_by(), or whatever.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM / Performance

2007-09-18 Thread Joseph Heck

two words: intelligent caching

Know what you're asking for commonly, and cache it up with memcache.
That will do you a world of benefit.

-joe

On 9/18/07, yezooz <[EMAIL PROTECTED]> wrote:
>
> hi all,
>
> I'm sure many of you run high traffic websites in Django and I'm very
> curious how you're avoiding performance hit caused by built-in ORM.
> Select_related not always working and it's still might generate dozens
> of select's.
> Are you just running custom SQL queries with joins ?
>
> greetings
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: null ForeignKey and INNER JOIN

2007-09-18 Thread olivier

Yups, sorry, the query would be build with Q objects :
Q(title__icontains = 'cooking')  | Q(collection__name__icontains =
'cooking')

But the JOIN problem remains.

   Olivier


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



null ForeignKey and INNER JOIN

2007-09-18 Thread olivier

Hi all,

Is there a way to switch django's relationship building from INNER
JOIN to LEFT OUTER JOIN ?
It causes unexpected behaviour when filtering on both parent and child
tables.

For instance, let's say my models are :

class Collection(model):
  name = CharField()

class Book(model):
  title = CharField()
  collection = ForeignKey(Collection, blank = True, null = True)

A Book may or not belong to a Collection, so some instances have a
collection foreign key set to null.

Now, if I want to get all books related to cooking (including
'Marvelous Puddings' in the collection 'Traditional british
cooking')  , I would build a queryset like :

mybooks = Book.objects.filter(title__icontains =
'cooking').filter(collection__name__icontains = 'cooking')

But this won't return books which title contains 'cooking' indeed, but
don't belong to a collection ( the corresponding records won't be
picked by the INNER JOIN, whereas a LEFT OUTER JOIN would have done
the job).

So, is there any way to go around this  ?
The only hack I have in mind is get the sql, replace INNER JOIN by
LEFT OUTER JOIN, but, gee, that's ugly...


Regards,

Olivier


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ORM / Performance

2007-09-18 Thread yezooz

hi all,

I'm sure many of you run high traffic websites in Django and I'm very
curious how you're avoiding performance hit caused by built-in ORM.
Select_related not always working and it's still might generate dozens
of select's.
Are you just running custom SQL queries with joins ?

greetings


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: reassessing our Operating System

2007-09-18 Thread Chris Brand

Justin Lilly wrote:
> Actually there is a reason why debian based OS's are preferred (in my 
> opinion). Having installed Django on CentOS, I found that you have to 
> run two concurrent versions of python. One for the OS and its tools 
> and one to run django on. (I believe I had to run 2.3 and 2.5) It can 
> make configuration for deployment to be a bit of a pain.
I've had no such problems with my Fedora Core 6 box. Just installed 
everything using yum and it worked fine. I think it uses python 2.4.4 
throughout.

Chris


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Is there a TRIM feature for templates in Django 0.91

2007-09-18 Thread Frank Peterson

I looked over the docs
http://www.djangoproject.com/documentation/0_91/templates/

but the closest thing was SPACELESS

I tried to use it like this:
{% block data %}{% spaceless %}{{ story.tease }}{% endspaceless %}{%
endblock %}

But it didnt work.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: python script

2007-09-18 Thread Horst Gutmann

You mean an error telling you that you need to set the
DJANGO_SETTINGS_MODULE environment variable? Or something else?

os.environ['DJANGO_SETTINGS_MODULE']='mysite.settings'

right at the top of your script (after the #! and the import for os ;) )
should solve this.

Then you should probably also add the parent directory of your project
to sys.path :-)

- Horst

Xan wrote:
> Hi,
> 
> If we have the models models.py:
> 
> from django.db import models
> 
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> 
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(max_length=200)
> votes = models.IntegerField()
> 
> [example extracted fro http://www.djangoproject.com/documentation/tutorial01/]
> 
> how can I write a python script for create various polls?
> 
> I tried:
> 
> a.py:
> 
> #!/usr/bin/python
> from mysite.polls.models import Poll
> import datetime
> 
> i = 0
> while i<4:
> a = str(i)
> print a
> Poll.create(question=a, data=datetime.date.today())
> i = i+1
> 
> 
> but when I run python a.py in bash, there are problems with imports.
> What lines of imports we need for running a standalone python script?
> 
> Thanks in advance,
> Xan.
> 
> PS: There is no doc in official site mentioning that. Maybe good to
> add it to site.
> 
> 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem using newforms cleaned_data with Oracle and DateField

2007-09-18 Thread Ian

Catriona,

What versions of Python and Django are you using?
What output do you get from running a describe on the Survey model's
table?

Ian

On Sep 17, 5:07 pm, Catriona <[EMAIL PROTECTED]> wrote:
> Hello
>
> I'm a newbie to Django and Python so sorry if this is a dumb mistake
> on my behalf.
>
> I have a model (using anOracleXE backend):
>
> class Survey(models.Model):
>
> company = models.ForeignKey(Company, null = False, blank = False)
> survey_name = models.CharField(max_length = 50, null = False, blank =
> False)
> location = models.CharField(max_length = 30, null = False, blank =
> False)
> start_date = models.DateField(null = False, blank = False)
> end_date = models.DateField(null = True, blank = True)
>
> and have a view
>
> def addEditSurvey(request, id=None):
>
> if id is None:
> SurveyForm = forms.models.form_for_model(Survey)
> else:
> survey = Survey.objects.get(id=id)
> SurveyForm = forms.models.form_for_instance(survey)
>
> if request.POST:
> f = SurveyForm(request.POST)
> if f.is_valid():
> newItem = Survey(company_id=1,
> survey_name=f.cleaned_data['survey_name'],
> location=f.cleaned_data['location'],start_date=f.cleaned_data['start_date'],
> end_date=f.cleaned_data['end_date'])
> newItem.save()
> else:
> f = SurveyForm()
>
> return render_to_response('add_survey.html', {'form':f})
>
> The problem is that I am getting "ORA-01722: invalid number" when
> trying to save the form.
>
> Any help would be greatfully appreciated.
>
> Catriona


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



python script

2007-09-18 Thread Xan

Hi,

If we have the models models.py:

from django.db import models

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')

class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()

[example extracted fro http://www.djangoproject.com/documentation/tutorial01/]

how can I write a python script for create various polls?

I tried:

a.py:

#!/usr/bin/python
from mysite.polls.models import Poll
import datetime

i = 0
while i<4:
a = str(i)
print a
Poll.create(question=a, data=datetime.date.today())
i = i+1


but when I run python a.py in bash, there are problems with imports.
What lines of imports we need for running a standalone python script?

Thanks in advance,
Xan.

PS: There is no doc in official site mentioning that. Maybe good to
add it to site.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Clubzuzu

2007-09-18 Thread turk970

Come on lets Join us !!  Clubzuzu.
www.clubzuzu.com

Meet your perfect match
Looking for an easy, fun, and safe way to meet friends, dates,
lovers ,partners of your dreams? You have come to the right place!
www.clubzuzu.com.

Here's the best part, it's FREE to join.

As a member, you can search for your ideal partners, check out their
photos and profiles, contact them, post your personal ad, upload your
photo. Whether you're looking for new friends or searching for your
soul mate, it couldn't be any easier!
Lets Join  start from here...

www.clubzuzu.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: uploading to a separate directory

2007-09-18 Thread Ian Lawrence

ola,
am i glad that people like you exist!!...you explained things just
fine and your code works like a charm
regards
Ian

On 9/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> You can not do what you are trying to do, the way you are doing it ;-)
>
> The problem is the 'test_name' does not refer to the data on the
> instance. It just evaluates to the local variable.
> That means you are constructing that upload_to string at import time.
> It is the equivalent of doing:
>
> foo = models.CharField(maxlength=200)
>
> class TestDetail(models.Model):
> test_name = foo
> python_file = models.File("Python File", upload_to = 'tests/' +
> str(foo) + '/')
>
> In other words, you can not just have the FileField use data from the
> particular TestDetail instance.
>
> To get around this, you need to create a new type of FileField. An
> example of doing exactly this can be found here:
> https://pycon.coderanger.net/browser/django/trunk/pycon/schedule/models.py#L256
>
> NOTE: this is not the best example, and it hard codes using the id of
> a relation instead of being able to supply a field name, and it also
> has the limitation of being old-form specific.
>
> Hopefully someone else will be able to explain things better than I
> have.
>
> -Doug
>
> On Sep 17, 1:17 pm, "Ian Lawrence" <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I would like each uploaded test to go into a separate directory in my
> > media_root. In models.py I have:
> >
> > class TestDetail(models.Model):
> > test_grouping = models.ForeignKey(TestGrouping)
> > test_name = models.CharField(maxlength=200)
> > python_file = models.FileField("Python File",
> > upload_to='tests/%s/' % test_name)
> > control_file = models.FileField("Control File",
> > upload_to='tests/%s/' % test_name)
> > resources = models.FileField("Resource", upload_to='tests/%s/' % 
> > test_name)
> > def __unicode__(self):
> > return self.test_name
> >
> > class Admin:
> > list_display = ('test_name',)
> >
> > but in the admin this gives me
> > home/ian/Web/media/tests/ > 0x8a3f68c>/fsfuzzer.py
> > when i try to upload files. This is probably very simple to solve but
> > i have looked through the docs and googled and nothing seems obvious
> > yet
> > thanks
> > Ian
> > --http://ianlawrence.info
>
>
> >
>


-- 
http://ianlawrence.info

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



apache authorization with django

2007-09-18 Thread Robin Becker

I find I can use django users and groups to authorize apache locations and 
directories using a modified version of modpython.py(I just hacked it to check 
for required groups).

I have some difficulties with this simple scheme.

First off it seems to be completely separate from the normal django behaviour. 
Is there a way to get existing django tokens to be used? So if I have already 
logged in or possess a django token can I use that token to provide access to 
an 
apache controlled area?

Secondly the apache validation examples all seem to use mod_python as the 
transport between apache and django. We are tending to use fastcgi (via flup 
and 
runfcgi) as it gives us greater flexibility; we can use an entirely separate 
process for the python (perhaps even a different python). Is there a way to use 
a fastcgi based validation?

Finally, my boss wants to use a single auth database. I'm not sure that's 
feasible, but it seems reasonable to have a central controlled database app 
which only does user/groups. I think this is less desirable because of the 
possibility of permission leakage. I can imagine exporting changes into some 
other project's db so this doesn't seem impossible.
-- 
Robin Becker

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Getting an object's meta value

2007-09-18 Thread Alex Koshelev

MyModel._meta.verbose_name

On 18 сент, 20:31, Rob Slotboom <[EMAIL PROTECTED]> wrote:
> For a class method I want to use the value of the
> Model>Meta>verbose_name.
> Can someone tell me how to get this value?
>
> Thanks, Rob


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Getting an object's meta value

2007-09-18 Thread Jonathan Buchanan

Rob Slotboom wrote:
> For a class method I want to use the value of the
> Model>Meta>verbose_name.
> Can someone tell me how to get this value?
> 
> Thanks, Rob

You almost had it:

 Model._meta.verbose_name

Jonathan.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django and Twitter

2007-09-18 Thread [EMAIL PROTECTED]

Tim,

Thanks for taking a look. Still feeling my way on what I need to post
to be most helpful.

The OS is Ubuntu 7.04 (Feisty).

Here's the full traceback:

Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
in get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
decorators.py" in _checklogin
  55. return view_func(request, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  39. response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
main.py" in change_stage
  329. new_object = manipulator.save(new_data)
File "/usr/lib/python2.5/site-packages/django/db/models/
manipulators.py" in save
  108. new_object.save()
File "/home/mwaite/django-projects/data/app/models.py" in save
  170. api = twitter.Api()
File "build/bdist.linux-i686/egg/twitter.py" in __init__
  900. self._cache = _FileCache()
File "build/bdist.linux-i686/egg/twitter.py" in __init__
  1451. self._InitializeRootDirectory(root_directory)
File "build/bdist.linux-i686/egg/twitter.py" in
_InitializeRootDirectory
  1508. root_directory = self._GetTmpCachePath()
File "build/bdist.linux-i686/egg/twitter.py" in _GetTmpCachePath
  1502. username = self._GetUsername()
File "build/bdist.linux-i686/egg/twitter.py" in _GetUsername
  1498. os.getlogin() or \

  OSError at /url/of/record/in/admin/
  [Errno 25] Inappropriate ioctl for device

Here's where I expose my rank noobishness: I'm not sure what user the
python process is running as. It's a local install, running on Apache/
mod_python so I'm guessing that it's running as me. Tell me how I can
figure it out and I'll tell you for sure.

As for executing on the python prompt: os.getlogin() gets my login.
The twitter._GetUsername() doesn't work however:

>>> twitter._GetUsername()
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'module' object has no attribute '_GetUsername'

Again, thank you for taking a look at this.

Matt Waite


On Sep 18, 12:10 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > However, when I save the record in the Django admin, I get this:
>
> > [Errno 25] Inappropriate ioctl for device
>
> > Exception Location: build/bdist.linux-i686/egg/twitter.py in
> > _GetUsername, line 1498
>
> A couple pieces of information would be helpful:
>
> Which OS?
>
> Could you provide the full traceback (redacted for
> usernames/passwords if needed, but at least the full callstack)?
>
> As which user is the python process running, and how is it
> running (dev server, apache, fast-cgi)?
>
> If you pull up a raw python prompt and execute the following two
> lines, what do you get:
>
>>>> import os
>>>> os.getlogin()
>
> Also at the raw python prompt, what happens if you do
>
>>>> import twitter
>>>> twitter._GetUsername()
>
> That should provide enough information to at least try and
> replicate the problem, and get things a step closer to finding an
> answer.
>
> -tim


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Getting an object's meta value

2007-09-18 Thread Rob Slotboom

For a class method I want to use the value of the
Model>Meta>verbose_name.
Can someone tell me how to get this value?

Thanks, Rob


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



'str' has no attribute 'strftime'

2007-09-18 Thread jacoberg2

Hey, I am trying to read a string from a file and then save it to the
database. In doing so I get the error message 'str' has no attribute
'strftime'. the string is a a dat that i am trying to save to the
datetimefield in my database. The parser i used returned a string but
hen it tries to save this string tothe appropiate place it send that
error back. any suggestions? Thanks for your time.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django and Twitter

2007-09-18 Thread Tim Chase

> However, when I save the record in the Django admin, I get this:
> 
> [Errno 25] Inappropriate ioctl for device
> 
> Exception Location: build/bdist.linux-i686/egg/twitter.py in
> _GetUsername, line 1498

A couple pieces of information would be helpful:

Which OS?

Could you provide the full traceback (redacted for 
usernames/passwords if needed, but at least the full callstack)?

As which user is the python process running, and how is it 
running (dev server, apache, fast-cgi)?

If you pull up a raw python prompt and execute the following two 
lines, what do you get:

   >>> import os
   >>> os.getlogin()

Also at the raw python prompt, what happens if you do

   >>> import twitter
   >>> twitter._GetUsername()

That should provide enough information to at least try and 
replicate the problem, and get things a step closer to finding an 
answer.

-tim


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Having Django iterate through JSON possible?

2007-09-18 Thread Richard Dahl
Robo,
The particular view I was describing returns a jsonified  dictionary that
(if all goes well) contains a form, a history table, and a messages table.
If things do not go well, it will return either a jsonified dictionary
containing either an error or a login_error depending on what went wrong.

The template for the individual forms is pretty basic as are the templates
for the history and messages tables:
form template:
{% if form %}

{{ form.as_p }}
{% if editable %}
Save
{% endif %}
{% endif %}

the history table template:



UserActionDate

{$ for l in logs %}
{{ l.user }}{{ l.action }}{{
l.datefield }}
{% endfor %}
   



the messages table template looks exactly like the history template with
just different headers and contents

Here is the function that initiates the ajax call and evaluates the ajax
response, but remember this is YUI specific, this will not work using
mochikit, prototype, or any other javascript library:

function loadDetailData(node){
var sUrl = ("get_asset_detail/" + node.nodeId + "/" + node.nodeType + "/" +
Math.ceil(Math.random() * 50) + "/");

//the math.random call is needed as the current version of the YIU treeview
widget uses a default mode to cache all expand calls.  I want users to be
able to see all nodes that may have been added by others during a user
session without doing a page refresh.  the view called by get_asset_detail
ignores the random number.

var callback = {
success: function(oResponse) {
var response_obj = eval('(' + oResponse.responseText + ')');
   if (response_obj.Login_Error){
alert('Your session has expired, please login again.');
var authWindow = window.open("", "loginWindow");
authWindow.document.write(response_obj.Login_error);
}
else{
var detailTabl = new YAHOO.widget.TabView('tab-div');
var myobj = response_obj.form; // Get the form html from the json
dictionary
var tab = detailTab.getTab(0);// Get the form tab
tab.set("content", myobj, true);  //Put the form on the tabview
widget
var myobj = response_obj.log; //get the history table html from the
json dictionary
var tab = detailTab.getTab(1);//Get the history tab
tab.set("content", myobj, true);  //Put the history table on the
tabview widget
buildLogTable();  //call the function that turns the raw html table
into a YUI datatable
}
}
failure: function(oResponse) {
alert("Failed to process XHR transaction.",
},
argument: {
"node": node, // This is the treeview node that is passed into the
function to initiate the async request
},
timeout: 7000
};

YAHOO.util.Connect.asyncRequest('GET', sUrl, callback):
}


Let me know if you need any clarification on any point.
-richard


On 9/18/07, robo <[EMAIL PROTECTED]> wrote:
>
>
> Hi Richard,
>
> I think I got the idea of your view. What I'd like to see is an
> example of your template and javascript to see how you are accessing
> the json data.
>
> Thanks a lot,
>
> robo
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django and Twitter

2007-09-18 Thread [EMAIL PROTECTED]

I'm trying to marry up Django and a python wrapper to the Twitter API
called Python-Twitter (http://code.google.com/p/python-twitter/) to
trigger a status change on saving an item to a database. It looks
something like this:

def save(self):
if self.makepublic:
 api = twitter.Api()
 api = twitter.Api(username='username',
password='password')
 status = api.PostUpdate('My update message here')
else:
 pass
super(Modelname, self).save()

However, when I save the record in the Django admin, I get this:

[Errno 25] Inappropriate ioctl for device

Exception Location: build/bdist.linux-i686/egg/twitter.py in
_GetUsername, line 1498

The section of code mentioned in the error from twitter.py is here:

  def _GetUsername(self):
'''Attempt to find the username in a cross-platform fashion.'''
return os.getenv('USER') or \
os.getenv('LOGNAME') or \
os.getenv('USERNAME') or \
os.getlogin() or \
'nobody'

Anyone got any guesses? I'm so much of a python noob that I can't even
spell half these things. Any suggestions are most appreciated.

Matt

Matthew Waite
politifact.com | mattwaite.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Having Django iterate through JSON possible?

2007-09-18 Thread robo

Hi Richard,

I think I got the idea of your view. What I'd like to see is an
example of your template and javascript to see how you are accessing
the json data.

Thanks a lot,

robo


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: reassessing our Operating System

2007-09-18 Thread Justin Lilly
Actually there is a reason why debian based OS's are preferred (in my
opinion). Having installed Django on CentOS, I found that you have to run
two concurrent versions of python. One for the OS and its tools and one to
run django on. (I believe I had to run 2.3 and 2.5) It can make
configuration for deployment to be a bit of a pain.

Hope it helps,
   -justin

On 9/18/07, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>
>
>
> On 18-Sep-07, at 4:32 PM, shabda wrote:
>
> > Any special reasons debian based installs are better than fedora based
> > ones?
>
> lets not start distro wars here. It is all a matter of individual
> choice - any linux/bsd flavour is fine - avoid windows and OSX for
> production servers.
>
> --
>
> regards
> kg
> http://lawgon.livejournal.com
> http://nrcfosshelpline.in/web/
>
>
>
> >
>


-- 
Justin Lilly
University of South Carolina

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ERROR: curr ... SET client_encoding to 'UNICODE'

2007-09-18 Thread paulh

Thanks for the speedy reply and your diagnosis was absolutely spot on.
Purely as an aside and because there may be others in my situation,
the cause of the error was a confusion between thinking in django
terms (where a foreign key is actually a python object) and in sql
terms where a foreign key is a number (often). Often, because old
habits die hard, when django wants a python object I go to great and
pointless lengths to get hold of the corresponding number and then get
an error.

On Sep 18, 2:27 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 9/18/07, paulh <[EMAIL PROTECTED]> wrote:
>
>
>
> >   ProgrammingError at /newso/6562/80/sisale/picked/
> >   ERROR: current transaction is aborted, commands ignored until end of
> > transaction block SET client_encoding to 'UNICODE'
>
> > The last statement executed was an explicit call to ...save().
>
> This is a somewhat misleading error message. Essentially, the Postgres
> backend is telling you that it couldn't run the 'SET client_encoding
> to UNICODE' SQL statement because the previous SQL statement caused an
> error.
>
> This generally means that the command prior to the command that raised
> the visible error is the _actual_ cause of the problem - usually
> because of some form of data integrity problem.
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ERROR: curr ... SET client_encoding to 'UNICODE'

2007-09-18 Thread Russell Keith-Magee

On 9/18/07, paulh <[EMAIL PROTECTED]> wrote:
>
>   ProgrammingError at /newso/6562/80/sisale/picked/
>   ERROR: current transaction is aborted, commands ignored until end of
> transaction block SET client_encoding to 'UNICODE'
>
> The last statement executed was an explicit call to ...save().

This is a somewhat misleading error message. Essentially, the Postgres
backend is telling you that it couldn't run the 'SET client_encoding
to UNICODE' SQL statement because the previous SQL statement caused an
error.

This generally means that the command prior to the command that raised
the visible error is the _actual_ cause of the problem - usually
because of some form of data integrity problem.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: reassessing our Operating System

2007-09-18 Thread Tim Chase

> Any special reasons debian based installs are better than
> fedora based ones?

I can't say there should be any sort of major difference once 
meta-package programs were instituted for dependency tracking. 
My understanding is that Yum may do this sort of thing.

I tried Red Hat early in the game and grew frustrated with the 
"yes, RPMs install easily, but you have to track down each 
dependency individually and install it first" nature of it. 
However, that was 5-10 years ago (around RH v5 through v8)...I've 
just never tried an RPM-based distro since then.  If I wanted 
dependency-tracking headaches, I'd build everything from source :)

As long as you can tell your distro "install these things I care 
about and install any requisite dependencies you might need to in 
order to get there", it doesn't really matter.

-tim




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ERROR: duplicate key violates unique constraint

2007-09-18 Thread Michal

Nis Jørgensen wrote:
>>   
> What is the value of "username"? This is what gives you the problem, not
> "email", as indicated here:
>> IntegrityError: ERROR:  duplicate key violates unique constraint 
>> "auth_user_username_key"

Hello Nis,
thank you for your interest. Username is evaluated from email by this 
function:

def create_username(email):
   from utils.czech import slugify
   username = slugify(email).replace('-', '_')
   try:
 u = User.objects.get(username__exact=username[:30])
 username = u"%s_%s" % (username[:21], 
User.objects.make_random_password(length=8))
   except User.DoesNotExist:
 username = username[:30]
 return username


Regards
Michal

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Backwards relationship doesn't work on one of the development machines

2007-09-18 Thread Aidas Bendoraitis

Hello, django users!

I am experiencing a strange behavior with our Django project on one of
the development computers.

We have such a situation where Users can be members of one or more
sharedspaces which are related to institutions.
User <- Membership -> SharedSpace -> Institution

Lately, I changed the previously used django row-level-permission
branch to the trunk. After the change, the following query
user_institutions =
Institution.objects.filter(sharedspace__membership__user=request.user)
fails just on one development environment with the error, saying that
the sharedspace attribute was not found. (All relationships are
implemented as ForeignKeys)

User is from the auth app
Institution model resides in the accounts app
Membership and SharedSpace reside in the groups app

All the apps are listed in the INSTALLED_APPS in the following order:
1. django.contrib.auth
2. accounts
3. groups

However, it still works perfectly on another two development
computers. The architecture and installation of that computer with the
strange behavior matches another development environment where it
works OK.

Has anyone any clues, what could be wrong on that machine or in the code?

Regards,
Aidas Bendoraitis [aka Archatas]

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



[ANN]db_dump.py 2.1 released!

2007-09-18 Thread limodou

I'v created a project db-dump on code.google.com, you can visit it at:
http://code.google.com/p/db-dump/

And db_dump.py is used for dump and restore database of Django. And it
can also support some simple situations for Model changes, so it can
also be used in importing data after the migration of Model.

So if you like it or want to try it, you can download it from
http://db-dump.googlecode.com/files/db_dump2.1.zip

And if you have any idea about it just write a issue or send me an
email, I'll try my best to change it.

If you want to run it, just extract it to project directory, you
should put it with the settings.py together, and run it according to
the document of the project site.

Hope you like it.
-- 
I like python!
UliPad <>: http://code.google.com/p/ulipad/
My Blog: http://www.donews.net/limodou

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: reassessing our Operating System

2007-09-18 Thread Kenneth Gonsalves


On 18-Sep-07, at 4:32 PM, shabda wrote:

> Any special reasons debian based installs are better than fedora based
> ones?

lets not start distro wars here. It is all a matter of individual  
choice - any linux/bsd flavour is fine - avoid windows and OSX for  
production servers.

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: response from another function

2007-09-18 Thread Dushyant Sharma

> function1(request):
> return function2(request)

no i just want that function2(request) call makes a permanent redirect
(not HttpResponseRedirect, i dont want more burden on urls.py) to
function2 and all the response should be sent from function2 only. it
should never come back to function1 again. if it is 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cronjob

2007-09-18 Thread Ramiro Morales

On 9/18/07, patrickk <[EMAIL PROTECTED]> wrote:
>
> now I get:
> ImportError: No module named django.core.management
>
> the directory "django_src" is on my python-path.
>

Read cron documentation; the cronjobs run with a crippled environment
but you can set/add the env vars (PYHTONPATH in this case) you need on
the crontab.

HTH

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to run server after install Django

2007-09-18 Thread Hannus

Dear Dushyant
I has followed your introduction,but the errors is still existing as
the following:

Traceback (most recent call last):
File"D:\python25\lib\site-packages\django\bin\newsite\manage.py",line
11,in 
File"D:\python25\lib\site-packages\django\core
\managemet.py",line1657,in execute_manager
project_directory=setup-environ
File"D:\python25\lib\site-packages\django\core
\managemet.py",line1649,in setup_environ
project_module=_import_,<>,['']>
import error:no module named mysite
-
Thank you very much

On 9月18日, 下午6时25分, Dushyant Sharma <[EMAIL PROTECTED]> wrote:
> dear Han
> you must add path of python.exe,  django-admin.py and manage.py to
> your system path
> you should avoid copying system files here and there as it will cause
> problems.
>
> clean approach should be
> 1. install python  (say installed at C:\python25)
> 2. set path for python.exe
> 3. install django (will be installed at c:\python25\lib\site-packages)
> 4. add django-admin.py and manage.py (complete path) to system path
> 5. create a new folder (just to manage your applications) (say c:
> \djangoapps)
> 6. inside c:\djangoapps use command django-admin.py
> startproject mysite
> 7. it will create new folder mysite inside c:\djangoapps
> 8. here you can run server manage.py runserver
> and you are ready to work


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: response from another function

2007-09-18 Thread Horst Gutmann

You basically want something like this?

function1(request):
return function2(request)

Sure, Django is "just" Python :-)

2007/9/18, Dushyant Sharma <[EMAIL PROTECTED]>:
>
> is it possible to return HttpResponse from another function
>
> like i have called a function say furnction1(request) and now is it
> possible
>
> function1(request):
>   #normal statements
>   #here i call another function
>   function2(request)
>   return HttpResponse('bye') #just for example not useful here
>
> function2(request):
>   return HttpResponse('ok')
>
>
> here it will return 'bye' but i want that the function call for
> function2 should return 'ok' to the client browser
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cronjob

2007-09-18 Thread Horst Gutmann

Better also insert it before doing this import. Your cron-manager
probably uses a different shell then your terminal :)

2007/9/18, patrickk <[EMAIL PROTECTED]>:
>
> now I get:
> ImportError: No module named django.core.management
>
> the directory "django_src" is on my python-path.
>
>
> On 18 Sep., 12:43, Christian Joergensen <[EMAIL PROTECTED]> wrote:
> > patrickk wrote:
> > > I just tried to set up a cronjob with plesk and I got this error:
> >
> > > from: can't read /var/mail/django.core.management
> > > /var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
> > > 4: import: command not found
> > > /var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
> > > 5: syntax error near unexpected token `settings'
> > > /var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
> > > 5: `setup_environ(settings)'
> >
> > > Here´s the test-script:
> >
> > > # coding: utf-8
> >
> > You're missing the shebang line:
> >
> > #!/usr/bin/python
> >
> > --
> > Christian Joergensen | Linux, programming or web 
> > consultancyhttp://www.razor.dk | Visit us at:http://www.gmta.info
> >
> >  signature.asc
> > 1KHerunterladen
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ERROR: curr ... SET client_encoding to 'UNICODE'

2007-09-18 Thread paulh

I got this error:
ERROR: current transaction is aborted, commands ignored until end of
transaction block SET client_encoding to 'UNICODE'
 from django dev version 6373. There are a couple of hits when I
searched the list, but either I didn't understand them, or they are
not relevenat (or both).
Here is the trace:
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
in _real_get_response
  81. response = callback(request, *callback_args, **callback_kwargs)
File "/var/www/pandyna/pan/sohi/views.py" in picked
  55. inh.save()
File "/usr/lib/python2.4/site-packages/django/db/models/base.py" in
save
  213. cursor = connection.cursor()
File "/usr/lib/python2.4/site-packages/django/db/backends/__init__.py"
in cursor
  33. cursor = self._cursor(settings)
File "/usr/lib/python2.4/site-packages/django/db/backends/postgresql/
base.py" in _cursor
  103. cursor.execute("SET client_encoding to 'UNICODE'")

  ProgrammingError at /newso/6562/80/sisale/picked/
  ERROR: current transaction is aborted, commands ignored until end of
transaction block SET client_encoding to 'UNICODE'

The last statement executed was an explicit call to ...save().
The same thing happens in the django shell.
Does anyone have any ideas?

Paul Hide


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cronjob

2007-09-18 Thread Nis Jørgensen

patrickk skrev:
> now I get:
> ImportError: No module named django.core.management
>
> the directory "django_src" is on my python-path.
>   
It probably isn't on cron's python-path, though. Try adding

PYTHONPATH=/your/python/path

to the top of your crontab.

-- 
Nis Jørgensen
Who is NOT a relative of Christian



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



response from another function

2007-09-18 Thread Dushyant Sharma

is it possible to return HttpResponse from another function

like i have called a function say furnction1(request) and now is it
possible

function1(request):
  #normal statements
  #here i call another function
  function2(request)
  return HttpResponse('bye') #just for example not useful here

function2(request):
  return HttpResponse('ok')


here it will return 'bye' but i want that the function call for
function2 should return 'ok' to the client browser


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ERROR: duplicate key violates unique constraint

2007-09-18 Thread Nis Jørgensen

Michal skrev:
> Hello,
> I have problem with inserting duplicate rows into DB.
>
> There is registration form on my site. User fill email address together 
> with additional parameters (form definition: http://dpaste.com/19959/). 
> After POST it to the server, email is checked in form against DB. If 
> user with same email exists, form error is generated.
>
> If form is valid (ie. user doesn't exists) I make another test in the 
> view and then call my function for creating whole new account:
>
>f_email = form.cleaned_data['email']
>if User.objects.filter(email__exact=f_email).count() == 0:
>  create_account(form.cleaned_data)
>
> In the create_account I try to create new user like this:
>
>user = User.objects.create_user(username, form['email'], 
> form['password1'])
>   
What is the value of "username"? This is what gives you the problem, not
"email", as indicated here:
> IntegrityError: ERROR:  duplicate key violates unique constraint 
> "auth_user_username_key"
>   
Nis

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cronjob

2007-09-18 Thread patrickk

now I get:
ImportError: No module named django.core.management

the directory "django_src" is on my python-path.


On 18 Sep., 12:43, Christian Joergensen <[EMAIL PROTECTED]> wrote:
> patrickk wrote:
> > I just tried to set up a cronjob with plesk and I got this error:
>
> > from: can't read /var/mail/django.core.management
> > /var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
> > 4: import: command not found
> > /var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
> > 5: syntax error near unexpected token `settings'
> > /var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
> > 5: `setup_environ(settings)'
>
> > Here´s the test-script:
>
> > # coding: utf-8
>
> You're missing the shebang line:
>
> #!/usr/bin/python
>
> --
> Christian Joergensen | Linux, programming or web 
> consultancyhttp://www.razor.dk | Visit us at:http://www.gmta.info
>
>  signature.asc
> 1KHerunterladen


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How do I pull a javascript array into a form submission

2007-09-18 Thread Aidas Bendoraitis

A couple of suggestions:

1. You can put the whole array of dates JSONized into a hidden field,
parse it in the webserver and validate it's values.

2. You can create input fields dynamically using JS on the client side
and using some dynamic form mechanism on the server side, and also
have some field which holds the number of dynamically created input
fields. Whenever a user submits the form, you check the number of
dynamically created fields and create a form with the number of those
dynamic fields.

Regards,
Aidas Bendoraitis [aka Archatas]

On 9/4/07, eriku777 <[EMAIL PROTECTED]> wrote:
>
> I have been tooling around with this wonderful javascript calendar
> that allows for the selections of multiple dates (with other really
> cool constraints) and then packs then all into an javascript array
> that can be walked though.  All the Django forms examples I have seen
> presume a fixed number form elements with predetermined field name
> names.  The array is dynamically created by the user by the javascript
> calendar.  I need some way to have django walk the array of date
> values, validate them, and accept them all for input.  Any one have
> any ideas on the most elegant way to do this?
>
> -- Eric --
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cronjob

2007-09-18 Thread Christian Joergensen
patrickk wrote:
> I just tried to set up a cronjob with plesk and I got this error:
> 
> from: can't read /var/mail/django.core.management
> /var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
> 4: import: command not found
> /var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
> 5: syntax error near unexpected token `settings'
> /var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
> 5: `setup_environ(settings)'
> 
> Here´s the test-script:
> 
> # coding: utf-8

You're missing the shebang line:

#!/usr/bin/python

-- 
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk  | Visit us at: http://www.gmta.info



signature.asc
Description: OpenPGP digital signature


Re: reassessing our Operating System

2007-09-18 Thread Tim Chase

> (live publicly viewable sites only)
> 1. What OS are you using to run Django on?

OpenBSD and Debian Linux

> 2. What OS do you think is most popular for running Django on?

Debian and its derivatives (Ubuntu, etc...anything using apt)

> 3. What OS do you think is most suited for running Django on?

Debian and its derivatives

> (non publicly viewable sites)
> 4. What OS do you think is most suited for developing Django on?

Again, I have a Debian leaning here, but any *nix-based
environment gives you a good feel for what's going on.  I've done
testing on OS X, Debians, and a couple BSDs.

Debian's apt-get does a lot of the hand-holding which makes the
install very easy:  you can just tell it that you want apache,
mod_python, , the  python libs, and PIL and it
deals with the rest (where "" is PostgreSQL, MySQL, or
sqlite...I haven't tried firebird).  For new servers, given the
option, I'd go with Debian.

The process is a little more complex elsewhere:  on OpenBSD, I
had to build Apache2/mod_python from source as OpenBSD comes with
a heavily modified version of Apache, pre-v2; on Mac OS X, I had
to upgrade Python and add in all the other bits by hand.

-tim





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to run server after install Django

2007-09-18 Thread Dushyant Sharma

dear Han
you must add path of python.exe,  django-admin.py and manage.py to
your system path
you should avoid copying system files here and there as it will cause
problems.

clean approach should be
1. install python  (say installed at C:\python25)
2. set path for python.exe
3. install django (will be installed at c:\python25\lib\site-packages)
4. add django-admin.py and manage.py (complete path) to system path
5. create a new folder (just to manage your applications) (say c:
\djangoapps)
6. inside c:\djangoapps use command django-admin.py
startproject mysite
7. it will create new folder mysite inside c:\djangoapps
8. here you can run server manage.py runserver
and you are ready to work


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can't install MySQLdb... any links?

2007-09-18 Thread Austin Govella

On 9/18/07, Horst Gutmann <[EMAIL PROTECTED]> wrote:
> Did you also receive any error message when running sudo python
> setup.py install on a newly extracted folder (basically when compiling
> the C part of that module)? This looks to me like mysql_config wasn't
> found. If you've installed mysql in a non-standard place (like for
> example MacPorts does), add the path to your mysql_config to the
> setup.cfg :-)

Actually, I think it was because I installed Python 2.5. I installed
2.4 and then mysqldb installed just like they say it does in all those
blog posts. And MacPorts. Ubernostrum advised MacPorts for mysqldb.

But I think I installed MySQL using the packages from MySQL.org.


-- 
Austin Govella
Thinking & Making: http://thinkingandmaking.com
Thinking Links: http://thinkingandmaking.com/links

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Macports Django install - which way?

2007-09-18 Thread Dave E

> We're always open to documentation improvements; thanks for offering to help.

The latest version (under revision before becoming HTML) of my
'absurdly simple' try-Django-locally for OS X is here:
ecoconsulting.co.uk/python/django-install.txt

> If you're installing from a downloaded version of Django (rather than 
> macports)
> The standard 'python setup.py install' will work, and will install
> Django into the site-packages of whichever python install is on the
> path at the time.

I did a CL install in the end, and all is well.

> Personally, I find Macports to be a very useful way of getting the
> support libraries in place...

Agreed, but it's an extra layer of complexity for me at this stage.

> I use an svn checkout of Django rather
> than the ports version.

I used 0.96, not confident enough for the svn, but may use in future.

SQLite is already on OS X, that's enough for trying/learning. I have
MySQL too.

> As a guideline, this is what is in my .profile:
> export PATH=/opt/local/bin:/opt/local/sbin:$PATH
> export PATH=/opt/local/lib/pgsql8/bin:$PATH
> export PATH=/opt/local/lib/python2.4/site-packages/django/bin:$PATH
> export 
> PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.4/bin:$PATH

Now that's really helpful - thanks. I may use Macports in future.

> > I know OS X needs Python elswhere
>
> Define 'needs'. OS X provides Python, but doesn't really use it at a
> core level.

I did read that some (3rd party?) OS X apps use the original Python,
but no problems so far - the 2.5 installer left the 2.3 version
intact.

> The bigger problem is coming up with an easy answer for 'how to
> install Postgres' (or any other database). [...] 'port
> install py-psycopg2' and setting up a few paths is much easier.

Agreed. But in this case I'm deliberately simplifying the setup for
trying out Django in a local environment, and just using SQLite
(already on OS X).

> If you find (or know of) a good set of Postgres/MySQL binaries for OSX
> (including Python bindings), this problem goes away. However, I
> haven't been able to find such a beast.

When I get to the development stage, if I find one I'll post it up
here :-)

>> ---
> > Macports is a good idea [...]
> > but the Python it installs isn't in the place OS X expects it to be,
> > so can't be used easily.
>
> Depends on your definition of easily. I can't say I had much
> difficulty setting up my .profile, but I'm coming from a unix
> background, so I'm used to that sort of thing.

Again, another layer of complexity that I wanted to remove at this
stage. I may well return to Macports when I have more time - I like
the concept. But my tutorial is for people without much Unix
experience (mine? Minimal Solaris 8 years ago, plus whatever FreeBSD I
need in OS X) who want to try out Django with the minimum barriers to
getting it running on OS X. When I get into a real site, I'll document
that too and get feedback on it.

The problem with many of the current guides and some of the
documentation is that it presumes some Unix experience, and covers too
much ground for those who just want to dip their toe in the Django
waters, so that's what I'm trying to remedy. I'm actually aiming to
lure web designers, who want to move towards web development, away
from proprietary or messy or solutions to which web designers tend to
default (like mixing up PHP and HTML too much).

Many thanks for the advice,

Dave


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



cronjob

2007-09-18 Thread patrickk

I just tried to set up a cronjob with plesk and I got this error:

from: can't read /var/mail/django.core.management
/var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
4: import: command not found
/var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
5: syntax error near unexpected token `settings'
/var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
5: `setup_environ(settings)'

Here´s the test-script:

# coding: utf-8

from django.core.management import setup_environ
import settings
setup_environ(settings)

def mail_movies():
from django.core.mail import send_mail

subject = u"test"
message = u"test"
send_mail(subject, message, "[EMAIL PROTECTED]",
['[EMAIL PROTECTED]'],)


patrick


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Strange error from get_and_delete_messages?

2007-09-18 Thread Ryan K

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/django/core/handlers/
base.py", line 77, in get_response
response = callback(request, *callback_args, **callback_kwargs)

  File "/home/llcom/projects/llcom/makeav/views.py", line 231, in
create_avatar
return render_to_response(template, dform_dict,
RequestContext(request))

  File "/usr/lib/python2.3/site-packages/django/template/context.py",
line 100, in __init__
self.update(processor(request))

  File "/usr/lib/python2.3/site-packages/django/core/
context_processors.py", line 17, in auth
return {

AttributeError: 'tuple' object has no attribute
'get_and_delete_messages'

I have Psyco enableddo you suspect this is what is causing the
problem?

Thanks,
Ryan


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: using multiple databases

2007-09-18 Thread Ben Ford
You can use the multi-db branch as is and use it for a different app for
each db if you want as per the instructions. However you'll lose a lot of
the recent functionality from trunk that way. I'd suggest checking out trunk
at r 6100 and then patching against that. Contact me off list and I'll send
you the patch if you want it. Note that I haven't used the patch yet.
Ben

On 18/09/2007, msoulier <[EMAIL PROTECTED]> wrote:
>
>
> On Sep 17, 11:00 pm, "Ben Ford" <[EMAIL PROTECTED]> wrote:
> > Hi Mike,
> > There is a branch that supports multiple databases in the repository.
> It's
> > quite out of date in the SVN repo but Koen put in some stirling work
> over
> > the period of the sprint and produced a patch against trunk at around
> r6100.
>
> Hmm. Looking at the repository, it looks like 0.96 was r4810. Sounds
> like a lot
> was done since then. :)
>
> > Multiple-db support is a feature that is asked for very regularly,
> > unfortunately there have been issues getting the latest changes into the
> > repo so others can use the branch. This is mainly due -as I understand
> it -
> > to quality of the code, lack of working tests, and the fact that the
> core
> > devs are busy on other things. I can send you a copy of the patch if you
> > like, or there's an earlier patch attached to ticket 4747 which is the
> > current version I'm using in production.
>
> Something that could just patch 0.96 would be nice. I don't mind
> trying it out.
>
> > Koen is busy this week I think, but we're probably going to discuss
> > refactoring the multi-db branch to take advantage of recent changes in
> the
> > backend code in the near future.
> > At present multi-db is usable, and as I said I have it in one of my
> projects
> > right now. Having said that, it's quite beta and to get the most out of
> it
> > you're going to have to be pretty happy digging through django's
> internals.
> > If  you are happy doing that we'd love some help with it, as there's
> still a
> > lot to be done! If you want either patch then send me a mail, and of
> course
> > if you have any problem/comments/suggestions I'm more than happy to
> help.
>
> I was hoping to just point each application at a different database,
> nothing more.
> If the patch accomplishes that, then I don't mind looking.
>
> Thanks,
> Mike
>
>
> >
>


-- 
Regards,
Ben Ford
[EMAIL PROTECTED]
+6281317958862

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: reassessing our Operating System

2007-09-18 Thread David Reynolds


On 18 Sep 2007, at 5:01 am, antonio von carmoducci wrote:

> (live publicly viewable sites only)
> 1. What OS are you using to run Django on?

Debian

> 2. What OS do you think is most popular for running Django on?

Debian or Ubuntu, I imagine.

> 3. What OS do you think is most suited for running Django on?

Debian seems to work well.

> (non publicly viewable sites)
> 4. What OS do you think is most suited for developing Django on?

I use a combination of Debian and OS X. For work, I store the files  
on my desktop machine and connect via ssh to run the server and nfs  
to edit the files using Textmate. At home, I just use OS X.

Hope that's of some help.

-- 
David Reynolds
[EMAIL PROTECTED]



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ERROR: duplicate key violates unique constraint

2007-09-18 Thread Michal

Hello,
I have problem with inserting duplicate rows into DB.

There is registration form on my site. User fill email address together 
with additional parameters (form definition: http://dpaste.com/19959/). 
After POST it to the server, email is checked in form against DB. If 
user with same email exists, form error is generated.

If form is valid (ie. user doesn't exists) I make another test in the 
view and then call my function for creating whole new account:

   f_email = form.cleaned_data['email']
   if User.objects.filter(email__exact=f_email).count() == 0:
 create_account(form.cleaned_data)

In the create_account I try to create new user like this:

   user = User.objects.create_user(username, form['email'], 
form['password1'])

But this code *sometimes* throw exception:

   [...]
   File "[...]/accounts/models.py", line 259, in create_account
 user = User.objects.create_user(username, form['email'], 
form['password1'])

   File "[...]/lib/python2.4/django_live/django/contrib/auth/models.py", 
line 96, in create_user
 user.save()

   File "[...]/lib/python2.4/django_live/django/db/models/base.py", line 
249, in save
 ','.join(placeholders)), db_values)

   File 
"[...]/lib/python2.4/django_live/django/db/backends/postgresql/base.py", 
line 53, in execute
 return self.cursor.execute(smart_str(sql, self.charset), 
self.format_params(params))

IntegrityError: ERROR:  duplicate key violates unique constraint 
"auth_user_username_key"


In my settings I have defined Transaction Middleware:

   MIDDLEWARE_CLASSES = (
 'django.middleware.common.CommonMiddleware',
 'django.middleware.transaction.TransactionMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware',
   )

Could you give me some advice, where could be the problem?

Thank you for any help.


Regards
Michal

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: using multiple databases

2007-09-18 Thread msoulier

On Sep 17, 11:00 pm, "Ben Ford" <[EMAIL PROTECTED]> wrote:
> Hi Mike,
> There is a branch that supports multiple databases in the repository. It's
> quite out of date in the SVN repo but Koen put in some stirling work over
> the period of the sprint and produced a patch against trunk at around r6100.

Hmm. Looking at the repository, it looks like 0.96 was r4810. Sounds
like a lot
was done since then. :)

> Multiple-db support is a feature that is asked for very regularly,
> unfortunately there have been issues getting the latest changes into the
> repo so others can use the branch. This is mainly due -as I understand it -
> to quality of the code, lack of working tests, and the fact that the core
> devs are busy on other things. I can send you a copy of the patch if you
> like, or there's an earlier patch attached to ticket 4747 which is the
> current version I'm using in production.

Something that could just patch 0.96 would be nice. I don't mind
trying it out.

> Koen is busy this week I think, but we're probably going to discuss
> refactoring the multi-db branch to take advantage of recent changes in the
> backend code in the near future.
> At present multi-db is usable, and as I said I have it in one of my projects
> right now. Having said that, it's quite beta and to get the most out of it
> you're going to have to be pretty happy digging through django's internals.
> If  you are happy doing that we'd love some help with it, as there's still a
> lot to be done! If you want either patch then send me a mail, and of course
> if you have any problem/comments/suggestions I'm more than happy to help.

I was hoping to just point each application at a different database,
nothing more.
If the patch accomplishes that, then I don't mind looking.

Thanks,
Mike


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can't install MySQLdb... any links?

2007-09-18 Thread Horst Gutmann

Did you also receive any error message when running sudo python
setup.py install on a newly extracted folder (basically when compiling
the C part of that module)? This looks to me like mysql_config wasn't
found. If you've installed mysql in a non-standard place (like for
example MacPorts does), add the path to your mysql_config to the
setup.cfg :-)

2007/9/18, Austin Govella <[EMAIL PROTECTED]>:
>
> On Sep 17, 9:29 pm, "Austin Govella" <[EMAIL PROTECTED]> wrote:
> > I tried it again and I get this error:
> > error: could not create 'build/bdist.macosx-10.3-fat/egg': Permission denied
>
> sudo python setup.py install did something, but when I test it (import
> MySQLdb), I still get an error.
>
> Python's help() gives me this error: http://dpaste.com/19934/
>
> Any clues?
>
>
>
> (Frantically needing to fix his installation... praying to interwebs,
> imagining minionhood, and beers-owed...)
>
>
>
>
> --
> Austin
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---