Waiting List App

2008-11-13 Thread Keyton Weissinger

I need a waiting list application in which a site's functionality
hasn't come online yet and I want to gather email addresses of folks
interested in hearing when we go live. I know that building such as
application would be almost trivial, but in the interest of reuse, I
thought I'd ask if anyone knew of one. I've looked on Google for
"django waiting list app" and similar to no avail. Probably too easy
to consider a reusable app, but, again, I thought I'd ask.

Thank you!

Keyton

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



Re: Testing system and alternate template languages

2008-11-13 Thread Russell Keith-Magee

On Fri, Nov 14, 2008 at 12:13 PM, Erik <[EMAIL PROTECTED]> wrote:
>
> In case there are others following this topic, I have the test system
> working.  I ended up putting a couple of functions in the contrib
> folder of my django installation under the mako_django folder.  The
> functions emulate the behavior of the instrumented_test_render and
> run_tests functions from django.test.utils an django.test.simple
> respectively.  This is pretty much the simplest scheme I could come up
> with, and I'm sure a different implementation would provide more
> features.  However, it does allow you to access the template and
> context members of the result when using the django test client.

> Russ -- Thanks for your help.  After browsing around in the code, I
> think the process for adding at least this much test functionality for
> an external template system was relatively painless.  I would welcome
> any comments (or corrections) regarding this solution if you have
> them.  As far as improvements, I think all that's really needed is a
> little howto (to which I would be happy to contribute).  It seemed
> easy enough at least in this case that adding special support might be
> overkill.

Documentation improvements are always welcome.

> If anyone wants to try it, what I did was to put the following code in
> django/contrib/mako_django/__init__.py:

Thanks for taking the time to do this Erik.

One minor suggestion - there's not really any need to put this into
the django.contrib namespace. django.contrib is intended as a
collection of officially sanctioned extensions, not a general storage
place for other plugins. It shouldn't make any difference to the way
your code runs - it just means people don't get confused into thinking
that your code is part of the official distribution that they are
missing for some reason.

Another suggestion, but a procedural one: I would suggest that you
upload this to djangosnippets.org. As a message in a mailing list,
this good work is easy to lose - on snippets, it is archived along
with lots of other useful goodies.

Yours,
Russ Magee %-)

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



Re: Apache Segmentation Fault on succesful authentication

2008-11-13 Thread Graham Dumpleton

Did you do a 'ls -L' on the symlink to validate it pointed at
something?

The relative location of where the .so will be is more a hint as for
different systems it may not be in same relative location.

Graham

On Nov 13, 10:44 pm, huw_at1 <[EMAIL PROTECTED]> wrote:
> My apologies. I forgot to mention that I already tried what was
> suggested in the article you pointed me at. I created a symlink in /
> usr/local/lib/python2.5/config as directed however recompiling
> mod_python still links to the library statically. Unless I missed a
> step in the article I am starting to wonder if mod_python just
> includes this library statically by default. Still, thanks for all the
> help so far. I really appreciate it.
>
> On Nov 13, 9:55 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > Because you have created the symlink for the .so file so it appears
> > next to the static library. It is arguably a a failing of standard
> > Python installer that it doesn't do this. What to do is explained in
> > document I previously pointed you at:
>
> >  http://code.google.com/p/modwsgi/wiki/InstallationIssues
>
> > Yes I know this is for mod_wsgi but same applies to mod_python.
>
> > Graham
>
> > On Nov 13, 8:44 pm, huw_at1 <[EMAIL PROTECTED]> wrote:
>
> > > ls -ltr /usr/local/lib
>
> > > -r-xr-xr-x     1 root root  4806649 Nov 11 11:22 libpython2.5.a
> > > -r-xr-xr-x     1 root root  4806649 Nov 12 12:49 libpython2.5.so.1.0
> > > lrwxrwxrwx  1 root root            19 Nov 12 12:49 libpython2.5.so ->
> > > libpython2.5.so.1.0
>
> > > echo $LD_LIBRARY_PATH
>
> > > /usr/local/lib
>
> > > ldd /usr/local/bin/python
>
> > >         libpython2.5.so.1.0 => /usr/local/lib/libpython2.5.so.1.0
> > > (0x2b6d8efc5000)
> > >         libpthread.so.0 => /lib64/libpthread.so.0 (0x0039a4a0)
> > >         libdl.so.2 => /lib64/libdl.so.2 (0x0039a460)
> > >         libutil.so.1 => /lib64/libutil.so.1 (0x0039b340)
> > >         libm.so.6 => /lib64/libm.so.6 (0x0039a420)
> > >         libc.so.6 => /lib64/libc.so.6 (0x0039a3e0)
> > >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > > recompile mod_python and do ldd /usr/local/apache2/modules/
> > > mod_python.so
>
> > >         libpthread.so.0 => /lib64/libpthread.so.0 (0x2b74c34f7000)
> > >         libdl.so.2 => /lib64/libdl.so.2 (0x2b74c3711000)
> > >         libutil.so.1 => /lib64/libutil.so.1 (0x2b74c3915000)
> > >         libm.so.6 => /lib64/libm.so.6 (0x2b74c3b19000)
> > >         libc.so.6 => /lib64/libc.so.6 (0x2b74c3d9c000)
> > >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > > I still don't get why the library is being compiled in statically.
>
> > > On Nov 13, 12:11 am, Graham Dumpleton <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > On Nov 12, 11:44 pm, huw_at1 <[EMAIL PROTECTED]> wrote:
>
> > > > > echo '/usr/local/lib' >> /etc/ld.so.conf
>
> > > > > more /etc/ld.so.conf
>
> > > > > include ld.so.conf.d/*.conf
> > > > > /usr/local/lib
>
> > > > > ldd /usr/local/bin/python
>
> > > > >         libpython2.5.so.1.0 => not found
> > > > >         libpthread.so.0 => /lib64/libpthread.so.0 (0x0039a4a0)
> > > > >         libdl.so.2 => /lib64/libdl.so.2 (0x0039a460)
> > > > >         libutil.so.1 => /lib64/libutil.so.1 (0x0039b340)
> > > > >         libm.so.6 => /lib64/libm.so.6 (0x0039a420)
> > > > >         libc.so.6 => /lib64/libc.so.6 (0x0039a3e0)
> > > > >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > > > Where is libpython2.5.so installed? What are the permissions on it?
>
> > > > What do you get for:
>
> > > >   echo $LD_LIBRARY_PATH
>
> > > > just prior to running 'ld'?
>
> > > > Graham
>
> > > > > On Nov 12, 11:57 am, marco ghidinelli <[EMAIL PROTECTED]> wrote:
>
> > > > > > On Wed, Nov 12, 2008 at 03:22:02AM -0800, huw_at1 wrote:
>
> > > > > > > An update on this.
>
> > > > > > > 'which python' returns:
>
> > > > > > >         libpython2.5.so.1.0 => not found
> > > > > > >         libpthread.so.0 => /lib64/libpthread.so.0 
> > > > > > > (0x0039a4a0)
> > > > > > >         libdl.so.2 => /lib64/libdl.so.2 (0x0039a460)
> > > > > > >         libutil.so.1 => /lib64/libutil.so.1 (0x0039b340)
> > > > > > >         libm.so.6 => /lib64/libm.so.6 (0x0039a420)
> > > > > > >         libc.so.6 => /lib64/libc.so.6 (0x0039a3e0)
> > > > > > >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > > > > > > This explains why I cannot compile mod_python without first 
> > > > > > > setting
> > > > > > > the LD_LIBRARY_PATH to '/usr/local/lib'. I don't know if this is 
> > > > > > > the
> > > > > > > reason why the mod_python compilation continuously compiles with 
> > > > > > > the
> > > > > > > python library as static. I upgraded my apache to the latest 
> > > > > > > version
> > > > > > > however I still am getting segmentation faults on user 
> > > > > > > authentication.
> > > > > > > Which potentially su

Re: Exclude fields in form by language

2008-11-13 Thread Brandon Taylor

Thanks Malcom, I'll give that a shot.

Cheers,
Brandon

On Nov 13, 10:47 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2008-11-13 at 20:36 -0800, Brandon Taylor wrote:
> > Hi Malcom,
>
> > This is what I have so far, but is not working...
>
> > #forms.py
> > class CreditApplicationForm(forms.Form):
> >     def __init__(language_code, *args, **kwargs):
> >         super(CreditApplicationForm, self).__init__(*args, **kwargs)
>
> >     class Meta():
> >         #trying to call self.language_code here returns an exception:
> > self is not defined
>
> That's correct. The inner class (which shouldn't have the parentheses,
> btw, since it's a class, not an instance) is parsed at import time, not
> runtime. You will need to make changes to the internal setup inside
> __init__, since it's per-instance changes.
>
>
>
> > #views.py
> > def my_action(request):
> >     credit_app_form = CreditApplicationForm(LANGUAGE_CODE)
>
> Since the first positional argument to a form is not the language code,
> this will almost certainly fail. If you're extending a parent class,
> it's usually a lot better to use keyword arguments. Then pop your
> keyword arguments from **kwargs before passing the result to the super()
> method.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Exclude fields in form by language

2008-11-13 Thread Malcolm Tredinnick


On Thu, 2008-11-13 at 20:36 -0800, Brandon Taylor wrote:
> Hi Malcom,
> 
> This is what I have so far, but is not working...
> 
> #forms.py
> class CreditApplicationForm(forms.Form):
> def __init__(language_code, *args, **kwargs):
> super(CreditApplicationForm, self).__init__(*args, **kwargs)
> 
> class Meta():
> #trying to call self.language_code here returns an exception:
> self is not defined

That's correct. The inner class (which shouldn't have the parentheses,
btw, since it's a class, not an instance) is parsed at import time, not
runtime. You will need to make changes to the internal setup inside
__init__, since it's per-instance changes.


> 
> #views.py
> def my_action(request):
> credit_app_form = CreditApplicationForm(LANGUAGE_CODE)

Since the first positional argument to a form is not the language code,
this will almost certainly fail. If you're extending a parent class,
it's usually a lot better to use keyword arguments. Then pop your
keyword arguments from **kwargs before passing the result to the super()
method.

Regards,
Malcolm



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



Re: Exclude fields in form by language

2008-11-13 Thread Brandon Taylor

Hi Malcom,

This is what I have so far, but is not working...

#forms.py
class CreditApplicationForm(forms.Form):
def __init__(language_code, *args, **kwargs):
super(CreditApplicationForm, self).__init__(*args, **kwargs)

class Meta():
#trying to call self.language_code here returns an exception:
self is not defined

#views.py
def my_action(request):
credit_app_form = CreditApplicationForm(LANGUAGE_CODE)
return render_to_response('template.html', {'form' : form})

Thoughts?
Brandon

On Nov 13, 9:54 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2008-11-13 at 18:06 -0800, Brandon Taylor wrote:
> > Hi everyone,
>
> > I'm doing an internationalization project and have a form with fields
> > that need to be localized. I would like to have one form, pass in the
> > language code and exclude the appropriate fields.
>
> > How would I go about passing in the variable to the form? I know I
> > have to pick it up in the __init__ of the form, just don't know the
> > correct syntax to do so.
>
> You subclass the Form object anyway, so you need to write an __init__
> method that also accepts this extra parameter. Then you pass in the
> extra parameter to the form yourself whenever you instantiate the form.
>
> Forms are just Python classes. So you customise them like any normal
> class. Django isn't going to do anything special to help or hinder you
> there.
>
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Setting Up Django on Vista and Creating a Database

2008-11-13 Thread John Antony


Thank you Karen and Marcelo, I had actually not set the path for
"django-admin.py".
To set the Windows PATH in Vista click the following:
Start>Control Panel>System>Advanced System
Settings>Advanced>Environment Variable

On Nov 13, 9:59 pm, Danny R <[EMAIL PROTECTED]> wrote:
> John,
>
> Setting the paths in Vista is quirky. I also cannot make it work.
>
> As a workaround whenever I open a new command prompt, i do the
> following command:
>
>            set path=C:\Python25\Lib\site-packages\django\bin\;C:
> \Python25\
>
> then, when i create an app or a project, i do this instead:
>
>            python C:\Python25\Lib\site-packages\django\bin\django-
> admin.py startproject djangoapps
>
> On Nov 12, 7:40 pm, John Antony <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have now used all your suggestions..
> > 1) Installed in C:\Python25\ (Marcelo Barbero)
> > 2)Installed Python 2.5 instead of Python 2.6 (Karen Tracey)
> > and finally
> > 3)Added the environment variables in "path" (not PATH, should i create
> > a new one named PATH) for both django and python.
>
> > I installed django and postgreSQL following it stepwise from
>
> >http://thinkhole.org/wp/django-on-windows/
>
> > but however
> > now when i reach the command of testing django i still am getting the
> > following error
>
> > C:\Python25\Lib\site-packages\django>django-admin.py startproject
> > testproject
> > 'django-admin.py' is not recognized as an internal or external
>
> > command,
> > operable program or batch file.
>
> > what sholud i do now
> > On Nov 11, 6:19 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> > > On Tue, Nov 11, 2008 at 1:40 AM, John Antony <[EMAIL PROTECTED]> wrote:
>
> > > > I am currently using Vista OS
> > > > I have installed Python in the path
> > > > D:\Python26\
> > > > and extracted the tarred file downloaded fromwww.djangoprojects.com
> > > > ie "Django-1.0.tar.gz" in the path
> > > > D:\Python26\Django-1.0\Django-1.0
> > > > I am however unable to intall Django
> > > > on typing the following command in command prompt I get this error:
>
> > > > D:\Python26\Django-1.0\Django-1.0>python setup.py install
> > > > 'python' is not recognized as an internal or external command,
> > > > operable program or batch file.
>
> > > The Python installer did not put the directory containing the python.exe
> > > executable in the Windows PATH environment variable.  That is why all the
> > > Django instructions for Windows generally drop the 'python' from such
> > > commands, since on Windows usually all you can count on when writing
> > > instructions is that the Python installer set up an association between
> > > '.py' files and the python executable.  So, if you drop the python from 
> > > the
> > > front of the command, that should work.
>
> > > However, I have heard reports that the association created by the Python 
> > > 2.6
> > > installer on Vista is broken, see here:
>
> > >http://groups.google.com/group/django-users/msg/1d00809e826fa8c3
>
> > > So, you may need to fix that as described in that message.
>
> > > You can also put the path to python.exe in your Windows system path, so 
> > > that
> > > you can use the 'python whatever' form of commands.  In older versions of
> > > Windows you would do that by going to Start->Settings->Control Panel,
> > > choosing "System", selecting the "Advanced" tab, clicking on "Environment
> > > Variables", and finding/editing the one for PATH.  I do not know if that 
> > > has
> > > changed in Vista.
>
> > > Karen- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Exclude fields in form by language

2008-11-13 Thread Malcolm Tredinnick


On Thu, 2008-11-13 at 18:06 -0800, Brandon Taylor wrote:
> Hi everyone,
> 
> I'm doing an internationalization project and have a form with fields
> that need to be localized. I would like to have one form, pass in the
> language code and exclude the appropriate fields.
> 
> How would I go about passing in the variable to the form? I know I
> have to pick it up in the __init__ of the form, just don't know the
> correct syntax to do so.

You subclass the Form object anyway, so you need to write an __init__
method that also accepts this extra parameter. Then you pass in the
extra parameter to the form yourself whenever you instantiate the form.

Forms are just Python classes. So you customise them like any normal
class. Django isn't going to do anything special to help or hinder you
there.

Malcolm




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



Re: Problem with named URL and parameters

2008-11-13 Thread Malcolm Tredinnick


On Thu, 2008-11-13 at 17:06 -0800, Brandon Taylor wrote:
> Hi everyone,
> 
> Gerard's suggestion worked. Moving the pattern into a separate
> definition fixed it. But, I couldn't explain why :)

Then there's some kind of bug there. :-(

Malcolm



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



Re: Read/Create Excel xls files using django

2008-11-13 Thread Tim Chase

>> [my stuff about using XML templates with Excel]
> Not trying to start a flame war, but pyexcelerator/xlwt support these
> as well...

No flame-war perceived...just sharing the hack I've used that 
doesn't involve much more complexity than a prefab template and 
Django's built-in templating.

[Steve & Matt dialoging]
>> I think Tim's point is that with XML you can use Excel visually to
>> create the spreadsheet you want, then use Django's existing template
>> mechanism to tailor the output as required. It struck me as a very neat
>> solution to the problem posed.
> 
> Good point, I didn't catch it on my way through ;)  Though I've heard
> of people doing similar XML manipulation after someone (good with
> design) does layout in OpenOffice, and then exporting to (ms) office.

I don't know if it's easy to reverse engineer the format of more 
complex documents -- my aim was merely to reverse enough of the 
format to export the data I wanted in a more preserving fashion. 
  For my simple data-dumps, it was good.  For complex 
fixed-dimension Excel files, it would also likely serve well (as 
a matter of fact, you can just put values like "{{ obj.field }}" 
in your cells).  But for more complex layouts that also need to 
dynamically grow rows or columns, something more domain-specific 
like Matt mentions will likely cause less headache.  However, MS 
does offer reference materials on the format[1]

> Is the 2K3 xml format supported by other versions of Office?

I don't know how far back it's readable -- I've got O2k3 on my 
office development machine, and others in the office with 02k7 
have no problems opening the export files.  I don't have access 
to pre-'03 versions for testing.  From what I've read, it works 
in "Excel 2002" (such a creature exists?)

-tim


[1]
http://msdn.microsoft.com/en-us/library/aa140066.aspx






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



Re: Testing system and alternate template languages

2008-11-13 Thread Erik

In case there are others following this topic, I have the test system
working.  I ended up putting a couple of functions in the contrib
folder of my django installation under the mako_django folder.  The
functions emulate the behavior of the instrumented_test_render and
run_tests functions from django.test.utils an django.test.simple
respectively.  This is pretty much the simplest scheme I could come up
with, and I'm sure a different implementation would provide more
features.  However, it does allow you to access the template and
context members of the result when using the django test client.

Russ -- Thanks for your help.  After browsing around in the code, I
think the process for adding at least this much test functionality for
an external template system was relatively painless.  I would welcome
any comments (or corrections) regarding this solution if you have
them.  As far as improvements, I think all that's really needed is a
little howto (to which I would be happy to contribute).  It seemed
easy enough at least in this case that adding special support might be
overkill.


If anyone wants to try it, what I did was to put the following code in
django/contrib/mako_django/__init__.py:

# *** __init__.py 
# mako_django unit test integration.  In order to install, I recommend
# placing this file in a folder called "mako_django" in the contrib
# section of your django install.  This might be a stupid
# recommendation, so if it seems that way or someone else says so,
# assume they're right.

# This is ALPHA code (at best) so use with caution. **

# Written by Erik Lee

# You have my permission to do anything you want with this code

from django.test.utils import setup_test_environment,
teardown_test_environment
from django.test.simple import run_tests
from mako.template import Template
from django.template.context import Context
from django.test import signals

def instrumented_test_render(self,**context):
"""
This function calls the template's render function with the given
rendering context, and then sends the template_rendered signal
with the context and the template being rendered in order to
integrate more fully with django's unit test system.  It seems to
behave properly on my system.
"""
self.pretest_render(**context)
signals.template_rendered.send(sender=self, template=self,
context=Context(context))



def run_mako_tests(test_labels, verbosity, interactive):
"""
This function simply hijacks the mako template renderer's render
function with a simple wrapper (instrumented_test_render) that
will trigger the template_rendered signal after rendering the
template.  After the tests are run (using the default test runner
provided in the django distribution, it restores the rendering
function to its original state.  During the tests, the original
function can be accessed through the name "pretest_render"
"""
Template.pretest_render = Template.render
Template.render = instrumented_test_render
result = run_tests(test_labels, verbosity, interactive)
Template.render = Template.pretest_render
return result

#  end __init__.py *

Erik


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



Exclude fields in form by language

2008-11-13 Thread Brandon Taylor

Hi everyone,

I'm doing an internationalization project and have a form with fields
that need to be localized. I would like to have one form, pass in the
language code and exclude the appropriate fields.

How would I go about passing in the variable to the form? I know I
have to pick it up in the __init__ of the form, just don't know the
correct syntax to do so.

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



Re: Problem with named URL and parameters

2008-11-13 Thread Brandon Taylor

Hi everyone,

Gerard's suggestion worked. Moving the pattern into a separate
definition fixed it. But, I couldn't explain why :)

Many thanks!
Brandon

On Nov 13, 6:48 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2008-11-14 at 01:20 +0300, Alex Koshelev wrote:
> > Hmm... Why in template tag you wrote `conversions` as view name but in
> > error traceback there is `my_site.conversions`?
>
> Because the error reporting from URL resolution is retarded. :-(
>
> The last thing it tries is . and that's what
> it reports, even though you might not even have project_name on the path
> and  might be a name specified explicitly (it's trying to
> see if it's the name of a view function, rather than a name="..." name).
>
> I have a bunch of uncommitted changes to improve that state of affairs,
> but there are a few corner cases, so it hasn't been committed yet.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-13 Thread Malcolm Tredinnick


On Fri, 2008-11-14 at 01:20 +0300, Alex Koshelev wrote:
> Hmm... Why in template tag you wrote `conversions` as view name but in
> error traceback there is `my_site.conversions`?

Because the error reporting from URL resolution is retarded. :-(

The last thing it tries is . and that's what
it reports, even though you might not even have project_name on the path
and  might be a name specified explicitly (it's trying to
see if it's the name of a view function, rather than a name="..." name).

I have a bunch of uncommitted changes to improve that state of affairs,
but there are a few corner cases, so it hasn't been committed yet.

Regards,
Malcolm



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



Re: Views triggering twice

2008-11-13 Thread Malcolm Tredinnick


On Thu, 2008-11-13 at 17:03 -0500, Jeff Gentry wrote:
> 
> Another piece of info, in case it's useful here - the page does *not*
> render on the first view call, it's only after the second call that the
> page will render.  I don't think it's even pulling up the template until
> the second go-around, as a test I put some intentionally bad template code
> in a template.  On the first time the view was called, nothing happened
> but on the second one I got the TemplateSyntaxError.

Quoting from the book of "if you hear hoofbeats, think horses, not
zebras": This obviously isn't normal Django behaviour and since calling
views is easily the most common operation in Django, it's safe to assume
that any breakage here in Django would have been noticed by other
people. Which means the problem is almost certainly in your code. None
of which you have shown us and we can't guess what it might contain.

Please create a very small example -- say a single URL pattern and a
view with one line it calling render_to_response() that demonstrates the
issue reliably. Then we might be able to work out what's going on.

I'm not entirely convinced by your diagnosis of rendering, since if the
browser was requesting the page twice, you might well not see the first
rendering at all. You could try printing things like the output of
traceback.print_stack() in your view to see if it's called the same way
both times, for example.

In any case, reduce you problem to the shortest possible example so that
you can show us the code. Although, typically, reducing it to the
shortest possible example more or less naturally reveals what the
problem is in the first place, because you end up seeing which line is
critical to triggering the issue at hand.

Regards,
Malcolm


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



Re: Read/Create Excel xls files using django

2008-11-13 Thread m h

On Thu, Nov 13, 2008 at 5:21 PM, Steve Holden <[EMAIL PROTECTED]> wrote:
>
> m h wrote:
>> On Thu, Nov 13, 2008 at 4:54 PM, Tim Chase
>> <[EMAIL PROTECTED]> wrote:
>>
 I am trying to detemine if there is a way to read the data from an
 Excel xls file into django. I also need to create an xls file. Does
 anyone know how that would be done ?

>>> In addition to the other suggestions on the list, Excel (at least
>>> '03, if not other versions) has a "save as XML" format that's
>>> fairly easy to mangle into your own machinations.  We use that
>>> for our internal application so our account-managers have
>>> something they can twiddle in a format they're more accustomed
>>> to.  The basic XML format is pretty easy to reverse engineer
>>> (just create a skeleton document with the content you want and
>>> take a look how things like workbooks, formatting, etc are done),
>>> and works wonderfully with Django's templating language.  The big
>>> draws for us over CSV:
>>>
>>>   - the ability to specify data-type (particularly to preserve
>>> leading zeroes)
>>>
>>>   - the ability to specify formatting (both "this should be
>>> formatted like a phone-number" and "this should be red 18-point
>>> comic-sans" sorts of formatting)
>>>
>>>   - the ability to define multiple tabs (workbooks/worksheets,
>>> whatever you want to call them)
>>>
>>>   - the ability to enter formula values
>>>
>>> Most of our work was pretty basic, but the file-format was
>>> sufficiently easy for our needs that it was a no-brainer.
>>> Additionally, it didn't require Django to be running on a Win32
>>> box with Excel installed (which we don't have installed on our
>>> Win32 servers, let alone our Linux servers hosting Django).
>>>
>>
>> Not trying to start a flame war, but pyexcelerator/xlwt support these
>> as well...
> I think Tim's point is that with XML you can use Excel visually to
> create the spreadsheet you want, then use Django's existing template
> mechanism to tailor the output as required. It struck me as a very neat
> solution to the problem posed.

Good point, I didn't catch it on my way through ;)  Though I've heard
of people doing similar XML manipulation after someone (good with
design) does layout in OpenOffice, and then exporting to (ms) office.

Is the 2K3 xml format supported by other versions of Office?

cheers
-matt

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



Re: TemplateDoesNotExist

2008-11-13 Thread Malcolm Tredinnick


On Thu, 2008-11-13 at 11:12 -0800, sergioh wrote:
> 
>  are you using fastcgi? it could be an error on your syspath?

The filesystem path in TEMPLATE_DIRS has absolutely nothing to do with
Python's import path. These are files that are loaded via os.open() and
read(). They aren't Python files at all.


Regards,
Malcolm



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



Re: Read/Create Excel xls files using django

2008-11-13 Thread Steve Holden

m h wrote:
> On Thu, Nov 13, 2008 at 4:54 PM, Tim Chase
> <[EMAIL PROTECTED]> wrote:
>   
>>> I am trying to detemine if there is a way to read the data from an
>>> Excel xls file into django. I also need to create an xls file. Does
>>> anyone know how that would be done ?
>>>   
>> In addition to the other suggestions on the list, Excel (at least
>> '03, if not other versions) has a "save as XML" format that's
>> fairly easy to mangle into your own machinations.  We use that
>> for our internal application so our account-managers have
>> something they can twiddle in a format they're more accustomed
>> to.  The basic XML format is pretty easy to reverse engineer
>> (just create a skeleton document with the content you want and
>> take a look how things like workbooks, formatting, etc are done),
>> and works wonderfully with Django's templating language.  The big
>> draws for us over CSV:
>>
>>   - the ability to specify data-type (particularly to preserve
>> leading zeroes)
>>
>>   - the ability to specify formatting (both "this should be
>> formatted like a phone-number" and "this should be red 18-point
>> comic-sans" sorts of formatting)
>>
>>   - the ability to define multiple tabs (workbooks/worksheets,
>> whatever you want to call them)
>>
>>   - the ability to enter formula values
>>
>> Most of our work was pretty basic, but the file-format was
>> sufficiently easy for our needs that it was a no-brainer.
>> Additionally, it didn't require Django to be running on a Win32
>> box with Excel installed (which we don't have installed on our
>> Win32 servers, let alone our Linux servers hosting Django).
>> 
>
> Not trying to start a flame war, but pyexcelerator/xlwt support these
> as well...
I think Tim's point is that with XML you can use Excel visually to
create the spreadsheet you want, then use Django's existing template
mechanism to tailor the output as required. It struck me as a very neat
solution to the problem posed.


regards
 Steve


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



Re: Foreign Key with a default key

2008-11-13 Thread Steve Holden

Luke Seelenbinder wrote:
> I'm am trying to make a ForeignKey with a default value.
> But when I save i get a "invalid literal for int() with base 10: 'Stat
> object'" error
> Here is my code:
>
> from django.db import models
>
> class Stat(models.Model):
> total   =   models.IntegerField(default=0)
> right   =   models.IntegerField(default=0)
> wrong   =   models.IntegerField(default=0)
>
> def percent_right(self):
> return (float(right) / total) * 100
>
> class Noun(models.Model):
>
> word=   models.CharField(max_length='50',
> unique=True)
>
> definition  =   models.CharField(max_length='100',
> default=Stat())
>
> definition_stats=   models.ForeignKey(Stat, default=Stat(),)
>
> GENDER_CHOICES  =   (
> (True, 'Masculine'),
> (False,'Feminine'),
> (None, 'Neuter'),
> )
> gender  =   models.BooleanField(blank=True, null=True,
> choices=GENDER_CHOICES)
> gender_stats=   models.ForeignKey(
> Stat,
> default=Stat(),
> related_name='gender_stats',
> )
>
> plurality   =   models.CharField(max_length='50',)
>
> class Verb(models.Model):
> word=   models.CharField(max_length='50',
> unique=True)
>
> definition  =   models.CharField(max_length='100',)
> definition_stats=   models.ForeignKey(Stat, default=Stat(),)
>
> irregular   =   models.BooleanField()
>
>   
Have you tried reading a Stat instance in from the database and using
that as the default value? The one you currently use hasn't been saved
anywhere, and therefore has a None primary key (though it looks to me as
though the instance is being used where a primary key value is required,
so maybe the default value should be the primary key of an existing
instance?).

regards
 Steve


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



Re: Testing system and alternate template languages

2008-11-13 Thread Erik

Thanks!  I'll look into this.  If anyone is interested in the outcome
I'll submit a patch to the mako_django package I'm using.  Drop a
reply here if you're interested in the results.

On Nov 12, 6:24 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Thu, Nov 13, 2008 at 9:58 AM, Erik <[EMAIL PROTECTED]> wrote:
>
> > I am involved in a project that's using django with the mako_django
> > package for template rendering.  I'm working on the unit tests, but
> > I'm running into the problem that the context and template are not
> > returned after a query from the test client (the members in the
> > response are empty).   I'm assuming that the reason for this is that
> > I'm using a non standard template system, and I was wondering if there
> > is a good way to add the full testing support to another template
> > language.
>
> > Can anyone give me some advice about how to get the test framework
> > working with an alternate template system?
>
> The Django test client logs templates and contexts by adding signal
> handlers during the setup phase of the test process. This setup phase
> instruments the Django template language so that whenever a template
> is rendered, a signal is fired; the test client listens for that
> signal, and the the template and context detail is saved for later
> use.
>
> If you are using a different template language, you will need to
> provide similar instrumentation. As long as your template language
> uses the a "template + context" approach to rendering, you should be
> able to use the same signal. The instrumentation is defined in
> django/test/utils.py. instrumented_test_render() is the instrumented
> rendering mechanism; it is installed using setup_test_environment(),
> and removed again using teardown_test_environment(); these methods are
> invoked as part of the Django test runner.
>
> If you write your own setup/teardown, you can install your own
> instrumentation; you then need to define a custom test runner that
> will invoke your own setup and teardown scheme. This process of
> integrating custom setup/teardown processes is certainly something
> that could be optimized; I'm open to any suggestions as to how it
> could be improved (I have a few ideas, but I'd like to hear opinions
> from a fresh mind before I introduce them).
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Read/Create Excel xls files using django

2008-11-13 Thread m h

On Thu, Nov 13, 2008 at 4:54 PM, Tim Chase
<[EMAIL PROTECTED]> wrote:
>
>> I am trying to detemine if there is a way to read the data from an
>> Excel xls file into django. I also need to create an xls file. Does
>> anyone know how that would be done ?
>
> In addition to the other suggestions on the list, Excel (at least
> '03, if not other versions) has a "save as XML" format that's
> fairly easy to mangle into your own machinations.  We use that
> for our internal application so our account-managers have
> something they can twiddle in a format they're more accustomed
> to.  The basic XML format is pretty easy to reverse engineer
> (just create a skeleton document with the content you want and
> take a look how things like workbooks, formatting, etc are done),
> and works wonderfully with Django's templating language.  The big
> draws for us over CSV:
>
>   - the ability to specify data-type (particularly to preserve
> leading zeroes)
>
>   - the ability to specify formatting (both "this should be
> formatted like a phone-number" and "this should be red 18-point
> comic-sans" sorts of formatting)
>
>   - the ability to define multiple tabs (workbooks/worksheets,
> whatever you want to call them)
>
>   - the ability to enter formula values
>
> Most of our work was pretty basic, but the file-format was
> sufficiently easy for our needs that it was a no-brainer.
> Additionally, it didn't require Django to be running on a Win32
> box with Excel installed (which we don't have installed on our
> Win32 servers, let alone our Linux servers hosting Django).

Not trying to start a flame war, but pyexcelerator/xlwt support these
as well

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



Re: Read/Create Excel xls files using django

2008-11-13 Thread Tim Chase

> I am trying to detemine if there is a way to read the data from an
> Excel xls file into django. I also need to create an xls file. Does
> anyone know how that would be done ?

In addition to the other suggestions on the list, Excel (at least 
'03, if not other versions) has a "save as XML" format that's 
fairly easy to mangle into your own machinations.  We use that 
for our internal application so our account-managers have 
something they can twiddle in a format they're more accustomed 
to.  The basic XML format is pretty easy to reverse engineer 
(just create a skeleton document with the content you want and 
take a look how things like workbooks, formatting, etc are done), 
and works wonderfully with Django's templating language.  The big 
draws for us over CSV:

   - the ability to specify data-type (particularly to preserve 
leading zeroes)

   - the ability to specify formatting (both "this should be 
formatted like a phone-number" and "this should be red 18-point 
comic-sans" sorts of formatting)

   - the ability to define multiple tabs (workbooks/worksheets, 
whatever you want to call them)

   - the ability to enter formula values

Most of our work was pretty basic, but the file-format was 
sufficiently easy for our needs that it was a no-brainer. 
Additionally, it didn't require Django to be running on a Win32 
box with Excel installed (which we don't have installed on our 
Win32 servers, let alone our Linux servers hosting Django).

-tim



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



Re: Foreign Key with a default key

2008-11-13 Thread Luke Seelenbinder

made a mistake in the c&p the line:
definition  =   models.CharField(max_length='100',
default=Stat())

should be:
definition  =   models.CharField(max_length='100',)

On Nov 13, 6:35 pm, Luke Seelenbinder <[EMAIL PROTECTED]> wrote:
> I'm am trying to make a ForeignKey with a default value.
> But when I save i get a "invalid literal for int() with base 10: 'Stat
> object'" error
> Here is my code:
>
> from django.db import models
>
> class Stat(models.Model):
>     total               =   models.IntegerField(default=0)
>     right               =   models.IntegerField(default=0)
>     wrong               =   models.IntegerField(default=0)
>
>     def percent_right(self):
>         return (float(right) / total) * 100
>
> class Noun(models.Model):
>
>     word                =   models.CharField(max_length='50',
> unique=True)
>
>     definition          =   models.CharField(max_length='100',
> default=Stat())
>
>     definition_stats    =   models.ForeignKey(Stat, default=Stat(),)
>
>     GENDER_CHOICES      =   (
>         (True, 'Masculine'),
>         (False,'Feminine'),
>         (None, 'Neuter'),
>     )
>     gender              =   models.BooleanField(blank=True, null=True,
> choices=GENDER_CHOICES)
>     gender_stats        =   models.ForeignKey(
>                                 Stat,
>                                 default=Stat(),
>                                 related_name='gender_stats',
>                             )
>
>     plurality           =   models.CharField(max_length='50',)
>
> class Verb(models.Model):
>     word                =   models.CharField(max_length='50',
> unique=True)
>
>     definition          =   models.CharField(max_length='100',)
>     definition_stats    =   models.ForeignKey(Stat, default=Stat(),)
>
>     irregular           =   models.BooleanField()
>
> Thanks,
> Luke
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: General question: Django-Profiles, auth.User and "merging" both data

2008-11-13 Thread Alex S.

I don't know if this is the best way to pre-populate a form, but I
changed my view so it takes now a data dictionnary. It works :-)

data = {
'first_name':user_obj.first_name,
'last_name':user_obj.last_name,
'gender':profile_obj.gender,
'birthdate':profile_obj.birthdate,
'country':profile_obj.country,
'city':profile_obj.city
}
form = form_class(data)

@ MikeKJ: Maybe it works for you to (just defining your own
forms.Form). My example code should help.

Thanks for all your help (especially to you, urukay)!

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



Foreign Key with a default key

2008-11-13 Thread Luke Seelenbinder

I'm am trying to make a ForeignKey with a default value.
But when I save i get a "invalid literal for int() with base 10: 'Stat
object'" error
Here is my code:

from django.db import models

class Stat(models.Model):
total   =   models.IntegerField(default=0)
right   =   models.IntegerField(default=0)
wrong   =   models.IntegerField(default=0)

def percent_right(self):
return (float(right) / total) * 100

class Noun(models.Model):

word=   models.CharField(max_length='50',
unique=True)

definition  =   models.CharField(max_length='100',
default=Stat())

definition_stats=   models.ForeignKey(Stat, default=Stat(),)

GENDER_CHOICES  =   (
(True, 'Masculine'),
(False,'Feminine'),
(None, 'Neuter'),
)
gender  =   models.BooleanField(blank=True, null=True,
choices=GENDER_CHOICES)
gender_stats=   models.ForeignKey(
Stat,
default=Stat(),
related_name='gender_stats',
)

plurality   =   models.CharField(max_length='50',)

class Verb(models.Model):
word=   models.CharField(max_length='50',
unique=True)

definition  =   models.CharField(max_length='100',)
definition_stats=   models.ForeignKey(Stat, default=Stat(),)

irregular   =   models.BooleanField()

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



Re: Book or documentation first

2008-11-13 Thread [EMAIL PROTECTED]

I'm just starting and I recommend the tutorial first. You can get it
done in an hour I think. Also, the book Practical Django Projects is
pretty good, if not totally up-to-date. But there is a website that
presents all changes you have to make to get it working with the
current version.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Book or documentation first

2008-11-13 Thread Russell Keith-Magee

On Fri, Nov 14, 2008 at 7:18 AM, waltbrad <[EMAIL PROTECTED]> wrote:
>
> Which is best to read the Django book, or to read the documentation/
> tutorial?
>
> I know someone is likely to say both, but which is best to read
> first?  Will one get you and going faster than the other?

At this point, the documentation and tutorial is a better bet for a
newcomer. The book is very good, but unfortunately there have been a
lot of changes to Django since it was written. There is still a lot of
good material in there, but a newcomer won't know which bits are still
current and which bits have been deprecated, so they would probably be
better served by documentation that is known to describe the current
state of play. The tutorial and online docs are part of Django itself,
and have been kept up to date, so they are less likely to cause
confusion.

Yours,
Russ Magee %-)

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



Re: Problem with named URL and parameters

2008-11-13 Thread Alex Koshelev
Hmm... Why in template tag you wrote `conversions` as view name but in error
traceback there is `my_site.conversions`?


On Thu, Nov 13, 2008 at 06:27, Brandon Taylor <[EMAIL PROTECTED]>wrote:

>
> Hi everyone,
>
> So I have a question/problem with a named URL pattern...
>
> #urls.py
> url(r'^resources/conversions/(?P[-\w]+)/$',
> 'my_site.views.conversions', name='conversions'),
>
> This is a mostly static site, but I would like to be able to pass the
> "conversion_template" parameter to do a dynamic include. However, when
> I try to provide the parameter in my template:
>
> Some text
>
> I receive an error:
> Reverse for 'my_site.conversions' with arguments '(u'steel-plate-
> weight',)' and keyword arguments '{}' not found.
>
> What am I doing wrong?
>
> Kind regards,
> Brandon
> >
>

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



Book or documentation first

2008-11-13 Thread waltbrad

Which is best to read the Django book, or to read the documentation/
tutorial?

I know someone is likely to say both, but which is best to read
first?  Will one get you and going faster than the other?


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



Re: Templates - testing multiple things on IF line

2008-11-13 Thread Steve Holden

John M wrote:
> Does the IF tag allow for OR's or AND's?
>
>   
Yes. You can use one or the other, but not both, IIRC. [Checks
documentation]. Yes: "If you need to combine and and or to do advanced
logic, just use nested if tags."

regards
 Steve


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



Re: Views triggering twice

2008-11-13 Thread Jeff Gentry


Another piece of info, in case it's useful here - the page does *not*
render on the first view call, it's only after the second call that the
page will render.  I don't think it's even pulling up the template until
the second go-around, as a test I put some intentionally bad template code
in a template.  On the first time the view was called, nothing happened
but on the second one I got the TemplateSyntaxError.




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



Re: Read/Create Excel xls files using django

2008-11-13 Thread Gerard flanagan

Kurczak wrote:
> On 13 Lis, 20:45, dj <[EMAIL PROTECTED]> wrote:
>> Hello All,
>>
>> I am trying to detemine if there is a way to read the data from an
>> Excel xls file into django. I also need to create an xls file. Does
>> anyone know how that would be done ?
> If you have windows hosting you could use COM interface from python
> win32 extensions.
> 

http://groups.google.com/group/comp.lang.python.announce/browse_frm/thread/c9e7b8019a309773#


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



Re: Views triggering twice

2008-11-13 Thread Jeff Gentry

> How have you noticed that view was triggered twice?

I noticed that the URLs were displaying twice in the devel server console
(and in HTTP logs for when running off of apache).  For the former case, I
put a print statement in the view function - when loading those pages, the
print is triggered twice.  

The main reason I noticed it was that one particular view is fairly CPU
intensive and I was lookign at ways to optimize it a bit - on my CPU
tracker I noticed that every time I ran it I'd get two identical spikes,
so this code is definitely being run 2x.


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



Re: Read/Create Excel xls files using django

2008-11-13 Thread m h

On Thu, Nov 13, 2008 at 2:35 PM, Steve Holden <[EMAIL PROTECTED]> wrote:
>
> Kurczak wrote:
>> On 13 Lis, 20:45, dj <[EMAIL PROTECTED]> wrote:
>>
snip snip

> Do you *really* have to create an xls file? If your users just want to
> get the data into Excel then creating a csv file is a much easier way of
> managing that.

Check out xlwt.  It's a newer fork of PyExcelerator.  Also I have a
csv2xls script that will convert (amazingly enough) csv to xls (pure
python, built on xlwt)  I guess I should release it

-matt

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



Re: Views triggering twice

2008-11-13 Thread Alex Koshelev
How have you noticed that view was triggered twice?


On Fri, Nov 14, 2008 at 00:17, Jeff Gentry <[EMAIL PROTECTED]>wrote:

>
>
> Actually I lied a little bit - a completely blank file doesn't trigger
> this (I can also seem to put in a  and  tag), but adding
> anything else will cause the view to be loaded 2x.
>
>
>
> >
>

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



Re: Problem with named URL and parameters

2008-11-13 Thread Gerard flanagan

Brandon Taylor wrote:
> Hi everyone,
> 
> So I have a question/problem with a named URL pattern...
> 
> #urls.py
> url(r'^resources/conversions/(?P[-\w]+)/$',
> 'my_site.views.conversions', name='conversions'),
> 
> This is a mostly static site, but I would like to be able to pass the
> "conversion_template" parameter to do a dynamic include. However, when
> I try to provide the parameter in my template:
> 
> Some text
> 
> I receive an error:
> Reverse for 'my_site.conversions' with arguments '(u'steel-plate-
> weight',)' and keyword arguments '{}' not found.
> 
> What am I doing wrong?
> 

Hi Brandon,

I had a similar problem, indeed for the same regex: [-\w]+

What happens if you add the problem url in a separate patterns list, 
something like:

from django.conf.urls.defaults import *

urlpatterns = patterns('',

)

urlpatterns += patterns('my_site.views',
   url(r'^resources/conversions/(?P[-\w]+)/$', 
'conversions', name='conversions'),
   )

This seemed to fix things for me (in fact using an 'include').

G.


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



Templates - testing multiple things on IF line

2008-11-13 Thread John M

Does the IF tag allow for OR's or AND's?

Thanks

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



Re: Read/Create Excel xls files using django

2008-11-13 Thread Steve Holden

Kurczak wrote:
> On 13 Lis, 20:45, dj <[EMAIL PROTECTED]> wrote:
>   
>> Hello All,
>>
>> I am trying to detemine if there is a way to read the data from an
>> Excel xls file into django. I also need to create an xls file. Does
>> anyone know how that would be done ?
>> 
> If you have windows hosting you could use COM interface from python
> win32 extensions.
>   
On any platform the xlrd module will allow you to read Excel
spreadsheets. Creating them is a little more problematic, but it looks
like the PyExcelerator module in SourceForge might work.

Do you *really* have to create an xls file? If your users just want to
get the data into Excel then creating a csv file is a much easier way of
managing that.

regards
 Steve


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



Re: Read/Create Excel xls files using django

2008-11-13 Thread Kurczak

On 13 Lis, 20:45, dj <[EMAIL PROTECTED]> wrote:
> Hello All,
>
> I am trying to detemine if there is a way to read the data from an
> Excel xls file into django. I also need to create an xls file. Does
> anyone know how that would be done ?
If you have windows hosting you could use COM interface from python
win32 extensions.

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



Re: Views triggering twice

2008-11-13 Thread Jeff Gentry


Actually I lied a little bit - a completely blank file doesn't trigger
this (I can also seem to put in a  and  tag), but adding
anything else will cause the view to be loaded 2x.



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



Re: Syncing two django applications via cURL

2008-11-13 Thread Kurczak

On 13 Lis, 19:23, Ryan Nowakowski <[EMAIL PROTECTED]> wrote:
> You could create a view that accepts a post that includes the following:
>   * admin username (for auth)
>   * admin password (for auth)
>   * username
>   * user password
>   * other attrs...
>
> Then from your admin hooks, you can do an http post to the other sites
> using httplib[1] keeping stuff in sync.
>
> 1.http://www.python.org/doc/2.5.2/lib/httplib-examples.html
>
> - Ryan
That sounds like a pretty nice idea. I believe it's a bit cleaner than
trying to force my way with curl.
I'm still not sure where to slip it, would User.save() be suitable?

Also, this could take a bit, maybe I should consider another thread/
process?


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



Re: Syncing two django applications via cURL

2008-11-13 Thread Kurczak



On 13 Lis, 19:17, "Dj Gilcrease" <[EMAIL PROTECTED]> wrote:
> Is there a profound reason you are not using the same DB for all the
> sites, and just using django.contrib.sites to keep the content
> separated between them?
Yes, client's request.

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



Re: Read/Create Excel xls files using django

2008-11-13 Thread dj

Hello All,

I am trying to detemine if there is a way to read the data from an
Excel xls file into django. I also need to create an xls file. Does
anyone know how that would be done ?

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



Views triggering twice

2008-11-13 Thread Jeff Gentry

In my apps, I'm finding that my views are triggering twice.  I have a
series of related apps, working off of the same settings.py file (there's
a global urls.py, which triggers off of the first string and sends to a
subdirectory w/ it's own urls.py/__init__.py/models.py/views.py/etc.  With
one exception (see below), any URL I send will call the resulting view
twice.

The one exception is that I'm using a heavily modified take off of the
djikiki wiki software, and it doesn't happen here.

My first thought was that it had to do w/ something in the template, but
replacing the template with a simple blank file the view still gets
triggered twice.

Then I noticed that the app based off of the djikiki setup was not doing
this, and I looked at what I had there but didn't notice anything that
would cause the difference.

Was hoping that someone might have an idea here as to what might be going
on.

-J


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



Sites Framework and Security

2008-11-13 Thread mcgwest

I recently read this article about the "sites" framework (http://
docs.djangoproject.com/en/dev/ref/contrib/sites/?from=olddocs) but I
have a few un-answered questions. Is it possible to restrict users of
the admin site to a particular "site"? I'd like to be able to create
users who can create content for a specific site. Would I need to make
any changes to my models?

I'd like to host multiple sites within a single Django instance, and
allow admin users to create and edit content for their own site.

Thanks.

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



AttributeError: 'TemporaryFileUploadHandler' object has no attribute 'file'

2008-11-13 Thread Zagor

I am in the process of migrating Django from 0.96 to 1.0.  Everything
seems to be working except file uploads.  What worked previously is
now giving the following error:

  File "C:\Python25\lib\site-packages\django\http\__init__.py", line
124, in parse_file_upload
return parser.parse()
  File "C:\Python25\lib\site-packages\django\http\multipartparser.py",
line 139,
 in parse
self.handle_file_complete(old_field_name, counters)
  File "C:\Python25\lib\site-packages\django\http\multipartparser.py",
line 240,
 in handle_file_complete
file_obj = handler.file_complete(counters[i])
  File "C:\Python25\lib\site-packages\django\core\files
\uploadhandler.py", line
140, in file_complete
self.file.seek(0)
AttributeError: 'TemporaryFileUploadHandler' object has no attribute
'file'
[13/Nov/2008 13:08:16] "POST /inject/ HTTP/1.1" 500 1849

Has anyone seen this error and knows what might be causing it?

Looking into the django code it seems that the file attribute for the
TemporaryFileUploadHandler never gets initialized.  I could write a
custom FileUpload handler but would prefer to use django out of the
box.

Thanks

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



Re: TemplateDoesNotExist

2008-11-13 Thread sergioh


 are you using fastcgi? it could be an error on your syspath?


On Nov 13, 3:57 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Wed, 2008-11-12 at 23:05 -0800, [EMAIL PROTECTED] wrote:
> > Sorry about the inconsistency but just to be clear, here is what I
> > have:
>
> > Dreamhost directory structure:
>
> > TEMPLATE_DIRS = (
> >     # Put strings here, like "/home/html/django_templates" or "C:/www/
> > django/templates".
> >     # Always use forward slashes, even on Windows.
> >     # Don't forget to use absolute paths, not relative paths.
> >    '/home/USERNAME/projects/django_templates/SITENAME/polls',
>
> Which is nothing like what you posted originally. So I'll wager this
> isn't what you have on Dreamhost at all, but an approximation, which
> introduces yet more errors (for example, the use of "USERNAME" and
> "SITENAME" -- they really aren't helping). Construct a realistic local
> example that fails in the same way where you can cut-and-paste the
> precise string without changing anything so that further errors aren't
> introduced and this might go faster.
>
>
>
> > within this directory:
> > - index.html
> > - base.html
>
> > local directory structure:
>
> > TEMPLATE_DIRS = (
> >     # Put strings here, like "/home/html/django_templates" or "C:/www/
> > django/templates".
> >     # Always use forward slashes, even on Windows.
> >     # Don't forget to use absolute paths, not relative paths.
> >         '/home/USERNAME/django_projects/django_templates/polls',
>
> Since your original view tries to load a template called
> polls/index.html, this implies that inside the django_templates/polls/
> directory you have *another* directory called polls/ containing
> index.html. It sounds like you need to remove the polls/ piece at the
> end here.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-13 Thread Brandon Taylor

Hi Chris,

Unfortunately, that doesn't work either. I guess I can just pass in a
dictionary of my local_variables and do them that way. A little
kludgy, but I guess it's not that bad, if that's what I have to do.

On Nov 13, 3:04 am, Chris Emerson <[EMAIL PROTECTED]> wrote:
> On Thu, Nov 13, 2008 at 02:56:26PM +1100, Malcolm Tredinnick wrote:
> > On Wed, 2008-11-12 at 22:39 -0500, Karen Tracey wrote:
> > > On Wed, Nov 12, 2008 at 10:27 PM, Brandon Taylor
> > > <[EMAIL PROTECTED]> wrote:
>
> > > Hi everyone,
>
> > > So I have a question/problem with a named URL pattern...
>
> > > #urls.py
> > > url(r'^resources/conversions/(?P[-\w]+)/$',
> > > 'my_site.views.conversions', name='conversions'),
> > [...]
>
> > > The \w in your specifier for conversion_template matches [a-zA-Z0-9_]
> > > but you are trying to match something with dashes in it.
>
> > That isn't the issue. The pattern is [-\w], which will also match
> > dashes. I'm not sure what is going wrong yet, though, since it looks
> > like it should be working.
>
> Shouldn't it be {% url conversions conversion_template="..." %}, ie
> using a keyword argument rather than positional?
>
> Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



confused about django-tagging usage

2008-11-13 Thread Aaron Lee

Hi,

I am a bit confused about the best practices for using the django-tagging.
>From the docs/overview.txt. It seems you can either have the tags
stored inside a model OR you can have them stored on the tagging_tag
table.

E.g.
   class Link(models.Model):
   ...
   def add_tag(self, tagname):
  Tag.objects.add_tag(self, tagname)
   def get_tags(self):
  Tag.objects.get_for_object(self)

vs

   class Link(models.Model):
   ...
   tags = TagField()

Assuming the tags are common and have significant overlap across the
objects, it seems better to store them outside the model?
I guess the advantage of using TagField is you can generate a
ModelForm automatically and be represented by a
tagging.forms.TagField. But then you can also workaround it by having
something like

class LinkForm(forms.ModelForm):
   tags = TagField()
   class Meta:
  model = LinkForm

But you probably have to do some manual work to populate this field
from your views by calling the get_tags() to fill this out?

Just curious on what your experiences are.

-Aaron

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



Re: Simple date issue ...

2008-11-13 Thread Steve Holden

dbee wrote:
> I'm having a simple issue here trying to pull dates out of a database.
> I can only pull out double digit months eg. October, November,
> December but not single ...
> 
> Database: entry_date
> 
>   2008-10-12
>   2008-09-12
> 
> DB API:
> 
>   month_1_count = all_sign_up.filter(entry_date__month=9).filter
> (entry_date__year=2008).count()
> 
> That doesn't match and pull out the value but this works fine ...
> 
>   month_1_count = all_sign_up.filter(entry_date__month=10).filter
> (entry_date__year=2008).count()
> 
> I'm probably missing something really simple here ...

How are you declaring the dates in the model, and what database platform
are you running on?

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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



Re: Foreignkey field in admin list_filter, Django 1.0

2008-11-13 Thread Ramiro Morales

On Thu, Nov 13, 2008 at 4:28 PM, caio ariede <[EMAIL PROTECTED]> wrote:
> Nothing about this? :(
>
> I can't put a field came from a foreignkey in a list_filter..
>
> If someone can help..

Have you tried reading the documentation?:

  http://docs.djangoproject.com/en/dev/ref/contrib/admin/#list-filter

it doesn't talk about fields of related models being supported at all.

Regards,

-- 
 Ramiro Morales

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



Re: FastCGI and Django as a continuously running server

2008-11-13 Thread Ryan Nowakowski

On Wed, Nov 05, 2008 at 11:21:14AM -0800, russellneufeld wrote:
>   The one thing left that I'd like to do is set up Django to run
> continuously, even when there are no http requests.  My application
> runs a bunch of periodic background tasks in addition to serving up
> web content, and it seems that after a few minutes with no web
> activity, the app is terminated.  I'm coming from the java world where
> you typically have one long-running jvm which handles all requests and
> does not start and stop with new Apache instances.  I'd like to set up
> something similar with Django.

With Django all state is in the database(unless you've setup cookies).
There's no guaranteed persistent process.  You'll need to use whatever
periodic scheduler Dreamhost gives you (cron, other?) to run your
background tasks as separate python scripts.  Here's an example:

#!/usr/bin/python
import sys
# This is my django model that I want to do something with
from mfg.bundle.models import Bundle

try:
bundles = Bundle.objects.all()
for bundle in bundles:
  bundle.do_something()
except:
print "Something went crazy wrong!"
sys.exit(1)

sys.exit(0)

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



Re: Syncing two django applications via cURL

2008-11-13 Thread Ryan Nowakowski

You could create a view that accepts a post that includes the following:
  * admin username (for auth)
  * admin password (for auth)
  * username
  * user password
  * other attrs...

Then from your admin hooks, you can do an http post to the other sites
using httplib[1] keeping stuff in sync.

1. http://www.python.org/doc/2.5.2/lib/httplib-examples.html

- Ryan

On Thu, Nov 13, 2008 at 10:13:25AM -0800, Kurczak wrote:
> 
> Hello everyone,
> I've got this unusual problem - I've got few django sites, and I need
> to synchronize Users and profiles between them. (it's a closed site
> where only admins create accounts so OpenID or similar won't help) I
> thought that probably the easiest way is to hook somewhere in admin
> interface (add, edit, delete actions) and run a cURL script that would
> log in to the rest of the sites as another user and execute same
> action. (I hope my description is understandable)
> Is it by any chance a good solution? If so, where is the best place to
> hook this?
> 
> I'd be profoundly grateful for any insights on this.
> 
> Thanks,
> Kurczak
> 
> 
> > 

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



Re: Foreignkey field in admin list_filter, Django 1.0

2008-11-13 Thread caio ariede
Nothing about this? :(

I can't put a field came from a foreignkey in a list_filter..

If someone can help..

On Thu, Nov 13, 2008 at 11:52 AM, caio ariede <[EMAIL PROTECTED]> wrote:

> Hello.
>
> I'm trying to put a field came from a foreignkey in admin list_filter.
>
> My model is something like this:
>
> class UserProfile(models.Model):
>
> user = models.ForeignKey(User, unique=True)
>
> state= models.CharField(max_length = 2, choices = STATE_CHOICES)
> city= models.CharField(max_length = 200)
>
> in the admin:
>
> class UserProfileAdmin(admin.ModelAdmin):
>
> form = UserProfileAdminForm
>
> def user(obj): return obj.user
> def is_staff(obj): return obj.user.is_staff
> 
>
> list_display = (user, email, first_name, last_name, is_staff, date_joined)
> list_filter = ('is_staff',)
>
>
> Look that list_display works fine, but I can't put 'is_staff' in
> list_filter, in Django 0.96 I think the method use 2 underscores,
> myfk__myfield (user__myfield), but now it doesn't work.
>
> How can I do?
>
> Thanks in advance.
>
> --
> Caio Ariede
> http://caioariede.com/
>



-- 
Caio Ariede
http://caioariede.com/

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



Syncing two django applications via cURL

2008-11-13 Thread Kurczak

Hello everyone,
I've got this unusual problem - I've got few django sites, and I need
to synchronize Users and profiles between them. (it's a closed site
where only admins create accounts so OpenID or similar won't help) I
thought that probably the easiest way is to hook somewhere in admin
interface (add, edit, delete actions) and run a cURL script that would
log in to the rest of the sites as another user and execute same
action. (I hope my description is understandable)
Is it by any chance a good solution? If so, where is the best place to
hook this?

I'd be profoundly grateful for any insights on this.

Thanks,
Kurczak


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



Re: Syncing two django applications via cURL

2008-11-13 Thread Dj Gilcrease

Is there a profound reason you are not using the same DB for all the
sites, and just using django.contrib.sites to keep the content
separated between them?

Dj Gilcrease
OpenRPG Developer
~~http://www.openrpg.com

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



Simple date issue ...

2008-11-13 Thread dbee

I'm having a simple issue here trying to pull dates out of a database.
I can only pull out double digit months eg. October, November,
December but not single ...

Database: entry_date

  2008-10-12
  2008-09-12

DB API:

  month_1_count = all_sign_up.filter(entry_date__month=9).filter
(entry_date__year=2008).count()

That doesn't match and pull out the value but this works fine ...

  month_1_count = all_sign_up.filter(entry_date__month=10).filter
(entry_date__year=2008).count()

I'm probably missing something really simple here ...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Logout- Back Button

2008-11-13 Thread AmanKow

use javascript to clear the history

On Nov 12, 1:05 pm, jai_python <[EMAIL PROTECTED]> wrote:
> hi.. i tried with logout_then_login method. But i am still facing that
> back button after logout issue.. any other suggestion?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: General question: Django-Profiles, auth.User and "merging" both data

2008-11-13 Thread Alex S.

Very good hint, urukay! I was a bit scared to use forms.Form because I
didn't know how to do it. But it was straight forward and works like a
charm! I'm getting my data saved working with two differend models.
Just awesome :-).
One last thing there (and after that I will clean up my code and write
a blog article about it to save others some headache [but even if the
last days were a bit frustrating sometimes, I have to admit that it
definitely was good for my understanding of python and django]). Ok
getting to the "problem" (not even slightly comparable to my previous
problems): When the user visites his profile page the data from the
database should be already filled in. How would I do this? Probably
this will be quite easy. Hopefully the two models to get the pre-fill
data from won't be a problem. And another small question: Do you know
a better way for getting the user object in the save method other than
the way I did (just passed it as an argument)?

Ok here is now my code that made it work:

>>> model <<<
class CustomUserProfile(models.Model):
GENDER_CHOICES = (
('-', _('not specified')),
('M', _('male')),
('F', _('female'))
)
user = models.ForeignKey(User, unique=True, editable=False)
birthdate = models.DateTimeField(_('birthdate'), blank=True)
gender = models.CharField(_('gender'), max_length=1,
choices=GENDER_CHOICES)
country = models.CharField(_('country'), max_length=30,
blank=True)
city = models.CharField(_('city'), max_length=30, blank=True)

def get_absolute_url(self):
return ('profiles_profile_detail', (), { 'username':
self.user.username })
get_absolute_url = models.permalink(get_absolute_url)

>>> form <<<
class CustomUserForm(forms.Form):
first_name = forms.CharField(required=False)
last_name = forms.CharField(required=False)
gender = forms.CharField(
label = _('Gender'),
widget = forms.Select
(choices=CustomUserProfile.GENDER_CHOICES))
birthdate = forms.DateField(required=False)
country = forms.CharField(required=False)
city = forms.CharField(required=False)

def save(self, user):
user_obj = User.objects.get(pk=user.id)
user_obj.first_name = self.cleaned_data['first_name']
user_obj.last_name = self.cleaned_data['last_name']

try:
profile_obj = user.get_profile()
except ObjectDoesNotExist:
profile_obj = CustomUserProfile()
profile_obj.user = user
profile_obj.birthdate = self.cleaned_data['birthdate']
profile_obj.gender = self.cleaned_data['gender']
profile_obj.country = self.cleaned_data['country']
profile_obj.city = self.cleaned_data['city']

profile_obj.save()
user_obj.save()

>>> view <<<
def edit_profile(request, form_class=CustomUserForm,
success_url="/profiles/edit/complete/"):

if request.method == 'POST':
form = form_class(data=request.POST)
if form.is_valid():
form.save(user=request.user)
return HttpResponseRedirect(success_url)
else:
form = form_class()
return render_to_response("profiles/edit_profile.html",
{'form':form},
context_instance=RequestContext(request))

I hope that code is readable enough to get it :-).

Alex

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



Re: Setting Up Django on Vista and Creating a Database

2008-11-13 Thread Danny R


John,

Setting the paths in Vista is quirky. I also cannot make it work.

As a workaround whenever I open a new command prompt, i do the
following command:

   set path=C:\Python25\Lib\site-packages\django\bin\;C:
\Python25\

then, when i create an app or a project, i do this instead:

   python C:\Python25\Lib\site-packages\django\bin\django-
admin.py startproject djangoapps


On Nov 12, 7:40 pm, John Antony <[EMAIL PROTECTED]> wrote:
> I have now used all your suggestions..
> 1) Installed in C:\Python25\ (Marcelo Barbero)
> 2)Installed Python 2.5 instead of Python 2.6 (Karen Tracey)
> and finally
> 3)Added the environment variables in "path" (not PATH, should i create
> a new one named PATH) for both django and python.
>
> I installed django and postgreSQL following it stepwise from
>
> http://thinkhole.org/wp/django-on-windows/
>
> but however
> now when i reach the command of testing django i still am getting the
> following error
>
> C:\Python25\Lib\site-packages\django>django-admin.py startproject
> testproject
> 'django-admin.py' is not recognized as an internal or external
>
> command,
> operable program or batch file.
>
> what sholud i do now
> On Nov 11, 6:19 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> > On Tue, Nov 11, 2008 at 1:40 AM, John Antony <[EMAIL PROTECTED]> wrote:
>
> > > I am currently using Vista OS
> > > I have installed Python in the path
> > > D:\Python26\
> > > and extracted the tarred file downloaded fromwww.djangoprojects.com
> > > ie "Django-1.0.tar.gz" in the path
> > > D:\Python26\Django-1.0\Django-1.0
> > > I am however unable to intall Django
> > > on typing the following command in command prompt I get this error:
>
> > > D:\Python26\Django-1.0\Django-1.0>python setup.py install
> > > 'python' is not recognized as an internal or external command,
> > > operable program or batch file.
>
> > The Python installer did not put the directory containing the python.exe
> > executable in the Windows PATH environment variable.  That is why all the
> > Django instructions for Windows generally drop the 'python' from such
> > commands, since on Windows usually all you can count on when writing
> > instructions is that the Python installer set up an association between
> > '.py' files and the python executable.  So, if you drop the python from the
> > front of the command, that should work.
>
> > However, I have heard reports that the association created by the Python 2.6
> > installer on Vista is broken, see here:
>
> >http://groups.google.com/group/django-users/msg/1d00809e826fa8c3
>
> > So, you may need to fix that as described in that message.
>
> > You can also put the path to python.exe in your Windows system path, so that
> > you can use the 'python whatever' form of commands.  In older versions of
> > Windows you would do that by going to Start->Settings->Control Panel,
> > choosing "System", selecting the "Advanced" tab, clicking on "Environment
> > Variables", and finding/editing the one for PATH.  I do not know if that has
> > changed in Vista.
>
> > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Upload Form does not validate

2008-11-13 Thread Israel Fernández Cabrera
Tks you all... I forgot it, it is now fixed.

regards

Israel Fdez. Cabrera
[EMAIL PROTECTED]
UNYK : 936 LDX
Linux registered user No.: 270292 [http://counter.li.org]

. 0 .
. . 0
0 0 0


On Wed, Nov 12, 2008 at 13:17, Daniel Roseman <[EMAIL PROTECTED]
> wrote:

>
> On Nov 12, 5:52 pm, "Israel Fdez. Cabrera" <[EMAIL PROTECTED]> wrote:
> > Hi:
> >
> > I'm trying to upload some CSV file I need to import into a database;
> > to do so I have the following Django form:
> >
> > 
> >
> > class CaptureEquipmentForm(forms.Form):
> >area = forms.FileField()
> >equipo = forms.FileField()
> >tipo = forms.FileField()
> >
> > 
> >
> > this Django template:
> >
> > 
> >
> > 
> >
> >
> >Capturar las tablas:
> >
> >{{ form.area.label_tag }}
> > {{ form.area }} {{ form.area.errors }}
> >{{ form.equipo.label_tag }}
> > {{ form.equipo }} {{ form.equipo.errors }}
> >{{ form.tipo.label_tag }}
> > {{ form.tipo }} {{ form.tipo.errors }}
> >
> >
> >
> >
> > 
> >
> > 
> >
> > and this view:
> >
> > 
> >
> > def captureEquipment(request, id_ea):
> >if request.method == "POST":
> >f = CaptureEquipmentForm(request.POST, request.FILES)
> >print request.FILES
> >if f.is_valid(): #The form never validates
> >return HttpResponseRedirect("/map")
> >else:
> >f = CaptureEquipmentForm()
> >return renderTemplate("Capturar Equipamiento",
> >  template="eainfo/captureEquipment.xhtml",
> >  initialContext={"form": f, "code": id_ea})
> >
> > 
> >
> > The problem is that in the view the form never validates, it always
> > behaves like if the form were submitted with all fields blank.
> >
> > Any hint?
> >
> > regards and thks in advance
> > Israel
>
> The immediate problem is that you're not using enctype="multipart/form-
> data" in your form tag. See here:
>
> http://docs.djangoproject.com/en/dev/ref/forms/api/#binding-uploaded-files-to-a-form
>
> You're also not displaying any non-field errors, which might have
> shown you what the problem was with validation.
> --
> 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django newbie observation

2008-11-13 Thread thi.l...@gmail.com

> You will find lots of excellent examples of Django projects [...]

It is sometimes difficult to know what Django version each project was
based on (especially those from djangosites.org, some of them are
still using Manipulator stuff).
There were many changes in trunk since 0.95. However, since Django hit
1.0, we can probably expect more manageable backward-
incompatibilities.

Still, Ayayalar has a point. Shipping(*) a showcase website with
Django would be nice:
- it would stay synchronized with code changes
- it could introduce new features with full examples (not to pollute
documentation)
- it would provide good material for the tutorial
- let's call it "instant convince-your-manager kit"

(*) A more realistic approach would be to consider this initiative as
a separate project, with a focus on synchronization to the
corresponding Django code version.
Pinax and the like act more like repositories for reusable apps, and
are not sold as introduction material for newcomers.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django newbie observation

2008-11-13 Thread bobhaugen

You will find lots of excellent examples of Django projects that are
open source and up-to-date with version 1.0.

See http://djangoplugables.com/

http://pinaxproject.com/ is huge, but the basic_project is fairly
simple.

http://code.google.com/p/django-basic-apps/ is another suite of apps.

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



Re: Django new comments framework error

2008-11-13 Thread DavidA

I just got bit by this too and it turned out that I had done an
install of Django-1.0 on top of an older Django install. In the site-
packages directory there was both a django/contrib/comments/urls.py
(from 1.0) and a django/contrib/comments/urls/ directory which
contained __init__.py and comments.py.

So the configuration of comments using this line:

(r'^comments/', include('django.contrib.comments.urls')),

Was just importing the empty __init__.py and no urlpatterns variable
was defined. Thus, urlresolvers.reverse never saw any urlpatterns for
comments and couldn't reverse the post_comment view.

Just thought I'd post this in case someone else runs into the same
thing.

-Dave

On Oct 1, 2:53 pm, hotani <[EMAIL PROTECTED]> wrote:
> It's back!
>
> No error on dev server, but crashing like crazy on test with same old
> crap:
>
> >> Caught an exception while rendering:Reversefor ' >> 0x2ae96d979410>' with arguments '()' and keyword arguments '{}' not found
>
> It alternates between that and:
>
> >> Caught an exception while rendering: No module named urls
>
> Then the error page goes on to show the error is being caused by the
> "{% comment_form_target %}" tag.
>
> I have removed .pyc files. I have removed all of django and reloaded
> it. What is left? This was working moments ago, and is fine on one
> server but not another.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Improvement: documentation example for extra Manager methods

2008-11-13 Thread bruno desthuilliers

On 13 nov, 14:53, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am building a custom Manager for adding extra methods that return
> filtered querysets.
> I believe this is a common case for custom Managers.

Yes, indeed.

> Digging into the documentation [1], the only example emphasises on the
> ability to return anything from a Manager method. However, I miss a
> standard example for methods that DO return a filtered queryset.



> I am still struggling with my custom Manager method, which raises an
> error in my project ('NoneType' object has no attribute '_meta'). Any
> hint?

Not without the relevant source code and the full traceback. Sorry, my
crystall ball is out for repair.

> My custom Manager method is like this:
>   def active(self):
> return self.get_query_set().filter(status=STATUS_ACTIVE)

or more simply:

  return self.filter(status=STATUS_ACTIVE)

But this won't solve your problem anyway.

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



Re: Basic concept for templatetag using node and parser

2008-11-13 Thread bruno desthuilliers

On 13 nov, 12:33, "suganthi saravanan" <[EMAIL PROTECTED]>
wrote:
> Thanks bruno...but i have already read the documentation for the Custom
> template tag.
>
> I need simple example for  more clarification

There's already one, and you can find quite a few others in third-part
dhango apps, or even in Django's source code ('builtin' templatetags
are written the exact same way).

> can you help me.

Not unless you get more specific about what you have trouble with.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Improvement: documentation example for extra Manager methods

2008-11-13 Thread [EMAIL PROTECTED]

I found the origin on my error ('NoneType' object has no attribute
'_meta').
I used a wrong (old?) syntax for adding custom Manager to my Model:
ModelClass.objects = MyCustomManager()  # After Model and Manager
definitions

My custom Manager should have been attached in the model definition
(as found in the Manager documentation):
objects = MyCustomManager()  # And manager definition had to be moved
before the Model definition

Still, my initial message is valid: there is no standard example about
custom Manager method that returns a filtered queryset :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: creating django middleware

2008-11-13 Thread Steve Holden

ershadul wrote:
> Dear ,
> I dont know whether my process_request() is being called or not?
> Can you inform me please, how can i verify that my middleware's
> process_request() is called ?
> 
> On Nov 12, 4:42 am, Steve Holden <[EMAIL PROTECTED]> wrote:
>> ershadul wrote:
>>> Dear all,
>>> please consider the following code-block:
>>> class SQLAlchemySessionMiddleware(object):
>>> """
>>> This class instantiates a sqlalchemy session and destroys
>>> """
>>> def process_request(self, request):
>>> request.db_session = session()
>>> return None
>> The last statement in your method is completely redundant, and I'd
>> suggest you remove it.
>>
>> How are you verifying that your middleware's "process_request()" method
>> is being called?
>> [...]

Try putting print statements in your code. Running the test server, of
course, so you will see any console output.

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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



Re: how to get the hash part(string after the'#' mark) of the requesting url in diango

2008-11-13 Thread Tim Chase

>> how to get the string of "x=1;y=2 " in django from requesting url 
>> "http://a.cn/b#x=1;y=2";.
> 
> I wouldn't expect to be able to get the part after the # (actually, I
> wouldn't expect the browser to bother sending it) - it's a pointer for
> the browser to a named anchor tag


If you watch the HTTP headers (there's a nice FireFox plugin 
called "Live HTTP Headers" that makes this easy to test with a 
URL like [1]), you can readily verify that Brett is correct -- 
the fragment identifier is *not* sent over the wire, so there's 
no way (short of javascript chicanery that might be possible) to 
learn this on the server-side.

-tim


[1]
http://en.wikipedia.org/wiki/HyperText_Transfer_Protocol#Request_message






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



Foreignkey field in admin list_filter, Django 1.0

2008-11-13 Thread caio ariede
Hello.

I'm trying to put a field came from a foreignkey in admin list_filter.

My model is something like this:

class UserProfile(models.Model):

user = models.ForeignKey(User, unique=True)

state= models.CharField(max_length = 2, choices = STATE_CHOICES)
city= models.CharField(max_length = 200)

in the admin:

class UserProfileAdmin(admin.ModelAdmin):

form = UserProfileAdminForm

def user(obj): return obj.user
def is_staff(obj): return obj.user.is_staff


list_display = (user, email, first_name, last_name, is_staff, date_joined)
list_filter = ('is_staff',)


Look that list_display works fine, but I can't put 'is_staff' in
list_filter, in Django 0.96 I think the method use 2 underscores,
myfk__myfield (user__myfield), but now it doesn't work.

How can I do?

Thanks in advance.

-- 
Caio Ariede
http://caioariede.com/

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



Improvement: documentation example for extra Manager methods

2008-11-13 Thread [EMAIL PROTECTED]

Hi,

I am building a custom Manager for adding extra methods that return
filtered querysets.
I believe this is a common case for custom Managers.

Digging into the documentation [1], the only example emphasises on the
ability to return anything from a Manager method. However, I miss a
standard example for methods that DO return a filtered queryset.

I am still struggling with my custom Manager method, which raises an
error in my project ('NoneType' object has no attribute '_meta'). Any
hint?
My custom Manager method is like this:
  def active(self):
return self.get_query_set().filter(status=STATUS_ACTIVE)


Based on your feedback, I could raise a ticket for updating the
documentation.
Thanks.

[1] 
http://docs.djangoproject.com/en/dev/topics/db/managers/#adding-extra-manager-methods
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to get the hash part(string after the'#' mark) of the requesting url in diango

2008-11-13 Thread Brett Parker

On 13 Nov 07:15, maoxl wrote:
> 
> how to get the string of "x=1;y=2 " in django from requesting url 
> "http://a.cn/b#x=1;y=2";.

I wouldn't expect to be able to get the part after the # (actually, I
wouldn't expect the browser to bother sending it) - it's a pointer for
the browser to a named anchor tag

-- 
Brett Parker

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



ChicagoLug Code review

2008-11-13 Thread Adam Jenkins
We would like to announce that this Saturday November 15th from 3 to 6pm is
the Chicago Lug code review meeting.

If you're stuck on a piece of code, looking to learn a few tricks, or just
wanna hang out with some nerds, then come by.

We will have people with knowledge in  C, Python, Django, Ruby, PHP, Bash,
HTML, and CSS

More detailed information can be found on our flier
http://www.chicagolug.org/wiki/images/c/ca/CodeReviewFlyer.svg

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



how to get the hash part(string after the'#' mark) of the requesting url in diango

2008-11-13 Thread maoxl

how to get the string of "x=1;y=2 " in django from requesting url 
"http://a.cn/b#x=1;y=2";.



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



Re: Setting Up Django on Vista and Creating a Database

2008-11-13 Thread Marcelo Barbero

You should search where your django-admin.py file is and include that
folder to your path environment variable.

But if you installed Django using the "python setup.py install"
command, the file must be in your Scripts directory under the Python
directory. Have you installed Django with "python setup.py install"?

Marcelo

2008/11/13 John Antony <[EMAIL PROTECTED]>:
>
>
> I have now used all your suggestions..
> 1) Installed in C:\Python25\ (Marcelo Barbero)
> 2)Installed Python 2.5 instead of Python 2.6 (Karen Tracey)
> and finally
> 3)Added the environment variables in "path" (not PATH, should i create
> a new one named PATH) for both django and python.
>
> I installed django and postgreSQL following it stepwise from
>
> http://thinkhole.org/wp/django-on-windows/
>
> but however
> now when i reach the command of testing django i still am getting the
> following error
>
> C:\Python25\Lib\site-packages\django>django-admin.py startproject
> testproject
> 'django-admin.py' is not recognized as an internal or external
>
> command,
> operable program or batch file.
>
>
> what sholud i do now
> On Nov 11, 6:19 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>> On Tue, Nov 11, 2008 at 1:40 AM, John Antony <[EMAIL PROTECTED]> wrote:
>>
>> > I am currently using Vista OS
>> > I have installed Python in the path
>> > D:\Python26\
>> > and extracted the tarred file downloaded fromwww.djangoprojects.com
>> > ie "Django-1.0.tar.gz" in the path
>> > D:\Python26\Django-1.0\Django-1.0
>> > I am however unable to intall Django
>> > on typing the following command in command prompt I get this error:
>>
>> > D:\Python26\Django-1.0\Django-1.0>python setup.py install
>> > 'python' is not recognized as an internal or external command,
>> > operable program or batch file.
>>
>> The Python installer did not put the directory containing the python.exe
>> executable in the Windows PATH environment variable.  That is why all the
>> Django instructions for Windows generally drop the 'python' from such
>> commands, since on Windows usually all you can count on when writing
>> instructions is that the Python installer set up an association between
>> '.py' files and the python executable.  So, if you drop the python from the
>> front of the command, that should work.
>>
>> However, I have heard reports that the association created by the Python 2.6
>> installer on Vista is broken, see here:
>>
>> http://groups.google.com/group/django-users/msg/1d00809e826fa8c3
>>
>> So, you may need to fix that as described in that message.
>>
>> You can also put the path to python.exe in your Windows system path, so that
>> you can use the 'python whatever' form of commands.  In older versions of
>> Windows you would do that by going to Start->Settings->Control Panel,
>> choosing "System", selecting the "Advanced" tab, clicking on "Environment
>> Variables", and finding/editing the one for PATH.  I do not know if that has
>> changed in Vista.
>>
>> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: apache mod_wsgi/nginx config: different behaviors if www pre-pended

2008-11-13 Thread Serdar T.

Thanks for the reply Graham. Since the time I wrote the initial
message, I figured out the problem: I was using nginx as the frontend,
as you point out, and sending requests to apache at 127.0.0.1:8080.
But I hadn't updated my virtualhost file to process requests to that
address.

I made the following change to get the dynamic content served
properly. In /etc/apache2/sites-available/mysite.org

 became 

I figured it out after going back to basics and reading up on what a
reverse proxy is and some of the syntax about nginx. Am I correct to
interpret this deployment style as an nginx server front-end that
servers media (once I configure that correctly) and proxies requests
for dynamic content upstream to apache? That makes sense to me
conceptually based on the config settings, but maybe I'm somehow
confusing things.

Now, on to fixing the serving of media.

Thanks again for the suggestions.

On Nov 12, 7:04 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Nov 13, 6:48 am, "Serdar T." <[EMAIL PROTECTED]> wrote:
>
>
>
> > Can someone offer advice on server deployment headaches involving
> > apache/mod_wsgi/nginx? I seem to be having two problems:
>
> > 1) Apache/mod_wsgi correctly serves dynamic content from a test app
> > (located in a ~/public_html directory) when the url starts with
> > "www".  But apache reverts to serving the default index.html (out of /
> > var/www) when the "www" is omitted from the url. I tried tweaking the
> > ServerAlias configs and even using Rewrite rules, but to no avail.
>
> > Ideally, I'd like apache and nginx to rerwite all urls to strip the
> > leading "www"
>
> > My server config and relevant django app files (settings.py and
> > urls.py) are athttp://dpaste.com/90308/
> > They are an adaptation of the configs from EricFlo's screencast 13
> > (http://thisweekindjango.com/screencasts/episode/21/django-ground-
> > episode-13/)
>
> What if you list all host names in single ServerAlias directive and
> not multiple.
>
>  http://httpd.apache.org/docs/2.2/mod/core.html#serveralias
>
> > 2) In addition, the admin backend doesn't work on the production
> > server (I get a 404 error) regardless of whether or not I pre-pend the
> > "www". Apache error logs stated that the sqlite database backend did
> > not have write permissions, but the 404 errors persisted even after I
> > added the permissions (chmod 755).
>
> You have:
>
>   ADMIN_MEDIA_PREFIX = '/media/'
>
> yet that doesn't appear to be where media files are being served from.
>
> Your configuration is a bit confusing with nginx in front and both
> nginx and Apache both attempting to serve static files. Suggest you
> get Apache working with static files first and ignore nginx until you
> have that working and understand how things are affected by Django
> settings for media.
>
> Graham
>
> > Any suggestions would be greatly appreciated!!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Password Field Form

2008-11-13 Thread Aatif

yes, it works. I was expecting a forms.Passwordfield() :-)

> password => 
> forms.CharField(label=_(u'Password'),widget=forms.PasswordInput(render_value=False))

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



Re: Query for all objects in table1 that DO NOT have corresponding objects in table2

2008-11-13 Thread Karen Tracey
On Thu, Nov 13, 2008 at 6:47 AM, Ropley <[EMAIL PROTECTED]> wrote:

>
> Noob question, but I've been running around in circles. I'm building
> an in-house jobs board, and have 2 models:
>
> class jobs(models.Model):
> ...
>
> class viewed_jobs(models.Model):
> job=models.ForeignKey(job)
> ...
>
> I would like to create a query that returns all jobs that have not
> been viewed - that is, those jobs for which there are no corresponding
> entries in viewed_jobs. I'm rather stuck with the model definitions as
> they are, for many reasons, and would like the database to do as much
> work as possible. Web research has shown some potential in the 'extra'
> QuerySet qualifier, but my noobness has defeated me. Grateful for any
> pointers.
>
>
Try:

jobs.objects.filter(viewed_jobs__isnull=True)

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



Re: Query for all objects in table1 that DO NOT have corresponding objects in table2

2008-11-13 Thread Alex Koshelev
Hi, Ropley!

Try this:

jobs.objects.exclude(viewed_jobs=True)


On Thu, Nov 13, 2008 at 14:47, Ropley <[EMAIL PROTECTED]> wrote:

>
> Noob question, but I've been running around in circles. I'm building
> an in-house jobs board, and have 2 models:
>
> class jobs(models.Model):
> ...
>
> class viewed_jobs(models.Model):
> job=models.ForeignKey(job)
> ...
>
> I would like to create a query that returns all jobs that have not
> been viewed - that is, those jobs for which there are no corresponding
> entries in viewed_jobs. I'm rather stuck with the model definitions as
> they are, for many reasons, and would like the database to do as much
> work as possible. Web research has shown some potential in the 'extra'
> QuerySet qualifier, but my noobness has defeated me. Grateful for any
> pointers.
>
> Ropz
>
>
>
>
> >
>

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



Query for all objects in table1 that DO NOT have corresponding objects in table2

2008-11-13 Thread Ropley

Noob question, but I've been running around in circles. I'm building
an in-house jobs board, and have 2 models:

class jobs(models.Model):
...

class viewed_jobs(models.Model):
job=models.ForeignKey(job)
...

I would like to create a query that returns all jobs that have not
been viewed - that is, those jobs for which there are no corresponding
entries in viewed_jobs. I'm rather stuck with the model definitions as
they are, for many reasons, and would like the database to do as much
work as possible. Web research has shown some potential in the 'extra'
QuerySet qualifier, but my noobness has defeated me. Grateful for any
pointers.

Ropz




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



Re: Basic concept for templatetag using node and parser

2008-11-13 Thread Karen Tracey
On Thu, Nov 13, 2008 at 6:33 AM, suganthi saravanan <
[EMAIL PROTECTED]> wrote:

>
> Thanks bruno...but i have already read the documentation for the Custom
> template tag.
>
>
> http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-tags
>
> I need simple example for  more clarification
>

The doc is built around the simple example of a "current_time" tag, so it is
hard to know what exactly you are looking for in a 2nd simple example.
Perhaps if you explained what it is you don't follow about the existing
example?  Or what it is you would like to do with a custom tag that isn't
covered by that example?

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



Re: Apache Segmentation Fault on succesful authentication

2008-11-13 Thread huw_at1

My apologies. I forgot to mention that I already tried what was
suggested in the article you pointed me at. I created a symlink in /
usr/local/lib/python2.5/config as directed however recompiling
mod_python still links to the library statically. Unless I missed a
step in the article I am starting to wonder if mod_python just
includes this library statically by default. Still, thanks for all the
help so far. I really appreciate it.

On Nov 13, 9:55 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> Because you have created the symlink for the .so file so it appears
> next to the static library. It is arguably a a failing of standard
> Python installer that it doesn't do this. What to do is explained in
> document I previously pointed you at:
>
>  http://code.google.com/p/modwsgi/wiki/InstallationIssues
>
> Yes I know this is for mod_wsgi but same applies to mod_python.
>
> Graham
>
> On Nov 13, 8:44 pm, huw_at1 <[EMAIL PROTECTED]> wrote:
>
> > ls -ltr /usr/local/lib
>
> > -r-xr-xr-x     1 root root  4806649 Nov 11 11:22 libpython2.5.a
> > -r-xr-xr-x     1 root root  4806649 Nov 12 12:49 libpython2.5.so.1.0
> > lrwxrwxrwx  1 root root            19 Nov 12 12:49 libpython2.5.so ->
> > libpython2.5.so.1.0
>
> > echo $LD_LIBRARY_PATH
>
> > /usr/local/lib
>
> > ldd /usr/local/bin/python
>
> >         libpython2.5.so.1.0 => /usr/local/lib/libpython2.5.so.1.0
> > (0x2b6d8efc5000)
> >         libpthread.so.0 => /lib64/libpthread.so.0 (0x0039a4a0)
> >         libdl.so.2 => /lib64/libdl.so.2 (0x0039a460)
> >         libutil.so.1 => /lib64/libutil.so.1 (0x0039b340)
> >         libm.so.6 => /lib64/libm.so.6 (0x0039a420)
> >         libc.so.6 => /lib64/libc.so.6 (0x0039a3e0)
> >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > recompile mod_python and do ldd /usr/local/apache2/modules/
> > mod_python.so
>
> >         libpthread.so.0 => /lib64/libpthread.so.0 (0x2b74c34f7000)
> >         libdl.so.2 => /lib64/libdl.so.2 (0x2b74c3711000)
> >         libutil.so.1 => /lib64/libutil.so.1 (0x2b74c3915000)
> >         libm.so.6 => /lib64/libm.so.6 (0x2b74c3b19000)
> >         libc.so.6 => /lib64/libc.so.6 (0x2b74c3d9c000)
> >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > I still don't get why the library is being compiled in statically.
>
> > On Nov 13, 12:11 am, Graham Dumpleton <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Nov 12, 11:44 pm, huw_at1 <[EMAIL PROTECTED]> wrote:
>
> > > > echo '/usr/local/lib' >> /etc/ld.so.conf
>
> > > > more /etc/ld.so.conf
>
> > > > include ld.so.conf.d/*.conf
> > > > /usr/local/lib
>
> > > > ldd /usr/local/bin/python
>
> > > >         libpython2.5.so.1.0 => not found
> > > >         libpthread.so.0 => /lib64/libpthread.so.0 (0x0039a4a0)
> > > >         libdl.so.2 => /lib64/libdl.so.2 (0x0039a460)
> > > >         libutil.so.1 => /lib64/libutil.so.1 (0x0039b340)
> > > >         libm.so.6 => /lib64/libm.so.6 (0x0039a420)
> > > >         libc.so.6 => /lib64/libc.so.6 (0x0039a3e0)
> > > >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > > Where is libpython2.5.so installed? What are the permissions on it?
>
> > > What do you get for:
>
> > >   echo $LD_LIBRARY_PATH
>
> > > just prior to running 'ld'?
>
> > > Graham
>
> > > > On Nov 12, 11:57 am, marco ghidinelli <[EMAIL PROTECTED]> wrote:
>
> > > > > On Wed, Nov 12, 2008 at 03:22:02AM -0800, huw_at1 wrote:
>
> > > > > > An update on this.
>
> > > > > > 'which python' returns:
>
> > > > > >         libpython2.5.so.1.0 => not found
> > > > > >         libpthread.so.0 => /lib64/libpthread.so.0 
> > > > > > (0x0039a4a0)
> > > > > >         libdl.so.2 => /lib64/libdl.so.2 (0x0039a460)
> > > > > >         libutil.so.1 => /lib64/libutil.so.1 (0x0039b340)
> > > > > >         libm.so.6 => /lib64/libm.so.6 (0x0039a420)
> > > > > >         libc.so.6 => /lib64/libc.so.6 (0x0039a3e0)
> > > > > >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > > > > > This explains why I cannot compile mod_python without first setting
> > > > > > the LD_LIBRARY_PATH to '/usr/local/lib'. I don't know if this is the
> > > > > > reason why the mod_python compilation continuously compiles with the
> > > > > > python library as static. I upgraded my apache to the latest version
> > > > > > however I still am getting segmentation faults on user 
> > > > > > authentication.
> > > > > > Which potentially suggests that the problem is not apache and is
> > > > > > something else like this issue.
>
> > > > > echo '/usr/local/lib' >> /etc/ld.so.conf
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/grou

Re: Basic concept for templatetag using node and parser

2008-11-13 Thread suganthi saravanan
Thanks bruno...but i have already read the documentation for the Custom
template tag.

http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-tags

I need simple example for  more clarification

can you help me.

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



Using FilteredSelectMultiple with Ajax

2008-11-13 Thread [EMAIL PROTECTED]

Hi guys,

I'm relatively new to django (coming from Zope) and I love it! This is
my first question.

Im using the FilteredSelectMultiple (from the admin application) in
one of my forms and it works like charm if I use with a "normal"
request. If I load the form with a AJAX request and inject the result
within my HTML I get the standard multi selection widget. I assume
that the widget is not initalized after the injection.

My question is: Is there a javascript function which I have to call
after I injecting the form into the HTML?

Thanks
L.

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



Re: Basic concept for templatetag using node and parser

2008-11-13 Thread bruno desthuilliers

On 13 nov, 11:13, sugi <[EMAIL PROTECTED]> wrote:
> Hi
>
> Can any one explain template tag with sample example.

No problem :
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-tags

To make a long story short: the parser function is called at
"compilation" time, and must return a Node object. The result of the
"compilation" phase is an in-memory tree of Node objects. Then this
tree is traversed, each Node being called with the current context,
and the return value being concat to build the final HTML (or
whatever) content.


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



Basic concept for templatetag using node and parser

2008-11-13 Thread sugi

Hi

Can any one explain template tag with sample example.


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



Re: Apache Segmentation Fault on succesful authentication

2008-11-13 Thread Graham Dumpleton

Because you have created the symlink for the .so file so it appears
next to the static library. It is arguably a a failing of standard
Python installer that it doesn't do this. What to do is explained in
document I previously pointed you at:

  http://code.google.com/p/modwsgi/wiki/InstallationIssues

Yes I know this is for mod_wsgi but same applies to mod_python.

Graham

On Nov 13, 8:44 pm, huw_at1 <[EMAIL PROTECTED]> wrote:
> ls -ltr /usr/local/lib
>
> -r-xr-xr-x     1 root root  4806649 Nov 11 11:22 libpython2.5.a
> -r-xr-xr-x     1 root root  4806649 Nov 12 12:49 libpython2.5.so.1.0
> lrwxrwxrwx  1 root root            19 Nov 12 12:49 libpython2.5.so ->
> libpython2.5.so.1.0
>
> echo $LD_LIBRARY_PATH
>
> /usr/local/lib
>
> ldd /usr/local/bin/python
>
>         libpython2.5.so.1.0 => /usr/local/lib/libpython2.5.so.1.0
> (0x2b6d8efc5000)
>         libpthread.so.0 => /lib64/libpthread.so.0 (0x0039a4a0)
>         libdl.so.2 => /lib64/libdl.so.2 (0x0039a460)
>         libutil.so.1 => /lib64/libutil.so.1 (0x0039b340)
>         libm.so.6 => /lib64/libm.so.6 (0x0039a420)
>         libc.so.6 => /lib64/libc.so.6 (0x0039a3e0)
>         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> recompile mod_python and do ldd /usr/local/apache2/modules/
> mod_python.so
>
>         libpthread.so.0 => /lib64/libpthread.so.0 (0x2b74c34f7000)
>         libdl.so.2 => /lib64/libdl.so.2 (0x2b74c3711000)
>         libutil.so.1 => /lib64/libutil.so.1 (0x2b74c3915000)
>         libm.so.6 => /lib64/libm.so.6 (0x2b74c3b19000)
>         libc.so.6 => /lib64/libc.so.6 (0x2b74c3d9c000)
>         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> I still don't get why the library is being compiled in statically.
>
> On Nov 13, 12:11 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Nov 12, 11:44 pm, huw_at1 <[EMAIL PROTECTED]> wrote:
>
> > > echo '/usr/local/lib' >> /etc/ld.so.conf
>
> > > more /etc/ld.so.conf
>
> > > include ld.so.conf.d/*.conf
> > > /usr/local/lib
>
> > > ldd /usr/local/bin/python
>
> > >         libpython2.5.so.1.0 => not found
> > >         libpthread.so.0 => /lib64/libpthread.so.0 (0x0039a4a0)
> > >         libdl.so.2 => /lib64/libdl.so.2 (0x0039a460)
> > >         libutil.so.1 => /lib64/libutil.so.1 (0x0039b340)
> > >         libm.so.6 => /lib64/libm.so.6 (0x0039a420)
> > >         libc.so.6 => /lib64/libc.so.6 (0x0039a3e0)
> > >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > Where is libpython2.5.so installed? What are the permissions on it?
>
> > What do you get for:
>
> >   echo $LD_LIBRARY_PATH
>
> > just prior to running 'ld'?
>
> > Graham
>
> > > On Nov 12, 11:57 am, marco ghidinelli <[EMAIL PROTECTED]> wrote:
>
> > > > On Wed, Nov 12, 2008 at 03:22:02AM -0800, huw_at1 wrote:
>
> > > > > An update on this.
>
> > > > > 'which python' returns:
>
> > > > >         libpython2.5.so.1.0 => not found
> > > > >         libpthread.so.0 => /lib64/libpthread.so.0 (0x0039a4a0)
> > > > >         libdl.so.2 => /lib64/libdl.so.2 (0x0039a460)
> > > > >         libutil.so.1 => /lib64/libutil.so.1 (0x0039b340)
> > > > >         libm.so.6 => /lib64/libm.so.6 (0x0039a420)
> > > > >         libc.so.6 => /lib64/libc.so.6 (0x0039a3e0)
> > > > >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > > > > This explains why I cannot compile mod_python without first setting
> > > > > the LD_LIBRARY_PATH to '/usr/local/lib'. I don't know if this is the
> > > > > reason why the mod_python compilation continuously compiles with the
> > > > > python library as static. I upgraded my apache to the latest version
> > > > > however I still am getting segmentation faults on user authentication.
> > > > > Which potentially suggests that the problem is not apache and is
> > > > > something else like this issue.
>
> > > > echo '/usr/local/lib' >> /etc/ld.so.conf
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: General question: Django-Profiles, auth.User and "merging" both data

2008-11-13 Thread MikeKJ

I think I may be banging my head on the same problem.

I have a UserProfile and Member model in the same app.
In views I am using ModelForm on Member for generate a
form for def member(request) and a limited set for
def associate_member(request)
What I really want to do is use the 1st 5 (common and
mandatory fields to both def's) to prepopulate those
same fields in UserProfile

So essentially the same problem with a subtle twist
hence my interest in this thread.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Apache Segmentation Fault on succesful authentication

2008-11-13 Thread huw_at1

ls -ltr /usr/local/lib

-r-xr-xr-x 1 root root  4806649 Nov 11 11:22 libpython2.5.a
-r-xr-xr-x 1 root root  4806649 Nov 12 12:49 libpython2.5.so.1.0
lrwxrwxrwx  1 root root19 Nov 12 12:49 libpython2.5.so ->
libpython2.5.so.1.0

echo $LD_LIBRARY_PATH

/usr/local/lib

ldd /usr/local/bin/python

libpython2.5.so.1.0 => /usr/local/lib/libpython2.5.so.1.0
(0x2b6d8efc5000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0039a4a0)
libdl.so.2 => /lib64/libdl.so.2 (0x0039a460)
libutil.so.1 => /lib64/libutil.so.1 (0x0039b340)
libm.so.6 => /lib64/libm.so.6 (0x0039a420)
libc.so.6 => /lib64/libc.so.6 (0x0039a3e0)
/lib64/ld-linux-x86-64.so.2 (0x0039a2c0)

recompile mod_python and do ldd /usr/local/apache2/modules/
mod_python.so

libpthread.so.0 => /lib64/libpthread.so.0 (0x2b74c34f7000)
libdl.so.2 => /lib64/libdl.so.2 (0x2b74c3711000)
libutil.so.1 => /lib64/libutil.so.1 (0x2b74c3915000)
libm.so.6 => /lib64/libm.so.6 (0x2b74c3b19000)
libc.so.6 => /lib64/libc.so.6 (0x2b74c3d9c000)
/lib64/ld-linux-x86-64.so.2 (0x0039a2c0)

I still don't get why the library is being compiled in statically.

On Nov 13, 12:11 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Nov 12, 11:44 pm, huw_at1 <[EMAIL PROTECTED]> wrote:
>
>
>
> > echo '/usr/local/lib' >> /etc/ld.so.conf
>
> > more /etc/ld.so.conf
>
> > include ld.so.conf.d/*.conf
> > /usr/local/lib
>
> > ldd /usr/local/bin/python
>
> >         libpython2.5.so.1.0 => not found
> >         libpthread.so.0 => /lib64/libpthread.so.0 (0x0039a4a0)
> >         libdl.so.2 => /lib64/libdl.so.2 (0x0039a460)
> >         libutil.so.1 => /lib64/libutil.so.1 (0x0039b340)
> >         libm.so.6 => /lib64/libm.so.6 (0x0039a420)
> >         libc.so.6 => /lib64/libc.so.6 (0x0039a3e0)
> >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> Where is libpython2.5.so installed? What are the permissions on it?
>
> What do you get for:
>
>   echo $LD_LIBRARY_PATH
>
> just prior to running 'ld'?
>
> Graham
>
> > On Nov 12, 11:57 am, marco ghidinelli <[EMAIL PROTECTED]> wrote:
>
> > > On Wed, Nov 12, 2008 at 03:22:02AM -0800, huw_at1 wrote:
>
> > > > An update on this.
>
> > > > 'which python' returns:
>
> > > >         libpython2.5.so.1.0 => not found
> > > >         libpthread.so.0 => /lib64/libpthread.so.0 (0x0039a4a0)
> > > >         libdl.so.2 => /lib64/libdl.so.2 (0x0039a460)
> > > >         libutil.so.1 => /lib64/libutil.so.1 (0x0039b340)
> > > >         libm.so.6 => /lib64/libm.so.6 (0x0039a420)
> > > >         libc.so.6 => /lib64/libc.so.6 (0x0039a3e0)
> > > >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > > > This explains why I cannot compile mod_python without first setting
> > > > the LD_LIBRARY_PATH to '/usr/local/lib'. I don't know if this is the
> > > > reason why the mod_python compilation continuously compiles with the
> > > > python library as static. I upgraded my apache to the latest version
> > > > however I still am getting segmentation faults on user authentication.
> > > > Which potentially suggests that the problem is not apache and is
> > > > something else like this issue.
>
> > > echo '/usr/local/lib' >> /etc/ld.so.conf
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic Paths for File Uploads

2008-11-13 Thread Jarek Zgoda

Wiadomość napisana w dniu 2008-11-13, o godz. 01:52, przez Tim:

> Just to add some more information - I have been messing around with
> making the upload_to a callable, but I still have the same problem in
> that I need to build the path based on information that only exists
> during runtime (that is, a call to a view). Basically, I don't know
> the value of upload_to until I'm in the view. Ideally I'd like to do
> the following actions in views.py:
>
> - import the model
> - set the upload_to value
> - save the file
>
> What to do?


It seems to me that the option would be to (temporarily) store the  
file somewhere using semi-static information you already have, then  
move it to final location and update the path stored in model's  
FileField in view code.

-- 
We read Knuth so you don't have to. - Tim Peters

Jarek Zgoda, R&D, Redefine
[EMAIL PROTECTED]


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



Re: Does the development enterprise application have the available third party report library

2008-11-13 Thread Christian Joergensen

vance ma wrote:
> Does the development enterprise application have the available report 
> library?

What application? What library?

Regards,

-- 
Christian Joergensen
http://www.technobabble.dk

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



Re: Dynamic Paths for File Uploads

2008-11-13 Thread bruno desthuilliers



On 13 nov, 01:52, Tim <[EMAIL PROTECTED]> wrote:
> Just to add some more information - I have been messing around with
> making the upload_to a callable, but I still have the same problem in
> that I need to build the path based on information that only exists
> during runtime (that is, a call to a view). Basically, I don't know
> the value of upload_to until I'm in the view. Ideally I'd like to do
> the following actions in views.py:
>
> - import the model
> - set the upload_to value
> - save the file
>

Don't know if this can apply to your problem, but here's what we did:

# models.py

def get_upload_path(instance, filename):
# store images under MEDIA_ROOT/myimages//filename
return os.path.join("myimages", instance.owner.username, filename)

class Image(Model):
"""
Media-Image
"""
owner = models.ForeignKey(User)
image_file = ImageField(
upload_to=get_upload_path
)
# etc...


Then it's just a matter of passing the request.user to the model (or
to the form) within the view.

HTH




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



Re: Problem with named URL and parameters

2008-11-13 Thread Chris Emerson

On Thu, Nov 13, 2008 at 02:56:26PM +1100, Malcolm Tredinnick wrote:
> On Wed, 2008-11-12 at 22:39 -0500, Karen Tracey wrote:
> > On Wed, Nov 12, 2008 at 10:27 PM, Brandon Taylor
> > <[EMAIL PROTECTED]> wrote:
> > 
> > Hi everyone,
> > 
> > So I have a question/problem with a named URL pattern...
> > 
> > #urls.py
> > url(r'^resources/conversions/(?P[-\w]+)/$',
> > 'my_site.views.conversions', name='conversions'),
> [...]
> 
> > The \w in your specifier for conversion_template matches [a-zA-Z0-9_]
> > but you are trying to match something with dashes in it.
> 
> That isn't the issue. The pattern is [-\w], which will also match
> dashes. I'm not sure what is going wrong yet, though, since it looks
> like it should be working.

Shouldn't it be {% url conversions conversion_template="..." %}, ie
using a keyword argument rather than positional?

Chris

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



Does the development enterprise application have the available third party report library

2008-11-13 Thread vance ma
Does the development enterprise application have the available report
library?

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



Re: General question: Django-Profiles, auth.User and "merging" both data

2008-11-13 Thread urukay


I always use my own forms (no ModelForms), because there is better control of
the form (validation, save function).
But definetely more of code will help (models, whole view function).
We will work it out ;-)

R.


erdmaennchen wrote:
> 
> 
> After the next night of coding, reading through documentation and
> searching through the userlist and google I'm now at the following
> point:
> I'm using two forms, one for the auth.User data (model=User) and one
> for the additional profile data (model=CustomProfile). Both are
> extending ModelForm and I managed to get them into one template.
> Everything just great with that and I think I will stay with that
> approach. Sadly I ran into new problems. I know that ModelForms which
> only want to use certain fields have to provide the rest of the data
> too. So I tried the following for getting the data into the User form
> that I'm not changing.
> 
> The form seems to forget my instance data. If I try to POST this, the
> form is always invalid because required fields like 'username' are
> suddenly unset. When I visit the site the first time (via GET) the
> data from the user is available. After the first POST the data is just
> gone. The request.user is set (and I'm using the correct Context
> Processor for it) and contains all the needed data. I'm quite sure
> that there is some minor bug in my code. But it's driving me insane
> because I'm working since I'd say 8 hours on this whole thing (nobody
> said learning is easy). If you need more explicite code (or more code
> in general) to find my mistake, please let me know. I'd really love to
> get that final piece in the registration / authentication / profiles
> chain working. Long story short, here's the code snippet:
> 
> (I left out and renamed some code to point out the things which I
> think are the problem (for example the whole second form handling
> etc).)
> [SNIP]
> if request.method == 'POST':
> 
> formUser = FormUser(data=request.POST, files=request.FILES,
> instance=request.User)
> 
> if formUser.is_valid():
> user_obj = formUser.save()
> return HttpResponseRedirect(reverse('some_site'))
> else:
> formUser = FormUser(instance=request.user)
> 
> return render_to_response("some/testing.html",
> {'formUser':formUser,
> 'formProfile':formProfile},
> context_instance=RequestContext(request))
> [SNIP]
> 
> Best regards and once again: Thanks in advance - maybe you are going
> to make my day :-).
> 
> Alex
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/General-question%3A-Django-Profiles%2C-auth.User-and-%22merging%22-both-data-tp20458575p20475992.html
Sent from the django-users mailing list archive at Nabble.com.


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