Re: Newbie: how to tell a URL for a page?

2010-07-29 Thread BobAalsma
Thanks very much!

Yes, I agree, probably not specifically Django, but it is the
environment where I needed the answer.

At least this will give me something to work with/from :-)

Regards,
Bob

On Jul 29, 8:03 am, Carlos Daniel Ruvalcaba Valenzuela
<clsdan...@gmail.com> wrote:
> Hello, your question probably does not have much to do with Django (as
> a framework), but you may be able to check at the iframeurlby
> quering the DOM using javascript, either directly or via a library
> like jquery if you are already using one.
>
> Check the W3C documentation for the frame/iframe DOM:
>
> http://www.w3schools.com/jsref/dom_obj_frame.asp
>
> The iframe should contain a document object which should contain theURLloaded 
> on the frame.
>
> Regards,
> Carlos Daniel Ruvalcaba Valenzuela
>
> On Wed, Jul 28, 2010 at 10:57 PM, BobAalsma <bob.aal...@aalsmacons.nl> wrote:
> > This question has been in the forum for about almost a week & no
> > response. So please help anewbieout: is it too easy or too difficult
> > to answer?
>
> > On Jul 24, 7:29 pm, BobAalsma <bob.aal...@aalsmacons.nl> wrote:
> >> I'm working on a programme where I want the user to register comments
> >> on a third party webpage.
> >> To show this third partypage, I intend to use frames or iframes, but
> >> I discovered that some of the URLs redirect. This means that thepage
> >> shown in the (i)frame will have a differentURLfrom theURLI use.
> >> The redirection is in itself also information I want to show.
>
> >> So my question is: how can I tell theURLof thepage(finally) shown
> >> in the (i)frame?
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Newbie: how to tell a URL for a page?

2010-07-28 Thread BobAalsma
This question has been in the forum for about almost a week & no
response. So please help a newbie out: is it too easy or too difficult
to answer?

On Jul 24, 7:29 pm, BobAalsma <bob.aal...@aalsmacons.nl> wrote:
> I'm working on a programme where I want the user to register comments
> on a third party web page.
> To show this third party page, I intend to use frames or iframes, but
> I discovered that some of the URLs redirect. This means that the page
> shown in the (i)frame will have a different URL from the URL I use.
> The redirection is in itself also information I want to show.
>
> So my question is: how can I tell the URL of the page (finally) shown
> in the (i)frame?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Newbie: how to tell a URL for a page?

2010-07-28 Thread BobAalsma
This question has been in the forum for about almost a week & no
response. So please help a newbie out: is it too easy or too difficult
to answer?

On Jul 24, 7:29 pm, BobAalsma <bob.aal...@aalsmacons.nl> wrote:
> I'm working on a programme where I want the user to register comments
> on a third party web page.
> To show this third party page, I intend to use frames or iframes, but
> I discovered that some of the URLs redirect. This means that the page
> shown in the (i)frame will have a different URL from the URL I use.
> The redirection is in itself also information I want to show.
>
> So my question is: how can I tell the URL of the page (finally) shown
> in the (i)frame?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Newbie: how to tell a URL for a page?

2010-07-28 Thread BobAalsma
This question has been in the forum for about almost a week & no
response. So please help a newbie out: is it too easy or too difficult
to answer?

On Jul 24, 7:29 pm, BobAalsma <bob.aal...@aalsmacons.nl> wrote:
> I'm working on a programme where I want the user to register comments
> on a third party web page.
> To show this third party page, I intend to use frames or iframes, but
> I discovered that some of the URLs redirect. This means that the page
> shown in the (i)frame will have a different URL from the URL I use.
> The redirection is in itself also information I want to show.
>
> So my question is: how can I tell the URL of the page (finally) shown
> in the (i)frame?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Newbie: how to tell a URL for a page?

2010-07-28 Thread BobAalsma
This question has been in the forum for about almost a week & no
response. So please help a newbie out: is it too easy or too difficult
to answer?

On Jul 24, 7:29 pm, BobAalsma <bob.aal...@aalsmacons.nl> wrote:
> I'm working on a programme where I want the user to register comments
> on a third party web page.
> To show this third party page, I intend to use frames or iframes, but
> I discovered that some of the URLs redirect. This means that the page
> shown in the (i)frame will have a different URL from the URL I use.
> The redirection is in itself also information I want to show.
>
> So my question is: how can I tell the URL of the page (finally) shown
> in the (i)frame?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Newbie: how to tell a URL for a page?

2010-07-28 Thread BobAalsma
This question has been in the forum for about almost a week & no
response. So please help a newbie out: is it too easy or too difficult
to answer?

On Jul 24, 7:29 pm, BobAalsma <bob.aal...@aalsmacons.nl> wrote:
> I'm working on a programme where I want the user to register comments
> on a third party web page.
> To show this third party page, I intend to use frames or iframes, but
> I discovered that some of the URLs redirect. This means that the page
> shown in the (i)frame will have a different URL from the URL I use.
> The redirection is in itself also information I want to show.
>
> So my question is: how can I tell the URL of the page (finally) shown
> in the (i)frame?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Newbie: how to tell a URL for a page?

2010-07-24 Thread BobAalsma
I'm working on a programme where I want the user to register comments
on a third party web page.
To show this third party page, I intend to use frames or iframes, but
I discovered that some of the URLs redirect. This means that the page
shown in the (i)frame will have a different URL from the URL I use.
The redirection is in itself also information I want to show.

So my question is: how can I tell the URL of the page (finally) shown
in the (i)frame?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Architecture? (newbie)

2010-07-03 Thread BobAalsma
Hi,

I'm trying to find a (good) book or other documentation on how to
group/organise Django files; I've found some posts on this forum, I've
found some remarks through Google, but not a "complete" guideline for
this subject.

I have a background in software packages (3GL) and try to find answers
to questions like:
- when to put a bit of software in a library
- how to organise these library files [not in the physical sense, but
in the organisational sense]
- how to separate / group models, views, urlconfs, etc

My concern is that, if I simply put everything together, I will
generate my own spaghetti code before my project is complete...

Any suggestions?

Regards,
Bob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 locate the OS user name? [newbie]

2010-03-26 Thread BobAalsma
In addition:
So maybe Baurzhan was right: using a database login (explicit or
implicit) could be the easier solution to build.

Regards,
Bob

On Mar 26, 7:32 am, BobAalsma <b...@leaddevice.com> wrote:
> Hmm, on second thoughts...
>
> I tested from the shell in a few user environements and it worked.
>
> However, when applying this to Django, all users show the user name of
> the user running the server.
>
> Hindsight makes this logical, as the other users only use their
> browser, not their own local python.
>
> So I think now the question seems to be "how to extract the OS user
> name from the browser environment?"
>
> Regards,
> Bob
>
> On Mar 25, 7:06 pm, BobAalsma <b...@leaddevice.com> wrote:
>
> > OK, found it - thanks!
>
> > Regards,
> > Bob
>
> > On Mar 25, 6:40 pm, "piz...@gmail.com" <piz...@gmail.com> wrote:
>
> > > Check the module index in the python website:http://docs.python.org/
> > > modindex.html
>
> > > There you will find everything about python modules like sys, os, and  
> > > others.
>
> > > Regards,
> > > Oscar C.
>
> > > El 25/03/2010, a las 18:28, BobAalsma escribió:
>
> > > > YES!
>
> > > > Works beautifully, thanks.
>
> > > > On the newbie part: how could I have found this?
> > > > I did find the os.environ and you've helped me discover how to look
> > > > inside, but what if I need something completely different?
>
> > > > Regards,
> > > > Bob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 locate the OS user name? [newbie]

2010-03-26 Thread BobAalsma
In addition:
So maybe Baurzhan was right: using a database login (explicit or
implicit) could be the easier solution to build.

Regards,
Bob

On Mar 26, 7:32 am, BobAalsma <b...@leaddevice.com> wrote:
> Hmm, on second thoughts...
>
> I tested from the shell in a few user environements and it worked.
>
> However, when applying this to Django, all users show the user name of
> the user running the server.
>
> Hindsight makes this logical, as the other users only use their
> browser, not their own local python.
>
> So I think now the question seems to be "how to extract the OS user
> name from the browser environment?"
>
> Regards,
> Bob
>
> On Mar 25, 7:06 pm, BobAalsma <b...@leaddevice.com> wrote:
>
> > OK, found it - thanks!
>
> > Regards,
> > Bob
>
> > On Mar 25, 6:40 pm, "piz...@gmail.com" <piz...@gmail.com> wrote:
>
> > > Check the module index in the python website:http://docs.python.org/
> > > modindex.html
>
> > > There you will find everything about python modules like sys, os, and  
> > > others.
>
> > > Regards,
> > > Oscar C.
>
> > > El 25/03/2010, a las 18:28, BobAalsma escribió:
>
> > > > YES!
>
> > > > Works beautifully, thanks.
>
> > > > On the newbie part: how could I have found this?
> > > > I did find the os.environ and you've helped me discover how to look
> > > > inside, but what if I need something completely different?
>
> > > > Regards,
> > > > Bob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 locate the OS user name? [newbie]

2010-03-26 Thread BobAalsma
Hmm, on second thoughts...

I tested from the shell in a few user environements and it worked.

However, when applying this to Django, all users show the user name of
the user running the server.

Hindsight makes this logical, as the other users only use their
browser, not their own local python.

So I think now the question seems to be "how to extract the OS user
name from the browser environment?"

Regards,
Bob


On Mar 25, 7:06 pm, BobAalsma <b...@leaddevice.com> wrote:
> OK, found it - thanks!
>
> Regards,
> Bob
>
> On Mar 25, 6:40 pm, "piz...@gmail.com" <piz...@gmail.com> wrote:
>
> > Check the module index in the python website:http://docs.python.org/
> > modindex.html
>
> > There you will find everything about python modules like sys, os, and  
> > others.
>
> > Regards,
> > Oscar C.
>
> > El 25/03/2010, a las 18:28, BobAalsma escribió:
>
> > > YES!
>
> > > Works beautifully, thanks.
>
> > > On the newbie part: how could I have found this?
> > > I did find the os.environ and you've helped me discover how to look
> > > inside, but what if I need something completely different?
>
> > > Regards,
> > > Bob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 locate the OS user name? [newbie]

2010-03-26 Thread BobAalsma
Hmm, on second thoughts...

I tested from the shell in a few user environements and it worked.

However, when applying this to Django, all users show the user name of
the user running the server.

Hindsight makes this logical, as the other users only use their
browser, not their own local python.

So I think now the question seems to be "how to extract the OS user
name from the browser environment?"

Regards,
Bob


On Mar 25, 7:06 pm, BobAalsma <b...@leaddevice.com> wrote:
> OK, found it - thanks!
>
> Regards,
> Bob
>
> On Mar 25, 6:40 pm, "piz...@gmail.com" <piz...@gmail.com> wrote:
>
> > Check the module index in the python website:http://docs.python.org/
> > modindex.html
>
> > There you will find everything about python modules like sys, os, and  
> > others.
>
> > Regards,
> > Oscar C.
>
> > El 25/03/2010, a las 18:28, BobAalsma escribió:
>
> > > YES!
>
> > > Works beautifully, thanks.
>
> > > On the newbie part: how could I have found this?
> > > I did find the os.environ and you've helped me discover how to look
> > > inside, but what if I need something completely different?
>
> > > Regards,
> > > Bob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 locate the OS user name? [newbie]

2010-03-25 Thread BobAalsma
OK, found it - thanks!

Regards,
Bob

On Mar 25, 6:40 pm, "piz...@gmail.com" <piz...@gmail.com> wrote:
> Check the module index in the python website:http://docs.python.org/
> modindex.html
>
> There you will find everything about python modules like sys, os, and  
> others.
>
> Regards,
> Oscar C.
>
> El 25/03/2010, a las 18:28, BobAalsma escribió:
>
> > YES!
>
> > Works beautifully, thanks.
>
> > On the newbie part: how could I have found this?
> > I did find the os.environ and you've helped me discover how to look
> > inside, but what if I need something completely different?
>
> > Regards,
> > Bob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 locate the OS user name? [newbie]

2010-03-25 Thread BobAalsma
YES!

Works beautifully, thanks.

On the newbie part: how could I have found this?
I did find the os.environ and you've helped me discover how to look
inside, but what if I need something completely different?

Regards,
Bob

On Mar 25, 4:43 pm, Benjamin Reitzammer <breitzam...@gmail.com> wrote:
> Hi Bob,
> this not a Django specific question/problem but more a general Python 
> question.
> The information you are looking for is most likely located in the
> os.environ object.
> So take a look at  this in your python commandline/shell
>
> >>> import os
> >>> [i for i in os.environ.items()]
>
> and look for the item that contains the username you are looking for.
>
> HTH & Cheers
>
> Benjamin
>
> On Thu, Mar 25, 2010 at 16:27, BobAalsma <b...@leaddevice.com> wrote:
> > I work as a single person on a single machine. I use an unstable
> > programme that requires me to employ more than one OS user. The
> > programme will store some files locally (in each specific user
> > environment).
>
> > I am trying to build a Django application to centralise the
> > information gathered by this unstable programme, but in some cases I
> > need to refer to the stored files. So I want to store the
> > "originating" OS user name in the database, along with the other
> > information.
>
> > So yes, there are concurrent users;  I know I will never use the same
> > user name twice; it is a single machine solution, not using any
> > network - I think there is no security problem to be solved here.
>
> > I have looked at the documentation and forums, but could not find an
> > answer to my question.
>
> > Regards,
> > Bob
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 locate the OS user name? [newbie]

2010-03-25 Thread BobAalsma
Hi Benjamin,

Thanks, I'll have look.

Bob

On Mar 25, 4:43 pm, Benjamin Reitzammer <breitzam...@gmail.com> wrote:
> Hi Bob,
> this not a Django specific question/problem but more a general Python 
> question.
> The information you are looking for is most likely located in the
> os.environ object.
> So take a look at  this in your python commandline/shell
>
> >>> import os
> >>> [i for i in os.environ.items()]
>
> and look for the item that contains the username you are looking for.
>
> HTH & Cheers
>
> Benjamin
>
> On Thu, Mar 25, 2010 at 16:27, BobAalsma <b...@leaddevice.com> wrote:
> > I work as a single person on a single machine. I use an unstable
> > programme that requires me to employ more than one OS user. The
> > programme will store some files locally (in each specific user
> > environment).
>
> > I am trying to build a Django application to centralise the
> > information gathered by this unstable programme, but in some cases I
> > need to refer to the stored files. So I want to store the
> > "originating" OS user name in the database, along with the other
> > information.
>
> > So yes, there are concurrent users;  I know I will never use the same
> > user name twice; it is a single machine solution, not using any
> > network - I think there is no security problem to be solved here.
>
> > I have looked at the documentation and forums, but could not find an
> > answer to my question.
>
> > Regards,
> > Bob
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 locate the OS user name? [newbie]

2010-03-25 Thread BobAalsma
I'd prefer not to as I keep switching between 15-20 users and find the
log in of the OS quite enough, thank you.
My beautiful but unstable programme makes it a good idea to
periodically fully log out and log in, say twice a day...

On Mar 25, 4:47 pm, Baurzhan Ismagulov <i...@radix50.net> wrote:
> On Thu, Mar 25, 2010 at 08:27:37AM -0700, BobAalsma wrote:
> > I am trying to build a Django application to centralise the
> > information gathered by this unstable programme, but in some cases I
> > need to refer to the stored files. So I want to store the
> > "originating" OS user name in the database, along with the other
> > information.
>
> What about authenticating those users in your Django app?
>
> With kind regards,
> --
> Baurzhan Ismagulovhttp://www.kz-easy.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to locate the OS user name? [newbie]

2010-03-25 Thread BobAalsma
I work as a single person on a single machine. I use an unstable
programme that requires me to employ more than one OS user. The
programme will store some files locally (in each specific user
environment).

I am trying to build a Django application to centralise the
information gathered by this unstable programme, but in some cases I
need to refer to the stored files. So I want to store the
"originating" OS user name in the database, along with the other
information.

So yes, there are concurrent users;  I know I will never use the same
user name twice; it is a single machine solution, not using any
network - I think there is no security problem to be solved here.

I have looked at the documentation and forums, but could not find an
answer to my question.

Regards,
Bob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Newbie question: value inequality in Manager Method?

2010-03-19 Thread BobAalsma
Thanks to both: I felt I was missing something but couldn't find where
to look :-)

Bob

On Mar 19, 3:55 pm, Bill Freeman <ke1g...@gmail.com> wrote:
> To expand on DR's answer slightly, the '=' in 'filter(crcWaarde=0)' is
> not a comparison
> operator.  All arguments to filter need to be of the form
> "'leagal_identifier'=value".  This
> is python syntax, nothing to do with django.  Think of this '=' as
> being more akin to
> assignment.
>
> The answer to your problem is to use exclude instead of filter:
>
>                 ...get_query_set().exclude(ccWaarde=0)
>
> Bill
>
> On Fri, Mar 19, 2010 at 9:35 AM, Daniel Roseman <dan...@roseman.org.uk> wrote:
> > On Mar 19, 1:22 pm, BobAalsma <b...@leaddevice.com> wrote:
> >> In models.py, when I use
> >> class GevondenManager(models.Manager):
> >>         def get_query_set(self):
> >>                 return 
> >> super(GevondenManager,self).get_query_set().filter(crcWaarde
> >> = 0)
> >> I get proper answers.
>
> >> However, I want to filter on "not equal to" and this does not seem to
> >> work. How to proceed?
>
> >> I have tried
> >> class GevondenManager(models.Manager):
> >>         def get_query_set(self):
> >>                 return 
> >> super(GevondenManager,self).get_query_set().filter(crcWaarde
> >> <> 0)
>
> >> as well as
> >> class GevondenManager(models.Manager):
> >>         def get_query_set(self):
> >>                 return 
> >> super(GevondenManager,self).get_query_set().filter(crcWaarde !
> >> = 0)
>
> >> and in both cases the results seem the same:
> > 
> >> NameError: global name 'crcWaarde' is not defined
>
> > This needs to be a standard filter expression. So you use the normal
> > Django query filter syntax as documented here:
> >http://docs.djangoproject.com/en/1.1/topics/db/queries/#retrieving-sp...
>
> > Don't forget these are *parameters to a function*, not expressions in
> > themselves. So in your case you need:
> >  return
> > super(GevondenManager,self).get_query_set().exclude(crcWaarde=0)
> > --
> > DR.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Newbie question: value inequality in Manager Method?

2010-03-19 Thread BobAalsma
In models.py, when I use
class GevondenManager(models.Manager):
def get_query_set(self):
return 
super(GevondenManager,self).get_query_set().filter(crcWaarde
= 0)
I get proper answers.

However, I want to filter on "not equal to" and this does not seem to
work. How to proceed?

I have tried
class GevondenManager(models.Manager):
def get_query_set(self):
return 
super(GevondenManager,self).get_query_set().filter(crcWaarde
<> 0)

as well as
class GevondenManager(models.Manager):
def get_query_set(self):
return 
super(GevondenManager,self).get_query_set().filter(crcWaarde !
= 0)

and in both cases the results seem the same:
MacPro1:leaddevice bobaalsma$ python manage.py shell
Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from leaddevice.LeadDeviceSysteem.models import HistorieGevonden
>>> HistorieGevonden.zoekresultaat.all()
Traceback (most recent call last):
  File "", line 1, in 
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/db/models/manager.py", line 105, in all
return self.get_query_set()
  File "/Volumes/LeadDevice-11/LeadDevice/Programmatuur/Django/
leaddevice/../leaddevice/LeadDeviceSysteem/models.py", line 9, in
get_query_set
return
super(GevondenManager,self).get_query_set().filter(crcWaarde <> 0)
NameError: global name 'crcWaarde' is not defined

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Modelling question: TypeError at Post?

2010-03-15 Thread BobAalsma
I get a TypeError at Post from the admin interface and I suspect this
is connected to my key definition, but couldn't find documentation on
this.

Any ideas?

Error message:
TypeError at /admin/LeadDeviceSysteem/vraagcomponentinhoud/add/
coercing to Unicode: need string or buffer, VraagComponentModel found
Request Method: POST
Request URL:
http://127.0.0.1:8000/admin/LeadDeviceSysteem/vraagcomponentinhoud/add/
Exception Type: TypeError
Exception Value:coercing to Unicode: need string or buffer,
VraagComponentModel found

Variables:

VariableValue
componentAfstand1   u'1'
_save   u'Opslaan'
componentAfstand3   u'2'
componentAfstand2   u'1'
componentModel  u'1'
componentInhoud1u'a'
componentInhoud2u'b'
componentInhoud3u'c'
componentInhoud4u'd'

Definition:
class VraagComponentModel(models.Model):
naamKlant = models.ForeignKey(Klant, verbose_name = 'Firmanaam
van de klant')
componentGroepNummer = models.IntegerField(verbose_name =
'Nummer van componentgroep')
componentGroepOmschrijving = models.CharField(max_length=30,
verbose_name = 'Omschrijving van componentgroep' )
componentTypeNummer = models.IntegerField(verbose_name =
'Nummer van componenttype') # Componenten met nummer 0 gelden voor
hele klant; 1 t/m n zijn zoekopdrachten
componentTypeOmschrijving = models.CharField(max_length=30,
verbose_name = 'Omschrijving van componenttype' )
componentInsluiting = models.BooleanField(default = 'True',
verbose_name = 'Uitsluiten')# insluiten (T) of uitsluiten (F) van
deze component

def __unicode__(self):
return u'%s %s %s %s %s' % (self.naamKlant,
self.componentGroepNummer, self.componentGroepOmschrijving,
self.componentTypeNummer, self.componentTypeOmschrijving)

class Meta:
ordering =
['naamKlant','componentGroepNummer','componentTypeNummer']
unique_together = ("naamKlant",
"componentGroepNummer","componentTypeNummer")
verbose_name_plural = "vraagcomponentenmodel"

class VraagComponentInhoud(models.Model):
componentModel = models.ForeignKey(VraagComponentModel)
componentInhoud1 = models.TextField(verbose_name = 'Eerste
onderdeel')
componentAfstand1 = models.IntegerField(null = 'True',
verbose_name = 'Afstand in woorden tussen 1e en 2e onderdeel')
componentInhoud2 = models.CharField(null = 'True',
max_length=50, verbose_name = 'Tweede onderdeel')
componentAfstand2 = models.IntegerField(null = 'True',
verbose_name = 'Afstand in woorden tussen 2e en 3e onderdeel')
componentInhoud3 = models.CharField(null = 'True',
max_length=50, verbose_name = 'Derde onderdeel')
componentAfstand3 = models.IntegerField(null = 'True',
verbose_name = 'Afstand in woorden tussen 3e en 4e onderdeel')
componentInhoud4 = models.CharField(null = 'True',
max_length=50, verbose_name = 'Vierde onderdeel')

def __unicode__(self):
return self.componentModel

class Meta:
verbose_name_plural = "vraagcomponenteninhoud"


In SQLite:
sqlite> .indices LeadDeviceSysteem_vraagcomponentmodel
LeadDeviceSysteem_vraagcomponentmodel_naamKlant_id
sqlite_autoindex_LeadDeviceSysteem_vraagcomponentmodel_1

Regards,
Bob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Newbie question: upgrade to python 2.6: cannot (re)connect to Django?

2010-03-10 Thread BobAalsma
YES!
Thank you very much.

Amazing how simple things can be blocking if the context is
missing ;-)

Regards,
Bob

On Mar 10, 11:12 am, Jirka Vejrazka  wrote:
> Hi Bob,
>
> > MacPro1:Downloads$ ls
> > Django-1.1.1.tar
>
>   You have not unpacked the Django archive. You need to run:
> $ tar xf Django-1.1.1.tar
>
>   It will create a subdirectory (named "Django-1.1.1" probably), then
> you need to move to that subdirectory
>
> $ cd Django-1.1.1
>
>  and then run the
> $ python setup.py install
>
>   Regards
>
>     Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Newbie question: upgrade to python 2.6: cannot (re)connect to Django?

2010-03-09 Thread BobAalsma
On this machine (MacPro, OS X 10.5.8) I have installed and started
working with Django. I wanted to upgrade to Pyhton 2.6. Installed from
http://www.python.org/download/ (downloaded 2.6.4 Mac Installer Disk
Image). Seems to work properly. Then wanted to use Django again. Can't
seem to connect to this.
Re-downloaded Django and still does not work:
MacPro1:Downloads$ ls
Django-1.1.1.tar
MacPro1:Downloads$ sudo python setup.py install
Password:
/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/
Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such
file or directory

I can't find anywhere how to proceed.
Please 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-us...@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: Newbie question: empty is not empty?

2009-12-31 Thread BobAalsma
Thanks Jani,

I've tried to folow your suggestions (and thanks for explaining the r/
s difference) into the current version of the test:
def search(request):
if request.get('q',False):
q = request.GET['q']
klanten = Klant.objects.filter(naam__icontains=q)
return 
render_to_response('Beppe_klant/search_results_klanten.html',
{'klanten': klanten, 'query': q})
else:
message = 'Leeg, joh'
return HttpResponse(message)

This leads to AttributeError at /search/
'WSGIRequest' object has no attribute 'get'

Typo?

On Dec 31, 12:31 pm, Jani Tiainen <rede...@gmail.com> wrote:
> On Thu, 2009-12-31 at 03:20 -0800, BobAalsma wrote:
> > Thanks Masklin, I've just tried your suggestion and there is no
> > change.
>
> > I'm somewhat mystified by the 'u' that gets added to all answer
> > messages - is this something to do with unicode? Could this be the
> > root of (some) evil?
>
> Again, your're using formatter %r which in python means "representation
> of object". In case of strings it prints either u'' for unicode strings,
> or just '' for non unicode ones.
>
> It's still a string and doesn't get "appended" magically.
>
> So instead of using %r use %s (which means "string") and you see that
> magical u to disappear.
>
> also if you send q (as in example), even it's empty it will get in GET
> query dictionary, just because it exists. And it has value - empty
> string.
>
> So what you need to test is:
>
> if 'q' in request.GET and request.GET['q']:
>
> Or to make things a bit more Pythonic:
>
> if request.get('q', False):
>
> > I've tried using [ ] instead of the suggested ( ), which leads to a
> > Django errorpage, stating that the contents of the variable 'q' is
> > u'd' - which seems to indicate to me that a "u" is added to all values
> > of q (also explaining why q is never empty).
>
> > On Dec 31, 11:27 am, Masklinn <maskl...@masklinn.net> wrote:
> > > On 31 Dec 2009, at 10:58 , BobAalsma wrote:
>
> > > > I'm following the Django book to learn Django. I'm getting unexpected
> > > > responses and can't find how to address this. It seems that submitting
> > > > an empty form is not handled as if it is empty ??
>
> > > > In views.py:
> > > > def search(request):
> > > >    if 'q' in request.GET:
> > > >            message = 'U zocht: %r' % request.GET['q']
> > > >    else:
> > > >            message = 'Leeg'
> > > >    return HttpResponse(message)
>
> > > > However, on submitting an empty form, the displayed message is:
> > > > U zocht: u''
>
> > > > On submitting a 'd', the answer is:
> > > > U zocht: u'd'
>
> > > > Consistent, that's the good news...
>
> > > > How to solve this?
>
> > > First of all, this has nothing to do with forms. "Forms" in a Django 
> > > context designates Django 
> > > Forms:http://docs.djangoproject.com/en/dev/topics/forms/. Here, you're 
> > > only playing with query parameters, forms are not involved.
>
> > > Second, this is a Python issue more than a Django one: even if the 
> > > parameter is empty (e.g. `yourpage.com/search?q=`) it is present, 
> > > therefore it will be put in the GET dictionary. `key in dict` only checks 
> > > that the key exists, not that it keys to a value (let alone a "falsy" 
> > > value such as an empty string). What you really want to check is that the 
> > > 'q' key exists *and is non-empty*.
>
> > > I suggest that you use the `dict.get` method for this: it returns the 
> > > value for the key if the key exists, None if it doesn't. Just replace 
> > > `'q' in request.GET` by `request.GET.get('q')` and you should have the 
> > > behavior you expect.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Newbie question: empty is not empty?

2009-12-31 Thread BobAalsma
Yes.

I've copied your text into the views.py and now I get the expected
answers - thanks!

I'll study the differences to see what went wrong.

Thanks again,
Bob

On Dec 31, 12:26 pm, Masklinn <maskl...@masklinn.net> wrote:
> On 31 Dec 2009, at 12:20 , BobAalsma wrote:
>
> > Thanks Masklin, I've just tried your suggestion and there is no
> > change.
>
> > I'm somewhat mystified by the 'u' that gets added to all answer
> > messages - is this something to do with unicode? Could this be the
> > root of (some) evil?
>
> It shouldn't be, it simply indicates that you're getting a unicode string 
> instead of a bytestring (sensible Django behavior).
>
> > I've tried using [ ] instead of the suggested ( ), which leads to a
> > Django errorpage, stating that the contents of the variable 'q' is
> > u'd' - which seems to indicate to me that a "u" is added to all values
> > of q (also explaining why q is never empty).
>
> No, you'll notice that the `u` prefixes the string, it's only here to say 
> that this is a unicode string (akin to the rawstring prefix, you can in fact 
> create a raw unicode string by writing `ru'foo'`). And an empty unicode 
> string is still considered 'falsy' so that should not be an issue:
>
> >>> bool(u'')
> False
> >>> if u'': print 'oops'
>
> ... else: print 'ok'
> ...
> ok
>
> If your code has been altered to
>
> def search(request):
>     if request.GET.get('q'):
>         message = 'U zocht: %r' % request.GET['q']
>     else:
>         message = 'Leeg'
>     return HttpResponse(message)
>
> then you should not see `U zocht: u''` in your output. Is the code for the 
> search function you provide here all of it?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Newbie question: empty is not empty?

2009-12-31 Thread BobAalsma
Thanks Masklin, I've just tried your suggestion and there is no
change.

I'm somewhat mystified by the 'u' that gets added to all answer
messages - is this something to do with unicode? Could this be the
root of (some) evil?

I've tried using [ ] instead of the suggested ( ), which leads to a
Django errorpage, stating that the contents of the variable 'q' is
u'd' - which seems to indicate to me that a "u" is added to all values
of q (also explaining why q is never empty).


On Dec 31, 11:27 am, Masklinn <maskl...@masklinn.net> wrote:
> On 31 Dec 2009, at 10:58 , BobAalsma wrote:
>
>
>
>
>
> > I'm following the Django book to learn Django. I'm getting unexpected
> > responses and can't find how to address this. It seems that submitting
> > an empty form is not handled as if it is empty ??
>
> > In views.py:
> > def search(request):
> >    if 'q' in request.GET:
> >            message = 'U zocht: %r' % request.GET['q']
> >    else:
> >            message = 'Leeg'
> >    return HttpResponse(message)
>
> > However, on submitting an empty form, the displayed message is:
> > U zocht: u''
>
> > On submitting a 'd', the answer is:
> > U zocht: u'd'
>
> > Consistent, that's the good news...
>
> > How to solve this?
>
> First of all, this has nothing to do with forms. "Forms" in a Django context 
> designates Django Forms:http://docs.djangoproject.com/en/dev/topics/forms/. 
> Here, you're only playing with query parameters, forms are not involved.
>
> Second, this is a Python issue more than a Django one: even if the parameter 
> is empty (e.g. `yourpage.com/search?q=`) it is present, therefore it will be 
> put in the GET dictionary. `key in dict` only checks that the key exists, not 
> that it keys to a value (let alone a "falsy" value such as an empty string). 
> What you really want to check is that the 'q' key exists *and is non-empty*.
>
> I suggest that you use the `dict.get` method for this: it returns the value 
> for the key if the key exists, None if it doesn't. Just replace `'q' in 
> request.GET` by `request.GET.get('q')` and you should have the behavior you 
> expect.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.




Newbie question: empty is not empty?

2009-12-31 Thread BobAalsma
I'm following the Django book to learn Django. I'm getting unexpected
responses and can't find how to address this. It seems that submitting
an empty form is not handled as if it is empty ??

In views.py:
def search(request):
if 'q' in request.GET:
message = 'U zocht: %r' % request.GET['q']
else:
message = 'Leeg'
return HttpResponse(message)

However, on submitting an empty form, the displayed message is:
U zocht: u''

On submitting a 'd', the answer is:
U zocht: u'd'

Consistent, that's the good news...

How to solve this?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 users to input formatted text

2009-12-21 Thread BobAalsma
Umm, I think you would then also invite/enable hackers to upload
unwanted thingies, such as viruses and scripts...

On Dec 21, 8:12 am, Continuation  wrote:
> I have a TextField() field that stores user entered text. However the
> formatting is a bit weird, eg. new lines are lost when displaying that
> field.
>
> What is the best way to retain that formatting and also enable users
> to format their inputs with either HTML tags or some rich text editors?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.