Re: Adding a link to edit_inline

2009-04-23 Thread Alfonso

Solved this myself with the excellent tutorial at
http://www.juripakaste.fi/blog/django-admin-inline-link.html.

Thought it might be of use to someone else here!

A

On 22 Apr, 19:48, Alfonso  wrote:
> I think this is probably a number of questions in one so here it goes:
>
> I need to add a hyperlink to an inline record that will take the user
> to a 'price history' view that lists the previous prices for that
> inline product.  My question is can I edit edit_inline for that model
> only and no other?
>
> I have a feeling I can't do that (I can with change_form of course)
> but would be very happy to be told otherwise.
>
> The other part of the question is I need this link to hold the inline
> object id for it to work, so how to I grab that from within the
> template?
>
> Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: dynamic form wizards

2009-04-23 Thread Ayaz Ahmed Khan


On 23-Apr-09, at 6:31 PM, Dennis Schmidt wrote:

> Hi there,
>
> I need to dynamically create complex forms in my application. Since
> version 1.0 django has these form wizards, which can manage complex
> forms quite well.  Now my only problem is, that they apparently have
> to be statically mapped by the urls.py. But what I need is a
> different set of forms for the wizard, depending of an ID specified
> in the URL.
>
> ie /order/1/accept/ shall use OrderAcceptionWizard([OrderPartOneForm,
> OrderPartTwoForm]) but
> /order/2/accept/ shall use OrderAcceptionWizard([OrderPartOneForm,
> OrderPartThreeForm]).

You could always tap into process_step() (a method of the
FormWizard[0] class) and alter self.form_list dynamically based on some
criterion. self.form_list is a list of Form classes that are used to
create forms at different steps of the wizard.

[0] 


-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: automatic updates for a set of model objects via email

2009-04-23 Thread Timboy

Let me be more specific to my needs:

Here is my example AutoSearch model:
name = charfield
uuid = uuid
query = charfield
autos = m2m
updated = boolean
emailed_on_update = boolean
emailed_on_new = boolean

Here are my needs:
 * updates to this search send the user an email
 * the user needs to know which autos were updated
 * new autos email the user
 * the user needs to know which autos are new

Questions assuming 1000 users.

 * Should this be a cron?
 * should I add two more m2m's to autos 1 for new autos and 1 for
updated autos? or is there a better way to keep track for the user?

Thanks.

On Apr 23, 10:20 pm, Alex Gaynor  wrote:
> On Fri, Apr 24, 2009 at 1:15 AM, Timboy  wrote:
>
> > I want my users to be able to be updated for changes to specific
> > models objects.
>
> > Let's say a user does a search of vehicle listings and the search
> > returns 3 cars. I want them to be able to be alerted when any of those
> > three car listings get updated. What's the best way to accomplish
> > this?
>
> > TIA
>
> The first thing to figure out is will this feature be for any model or for a
> specific one?  The next step is to set up a DB table, it's probably going to
> just be a few columns, a foreign key to user(or maybe just an email field if
> you want unauthenticated users to be able to sign up for updates), and a
> foreign key to the model(or a generic foriegn key).  Then you'd write a
> signal handler, probably a post_save one, that sends out an email to the
> appropriate people if it determines that the object has been changed, and it
> would just send emails to everyone who's email is in the table.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: automatic updates for a set of model objects via email

2009-04-23 Thread Alex Gaynor
On Fri, Apr 24, 2009 at 1:15 AM, Timboy  wrote:

>
> I want my users to be able to be updated for changes to specific
> models objects.
>
> Let's say a user does a search of vehicle listings and the search
> returns 3 cars. I want them to be able to be alerted when any of those
> three car listings get updated. What's the best way to accomplish
> this?
>
> TIA
> >
>
The first thing to figure out is will this feature be for any model or for a
specific one?  The next step is to set up a DB table, it's probably going to
just be a few columns, a foreign key to user(or maybe just an email field if
you want unauthenticated users to be able to sign up for updates), and a
foreign key to the model(or a generic foriegn key).  Then you'd write a
signal handler, probably a post_save one, that sends out an email to the
appropriate people if it determines that the object has been changed, and it
would just send emails to everyone who's email is in the table.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: rude, curt, and impatient, or direct, cut-through-the-B.S. communications

2009-04-23 Thread Phil Mocek

On Fri, Apr 24, 2009 at 10:46:46AM +0800, Russell Keith-Magee wrote:
> On Thu, Apr 23, 2009 at 10:19 PM, Phil Mocek
> > On Thu, Apr 23, 2009 at 06:58:53AM -0700, joeygartin wrote:
> > > Their inner sorrow is projected out in a form of rage and that
> > > usually (hopefully) only comes out as rude, curt and inpatient.
> >
> > That's a common misperception.
> >
> > 
> 
> Phil - I can tell that you _really_ like ESR

My frequent referral to his writing doesn't indicate much about the
degree to which I like him.  His is simply *the* essay that people refer
to when teaching newbies how to deal with technical discussions on
Usenet, mailing lists, and Web forums.  It has been for almost a decade.

"How to Ask Questions the Smart Way" is a distillation of many lessons
learned and norms established over a quarter-century of discussions in
computer-related discussion forums.  It's better, I think, to point to
something written by someone with a whole lot more seniority than I have
than to simply express my own opinion as if it were mine alone.  My
opinions hold little weight.  Not so for uber-hackers in the class of
ESR, RMS, John Gilmore, Linus Torvalds, Allan Cox, Larry Wall, and Guido
van Rossum.

> 1) We'd be much obliged if you'd stop reposting great chunks of ESR's
> essays. A link is fine.

Roger that.  In my defense, it seemed that posting a link wasn't
effective.  Sometimes peoples' appetites need to be whetted.  But I will
concede that this was poor form.

> 2) If you would stop changing the subject line of discussions every
> time you respond, that would be just dandy, too. Rapid-fire subject
> changes don't help anyone keep track of what is going on.

I didn't do that.  I only change the subject line when the topic of
discussion changes.  It would be nice if more other people did as well.

When the topic of discussion in a thread changes, it's good etiquette to
change the subject header to reflect the change.  Customarily, the first
person to reply after the change trims the "was:" portion.  This
well-established custom [1] allows subscribers who have stopped reading
the discussion (likely because of disinterest in the topic at hand) to
know that the topic has changed.  It also allows people who are still
following the discussion to know that the new topic is one that branched
from the old one.

[1]: 


How is the conveyance of such information preferred on this list?
Neither this message nor that to which I am replying is at all related
to a comparison of Django and web.py, it's courteous to avoid indicating
that they are.

> It doesn't take much effort to write in a way that won't be
> interpreted as insulting. Hackers don't get a special pass to treat
> other people like crap simply because they have 133t skillz. 

Agreed.  And "AOLamers", their modern equivalents, and newbies of all
sorts, should only get one pass to treat a thousand others like their
personal research assistants because they haven't yet discovered man
pages, documentation, mailing list archives, and Google.  Once they've
been introduced to those things; there's no excuse.  Continued similar
behavior is at best inconsiderate, and at worst, insulting to fellow
subscribers.

> The correct response to the perception of insult isn't to direct
> someone to an essay as to why they are wrong in their perception - the
> correct response is to apologize for any perceived insult, indicate
> that the insult wasn't intended, and to rephrase your point in a way
> that isn't insulting.

I didn't intend to be insulting.  I apologize for any perceived insult.

When someone here suggested that I had been insulting, I acknowledged
that his misperception was a common one -- so common, in fact, that one
of the fathers of the free software movement wrote a whole section of
his famous essay about how to effectively communicate on lists like this
one *about* such misperceptions.  These aren't just my feelings, they're
those that many, many, people have felt over the years, and the only way
to avoid having to repeatedly feel them is to explain to people that
they could communicate a whole lot more effectively and waste a whole
lot less of other people's time if they looked at the traditions that
we've developed over many years of conducting these discussions.

The "correct response" can only be repeated so many times before it
makes sense for people to write down all the things that people keep
asking and implore them to read it before posting their own question.
We call this a FAQ.  Is it rude to point people to the FAQ when they
skipped over it and asked the same question that has been asked and
answered hundreds of times?

There's a lot to be said for keeping a mailing list's signal-to-noise
ratio low.  Ignoring a problem like an abundance of messages that are
summarized by subjects like "Help! Can I do thi

automatic updates for a set of model objects via email

2009-04-23 Thread Timboy

I want my users to be able to be updated for changes to specific
models objects.

Let's say a user does a search of vehicle listings and the search
returns 3 cars. I want them to be able to be alerted when any of those
three car listings get updated. What's the best way to accomplish
this?

TIA
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



limit number of many to one relationships for an entity

2009-04-23 Thread Avi

is there a neat way to inform the admin interface that you want to
limit hte number of one to many relationships ? (i..e. only allow 3
addresse entires per person) ?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Multi Page Form With Database Persistence

2009-04-23 Thread Timboy

Well I really want the data to post to the database at the same time
as well. Thanks n e way but I'll just re-write the form wizard to do
what I want.



On Apr 23, 9:51 pm, Timboy  wrote:
> I basically want to be able to skip to a specific step in the form
> wizard process.
>
> On Apr 20, 5:56 pm, Timboy  wrote:
>
> > I need to create a multiple page form that upon submit the information
> > is saved to the database so the user can finish it later.
>
> > I want to be able to check the data filled out on the form and
> > depending on the values entered present different pages to the user.
>
> > I know this is possible, I just don't know how and the best way to
> > accomplish this. I have looked into the FormWizard but it looks like
> > it is more meant for forms that go in a straight line.
>
> > Formwizard
> > Page1 --> Page2 --> Page3 --> Page4 --> Page5 --> Page6 --> Page7 -->
> > Page8
>
> > I want my form to be able to skip a page or insert one, depending on
> > the input given on those pages.
> > Page1 --> Page3 --> Page5 --> Page7 --> Page8
> > or
> > Page1 --> Page2 --> Page4 --> Page5 --> Page8
>
> > Example of my model:
>
> > #models.py
> > from django.db import models
>
> > class Poll(models.Model):
> >     question1 = models.CharField(max_length=200)
> >     pub_date1 = models.DateTimeField('date published')
> >     question2_state = USStateField()
> >     question3 = models.CharField(max_length=200)
> >     question4 = models.CharField(max_length=200)
> >     question5 = models.CharField(max_length=200)
> >     question6...
> >     agree = models.BooleanField(help_text='I agree that this is
> > correct')
>
> > #forms.py
> > from django import forms
>
> >  class PollForm1(forms.Form):
> >      question1 = forms.CharField(max_length=200)
> >      question2 = forms.ChoiceField(max_length=200)
>
> >  class PollForm2(forms.Form):
> >      question3 = forms.CharField(max_length=200)
>
> >  class PollForm3(forms.Form):
> >      question4 = forms.CharField(max_length=200)
>
> >  class PollForm4(forms.Form):
> >      question5 = forms.CharField(max_length=200)
> >      question6 = forms.CharField(max_length=200)
>
> >  class PollForm5...
> >  class PollFormN...
> >      agree = forms.BooleanField()
>
> > Thanks in advance for the help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Multi Page Form With Database Persistence

2009-04-23 Thread Timboy

I basically want to be able to skip to a specific step in the form
wizard process.

On Apr 20, 5:56 pm, Timboy  wrote:
> I need to create a multiple page form that upon submit the information
> is saved to the database so the user can finish it later.
>
> I want to be able to check the data filled out on the form and
> depending on the values entered present different pages to the user.
>
> I know this is possible, I just don't know how and the best way to
> accomplish this. I have looked into the FormWizard but it looks like
> it is more meant for forms that go in a straight line.
>
> Formwizard
> Page1 --> Page2 --> Page3 --> Page4 --> Page5 --> Page6 --> Page7 -->
> Page8
>
> I want my form to be able to skip a page or insert one, depending on
> the input given on those pages.
> Page1 --> Page3 --> Page5 --> Page7 --> Page8
> or
> Page1 --> Page2 --> Page4 --> Page5 --> Page8
>
> Example of my model:
>
> #models.py
> from django.db import models
>
> class Poll(models.Model):
>     question1 = models.CharField(max_length=200)
>     pub_date1 = models.DateTimeField('date published')
>     question2_state = USStateField()
>     question3 = models.CharField(max_length=200)
>     question4 = models.CharField(max_length=200)
>     question5 = models.CharField(max_length=200)
>     question6...
>     agree = models.BooleanField(help_text='I agree that this is
> correct')
>
> #forms.py
> from django import forms
>
>  class PollForm1(forms.Form):
>      question1 = forms.CharField(max_length=200)
>      question2 = forms.ChoiceField(max_length=200)
>
>  class PollForm2(forms.Form):
>      question3 = forms.CharField(max_length=200)
>
>  class PollForm3(forms.Form):
>      question4 = forms.CharField(max_length=200)
>
>  class PollForm4(forms.Form):
>      question5 = forms.CharField(max_length=200)
>      question6 = forms.CharField(max_length=200)
>
>  class PollForm5...
>  class PollFormN...
>      agree = forms.BooleanField()
>
> Thanks in advance for the help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django forms validation with choice and m2m fields

2009-04-23 Thread Timboy

Thank you very much Alex!

On Apr 23, 9:28 pm, Alex Gaynor  wrote:
> On Fri, Apr 24, 2009 at 12:25 AM, Timboy  wrote:
>
> > Does this data get checked to make sure that it is what was on the
> > form?
>
> > If I have a list of choices 1,2,3 and someone modifies the form to add
> > a # 4 and chooses that will django forms catch it or do I need to make
> > sure on every one of my fields that the entered value is what was in
> > the list?
>
> > TIA
>
> Yes, if someone submits data that isn't a valid choice Django forms will
> validate and reject it.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Insensitivity of filtering to stressed chars

2009-04-23 Thread Karen Tracey
On Fri, Apr 24, 2009 at 12:24 AM, space0x42 wrote:

>
> HI all
>
> This is puzzling me:
> django 1.0 with a mysql database, innodb engine, database created with
> "character set utf8 collate utf8_general_ci."
>
> Filtering by object name is insensitive to stressed chars!
>
> EntityType.objects.get(name='sven') returns the same object of
> EntityType.objects.get(name='svèn')...
>
> This problem is generic, I did several test, both with objects named
> with stressed chars and objects with plain names and I always have
> both get and filter return the same object despite I pass stressed or
> plain version of name...
>
> Did some google search about this, but didn't find anything...am I
> missing something obvious?
>

This is due to MySQL's default collation. Though the doc here:

http://docs.djangoproject.com/en/dev/ref/databases/#collation-settings

only explicitly calls out case sensitivity the effect you are seeing with
accented characters is due to the same cause.  The doc linked above points
to the MySQL doc for more information, and gives some guidance on what
you'll need to do if you want to change to a stricter (binary equality)
collation.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django forms validation with choice and m2m fields

2009-04-23 Thread Alex Gaynor
On Fri, Apr 24, 2009 at 12:25 AM, Timboy  wrote:

>
> Does this data get checked to make sure that it is what was on the
> form?
>
> If I have a list of choices 1,2,3 and someone modifies the form to add
> a # 4 and chooses that will django forms catch it or do I need to make
> sure on every one of my fields that the entered value is what was in
> the list?
>
> TIA
> >
>
Yes, if someone submits data that isn't a valid choice Django forms will
validate and reject it.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Insensitivity of filtering to stressed chars

2009-04-23 Thread space0x42

HI all

This is puzzling me:
django 1.0 with a mysql database, innodb engine, database created with
"character set utf8 collate utf8_general_ci."

Filtering by object name is insensitive to stressed chars!

EntityType.objects.get(name='sven') returns the same object of
EntityType.objects.get(name='svèn')...

This problem is generic, I did several test, both with objects named
with stressed chars and objects with plain names and I always have
both get and filter return the same object despite I pass stressed or
plain version of name...

Did some google search about this, but didn't find anything...am I
missing something obvious?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django forms validation with choice and m2m fields

2009-04-23 Thread Timboy

Does this data get checked to make sure that it is what was on the
form?

If I have a list of choices 1,2,3 and someone modifies the form to add
a # 4 and chooses that will django forms catch it or do I need to make
sure on every one of my fields that the entered value is what was in
the list?

TIA
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Prolem dealing with json post data

2009-04-23 Thread Francis

Hi, I'm using dojo (also tried with jquery) to send json data to my
django application.

But I can't get it working properly.

The problem is that my json data is manage as a dict key with an empty
string as value.

json data :
{"Home":{"Id":"1","Name":"home"},"Home2":{"Id":"3","Name":"Home2"}}
django request post :


The only way I found is to convert them into a python dictionnary is
to do this :
"""
if request.method == 'POST':
postlist = request.POST.keys()[0]
json_data = json.JSONDecoder().decode(post)
"""

You can note that I need to take the keys()[0] to access the data.
It doesn't look right to me.

Do someone knows what I'm doing wrong ?

Thank you

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Enable Image macro on tracwiki markup (djangosnippet 1047)

2009-04-23 Thread Matías Iturburu
Nevermind, I think I'll cut the problem down and use markdown instead of
trac's mackup. I've found a way of handling images that seems more sane here
http://www.omh.cc/2008/aug/18/django-inserting-and-positioning-images/

Although I find trac's markup easier

2009/4/23 Matías Iturburu 

> Hi all
>
> I have been using this snippet
> http://www.djangosnippets.org/snippets/1047/ to enable the trac's excelent
> wiki markup to my app, so far so well, the snippet works flawlessy rendering
> _text_ , however I would like to use the [Image()] macro as it enables me to
> do some cool stuff with images already stored in the server.
>
> I'm not quite a pythonista myself and already spent a while trying to
> figure out what are the parts I'm missing.
> I also wonder what the problems of mixing macros from different frameworks
> would be.
>
> What do you guys think? I am just asking too much? :)
>
> Thanks for any pointer
>
>
> --
> Matías Iturburu
> Revoluciones Informáticas
> www.revolucionesweb.com.ar
> http://www.linkedin.com/in/miturburu
>



-- 
Matías Iturburu
Revoluciones Informáticas
www.revolucionesweb.com.ar
http://www.linkedin.com/in/miturburu

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ColdFusion components calling Django-Jython objects

2009-04-23 Thread EhVK9OAlL9oT

The Jython interpreter can be embedded in a ColdFusion page.  So I can
instantiate Django objects instead of serializing them, right?

http://www.jython.org/docs/embedding.html

http://www.jython.org/docs/javadoc/org/python/util/PythonInterpreter.html

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



Re: Configuring the Admin of a Child Class

2009-04-23 Thread Heigler

Here the Place is just an class, isn't a "real model" so you can't
register it in admin.
I've tried simulate your situation and worked very well to me (without
"city" field in ModelAdmin).

Can you paste the full models.py and admin.py files?
Try pasting here:
http://pastebin.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: rude, curt, and impatient, or direct, cut-through-the-B.S. communications? [was: Webpy vs Django]

2009-04-23 Thread Russell Keith-Magee

On Thu, Apr 23, 2009 at 10:19 PM, Phil Mocek
 wrote:
>
> On Thu, Apr 23, 2009 at 06:58:53AM -0700, joeygartin wrote:
>> Their inner sorrow is projected out in a form of rage and that usually
>> (hopefully) only comes out as rude, curt and inpatient.
>
> That's a common misperception.
>
> 

Phil - I can tell that you _really_ like ESR, but:

1) We'd be much obliged if you'd stop reposting great chunks of ESR's
essays. A link is fine.

2) If you would stop changing the subject line of discussions every
time you respond, that would be just dandy, too. Rapid-fire subject
changes don't help anyone keep track of what is going on.

3) This is one of those times that ESR has got things _completely_
bass ackwards.

Many hackers are rude. They may not intend to be rude, but we can only
judge a person by the words that come out of their mouth. It doesn't
take much effort to write in a way that won't be interpreted as
insulting. Hackers don't get a special pass to treat other people like
crap simply because they have 133t skillz. The correct response to the
perception of insult isn't to direct someone to an essay as to why
they are wrong in their perception - the correct response is to
apologize for any perceived insult, indicate that the insult wasn't
intended, and to rephrase your point in a way that isn't insulting.

Regardless of whether you agree with this last point, I'm telling you
now: on this point, ESR doesn't speak for the Django community. The
Django core team places a high value on civility. Anyone who makes a
regular habit of posting inappropriate abusive responses will be asked
- politely - to find somewhere else to vent their frustration.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to make the first row in the table (table header) bold

2009-04-23 Thread Nalini

Thanks alan..

On Apr 22, 5:00 pm, zayatzz  wrote:
> You can remove this if at all and use css based formatting if you want
> to.
>
> but otherwise :
> {% ifequal athlete.name coach.name %}
>     ...
> {% endifequal %}
>
> Taken from  http://docs.djangoproject.com/en/dev/topics/templates/
>
> Alan.
>
> On Apr 22, 2:48 pm, Nalini  wrote:
>
> > >  {% autopaginate rows 5%}
>
> > >   {% forrowin rows %}
> > >   
> > >         {% for value inrow%}
> > >             val=this.rowindex
> > >                  {% if (val == 0) %}
> > >                    {{ value }}
>
> > >                  {% else %}
>
> > >                          >{{ value }}
> > >                  {% endif %}
>
> > >     {% endfor %}
>
> > >    
> > >   {% endfor %}
>
> > >  {% paginate %}
>
> > When i try executing this script i get this error
>
> > 'if' statement improperly formatted
>
> > Can anyone help me..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Export to excel sheet in djanogo using pagination

2009-04-23 Thread Nalini

Hi,

I have many pages to be exported to the excel sheet. I use django and
javascript.
i use pagination. Can any one help me out ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ColdFusion components calling Django-Jython objects

2009-04-23 Thread Joshua Partogi

I don't know much about ColdFusion. But if you ever want to call
django components you can make a loosely coupled by sending JSON
objects from django to your Coldfusion apps.

On Apr 24, 9:47 am, EhVK9OAlL9oT  wrote:
> Hi,
>
> Can ColdFusion components call Django objects?  Do I need to install
> Django on the ColdFusion server?  Or can I use Django + Jython to
> provide ColdFusion with my Django objects?
>
> http://code.google.com/p/django-jython/wiki/WarDeployment
>
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ColdFusion components calling Django-Jython objects

2009-04-23 Thread EhVK9OAlL9oT

Hi,

Can ColdFusion components call Django objects?  Do I need to install
Django on the ColdFusion server?  Or can I use Django + Jython to
provide ColdFusion with my Django objects?

http://code.google.com/p/django-jython/wiki/WarDeployment

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



Re: Show user page on first login.

2009-04-23 Thread Joshua Partogi



On Apr 24, 4:14 am, tristan  wrote:
> Hi there,
>
> I'm build a Django web-app with some pinax components, and would like
> to show to take the user to a specific page on their first login, and
> afterwards not show them that page again.
> Has anyone implemented this, or seen any example code for it?

I haven't use Pinax before, but you can manipulate that with
HttpResponseRedirect.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django on tomcat

2009-04-23 Thread Joshua Partogi

On Apr 24, 8:33 am, Brendan Miller  wrote:
> What servers does django support? Is there any way to get it with
> cpython to run on top of tomcat?

Aren't you suppose to use Jython for that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Configuring the Admin of a Child Class

2009-04-23 Thread vitramarweb



On Apr 24, 12:07 am, Heigler  wrote:
> Hello,
> I think the problem isn't currency in your ModelAdmin, i think the
> problem is the field "city", where is it in your CountryModel?

Thanks for the answer.
I already correct that, and also in the import (it was a bad copy-
paste) and still getting the same problem.

from vitramar.lugares.models import Place, Country
from django.contrib import admin

class CountryAdmin(admin.ModelAdmin):
fieldsets = [
(None,   {'fields': ['country']}),
('General info', {'fields': ['continent', 'president',
'currency'], 'classes': ['collapse']}),
]

admin.site.register(Country, CountryAdmin)

By the way, I tried:
admin.site.register(Place)
and when trying to add a new place gives an error:

Page not found (404)
Request Method: GET
Request URL:http://127.0.0.1:8000/admin/lugares/place/add/

App u'lugares', model u'place', not found.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django on tomcat

2009-04-23 Thread Brendan Miller

What servers does django support? Is there any way to get it with
cpython to run on top of tomcat?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: graph tools

2009-04-23 Thread R. Gorman

There's also Google visualizations (http://code.google.com/apis/
visualization/). They have a python library that can easily interact
with Django (http://code.google.com/apis/visualization/documentation/
dev/gviz_api_lib.html).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: dynamic form wizards

2009-04-23 Thread Dougal Matthews
First result in a google search for "django dynamic forms" gives you this;
http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/
Just so happens I read it today and found it useful.

You can create your form fields on the fly in the __init__, I've got a form
thats completely generated from my models.

Dougal


---
Dougal Matthews - @d0ugal
http://www.dougalmatthews.com/



2009/4/23 Dennis Schmidt 

>
> Hi there,
>
> I need to dynamically create complex forms in my application. Since
> version 1.0 django has these form wizards, which can manage complex
> forms quite well.
> Now my only problem is, that they apparently have to be statically
> mapped by the urls.py. But what I need is a different set of forms for
> the wizard, depending of an ID specified in the URL.
>
> ie /order/1/accept/ shall use OrderAcceptionWizard([OrderPartOneForm,
> OrderPartTwoForm]) but
> /order/2/accept/ shall use OrderAcceptionWizard([OrderPartOneForm,
> OrderPartThreeForm]).
>
> any idea if this is somehow possible?
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Configuring the Admin of a Child Class

2009-04-23 Thread Heigler

Hello,
I think the problem isn't currency in your ModelAdmin, i think the
problem is the field "city", where is it in your CountryModel?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Configuring the Admin of a Child Class

2009-04-23 Thread vitramarweb

Hi, I am still pretty new here and a bit confused.
I have the next models:

Place is an abstract class

class Place(models.Model):

place = models.CharField(_('place'), max_length=128)
currency = models.CharField(_('currency'), max_length=128)
#...
#... and many other generic data about a place
class Meta:
abstract = True
verbose_name = "place"
verbose_name_plural = "places"
ordering = ('place','currency',)
def __unicode__(self):
return self.place

A Country is a Place

class Country(Place):

country = models.CharField(_('country'), max_length = 100)
continent = models.CharField(_('continent'), max_length = 100,
blank
= True, null=True)
president = models.CharField(_('president'), max_length = 100,
blank
= True, null=True)

class Meta:
abstract = False
ordering = ('country',)
verbose_name = "country"
verbose_name_plural = "countries"

def __unicode__(self):
return self.country


And in the Admin.py I would like to edit the currency field too

from vitramar.lugares.models import Place, City
from django.contrib import admin

class CountryAdmin(admin.ModelAdmin):
fieldsets = [
(None,   {'fields': ['city']}),
('General info', {'fields': ['continent', 'president',
'currency'], 'classes': ['collapse']}),
]

admin.site.register(Country, CountryAdmin)

But i get the error:
ImproperlyConfigured at /admin/
'CountryAdmin.fieldsets[1][1]['fields']' refers to field 'currency'
that is missing from the form.

I have already tried with place.currency, place_currency,
place._currency with no luck.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Configuring the Admin of a child class

2009-04-23 Thread Felix de Vitramar

Hi, I am still pretty new here and a bit confused.
I have the next models:

Place is an abstract class

class Place(models.Model):

place = models.CharField(_('place'), max_length=128)
currency = models.CharField(_('currency'), max_length=128)
#... 
#... and many other generic data about a place
class Meta:
abstract = True
verbose_name = "place"
verbose_name_plural = "places"
ordering = ('place','currency',)
def __unicode__(self):
return self.place

A Country is a Place

class Country(Place):

country = models.CharField(_('country'), max_length = 100)
continent = models.CharField(_('continent'), max_length = 100, blank
= True, null=True)
president = models.CharField(_('president'), max_length = 100, blank
= True, null=True)

class Meta:
abstract = False
ordering = ('country',)
verbose_name = "country"
verbose_name_plural = "countries"

def __unicode__(self):
return self.country
   

And in the Admin.py I would like to edit the currency field too

from vitramar.lugares.models import Place, City
from django.contrib import admin

class CountryAdmin(admin.ModelAdmin):
fieldsets = [
(None,   {'fields': ['city']}),
('General info', {'fields': ['continent', 'president',
'currency'], 'classes': ['collapse']}),
]

admin.site.register(Country, CountryAdmin)

But i get the error: 
ImproperlyConfigured at /admin/
'CountryAdmin.fieldsets[1][1]['fields']' refers to field 'currency' that is 
missing from the form.

I have already tried with place.currency, place_currency,
place._currency with no luck.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-23 Thread Tyler Erickson

Following up on my last post... After using distinct(), the count() is
what I expect, but when I iterate through the queryset results there
are more results that I expect, and the count of the queryset changes
(see example below).

--
def get_unique_vehicles():

q = TruckLog.objects.values('vehicleid').distinct()

print 'count before loop = ' + str(q.count())
for i in q:
print i
print 'count after loop = ' + str(q.count())
--

Produces the following output...

--
count before loop = 3
{'vehicleid': 80533}
{'vehicleid': 80480}
{'vehicleid': 80437}
{'vehicleid': 80437}
{'vehicleid': 80533}
{'vehicleid': 80480}
{'vehicleid': 80533}
{'vehicleid': 80533}
{'vehicleid': 80437}
{'vehicleid': 80533}
{'vehicleid': 80480}
count after loop = 11
--
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: updating dependent page from an iframe

2009-04-23 Thread snorkel

Sadly can't think of another way of organizing  page with the need of
functionality unless I use an iframe
but I'm trying to do a reload with Javascript - without success so far
thanks

On Apr 23, 9:25 pm, Florian Strzelecki 
wrote:
> I think this is a basic html's problem, and, I'll suppose that you absolutly
> need an iframe on your site.
>
> So, when you make something in an iframe, the another have to be reloaded.
> With Javascript, or another way...
>
> And if you don't want to reload the entire iframe, use Ajax technologie...
>
> Hm... but... are you sure you need an iframe ? :x
>
> 2009/4/23 snorkel 
>
>
>
> > Hi,
> >  I have a page with an iframe which contains operations on model data
> > such as adding /deleting etc
> > and the rest of the page which has a clickable list of all the items.
> >  However when you add or delete an item via the ifame the list does
> > not update.
> > Should I be using reload or is there another method?
>
> > Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: updating dependent page from an iframe

2009-04-23 Thread Florian Strzelecki
I think this is a basic html's problem, and, I'll suppose that you absolutly
need an iframe on your site.

So, when you make something in an iframe, the another have to be reloaded.
With Javascript, or another way...

And if you don't want to reload the entire iframe, use Ajax technologie...

Hm... but... are you sure you need an iframe ? :x

2009/4/23 snorkel 

>
> Hi,
>  I have a page with an iframe which contains operations on model data
> such as adding /deleting etc
> and the rest of the page which has a clickable list of all the items.
>  However when you add or delete an item via the ifame the list does
> not update.
> Should I be using reload or is there another method?
>
> Thanks
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-23 Thread Tyler Erickson

I seem to be encountering the same or similar issue. The distinct()
method seems to have no affect on my queryset.

I am using PostgreSQL, and the django.contrib.gis.db models object.

ipdb> p TruckLog.objects.values('vehicleid')
[{'vehicleid': 80533}, {'vehicleid': 80480}, {'vehicleid': 80437},
{'vehicleid': 80437}, {'vehicleid': 80533}, {'vehicleid': 80480},
{'vehicleid': 80533}, {'vehicleid': 80533}, {'vehicleid': 80437},
{'vehicleid': 80533}, {'vehicleid': 80480}]

ipdb> p TruckLog.objects.values('vehicleid').distinct()
[{'vehicleid': 80533}, {'vehicleid': 80480}, {'vehicleid': 80437},
{'vehicleid': 80437}, {'vehicleid': 80533}, {'vehicleid': 80480},
{'vehicleid': 80533}, {'vehicleid': 80533}, {'vehicleid': 80437},
{'vehicleid': 80533}, {'vehicleid': 80480}]
ipdb>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Opera File Upload Issue

2009-04-23 Thread pcoles

Szymon discovered the cause - which was a  bug in modwsgi 2.3 that is
now fixed in modwsgi 2.4

http://code.google.com/p/modwsgi/issues/detail?id=121 (thanks for the
fix Graham!)

On Apr 23, 2:35 pm, Szymon  wrote:
> Hello,
>
> I've faced same problem today. Have you find solution? Or anyone know
> what can be wrong?
>
> Best regards,
> Szymon
>
> On 30 Mar, 18:37, Peter  wrote:
>
> > I'm having an opera file upload issue, which may not be django's
> > fault, but I'm curious if anyone has seen it (and has a solution)...
>
> > When I upload an image *only in opera* (specifically 9.64 on mac osx)
> > it doesn't appear in request.FILES.  However, if I upload a really
> > small image 8kb, it works.  Same problem as this 
> > post:http://groups.google.com/group/django-users/browse_thread/thread/eecc...
> > (which no one has responded to)
>
> > The only other thing that I could find on the internet that might
> > refer to this was from this thread (in 
> > 2001!):http://list.opera.com/pipermail/opera-users/2001-June/004854.html I'm
> > currently running a very standard version of apache.
>
> > If anyone else has encountered and solved this problem your input
> > would be greatly appreciated!
>
> > (also, yes the form has the proper enctype and the upload field is
> > just rendered directly by the django form resulting in  > type="file" name="image" id="id_image" />)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Writing csv files to server

2009-04-23 Thread Florian Strzelecki
Hm... in my opinion this isn't a Django problem, but a conception problem.

I think you need a "state" on the invoices : when does it have been paid ?
If you know when, so you can filter on the date of paiement.

Exemple :

Paid (id-1, sales-1, date_paid-2009-03-02, value-$150)
Paid (id-1, sales-1, date_paid-2009-03-24, value-$100)
Paid (id-2, sales-1, date_paid-2009-04-02, value-$400)

And, in another table, you could have this :

Invoice (id-1, client-1, value-$650, is_paid-1)

At 2009-03-25 you can say : the client have paid $350, remain $400.
At 2009-04-12 you can say : the client have paid $650, remain $0

And, if you want, at 2009-05-06 say "at 2009-03-25 what was the state of
this sales ?" : you are able to give this information !

2009/4/23 Alfonso 

> Does anyone have a better suggestion and how would I start writing to
> csv on server.
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Enable Image macro on tracwiki markup (djangosnippet 1047)

2009-04-23 Thread Matías Iturburu
Hi all

I have been using this snippet
http://www.djangosnippets.org/snippets/1047/to enable the trac's
excelent wiki markup to my app, so far so well, the
snippet works flawlessy rendering _text_ , however I would like to use the
[Image()] macro as it enables me to do some cool stuff with images already
stored in the server.

I'm not quite a pythonista myself and already spent a while trying to figure
out what are the parts I'm missing.
I also wonder what the problems of mixing macros from different frameworks
would be.

What do you guys think? I am just asking too much? :)

Thanks for any pointer


-- 
Matías Iturburu
Revoluciones Informáticas
www.revolucionesweb.com.ar
http://www.linkedin.com/in/miturburu

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Writing csv files to server

2009-04-23 Thread Alfonso

I need to generate a statement at the end of the month that grabs all
the invoices for that month and lets the client knows who hasn't paid
on time. Problem is the usual setup I have of creating a view/template
that simply shows unpaid invoices (within a statement) doesn't stay
persistent, i.e. when one invoice is paid it disappears from the
statement and the client wants to have these statements as a sort of
permanent 'snapshot' of everything that wasn't settled at that time.

I'm at a bit of a loss to make this work but figure writing the
relevant data to csv on the server and pulling it through in a custom
django template could be a way to go.

Does anyone have a better suggestion and how would I start writing to
csv on server.

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Only show field in admin for superuser

2009-04-23 Thread phoebebright

That just what I needed!  Many thanks.
Here is the code that worked for me:

class WhoAdmin(admin.ModelAdmin):

fields = ('name','owner')

def get_fieldsets(self, request, obj=None):

fs = super(WhoAdmin, self).get_fieldsets(request, obj)
# only allow superusers to see/change owner
fields=list(fs[0][1]['fields'])


if not request.user.is_superuser:
fields.remove('owner')

return [(None, {'fields': tuple(fields)})]

def queryset(self, request):
if request.user.is_superuser:
return Who.objects.all()
else:
return Who.objects.filter(owner=request.user)

class Meta:
model = Who

admin.site.register(Who,WhoAdmin)


On Apr 23, 12:06 pm, Zain Memon  wrote:
> In that case, try overriding ModelAdmin.get_fieldsets(); add the owner field
> to self.fieldset if request.user.is_superuser, and then call
> super.get_fieldsets().
> For reference, you can find get_fieldsets() (and other beautiful things you
> can override) in django/contrib/admin/options.py.
>
> On Thu, Apr 23, 2009 at 3:32 AM, phoebebright wrote:
>
>
>
>
>
> > Zain,
>
> > Thanks for responding.
> > I would really prefer not to show the field at all - I don't want
> > ordinary users being able to see a list of all the users on the
> > system!
>
> > Phoebe
>
> > On Apr 23, 9:42 am, Zain Memon  wrote:
> > > You can override the ModelAdmin.save_model() method to check if the
> > current
> > > user has permission to change the owner.
> > > Take a look athttp://www.b-list.org/weblog/2008/dec/24/admin/tosee an
> > > example.
>
> > > On Thu, Apr 23, 2009 at 1:37 AM, phoebebright  > >wrote:
>
> > > > I have a model with an owner field that I only want a superuser to be
> > > > able to change.  I can't change the list of fields in form in admin.py
> > > > because there is not request.user to test at that time.  If I were
> > > > using custom templates I could put it in the template, but would
> > > > rather stick to the standard admin.
>
> > > > If I add the field by default, Is there somewhere I could remove the
> > > > field as it's being loaded if the requesting user is not a superuser?
> > > > Any ideas gratefully received!
>
> > > > THIS DOES NOT WORK:
>
> > > >    if request.user.is_superuser:
> > > >         fieldsets = [
> > > >             (None,   {'fields':
> > > > ['tourism','community','cat','name','is_live','paid','owner']}),
> > > >             ('Contact', {'fields':
> > > > ['phone','mobile','fax','email','web','address']}),
> > > >             ('Details', {'fields':
> > > > ['description','pic1','pic2','pic3','pic4']}),
> > > >         ]
> > > >    else:
> > > >         fieldsets = [
> > > >             (None,   {'fields':
> > > > ['tourism','community','cat','name','is_live','paid','owner']}),
> > > >             ('Contact', {'fields':
> > > > ['phone','mobile','fax','email','web','address']}),
> > > >             ('Details', {'fields':
> > > > ['description','pic1','pic2','pic3','pic4']}),
> > > >         ]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Update only one field on save

2009-04-23 Thread Alex Gaynor
On Thu, Apr 23, 2009 at 2:50 PM, Michel Thadeu Sabchuk
wrote:

>
> Hi guys,
>
> I'm loooking for a way to update only one field when changing a model.
> I started from:
>
> object = get_object_or_404(SomeModel)
> object.hits += 1
> object.save()
>
> I using django1.1. I saw there is a ticket talking about this:
>
> http://code.djangoproject.com/ticket/4102
>
> And a snippet too:
>
> http://www.djangosnippets.org/snippets/479/
>
> But I want to know if there is a better way. I'm trying:
>
> object = get_object_or_404(SomeModel)
> SomeModel.objects.filter(id=object.id).update(hits=object.hits+1)
> object.save()
>
> This way I do what I want but, is this the better approach?
>
> Do I need to worry about performance at this point or an update method
> over all fields of a model aren't so bad?
>
> Best regards,
> >
>
In Django 1.1 you can do:

Model.objects.filter(pk=z).update(hits=F('hits')+1)

Which will be atomic at the DB level.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Update only one field on save

2009-04-23 Thread Michel Thadeu Sabchuk

Hi guys,

I'm loooking for a way to update only one field when changing a model.
I started from:

object = get_object_or_404(SomeModel)
object.hits += 1
object.save()

I using django1.1. I saw there is a ticket talking about this:

http://code.djangoproject.com/ticket/4102

And a snippet too:

http://www.djangosnippets.org/snippets/479/

But I want to know if there is a better way. I'm trying:

object = get_object_or_404(SomeModel)
SomeModel.objects.filter(id=object.id).update(hits=object.hits+1)
object.save()

This way I do what I want but, is this the better approach?

Do I need to worry about performance at this point or an update method
over all fields of a model aren't so bad?

Best regards,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Opera File Upload Issue

2009-04-23 Thread Szymon

Hello,

I've faced same problem today. Have you find solution? Or anyone know
what can be wrong?

Best regards,
Szymon

On 30 Mar, 18:37, Peter  wrote:
> I'm having an opera file upload issue, which may not be django's
> fault, but I'm curious if anyone has seen it (and has a solution)...
>
> When I upload an image *only in opera* (specifically 9.64 on mac osx)
> it doesn't appear in request.FILES.  However, if I upload a really
> small image 8kb, it works.  Same problem as this 
> post:http://groups.google.com/group/django-users/browse_thread/thread/eecc...
> (which no one has responded to)
>
> The only other thing that I could find on the internet that might
> refer to this was from this thread (in 
> 2001!):http://list.opera.com/pipermail/opera-users/2001-June/004854.html I'm
> currently running a very standard version of apache.
>
> If anyone else has encountered and solved this problem your input
> would be greatly appreciated!
>
> (also, yes the form has the proper enctype and the upload field is
> just rendered directly by the django form resulting in  type="file" name="image" id="id_image" />)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem in tutorial

2009-04-23 Thread Karen Tracey
On Thu, Apr 23, 2009 at 11:48 AM, Mike Ramirez  wrote:

> On Thursday 23 April 2009 07:43:14 am Karen Tracey wrote:
> > which was closed as a dup of another bug which was fixed pretty recently.
> > So you can either try with a recent SVN checkout, or (what I do) just use
> > the mysql program directly rather than going through manage.py dbshell
> for
> > stuff like this.
> >
> > Karen
> >
>
> Just a quick question, from my experience, dbshell seems it is just a
> simple
> way of launching into the mysql/postgres cli clients.  So the question is
> which mysql program are you talking about?
>

This one:

http://dev.mysql.com/doc/refman/5.0/en/mysql.html

On Windows it's installed into \bin, e.g. someplace like
c:\Program Files\MySQL\MySQL Server 5.0\bin\mysql.exe.  You may need to add
that directory to your Windows PATH if you want to be able to run it without
specifying the full path to it -- I don't think the install does that.  On
Linux it is generally automatically installed into someplace where it will
be on your path automatically.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



updating dependent page from an iframe

2009-04-23 Thread snorkel

Hi,
  I have a page with an iframe which contains operations on model data
such as adding /deleting etc
and the rest of the page which has a clickable list of all the items.
  However when you add or delete an item via the ifame the list does
not update.
Should I be using reload or is there another method?

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Show user page on first login.

2009-04-23 Thread tristan

Hi there,

I'm build a Django web-app with some pinax components, and would like
to show to take the user to a specific page on their first login, and
afterwards not show them that page again.
Has anyone implemented this, or seen any example code for it?

Thanks,

Tristan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: doctest testing with templatefilters

2009-04-23 Thread Jari Pennanen

Found out that putting them to tests.py *does* run them, but since
when all is "ok" it won't print anything... But nevertheless I
wouldn't like to put them root, and inside "if __name__ ==
'__main__':", manage.py test myapp wont find them.

On Apr 23, 8:11 pm, Jari Pennanen  wrote:
> Hi!
>
> I'm just wondering the same thing, not exact same, but this:
>
> How do I run doctests when doing "./manage.py test myapp", where
> should I define doctest.testmod(...) lines? In root of tests.py it
> doesn't work.
>
> On Apr 12, 7:51 pm, Julian  wrote:
>
> > hello,
>
> > I am testing some of my filters with doctests. it's very easy, but I
> > have to call the module with the filters manually:
>
> > python /foo/bar/templatetags/eggs_extra.py -v
>
> > to let the doctest run.
>
> > Now I've added at the end of the egg.py the following code:
>
> > def run_doctest():
> >     import doctest
> >     doctest.testmod()
>
> > and at the beginning of the tests.py the following:
>
> > from foo/bar/templatetags/eggs_extra.py import run_doctest
>
> > run_doctest()
>
> > but nothing happens.
>
> > what can I do that that the doctests in the template filters are run
> > with ./manage.py test?
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: doctest testing with templatefilters

2009-04-23 Thread Jari Pennanen

Hi!

I'm just wondering the same thing, not exact same, but this:

How do I run doctests when doing "./manage.py test myapp", where
should I define doctest.testmod(...) lines? In root of tests.py it
doesn't work.

On Apr 12, 7:51 pm, Julian  wrote:
> hello,
>
> I am testing some of my filters with doctests. it's very easy, but I
> have to call the module with the filters manually:
>
> python /foo/bar/templatetags/eggs_extra.py -v
>
> to let the doctest run.
>
> Now I've added at the end of the egg.py the following code:
>
> def run_doctest():
>     import doctest
>     doctest.testmod()
>
> and at the beginning of the tests.py the following:
>
> from foo/bar/templatetags/eggs_extra.py import run_doctest
>
> run_doctest()
>
> but nothing happens.
>
> what can I do that that the doctests in the template filters are run
> with ./manage.py test?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem in tutorial

2009-04-23 Thread Mike Ramirez
On Thursday 23 April 2009 07:43:14 am Karen Tracey wrote:
> which was closed as a dup of another bug which was fixed pretty recently.
> So you can either try with a recent SVN checkout, or (what I do) just use
> the mysql program directly rather than going through manage.py dbshell for
> stuff like this.
>
> Karen
>

Just a quick question, from my experience, dbshell seems it is just a simple 
way of launching into the mysql/postgres cli clients.  So the question is 
which mysql program are you talking about?

Mike
-- 
Reappraisal, n.:
An abrupt change of mind after being found out.


signature.asc
Description: This is a digitally signed message part.


Re: Problem in tutorial

2009-04-23 Thread Karen Tracey
On Thu, Apr 23, 2009 at 3:54 AM, 83nini <83n...@gmail.com> wrote:

>
> Hi guys,
>
> I'm working on django tutorial that is in "www.djangobook.com", I'm in
> chapter6 where i'm in the process of creating an admin Web site.
> The site is created and it works just perfectly, the thing is I'm
> trying to make some date and numeric fields optional, so I modified
> the models.py folder and added the "null=True" statement as follows:
>
> publication_date = models.DateField(blank=True, null=True)
>
> now according to what's written in the book, it is my responsibility
> to ALTER TABLE statement whenever such a change is made in the
> models.py file, so I did the following:
>  1. called python manage.py dbshell from the command line
>  2. when i got the dbshell "mysql>", i wrote the following statement
> ALTER TABLE books_book ALTER COLUMN publication_date DROP NOT
> NULL;
>
> I'm getting "ALTER is not an internal command, external command,
> program or commandfile"
>
> WHY???


This sounds like:

http://code.djangoproject.com/ticket/10639

which was closed as a dup of another bug which was fixed pretty recently.
So you can either try with a recent SVN checkout, or (what I do) just use
the mysql program directly rather than going through manage.py dbshell for
stuff like this.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Importing from many apps causing import conflicts?

2009-04-23 Thread Karen Tracey
[Replying to your first message rather than your last because this is the
one with a traceback showing why this problem is happening.  See comments
inline in the traceback.]

On Wed, Apr 22, 2009 at 9:33 AM, robin  wrote:

>
> I have an unexplainable problem involving importing from 3 apps and
> one python script.
> Thank you to those who took the time to understand this problem.
>
> Sorry I cannot explain this problem, I tried to make it as simple as
> possible below.
>
> 'acc' has many 'numbers' which has a one-to-one relationship with
> 'two'.
>
> 'python run.py' tries to import from 'numbers' but causes import
> errors when 'acc' modelchoicefield queryset changes from 'all' to
> 'filter'
>
> acc/models.py--
>
> from django.db import models
> from django import forms
>
> class Group(models.Model):
>  name=models.IntegerField()
>
> class User(models.Model):
>  group=models.ForeignKey(Group)
>
> class UserForm(forms.ModelForm):
>  group=forms.ModelChoiceField(Group.objects.all()) #causes problem if
> changed to Group.objects.filter(name='blah')
>  class Meta:
>model=User
>
> number/models.py
>
> from django.db import models
> from acc.models import User
>
> class Number(models.Model):
>  name=models.IntegerField()
>
> ---two/models.py-
>
> from django.db import models
> from numbers.models import Number
>
> class Two(models.Model):
>  number=models.OneToOneField(Number,primary_key=True) #potential
> problem line
>
> ---run.py---
>
> #!/usr/bin/env python
> from django.core.management import setup_environ
> import settings
> setup_environ(settings)
> from numbers.models import Number
>
> ###PROBLEM-###
>
> With the above setup, if i execute: python run.py, it should be fine.
> BUT the problem occurs the moment i change acc.models from:
>
> group=forms.ModelChoiceField(Group.objects.all())
> #TO#
> group=forms.ModelChoiceField(Group.objects.filter(name='blah'))
>
> The last error it will show is:
>
> File "/home/robin/test/toast/two/models.py", line 2, in 
>from numbers.models import Number
> ImportError: cannot import name Number
>
>
> Thanks a lot,
> Robin
>
>
> The complete errors are below:
>
> Traceback (most recent call last):
>  File "expire_listing.py", line 6, in 
>from numbers.models import Number


It all starts with attempting to import Number from numbers.models...


>
>  File "/home/robin/test/toast/numbers/models.py", line 2, in 
>from acc.models import User


which leads to needing to import User from acc.models...


>
>  File "/home/robin/test/toast/acc/models.py", line 11, in 
>class UserForm(forms.ModelForm):


and acc.models contains a UserForm class definition...


>
>  File "/home/robin/test/toast/acc/models.py", line 12, in UserForm
>group=forms.ModelChoiceField(Group.objects.filter(name__in=[0,1]))


which includes a Group.objects.filter() call.  filter() has a bit of work to
do...


>
>  File "/usr/lib/python2.5/site-packages/django/db/models/manager.py",
> line 102, in filter
>return self.get_query_set().filter(*args, **kwargs)
>  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> line 489, in filter
>return self._filter_or_exclude(False, *args, **kwargs)
>  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> line 507, in _filter_or_exclude
>clone.query.add_q(Q(*args, **kwargs))
>  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> query.py", line 1258, in add_q
>can_reuse=used_aliases)
>  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> query.py", line 1133, in add_filter
>negate=negate, process_extras=process_extras)
>  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> query.py", line 1309, in setup_joins
>field, model, direct, m2m = opts.get_field_by_name(name)
>  File "/usr/lib/python2.5/site-packages/django/db/models/options.py",
> line 281, in get_field_by_name
>cache = self.init_name_map()
>  File "/usr/lib/python2.5/site-packages/django/db/models/options.py",
> line 311, in init_name_map
>for f, model in self.get_all_related_m2m_objects_with_model():
>  File "/usr/lib/python2.5/site-packages/django/db/models/options.py",
> line 388, in get_all_related_m2m_objects_with_model
>cache = self._fill_related_many_to_many_cache()
>  File "/usr/lib/python2.5/site-packages/django/db/models/options.py",
> line 402, in _fill_related_many_to_many_cache
>for klass in get_models():
>  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
> line 136, in get_models
>self._populate()
>  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
> line 57, in _populate
>self.load_app(app_name, True)


which eventually requires ensuring that your app is loaded...


>
>  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
> line 72, in load_app
>mod = __import__(app_name, {}, {}, 

rude, curt, and impatient, or direct, cut-through-the-B.S. communications? [was: Webpy vs Django]

2009-04-23 Thread Phil Mocek

On Thu, Apr 23, 2009 at 06:58:53AM -0700, joeygartin wrote:
> Their inner sorrow is projected out in a form of rage and that usually
> (hopefully) only comes out as rude, curt and inpatient.

That's a common misperception.



>> ## Dealing with rudeness ##
>> 
>> Much of what looks like rudeness in hacker circles is not intended to
>> give offense. Rather, it's the product of the direct,
>> cut-through-the-bullshit communications style that is natural to
>> people who are more concerned about solving problems than making
>> others feel warm and fuzzy.
>> 
>> When you perceive rudeness, try to react calmly. If someone is really
>> acting out, it is very likely a senior person on the list or
>> newsgroup or forum will call him or her on it. If that doesn't happen
>> and you lose your temper, it is likely that the person you lose it at
>> was behaving within the hacker community's norms and you will be
>> considered at fault. This will hurt your chances of getting the
>> information or help you want.
>> 
>> On the other hand, you will occasionally run across rudeness and
>> posturing that is quite gratuitous. The flip-side of the above is
>> that it is acceptable form to slam real offenders quite hard,
>> dissecting their misbehavior with a sharp verbal scalpel. Be very,
>> very sure of your ground before you try this, however. The line
>> between correcting an incivility and starting a pointless flamewar is
>> thin enough that hackers themselves not infrequently blunder across
>> it; if you are a newbie or an outsider, your chances of avoiding such
>> a blunder are low. If you're after information rather than
>> entertainment, it's better to keep your fingers off the keyboard than
>> to risk this.
>> 
>> (Some people assert that many hackers have a mild form of autism or
>> Asperger's Syndrome, and are actually missing some of the brain
>> circuitry that lubricates "normal" human social interaction. This may
>> or may not be true. If you are not a hacker yourself, it may help you
>> cope with our eccentricities if you think of us as being
>> brain-damaged. Go right ahead. We won't care; we like being whatever
>> it is we are, and generally have a healthy skepticism about clinical
>> labels.)
>> 
>> In the next section, we'll talk about a different issue; the kind of
>> "rudeness" you'll see when you misbehave.
>>
>> 
>> ## On Not Reacting Like A Loser ##
>> 
>> Odds are you'll screw up a few times on hacker community forums -- in
>> ways detailed in this article, or similar. And you'll be told exactly
>> how you screwed up, possibly with colourful asides. In public.
>> 
>> When this happens, the worst thing you can do is whine about the
>> experience, claim to have been verbally assaulted, demand apologies,
>> scream, hold your breath, threaten lawsuits, complain to people's
>> employers, leave the toilet seat up, etc. Instead, here's what you
>> do:
>> 
>> Get over it. It's normal. In fact, it's healthy and appropriate.
>> 
>> Community standards do not maintain themselves: They're maintained by
>> people actively applying them, visibly, in public. Don't whine that
>> all criticism should have been conveyed via private e-mail: That's
>> not how it works. Nor is it useful to insist you've been personally
>> insulted when someone comments that one of your claims was wrong, or
>> that his views differ. Those are loser attitudes.
>> 
>> There have been hacker forums where, out of some misguided sense of
>> hyper-courtesy, participants are banned from posting any
>> fault-finding with another's posts, and told "Don't say anything if
>> you're unwilling to help the user." The resulting departure of
>> clueful participants to elsewhere causes them to descend into
>> meaningless babble and become useless as technical forums.
>> 
>> Exaggeratedly "friendly" (in that fashion) or useful: Pick one.
>> 
>> Remember: When that hacker tells you that you've screwed up, and (no
>> matter how gruffly) tells you not to do it again, he's acting out of
>> concern for (1) you and (2) his community. It would be much easier
>> for him to ignore you and filter you out of his life. If you can't
>> manage to be grateful, at least have a little dignity, don't whine,
>> and don't expect to be treated like a fragile doll just because
>> you're a newcomer with a theatrically hypersensitive soul and
>> delusions of entitlement.
>> 
>> Sometimes people will attack you personally, flame without an
>> apparent reason, etc., even if you don't screw up (or have only
>> screwed up in their imagination). In this case, complaining is the
>> way to really screw up.
>> 
>> These flamers are either lamers who don't have a clue but believe
>> themselves to be experts, or would-be psychologists testing whether
>> you'll screw up. The other readers either ignore them, or find ways
>> to deal with them on their own. The flamers' behavior creates
>> problems for themselves, which don't have to

Re: New site: www.portaltotheuniverse.org

2009-04-23 Thread larsholm

Not at all :-)

For the site we use:
feedparser (nearly obviously for the feed parsing - it's unbeatable)
beautifulsoup
django-command-extensions
django-batchadmin (which I'm very happy to see makes it into Django
1.1)
django-mptt (for our menu system)
djangodblog
PIL
threadpool
SSLMiddleware

For deployment we're using a combination of Paver (with some of our
own add-ons), Fabric and virtualenv - all of it works really well
together and makes deployment so much easier.

Besides that we have a growing common code base for all our sites,
that contains all the base components you just need in a site (menus +
breadcrumbs generation, a more flexible flatpages app with TinyMCE
editor, searching etc). Most of our code base, I'd like to release as
open source, but it's quite a big task for the initial stuff we did,
which is basically where it gets stuck. The new applications we are
doing, we have much greater focus on making them open source, so
hopefully you should see small apps coming from us in a not so distant
future (ESO is after all funded with tax money ;-).

Cheers,
Lars

On Apr 23, 3:34 pm, Zain Memon  wrote:
> Cool! Mind sharing the names of any open source django apps you used?
>
>
>
> On Thu, Apr 23, 2009 at 6:09 AM, larsholm  wrote:
>
> > Dear all,
>
> > Allow me to advertise for our new Django based site:
> >http://www.portaltotheuniverse.org
>
> > Keeping up-to-date with cutting-edge astronomy and space science
> > breakthroughs has just become that much easier, thanks to the Portal
> > To The Universe, the latest Cornerstone project of the International
> > Year of Astronomy 2009 (IYA2009).
>
> > On the tech side it basically boils down to a content-specific feed
> > aggregator with a number of important add-ons:
> > - human moderation to feature high quality content.
> > - embargoed press releases for journalists with login (works in much
> > the same way as when journalists can be invited to watch new movies a
> > day before everybody else).
> > - the RSS crawler is fast and updated very often to keep up-to-date
> > with the news development during the day.
>
> > This is our third major Django-based website we have done here at ESO
> > - European Southern Observatory (located in Munich, Germany), and we
> > naturally have more websites with astronomy content in the pipeline.
>
> > Thanks for viewing!
>
> > Lars Holm Nielsen 
> > ESO - European Southern Observatory
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Webpy vs Django

2009-04-23 Thread joeygartin

I almost made a comment the other day on this topic in regards to how
to "Properly reply to a question" and other etiquette.

Several years ago I entered the tech and IT industry and quickly
noticed the incredible lack of good social skills by my peers.  It
went beyond not knowing how to dress (beyond fashion sense, but not
realizing your clothes were wrinkled, dirty and had a bad odor) or how
to talk to girls, it included the inability to control inner
dialogue.  There was a genuine inability to understand true team
dynamics.  I had transferred to the "computer realm" from a strong
Chemistry background, so socially awkward people were a norm, but this
was different.  I noticed that most of these people would discuss
these issues and cite books they had read about building teams and how
to "read" or "handle" people.  It was quite funny to hear one of them
explain how to work with others and respect people, yet not be able to
actually execute it appropriately.

I have not pursued a formal study, but I have noticed that there is a
lack of team building events in their early lives.  No true team
sports growing up, but rather events rewarding being an individual
(chess, video games, go, etc).  The deeper concepts of teams
completely eluded them, just as most social skills.  They could read
all about how to build teams or work in teams, but oddly most of the
books they read were written by other "techies" who had made a living
jumping from team to team and being praised as "guns for hire" in the
tech world.

You will notice these people have a very small group of friends in
their real life and are more empowered in this virtual world.  Their
weakness in the real world is balanced out by being strong in this
world and most of them pursue/view strength through an ability to be
condescending.  Their inner sorrow is projected out in a form of rage
and that usually (hopefully) only comes out as rude, curt and
inpatient.

No need to chastise them, their life is full enough of that, rather
ignore their rudeness and try and pick the "gems" of wisdom they
dispense between stabs.  After all, most of them are very intelligent
in a very focused realm, like programming in Python.


On Apr 22, 8:15 pm, mdipierro  wrote:
> > Knowing nothing about web design, this seems a very legal question to me.
> > With Python you can do everything, so why do you need Django or Web2Py
> > at all ?
>
> without going over differences since this is not the appropriate place
> for me to speak...
> all web apps have something in common:
> - the need to map urls into function calls (dispatching)
> - they need to manage persistence (sessions, cookies, database, cache)
> - they need to be able to manipulate standard protocols including
> http, html, rss, json, etc.
>
> At first approximation a framework is a collection of libraries for
> doing those things in the proper way.
> Some frameworks are collections of modules written separately, some
> are collections developed to work together.
>
> At second approximation a framework usually has a philosophy and
> guides the developer to follow good software engineering practices by
> forcing the developer to build web apps in a modular way.
>
> You can develop web apps without a framework but there is a lot of
> coding to do. It would not be efficient. Just think about the problem
> of efficiently handling sessions, generate session cookies, retrieve
> the session, etc. There are many chances of doing mistakes and, if you
> know how to it eventually you end writing a framework yourself.
> Unfortunately that is what happened to some of us.
>
> > One of the selection criteria I often use,
> > is the support offered in discussion lists
> > ... and until now I didn't encounter the kind of answers in the web2py
> > list as I've seen here on this question.
>
> I do not remember you ever asking this question there but if you do
> again I will be happy go over more details.
>
> > just my 2 cents as another still seeking for the right answers person,
> > cheers,
> > Stef Mientki
>
> sorry for the intrusion.
>
> Massimo

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: New site: www.portaltotheuniverse.org

2009-04-23 Thread Zain Memon
Cool! Mind sharing the names of any open source django apps you used?

On Thu, Apr 23, 2009 at 6:09 AM, larsholm  wrote:

>
> Dear all,
>
> Allow me to advertise for our new Django based site:
> http://www.portaltotheuniverse.org
>
> Keeping up-to-date with cutting-edge astronomy and space science
> breakthroughs has just become that much easier, thanks to the Portal
> To The Universe, the latest Cornerstone project of the International
> Year of Astronomy 2009 (IYA2009).
>
> On the tech side it basically boils down to a content-specific feed
> aggregator with a number of important add-ons:
> - human moderation to feature high quality content.
> - embargoed press releases for journalists with login (works in much
> the same way as when journalists can be invited to watch new movies a
> day before everybody else).
> - the RSS crawler is fast and updated very often to keep up-to-date
> with the news development during the day.
>
> This is our third major Django-based website we have done here at ESO
> - European Southern Observatory (located in Munich, Germany), and we
> naturally have more websites with astronomy content in the pipeline.
>
> Thanks for viewing!
>
> Lars Holm Nielsen 
> ESO - European Southern Observatory
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



dynamic form wizards

2009-04-23 Thread Dennis Schmidt

Hi there,

I need to dynamically create complex forms in my application. Since
version 1.0 django has these form wizards, which can manage complex
forms quite well.
Now my only problem is, that they apparently have to be statically
mapped by the urls.py. But what I need is a different set of forms for
the wizard, depending of an ID specified in the URL.

ie /order/1/accept/ shall use OrderAcceptionWizard([OrderPartOneForm,
OrderPartTwoForm]) but
/order/2/accept/ shall use OrderAcceptionWizard([OrderPartOneForm,
OrderPartThreeForm]).

any idea if this is somehow possible?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: New site: www.portaltotheuniverse.org

2009-04-23 Thread 83nini

nice work, you gotta be proud of it :)


On 23 Apr, 15:09, larsholm  wrote:
> Dear all,
>
> Allow me to advertise for our new Django based 
> site:http://www.portaltotheuniverse.org
>
> Keeping up-to-date with cutting-edge astronomy and space science
> breakthroughs has just become that much easier, thanks to the Portal
> To The Universe, the latest Cornerstone project of the International
> Year of Astronomy 2009 (IYA2009).
>
> On the tech side it basically boils down to a content-specific feed
> aggregator with a number of important add-ons:
> - human moderation to feature high quality content.
> - embargoed press releases for journalists with login (works in much
> the same way as when journalists can be invited to watch new movies a
> day before everybody else).
> - the RSS crawler is fast and updated very often to keep up-to-date
> with the news development during the day.
>
> This is our third major Django-based website we have done here at ESO
> - European Southern Observatory (located in Munich, Germany), and we
> naturally have more websites with astronomy content in the pipeline.
>
> Thanks for viewing!
>
> Lars Holm Nielsen 
> ESO - European Southern Observatory
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



New site: www.portaltotheuniverse.org

2009-04-23 Thread larsholm

Dear all,

Allow me to advertise for our new Django based site: 
http://www.portaltotheuniverse.org

Keeping up-to-date with cutting-edge astronomy and space science
breakthroughs has just become that much easier, thanks to the Portal
To The Universe, the latest Cornerstone project of the International
Year of Astronomy 2009 (IYA2009).

On the tech side it basically boils down to a content-specific feed
aggregator with a number of important add-ons:
- human moderation to feature high quality content.
- embargoed press releases for journalists with login (works in much
the same way as when journalists can be invited to watch new movies a
day before everybody else).
- the RSS crawler is fast and updated very often to keep up-to-date
with the news development during the day.

This is our third major Django-based website we have done here at ESO
- European Southern Observatory (located in Munich, Germany), and we
naturally have more websites with astronomy content in the pipeline.

Thanks for viewing!

Lars Holm Nielsen 
ESO - European Southern Observatory

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Table or view does not exist - Oracle

2009-04-23 Thread jeffhg58


I am using pretty much the same setup you have except I use cx_oracle 5.0.1. 
Have you narrowed down 

what tables are missing? 
- Original Message - 
From: "Petry"  
To: "Django users"  
Sent: Thursday, April 23, 2009 6:57:45 AM GMT -06:00 US/Canada Central 
Subject: Re: Table or view does not exist - Oracle 


I'm using Python 2.6.2, cx_oracle 4.4.1 and django 1.1 beta 1 
SVN-10620 

anyone know what happend?? 

On 22 abr, 17:48, Petry  wrote: 
> I have the same problem. 
> 
> I ran the command "python manage.py syncdb" and the tables were 
> created. 
> 
> In the shell I run: 
> from django.contrib.auth.models import * 
> Permission.objects.all () 
> 
> and returned the objects 
> 
> but when I tried to use the runserver 
> 
> the error appears: Databaseerror: ORA-00942: table or view does not 
> exist 
> 
> On 24 fev, 11:10, Brandon Taylor  wrote: 
> 
> > Hi Karen, 
> 
> > Yes, that is exactly what I'm seeing. 
> 
> > On Feb 23, 6:02 pm, Karen Tracey  wrote: 
> 
> > > On Mon, Feb 23, 2009 at 10:15 AM, Brandon Taylor 
> > > wrote: 
> 
> > > > Hi everyone, 
> 
> > > > Still fighting with Oracle :( 
> 
> > > > Quick recap...my setup is: 
> 
> > > > OS X 10.5.6 (Intel), cx_Oracle-5.0.1 (Intel), instantclient_10_2, 
> > > > Django Trunk, Python 2.6.1 
> 
> > > > If I run Django in shell, I am able to connect to Oracle, retrieve 
> > > > objects via the ORM, etc. However, when I executing a view action 
> > > > while running Django using the built-in server, I get the error: 
> 
> > > > DatabaseError:ORA-00942: table or view does not exist 
> 
> > > > My Oracle person has confirmed that the username I'm using has 
> > > > permissions to view/create/drop/update. 
> 
> > > > Why would it work from the shell, using all of the same connection 
> > > > information from settings.py and fail from the built-in server? I 
> > > > don't know what else to try. 
> 
> > > Just to be clear -- you're seeing a difference in the ability to run (the 
> > > exact same) queries against Oracle when you use: 
> 
> > > python manage.py shell 
> 
> > > versus 
> 
> > > python manage.py runserver 
> 
> > > ? 
> 
> > > And you start both of those from the exact same command shell 
> > > environment? 
> 
> > > Karen 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Table or view does not exist - Oracle

2009-04-23 Thread Petry

I'm using Python 2.6.2, cx_oracle 4.4.1 and django 1.1 beta 1
SVN-10620

anyone know what happend??

On 22 abr, 17:48, Petry  wrote:
> I have the same problem.
>
> I ran the command "python manage.py syncdb" and the tables were
> created.
>
> In the shell I run:
> from django.contrib.auth.models import *
> Permission.objects.all ()
>
> and returned the objects
>
> but when I tried to use the runserver
>
> the error appears: Databaseerror: ORA-00942: table or view does not
> exist
>
> On 24 fev, 11:10, Brandon Taylor  wrote:
>
> > Hi Karen,
>
> > Yes, that is exactly what I'm seeing.
>
> > On Feb 23, 6:02 pm, Karen Tracey  wrote:
>
> > > On Mon, Feb 23, 2009 at 10:15 AM, Brandon Taylor 
> > > wrote:
>
> > > > Hi everyone,
>
> > > > Still fighting with Oracle :(
>
> > > > Quick recap...my setup is:
>
> > > > OS X 10.5.6 (Intel), cx_Oracle-5.0.1 (Intel), instantclient_10_2,
> > > > Django Trunk, Python 2.6.1
>
> > > > If I run Django in shell, I am able to connect to Oracle, retrieve
> > > > objects via the ORM, etc. However, when I executing a view action
> > > > while running Django using the built-in server, I get the error:
>
> > > > DatabaseError:ORA-00942: table or view does not exist
>
> > > > My Oracle person has confirmed that the username I'm using has
> > > > permissions to view/create/drop/update.
>
> > > > Why would it work from the shell, using all of the same connection
> > > > information from settings.py and fail from the built-in server? I
> > > > don't know what else to try.
>
> > > Just to be clear -- you're seeing a difference in the ability to run (the
> > > exact same) queries against Oracle when you use:
>
> > > python manage.py shell
>
> > > versus
>
> > > python manage.py runserver
>
> > > ?
>
> > > And you start both of those from the exact same command shell environment?
>
> > > Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Hierarchy menu system

2009-04-23 Thread Zain Memon
It sounds like you're trying to build a CMS app; check out django-cms if you
haven't already. http://django-cms.org/

On Wed, Apr 22, 2009 at 9:50 AM, tdelam  wrote:

>
> What's the best way to build a hierarchy menu system? e.g: Page items
> can have sub-pages and sub-pages can have sub-sub-pages and so on
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: graph tools

2009-04-23 Thread Zain Memon
You might find it easier to go with a Javascript library to render the
graphs instead; for example, the excellent flot plugin for jQuery.
http://code.google.com/p/flot/

On Thu, Apr 23, 2009 at 12:10 AM, Lars Stavholm  wrote:

>
> Hi All,
>
> looking to produce graphs within a django application,
> preferably within the admin site.
>
> django-graphs might be a contender, but it seems to be
> not fully completed yet. Anyone using it?
>
> Other django graph app's?
>
> Any advice appreciated
> /Lars Stavholm
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Only show field in admin for superuser

2009-04-23 Thread Zain Memon
In that case, try overriding ModelAdmin.get_fieldsets(); add the owner field
to self.fieldset if request.user.is_superuser, and then call
super.get_fieldsets().
For reference, you can find get_fieldsets() (and other beautiful things you
can override) in django/contrib/admin/options.py.

On Thu, Apr 23, 2009 at 3:32 AM, phoebebright wrote:

>
> Zain,
>
> Thanks for responding.
> I would really prefer not to show the field at all - I don't want
> ordinary users being able to see a list of all the users on the
> system!
>
> Phoebe
>
> On Apr 23, 9:42 am, Zain Memon  wrote:
> > You can override the ModelAdmin.save_model() method to check if the
> current
> > user has permission to change the owner.
> > Take a look athttp://www.b-list.org/weblog/2008/dec/24/admin/to see an
> > example.
> >
> > On Thu, Apr 23, 2009 at 1:37 AM, phoebebright  >wrote:
> >
> >
> >
> >
> >
> > > I have a model with an owner field that I only want a superuser to be
> > > able to change.  I can't change the list of fields in form in admin.py
> > > because there is not request.user to test at that time.  If I were
> > > using custom templates I could put it in the template, but would
> > > rather stick to the standard admin.
> >
> > > If I add the field by default, Is there somewhere I could remove the
> > > field as it's being loaded if the requesting user is not a superuser?
> > > Any ideas gratefully received!
> >
> > > THIS DOES NOT WORK:
> >
> > >if request.user.is_superuser:
> > > fieldsets = [
> > > (None,   {'fields':
> > > ['tourism','community','cat','name','is_live','paid','owner']}),
> > > ('Contact', {'fields':
> > > ['phone','mobile','fax','email','web','address']}),
> > > ('Details', {'fields':
> > > ['description','pic1','pic2','pic3','pic4']}),
> > > ]
> > >else:
> > > fieldsets = [
> > > (None,   {'fields':
> > > ['tourism','community','cat','name','is_live','paid','owner']}),
> > > ('Contact', {'fields':
> > > ['phone','mobile','fax','email','web','address']}),
> > > ('Details', {'fields':
> > > ['description','pic1','pic2','pic3','pic4']}),
> > > ]
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Only show field in admin for superuser

2009-04-23 Thread phoebebright

Zain,

Thanks for responding.
I would really prefer not to show the field at all - I don't want
ordinary users being able to see a list of all the users on the
system!

Phoebe

On Apr 23, 9:42 am, Zain Memon  wrote:
> You can override the ModelAdmin.save_model() method to check if the current
> user has permission to change the owner.
> Take a look athttp://www.b-list.org/weblog/2008/dec/24/admin/to see an
> example.
>
> On Thu, Apr 23, 2009 at 1:37 AM, phoebebright wrote:
>
>
>
>
>
> > I have a model with an owner field that I only want a superuser to be
> > able to change.  I can't change the list of fields in form in admin.py
> > because there is not request.user to test at that time.  If I were
> > using custom templates I could put it in the template, but would
> > rather stick to the standard admin.
>
> > If I add the field by default, Is there somewhere I could remove the
> > field as it's being loaded if the requesting user is not a superuser?
> > Any ideas gratefully received!
>
> > THIS DOES NOT WORK:
>
> >    if request.user.is_superuser:
> >         fieldsets = [
> >             (None,   {'fields':
> > ['tourism','community','cat','name','is_live','paid','owner']}),
> >             ('Contact', {'fields':
> > ['phone','mobile','fax','email','web','address']}),
> >             ('Details', {'fields':
> > ['description','pic1','pic2','pic3','pic4']}),
> >         ]
> >    else:
> >         fieldsets = [
> >             (None,   {'fields':
> > ['tourism','community','cat','name','is_live','paid','owner']}),
> >             ('Contact', {'fields':
> > ['phone','mobile','fax','email','web','address']}),
> >             ('Details', {'fields':
> > ['description','pic1','pic2','pic3','pic4']}),
> >         ]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



[Querysets] Trying to determine status of an order based on the properties of its order items

2009-04-23 Thread Andrew Ingram

Hi All,

I'm looking for an efficient way to solve the following problem, I'm
happy to use custom sql if necessary.

Basically I have an Order model and an OrderItem model (ecommerce
site), structured as follows:

Order(models.Model):
 ... some fields ...

OrderItem(models.Model):
 ... some fields ...
 order = models.ForeignKey(Order,related_name='items')
 progress = models.CharField(max_length=20)

The site logic dictates that an Order is considered 'Open', if at
least one item has a progress of 'PROCESSING', 'CHARGED' or
'ACTION_NEEDED', if ALL the items are of any other progress value the
order is considered 'Closed'.

I'm trying to figure out the QuerySet chain to run on the Order object
to find all the open orders, and another for all the closed orders.

Naturally I started out looked at
Order.objects.exclude(items__progress__in=(list of closed progress
values)), but this doesn't work. I'm assuming because it will just
take the progress of the first item it finds rather than looking at
the whole set.

I'm not really sure of the best way to tackle this, theoretically this
should only be running on small sets of items and orders because it'll
be getting the orders for individual orders rather than for everyone,
but an efficient solution is still preferred.

Any ideas would be appreciated

Regards,
Andrew Ingram

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to get request.user inside a model method?

2009-04-23 Thread Bastien

Karen, thanks, I think I will follow the way of the custom template
tag.
Bastien


On Apr 22, 4:32 pm, Karen Tracey  wrote:
> On Wed, Apr 22, 2009 at 5:13 AM, Bastien  wrote:
>
> > The last thread about that is quite old, I was wondering if there is
> > any new way to do that?
>
> Likely nothing has changed.  It's still the case that models are independent
> of requests, so trying to tightly couple them can lead to problems.  What it
> request.user when you are manipulating a model from a shell prompt or an
> independent Python script?
>
> > I wrote a method in a model that requires the current user and I use
> > this method in a template so I guess I can't pass any argument, can I?
>
> No, you can't pass a arguments to methods in templates.  Template tags are
> quite easy to write, though, so you might try looking into that.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Only show field in admin for superuser

2009-04-23 Thread Zain Memon
You can override the ModelAdmin.save_model() method to check if the current
user has permission to change the owner.
Take a look at http://www.b-list.org/weblog/2008/dec/24/admin/ to see an
example.

On Thu, Apr 23, 2009 at 1:37 AM, phoebebright wrote:

>
> I have a model with an owner field that I only want a superuser to be
> able to change.  I can't change the list of fields in form in admin.py
> because there is not request.user to test at that time.  If I were
> using custom templates I could put it in the template, but would
> rather stick to the standard admin.
>
> If I add the field by default, Is there somewhere I could remove the
> field as it's being loaded if the requesting user is not a superuser?
> Any ideas gratefully received!
>
>
> THIS DOES NOT WORK:
>
>if request.user.is_superuser:
> fieldsets = [
> (None,   {'fields':
> ['tourism','community','cat','name','is_live','paid','owner']}),
> ('Contact', {'fields':
> ['phone','mobile','fax','email','web','address']}),
> ('Details', {'fields':
> ['description','pic1','pic2','pic3','pic4']}),
> ]
>else:
> fieldsets = [
> (None,   {'fields':
> ['tourism','community','cat','name','is_live','paid','owner']}),
> ('Contact', {'fields':
> ['phone','mobile','fax','email','web','address']}),
> ('Details', {'fields':
> ['description','pic1','pic2','pic3','pic4']}),
> ]
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem in tutorial

2009-04-23 Thread Zain Memon
Your SQL is wrong. Look up the correct syntax for changing a column in the
MySQL docs.

On Thu, Apr 23, 2009 at 12:54 AM, 83nini <83n...@gmail.com> wrote:

>
> Hi guys,
>
> I'm working on django tutorial that is in "www.djangobook.com", I'm in
> chapter6 where i'm in the process of creating an admin Web site.
> The site is created and it works just perfectly, the thing is I'm
> trying to make some date and numeric fields optional, so I modified
> the models.py folder and added the "null=True" statement as follows:
>
> publication_date = models.DateField(blank=True, null=True)
>
> now according to what's written in the book, it is my responsibility
> to ALTER TABLE statement whenever such a change is made in the
> models.py file, so I did the following:
>  1. called python manage.py dbshell from the command line
>  2. when i got the dbshell "mysql>", i wrote the following statement
> ALTER TABLE books_book ALTER COLUMN publication_date DROP NOT
> NULL;
>
> I'm getting "ALTER is not an internal command, external command,
> program or commandfile"
>
> WHY???
>
> thanks for explaining,
> cheers,
> Lina
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Only show field in admin for superuser

2009-04-23 Thread phoebebright

I have a model with an owner field that I only want a superuser to be
able to change.  I can't change the list of fields in form in admin.py
because there is not request.user to test at that time.  If I were
using custom templates I could put it in the template, but would
rather stick to the standard admin.

If I add the field by default, Is there somewhere I could remove the
field as it's being loaded if the requesting user is not a superuser?
Any ideas gratefully received!


THIS DOES NOT WORK:

if request.user.is_superuser:
 fieldsets = [
 (None,   {'fields':
['tourism','community','cat','name','is_live','paid','owner']}),
 ('Contact', {'fields':
['phone','mobile','fax','email','web','address']}),
 ('Details', {'fields':
['description','pic1','pic2','pic3','pic4']}),
 ]
else:
 fieldsets = [
 (None,   {'fields':
['tourism','community','cat','name','is_live','paid','owner']}),
 ('Contact', {'fields':
['phone','mobile','fax','email','web','address']}),
 ('Details', {'fields':
['description','pic1','pic2','pic3','pic4']}),
 ]


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem in tutorial

2009-04-23 Thread 83nini

Hi guys,

I'm working on django tutorial that is in "www.djangobook.com", I'm in
chapter6 where i'm in the process of creating an admin Web site.
The site is created and it works just perfectly, the thing is I'm
trying to make some date and numeric fields optional, so I modified
the models.py folder and added the "null=True" statement as follows:

publication_date = models.DateField(blank=True, null=True)

now according to what's written in the book, it is my responsibility
to ALTER TABLE statement whenever such a change is made in the
models.py file, so I did the following:
 1. called python manage.py dbshell from the command line
 2. when i got the dbshell "mysql>", i wrote the following statement
 ALTER TABLE books_book ALTER COLUMN publication_date DROP NOT
NULL;

I'm getting "ALTER is not an internal command, external command,
program or commandfile"

WHY???

thanks for explaining,
cheers,
Lina


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: auth.contrib silently catching TypeError. Bug?

2009-04-23 Thread Tamas Szabo

Hi,

I understand the need for supporting multiple authentication systems,
but I don't think that the implementation is the best that it can be
done.

IMHO, silencing exceptions is something you should be very careful
with even if you control all the code that you are doing it for.

Other implementations will involve more work, yes. Whether that's
worth doing it's not for me to decide.

I would be inclined towards introducing the concept of Credentials of
different types. Username/password would be one type, Token-based
would be another one etc.
The code that tries to authenticate will know what type of credentials
it has (for example the login in admin knows that it has a
username/password) so it can tell the authenticate() method the type
of the Credentials.

Authentication backends would be written for a given type of
Credentials and shouldn't be called with other credential types.
(Alternatively they could be called with Credential types they don't
support, but will be required to raise an
UnsupportedAuthenticationMethod exception. In this case the API would
make it clear that your custom Authenticator can get different
Credential types, so you have to handle the unsupported ones.)

The current implementation assumes that TypeError can be raised only
by the call to authenticate(**credentials) method (which isn't true)
and also that it will always be raised if the wrong credentials are
passed in.
We already discussed the first assumption, but the second assumption
is also wrong.

For example if I have a Token based authenticator
(authenticate(token)) that is configured to be after my User/Password
based authenticator (authenticate(user, password)) in settings.py the
current code will call the user/password based authenticator and it
will pass in the token as a username (password will be null). If I
have an authenticator with 2 string arguments, the same will happen.
This is conceptually wrong and it could cause all kind of problems.
For example my User/Password based LDAPAuthenticator might be making
expensive LDAP queries as a result which will be much slower then a
changed implementation.

Regards,

Tamas


On Thu, Apr 23, 2009 at 8:06 AM, James Bennett  wrote:
>
> On Mon, Apr 20, 2009 at 4:20 AM, Tamas Szabo  wrote:
>> As you can see the code catches and silently ignores all TypeError 
>> exceptions:
>> The problems with this approach are:
>>    - Why not fail as early as possible if one of the authentication
>> backends configured in settings.py has a wrong signature? If nothing
>> else at least a warning should be logged IMHO.
>
> Because it's conceivable that you'll be using multiple authentication
> systems on the same site, and that not all of them will expect the
> same set of credentials. The alternative -- looking at the keys in the
> 'credentials' dictionary and manually inspecting the argument
> signature of the backend's method every time -- would be cumbersome,
> slower and also error-prone (what happens when a backend accepts
> '**kwargs' but really wants a specific set of keys in there and raises
> a KeyError you didn't expect?)
>
>>    - The bigger is that the code silently catches all TypeError
>> exceptions. If the signature is correct, but the custom backend
>> authenticator somewhere has a bug and a TypeError is raised as a
>> result, the exception will be hidden away. TypeError is a common
>> exception, so I don't think that catching and ignoring it in code that
>> others will write is a good idea.
>
> People who write custom auth backends should probably be unit-testing
> them independently of Django's auth framework, which would catch such
> errors early on. And since Python doesn't offer a more specific
> YouPassedArgumentsIDoNotLikeError, I think that means TypeError's the
> way to go.
>
>
> --
> "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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



graph tools

2009-04-23 Thread Lars Stavholm

Hi All,

looking to produce graphs within a django application,
preferably within the admin site.

django-graphs might be a contender, but it seems to be
not fully completed yet. Anyone using it?

Other django graph app's?

Any advice appreciated
/Lars Stavholm

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---