Re: Testing email with the testserver

2010-03-26 Thread Russell Keith-Magee
On Fri, Mar 26, 2010 at 11:29 PM, Ben Gerdemann  wrote:
> I found the Django documentation about testing E-mail services
> confusing. It says here 
> http://docs.djangoproject.com/en/1.1/topics/testing/#e-mail-services
> "Django's test runner automatically redirects all Django-sent e-mail
> to a dummy outbox", but the example code shows using the 'mail' object
> directly in the TestCase and not in the view like the documentation
> states.
>
> I am using "manage.py testserver" and Selenium to drive the browser.
> When I have a test that triggers an email event, the email is sent and
> not collected in the dummy outbox. Is this the expected behavior?
> Would the behavior be different if I loaded the view using
> django.test.client instead of through the testserver?
>
> It would be nice of the testserver also used the dummy outbox, but at
> a minimum I think the documentation should be clearer and perhaps give
> a better example?

As noted by Phlip, the behaviour you're seeing is caused because
testserver isn't running in the test environment; it's just using the
test database.

However, if you're using trunk (soon to be 1.2), there is a way around
your problem.

One of the new features that has been added is the ability to control
the mail sending backend. One of the available backends is the locmem
backend, which is the same memory-backed mail sending interface that
the test framework uses to send mail. There are also console and file
based backends, if you're looking for other ways to avoid SMTP but
retain the ability to check mail output.

See the release notes [1] and feature docs [2] for more details.

[1] http://docs.djangoproject.com/en/dev/releases/1.2/#e-mail-backends
[2] http://docs.djangoproject.com/en/dev/topics/email/#topic-email-backends

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



Re: Re: Using ModelForm to edit ManyToMany in both directions?

2010-03-26 Thread jwils2004
I believe the answer is to append a regular Form to the ModelForm) with a  
single ModelMultipleChoice field and use its queryset member to manage the  
selected volunteers manually.


I've found Django to be so good at just having everything I need, I was  
hoping there would be something out of the box for this as well.


Wilb

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



list_display is not working

2010-03-26 Thread Ovnicraft
Hi folks, i am using v1.1.1 on slackware64, i customize th geoadmin, and i
change the list_display, i have data loaded and pagination is showed, (test
also list_per_page and works ok)  but list with records is not showed i want
to know how i can identify the problem, this is my code
http://dpaste.com/176598/, i guess everything is ok.

Best regards,
-- 
Cristian
Cuenca - Ecuador

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



Re: New User - Writing your first Django app part 1 crashed

2010-03-26 Thread Karen Tracey
On Fri, Mar 26, 2010 at 8:52 PM, Paul Harouff  wrote:
[snip]

>connection = zxJDBC.connect(self.jdbc_url(),
> zxJDBC.DatabaseError: driver [org.postgresql.Driver] not found
>
>
> All of my searches say the solution is to use the --verify flag with
> jython. But, the --verify flag was removed from jython-2.5, because
> that is now the default classpath behavior. So, I have no idea how to
> fix this.
>
>
Sorry, I don't use Jython, so I've no clue on this one.

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



Re: New User - Writing your first Django app part 1 crashed

2010-03-26 Thread Paul Harouff
On Fri, Mar 26, 2010 at 6:26 PM, Karen Tracey  wrote:
> On Fri, Mar 26, 2010 at 5:58 PM, Paul Harouff  wrote:
>>
>> I uninstalled Django development trunk and installed Django-1.1.1. Now
>> when I run "jython manage.py runserver" I get "Error: No module named
>> messages"
>>
>
> I've no idea bout your earlier problem but this one sounds like you are
> using a settings file created by trunk-level manage.py startproject against
> 1.1.1 code. If you previously ran startproject using trunk-level code you
> need to start over and re-run it with the older code you have installed now:
> an 'uplevel' settings file may contain a number of new things that are not
> going to be understood by 'backlevel' Django.
>

Thank you. That was the problem. The settings.py file has two extra
lines. I was able to get Django-1.1.1 to run and connect to it with a
browser.

BUT, now when I move on to the next step in the tutorial it crashes again.

/CSDB/projects/mysite> jython manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/CSDB/jython/Lib/site-packages/django/core/management/__init__.py",
line 362, in execute_manager
utility.execute()
  File "/CSDB/jython/Lib/site-packages/django/core/management/__init__.py",
line 303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/CSDB/jython/Lib/site-packages/django/core/management/base.py",
line 195, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/CSDB/jython/Lib/site-packages/django/core/management/base.py",
line 222, in execute
output = self.handle(*args, **options)
  File "/CSDB/jython/Lib/site-packages/django/core/management/base.py",
line 222, in execute
output = self.handle(*args, **options)
  File "/CSDB/jython/Lib/site-packages/django/core/management/base.py",
line 351, in handle
return self.handle_noargs(**options)
  File 
"/CSDB/jython/Lib/site-packages/django/core/management/commands/syncdb.py",
line 49, in handle_noargs
cursor = connection.cursor()
  File "/CSDB/jython/Lib/site-packages/django/db/backends/__init__.py",
line 81, in cursor
cursor = self._cursor()
  File 
"/CSDB/jython/Lib/site-packages/django_jython-1.1.1-py2.5.egg/doj/backends/zxjdbc/postgresql/base.py",
line 78, in _cursor
self.connection = self.new_connection()
  File 
"/CSDB/jython/Lib/site-packages/django_jython-1.1.1-py2.5.egg/doj/backends/zxjdbc/common.py",
line 39, in new_connection
connection = zxJDBC.connect(self.jdbc_url(),
zxJDBC.DatabaseError: driver [org.postgresql.Driver] not found


All of my searches say the solution is to use the --verify flag with
jython. But, the --verify flag was removed from jython-2.5, because
that is now the default classpath behavior. So, I have no idea how to
fix this.

Paul

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



Default filter value for Admin?

2010-03-26 Thread david.schruth
I'm wondering if there is an easy way to set up a default filter on
the rows of my table:

1) at all
2) using a foreign class' field

for example.

lets say I have a table called
   'student' with fields name, gpa, school, etc
 and another called
'school' with fields name, closed

in the case of question 1)
what if I wanted to just show the students with gpa > 3.0 in the admin
interface?
in the case of question 2)
what if I just wanted to show the students who's school is not closed?

Could there be a way to filter using the "Meta" subclass?

Thanks in advance!

Dave

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



Re: Tests for contrib.flatpages

2010-03-26 Thread Bjunix
Thanks for the hint. I'll have a look at this ticket.

On Mar 26, 6:38 pm, faldridge  wrote:
> Bjunix:
>
> Before you get too far on this, please see the note I attached to your
> ticket (cross-referencing ticket #6932).  There has already been some
> work done on this issue, and I'd hate for you to waste any time re-
> duplicating effort.
>
> On Mar 26, 11:06 am, Bjunix  wrote:
>
> > Thanks for your answer,
>
> > I created a ticket for this here:
>
> >http://code.djangoproject.com/ticket/13219
>
> > I am new to testing django apps, but maybe I'll have a try on some
> > tests for flatpages.
>
> > On Mar 26, 4:02 pm, Russell Keith-Magee 
> > wrote:
>
> > > On Fri, Mar 26, 2010 at 9:42 PM, Bjunix  wrote:
> > > > Hi all,
>
> > > > I am looking for tests for the flatpages app. I can't find any. Do I
> > > > miss something or ships django without tests for flatpages?
>
> > > You're not missing anything; for historical reasons (specifically,
> > > that flatpages was written before Django gained a full testing
> > > framework), there aren't any tests for flatpages.
>
> > > If someone wants to contribute some, they would be most welcome. There
> > > isn't much that needs testing, but there are a couple of edge cases
> > > that are worth validating.
>
> > > 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ForeignKeyField

2010-03-26 Thread Asim Yuksel
You know what I am trying to solve this for about 2 days. Thank you so
much it worked :) All my respects to your brain :)

On 26 Mart, 20:04, Karen Tracey  wrote:
> On Fri, Mar 26, 2010 at 8:00 PM, Asim Yuksel wrote:
>
> > I've tried this.
> > The model is
>
> > class Advisors(models.Model):
> >     advisorid = models.IntegerField(primary_key=True,
> > db_column='advisorId') # Field name made lowercase.
> >    maphdid = models.ForeignKey(Tblmaphds, db_column='maPhDId') #
> > Field name made lowercase.
> >    rank = models.SmallIntegerField()
> >    def __unicode__(self):
> >        return self.maphdid
> >    class Meta:
> >        db_table = u'Advisors'
>
> You are showing a __unicode__ method for the Advisors model. A ForeignKey
> field where the related model is a Tblmaphds will use the __unicode__ method
> of the Tblmaphds model to display the value of the related field. You need
> to add a __unicode__ method to the Tblmaphds model.
>
> 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: automatically import lots of modules at python manage.py shell time?

2010-03-26 Thread Bjunix
django-extensions[1] brings the shell_plus command which auto-imports
all models in installed apps. You can use this or have a look at it's
source.

[1] http://github.com/django-extensions/django-extensions

On Mar 26, 11:52 pm, "Tom X. Tobin"  wrote:
> On Fri, Mar 26, 2010 at 5:45 PM, Phlip  wrote:
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'dev2_settings'  #  TODO  look
> > up which one
>
> My local copy actually has the following code in it:
>
> 
> import os
> import re
> import sys
>
> m = re.search(r'^([a-zA-Z0-9_]+)-shell$', os.path.basename(sys.argv[0]))
> mn = 'avclub'
> if m:
>     g = m.group(1)
>     if g in ['avclub', 'onion']:
>         mn = g
>     del g
> del m
> os.environ['DJANGO_SETTINGS_MODULE'] = 'afns.sites.local_%s.settings'
> % (mn,)  # "afns" is the Onion's Python package
> 
>
> This way I can just make symlinks named "avclub-shell" and
> "onion-shell" to the original executable, and it will use the
> respective settings files automatically without having to maintain
> separate copies.  You could also get fancier with optparse, I suppose.

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



Re: ForeignKeyField

2010-03-26 Thread Karen Tracey
On Fri, Mar 26, 2010 at 8:00 PM, Asim Yuksel wrote:

> I've tried this.
> The model is
>
> class Advisors(models.Model):
> advisorid = models.IntegerField(primary_key=True,
> db_column='advisorId') # Field name made lowercase.
>maphdid = models.ForeignKey(Tblmaphds, db_column='maPhDId') #
> Field name made lowercase.
>rank = models.SmallIntegerField()
>def __unicode__(self):
>return self.maphdid
>class Meta:
>db_table = u'Advisors'
>
>
You are showing a __unicode__ method for the Advisors model. A ForeignKey
field where the related model is a Tblmaphds will use the __unicode__ method
of the Tblmaphds model to display the value of the related field. You need
to add a __unicode__ method to the Tblmaphds model.

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



Re: ForeignKeyField

2010-03-26 Thread Asim Yuksel
I've tried this.
The model is

class Advisors(models.Model):
advisorid = models.IntegerField(primary_key=True,
db_column='advisorId') # Field name made lowercase.
maphdid = models.ForeignKey(Tblmaphds, db_column='maPhDId') #
Field name made lowercase.
rank = models.SmallIntegerField()
def __unicode__(self):
return self.maphdid
class Meta:
db_table = u'Advisors'

in admin.py I have

def AdvisorAdmin(model):
class BrdgadvisorsAdmin(admin.ModelAdmin):
model = Brdgadvisors
list_display = [f.name for f in model._meta.fields]
return BrdgadvisorsAdmin

admin.site.register(Brdgadvisors,AdvisorAdmin(Brdgadvisors))

So this doesnt work.
On 26 Mart, 19:10, Karen Tracey  wrote:
> On Fri, Mar 26, 2010 at 4:31 PM, Asim Yuksel wrote:
>
> > here is the list display
>
> >http://picasaweb.google.com/110428031719333287170/BaslKsZAlbum#545304...
>
> > I want that to appear in a list display, because that is what the
> > client wants :)
>
> > I tried writing unicode method , but it has no effect.I dont know
> > why.
>
> Since you haven't shown exactly what you tried there, we don't know either.
> As documented here:
>
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contri...
>
> if the field is a ForeignKey, Django will display the __unicode__() of the
> related object.
>
> Thus if your Tblmaphds model had a __unicode__ method, whatever it returned
> would be what you see instead of "Tblmaphds object" in list display.
>
> Adding a __unicode__ method to that model is the easiest way to accomplish
> what you are asking for. There are also other options, as noted in that doc
> you can define callables on your model or model admin that return whatever
> you'd like to be shown in the list display, but really the easiest thing
> here would be the __unicode__ method on that model, so I'd suggest you try
> to figure out why that easiest solution isn't working before trying other
> more complicated things.
>
> 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: extend admin interface - chang_list_results.html

2010-03-26 Thread Karen Tracey
On Fri, Mar 26, 2010 at 5:27 PM, Sven Richter wrote:

> Ok, just for Information, i found the answer myself. In the django
> docs it is said:
> "Some of the admin templates, such as change_list_request.html are
> used to render custom inclusion tags. These may be overridden, but in
> such cases you are probably better off creating your own version of
> the tag in question and giving it a different name. That way you can
> use it selectively."
>
> So, i'm gonna do it myself.
>

Some tickets you might be interested in:

http://code.djangoproject.com/ticket/9093
http://code.djangoproject.com/ticket/9749

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



Re: New User - Writing your first Django app part 1 crashed

2010-03-26 Thread Karen Tracey
On Fri, Mar 26, 2010 at 5:58 PM, Paul Harouff  wrote:

> I uninstalled Django development trunk and installed Django-1.1.1. Now
> when I run "jython manage.py runserver" I get "Error: No module named
> messages"
>
>
I've no idea bout your earlier problem but this one sounds like you are
using a settings file created by trunk-level manage.py startproject against
1.1.1 code. If you previously ran startproject using trunk-level code you
need to start over and re-run it with the older code you have installed now:
an 'uplevel' settings file may contain a number of new things that are not
going to be understood by 'backlevel' Django.

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



Re: ForeignKeyField

2010-03-26 Thread Karen Tracey
On Fri, Mar 26, 2010 at 4:31 PM, Asim Yuksel wrote:

> here is the list display
>
>
> http://picasaweb.google.com/110428031719333287170/BaslKsZAlbum#5453042316004332754
>
> I want that to appear in a list display, because that is what the
> client wants :)
>
> I tried writing unicode method , but it has no effect.I dont know
> why.
>

Since you haven't shown exactly what you tried there, we don't know either.
As documented here:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

if the field is a ForeignKey, Django will display the __unicode__() of the
related object.

Thus if your Tblmaphds model had a __unicode__ method, whatever it returned
would be what you see instead of "Tblmaphds object" in list display.

Adding a __unicode__ method to that model is the easiest way to accomplish
what you are asking for. There are also other options, as noted in that doc
you can define callables on your model or model admin that return whatever
you'd like to be shown in the list display, but really the easiest thing
here would be the __unicode__ method on that model, so I'd suggest you try
to figure out why that easiest solution isn't working before trying other
more complicated things.

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



Re: Testing email with the testserver

2010-03-26 Thread Phlip
Ben Gerdemann wrote:

> I am using "manage.py testserver" and Selenium to drive the browser.

Therefor you are running thru the real webserver, not its mock.

And, incidentally, most testing effort should be in unit tests -
Selenium should _only_ test the last mile of integration, where stuff
like JS and Flash come together. Unit tests can trivially use
assert_mail(), available here:
http://github.com/cuker/django-test-extensions/blob/master/src/test_extensions/django_common.py
, to test mail into that mock inbox.

> It would be nice of the testserver also used the dummy outbox, but at
> a minimum I think the documentation should be clearer and perhaps give
> a better example?

Get a cheap SMTP implemention, such as Python's own library, and set
up a dummy email server. But, again, you are literally throwing good
money after bad without unit tests. That's why the documentation
assumed you started there.

--
  Phlip

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



Re: automatically import lots of modules at python manage.py shell time?

2010-03-26 Thread Tom X. Tobin
On Fri, Mar 26, 2010 at 5:45 PM, Phlip  wrote:
> os.environ['DJANGO_SETTINGS_MODULE'] = 'dev2_settings'  #  TODO  look
> up which one

My local copy actually has the following code in it:


import os
import re
import sys

m = re.search(r'^([a-zA-Z0-9_]+)-shell$', os.path.basename(sys.argv[0]))
mn = 'avclub'
if m:
g = m.group(1)
if g in ['avclub', 'onion']:
mn = g
del g
del m
os.environ['DJANGO_SETTINGS_MODULE'] = 'afns.sites.local_%s.settings'
% (mn,)  # "afns" is the Onion's Python package


This way I can just make symlinks named "avclub-shell" and
"onion-shell" to the original executable, and it will use the
respective settings files automatically without having to maintain
separate copies.  You could also get fancier with optparse, I suppose.

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



Re: automatically import lots of modules at python manage.py shell time?

2010-03-26 Thread Phlip
Tom X. Tobin wrote:

> #!/usr/bin/env ipython -i -nobanner
> Save that to a file in your PATH, make it executable, and you should be set.

Awesome--thanks. And, instead of chmod +x-ing it, I added it to our
common fab files, so everyone gets it with 'fab shell'.

And I could not get ip = IPython.ipapi.get() working (not sure why -
it returned a None), so I added it with this contemptible but
bulletproof hack:

def shell():
open('.ipython', 'w').write('''
# don't need this part if DJANGO_SETTINGS_MODULE is already set in
your environment
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'dev2_settings'  #  TODO  look
up which one

from django.db.models import Count, Max, Min, Q
from django.db.models.loading import cache as appcache

local_dict = locals()
for model_class in appcache.get_models():
local_dict[model_class.__name__] = model_class
del local_dict, appcache, os
''')
os.system('ipython -i -nobanner .ipython')

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand

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



Re: automatically import lots of modules at python manage.py shell time?

2010-03-26 Thread Tom X. Tobin
On Fri, Mar 26, 2010 at 4:47 PM, Phlip  wrote:
> I am in anguish over watching my colleagues fire up python manage.py
> shell...
>
> ...and then typing several incredibly long import lines before
> actually getting anything done.
>
> These same colleagues also seem to have itchy ^C fingers, meaning they
> bail out of the shell too often, too.
>
> How can we fix the first problem? How can this (otherwise useful)
> shell use a minimal or invisible import rubric, to grab, say, a bunch
> of models so they are all ready & available for use?

I use something like this (assuming you have iPython installed):

**
#!/usr/bin/env ipython -i -nobanner

# don't need this part if DJANGO_SETTINGS_MODULE is already set in
your environment
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'YOUR.SETTINGS.MODULE'

from django.db.models import Count, Max, Min, Q
from django.db.models.loading import cache as appcache

local_dict = locals()
for model_class in appcache.get_models():
local_dict[model_class.__name__] = model_class
del local_dict, appcache, os
**

Save that to a file in your PATH, make it executable, and you should be set.

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



Re: Difference between request.POST.get('foo') and request.POST['foo']?

2010-03-26 Thread Daniel
Thanks guys, that was very clear and helpful.

On Mar 24, 2:23 am, Mahmoud Abdelkader  wrote:
> In python, dictionaries have a get method that will return None if you
> call it on a dictionary key that doesn't exist. get() can also take an
> optional default parameter that returns it's value if the key doesn't
> exist.
>
> If you use the indexing method, i.e. [], it invokes the dictionaries
> __getitem__ method, which can throw a KeyError exception if the key
> doesn't exist.
>
> --Sent from my iPhone
>
> On Mar 23, 2010, at 11:14 PM, Daniel  wrote:
>
> > Hi,
>
> > Are these statements equivalent?  I want to say no, but I can't see
> > why.
>
> > Thank you
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en
> > .

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



Re: New User - Writing your first Django app part 1 crashed

2010-03-26 Thread Paul Harouff
On Fri, Mar 26, 2010 at 2:17 PM, Beartenor1  wrote:
> I have a openSUSE linux server.
>
> Created folder /CSDB.
> Dropped copy of Sun jdk6u18 in /CSDB/java/jdk6u18.
> Installed copy of Jython in /CSDB/jython
> Installed easy_install
> Installed distribute
> Installed virtualenv
> Ran virtualenv --relocatable /CSDB/jython
> Dropped copy of Apache tomcat6 in /CSDB/tomcat
> Ran tomcat and verified browser can connect to it
> checkedout a copy of Django development trunk
> Ran jython setup.py install
> Django-1.2_beta_1-py2.5.egg was installed to /CSDB/jython/Lib/site-
> packages/django
> Ran easy_install -U django_jython
> django_jython-1.1.1-py2.5.egg was also installed to /CSDB/jython/Lib/
> site-packages
>
> Created folder /CSDB/projects
> cd /CSDB/projects
> django-admin.py startproject mysite
> cd mysite
> jython manage.py runserver
>
> Validating models...
> Unhandled exception in thread started by 
> Traceback (most recent call last):
>  File "/CSDB/jython/Lib/site-packages/django/core/management/commands/
> runserver.py", lin inner_run
>    self.validate(display_num_errors=True)
>  File "/CSDB/jython/Lib/site-packages/django/core/management/
> base.py", line 250, in va
>    num_errors = get_validation_errors(s, app)
>  File "/CSDB/jython/Lib/site-packages/django/core/management/
> validation.py", line 149,validation_errors
>    for inter_field in f.rel.through._meta.fields:
> AttributeError: type object 'Group_permissions' has no attribute
> '_meta'
>
>

I uninstalled Django development trunk and installed Django-1.1.1. Now
when I run "jython manage.py runserver" I get "Error: No module named
messages"

Am I ever going to get through Part 1 of the beginner tutorial?

Paul

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



automatically import lots of modules at python manage.py shell time?

2010-03-26 Thread Phlip
Djangoists:

I am in anguish over watching my colleagues fire up python manage.py
shell...

...and then typing several incredibly long import lines before
actually getting anything done.

These same colleagues also seem to have itchy ^C fingers, meaning they
bail out of the shell too often, too.

How can we fix the first problem? How can this (otherwise useful)
shell use a minimal or invisible import rubric, to grab, say, a bunch
of models so they are all ready & available for use?

--
  Phlip
  http://penbird.deviantart.com/

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



Re: extend admin interface - chang_list_results.html

2010-03-26 Thread Sven Richter
Ok, just for Information, i found the answer myself. In the django
docs it is said:
"Some of the admin templates, such as change_list_request.html are
used to render custom inclusion tags. These may be overridden, but in
such cases you are probably better off creating your own version of
the tag in question and giving it a different name. That way you can
use it selectively."

So, i'm gonna do it myself.

Greetings
Sven

On Fri, Mar 26, 2010 at 7:24 PM, Sven Richter  wrote:
> Hi,
>
> i am about to extend the admin interface and came to the following problem.
> I want to add some information to the overview of an application
> model. Now, i look in the change_list.html and see that the {%
> result_list cl %}   template tag is the one i need to adapt.
> Now, when i look in the templatetags.py i see the link to
> register.inclusion_tag("admin/change_list_results.html") and finally
> found the template i need to adapt.
>
> But the problem is, the path is hardcoded. So i have to put
> change_list_results.html in "templates/admin" path to get it used
> instead of "templates/app/model/" path.
>
> That of course is not very useful, cause the template will be used for
> every app instead for the one i want to adapt.
>
> How do i get around that? Is there a standard way for doing these things?
>
>
> Greetings
> Sven
>

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



Re: ForeignKeyField

2010-03-26 Thread Asim Yuksel
here is the list display

http://picasaweb.google.com/110428031719333287170/BaslKsZAlbum#5453042316004332754

I want that to appear in a list display, because that is what the
client wants :)

I tried writing unicode method , but it has no effect.I dont know
why.And when I try to use maphdid_id, it says it deosnt exist

On 26 Mart, 13:11, Daniel Roseman  wrote:
> On Mar 26, 4:44 pm, Asim Yuksel  wrote:
>
> > Yes foreignkey is an object but there must be a way to display the
> > value in a list_display. I am a newbie too. self.maphdid.id doesnt
> > work
>
> The underlying id field is called "maphdid_id", so you should be able
> to use that. But I have no idea why you'd want that to appear in a
> list_display, it's of no use to users of your application.
>
> Much more worthwhile is to define a useful __unicode__ method on the
> Tblmaphds model itself, which will then appear in the list_display in
> place of 'Tblmaphds object'.
> --
> DR.

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



New User - Writing your first Django app part 1 crashed

2010-03-26 Thread Beartenor1
I have a openSUSE linux server.

Created folder /CSDB.
Dropped copy of Sun jdk6u18 in /CSDB/java/jdk6u18.
Installed copy of Jython in /CSDB/jython
Installed easy_install
Installed distribute
Installed virtualenv
Ran virtualenv --relocatable /CSDB/jython
Dropped copy of Apache tomcat6 in /CSDB/tomcat
Ran tomcat and verified browser can connect to it
checkedout a copy of Django development trunk
Ran jython setup.py install
Django-1.2_beta_1-py2.5.egg was installed to /CSDB/jython/Lib/site-
packages/django
Ran easy_install -U django_jython
django_jython-1.1.1-py2.5.egg was also installed to /CSDB/jython/Lib/
site-packages

Created folder /CSDB/projects
cd /CSDB/projects
django-admin.py startproject mysite
cd mysite
jython manage.py runserver

Validating models...
Unhandled exception in thread started by 
Traceback (most recent call last):
  File "/CSDB/jython/Lib/site-packages/django/core/management/commands/
runserver.py", lin inner_run
self.validate(display_num_errors=True)
  File "/CSDB/jython/Lib/site-packages/django/core/management/
base.py", line 250, in va
num_errors = get_validation_errors(s, app)
  File "/CSDB/jython/Lib/site-packages/django/core/management/
validation.py", line 149,validation_errors
for inter_field in f.rel.through._meta.fields:
AttributeError: type object 'Group_permissions' has no attribute
'_meta'


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



Re: xmlrpc + 'django.contrib.auth.middleware.RemoteUserMiddleware' throws "Forbidden"

2010-03-26 Thread David
> Are you telling me that there's no way to get this workin without an
apache in front of django? So, all the questions I'm going to ask you
at the end of this email have
only this answer? :)

That's pretty much true although it isn't Apache specific. Lots of
other web servers have a way of setting REMOTE_USER which is what the
RemoteUserMiddleware requires.

>>> s = ServerProxy('http://admin:ad...@localhost:8000')

This tells Python's xmlrpclib that "admin" should be sent as HTTP
basic authentication [1]. Django has no way (that I know of) to use
HTTP basic authentication other than the RemoteUserMiddleware or a
derived middleware.

> AFAIK, you can pass those values only within the url 
> (http://user:pas...@www.mysite.com). So, I suppose the middleware to take 
> those values from the http request and set them properly.

Actually, the web server takes those values and puts them into the
HTTP request that Django processes. The RemoteUserMiddleware just
checks those values and assumes that if they were set properly by the
server.

> I'm not able to login using username and password... and here comes the big 
> question: isn't this stack supposed to work as fallback chain?

Django will fall back onto ModelBackend if you tell it to. However,
the ModelBackend does not pick up the username and password from HTTP
basic auth and so this doesn't work as you were hoping. The
ModelBackend is used to login users through a web form.


In general, the RemoteUserMiddleware is used when the web server does
the authentication and RPC4Django uses the RemoteUserMiddleware for
authenticated requests. If you plan to deploy your application to a
web server when you're done debugging you could write a custom
middleware that set remote user if DEBUG is True so you can test it.
However, it is possible that RemoteUserMiddleware does not exactly
meet your requirements. In that case, you can file an issue on
RPC4Django to support some alternative authentication mechanism.
You'll have to email me to do this until I finish transferring
RPC4Django to Launchpad. However, XMLRPC and JSONRPC protocols do not
support authentication. In other RPC libraries for Django [2] I've
seen that they provide a decorator which adds two parameters (username
and password) to your RPC method. However, I did not really like this
solution for a variety of reasons.



[1] http://docs.python.org/library/xmlrpclib.html#xmlrpclib.ServerProxy
[2] http://github.com/samuraisam/django-json-rpc


On Mar 26, 10:13 am, Simone Orsi  wrote:
> Hi David, Ale, thanks for your answers :)
>
> On 03/26/2010 05:24 PM, David wrote:> Simone,
>
> > It looks to me like there may be a problem in how you have configured
> > basic authentication on your web server.
>
> At the moment I didn't configure any server at all :)> Firstly, the fact that 
> you
> > are able to connect to your unprotected methods without using the
> > username "admin" with password "admin" leads me to believe that your
> > server is unprotected by basic authentication.
>
> I supposed the django server provides this...> Also, the fact that
> > you're on port 8000 usually implies that you're using the built-in
> > Django test server.
>
> Yep, because I'm still testing it.> As far as I know, there is no way to 
> configure the
> > built-in server with basic authentication. With Apache/mod_python, you
> > can configure it to use Django's database for web server
> > authentication [1]. With mod_wsgi, take a look at Django ticket #10809
> > [2].
>
> Are you telling me that there's no way to get this workin without an
> apache in front of django?
> So, all the questions I'm going to ask you at the end of this email have
> only this answer? :)
>
> > Alessandro,
>
> > I think what you have is perfect is your web server sets
> > HTTP_AUTHORIZATION instead of REMOTE_USER when it authenticates.
> > However, I think you could just subclass the RemoteUserMiddleware [3].
>
> > [1]http://docs.djangoproject.com/en/1.1/howto/apache-auth
> > [2]http://code.djangoproject.com/ticket/10809
> > [3]http://docs.djangoproject.com/en/1.1/howto/auth-remote-user
>
> > -David
>
> @Alessandro: mmm, I see that your code is pretty much the same of this
> [1], except for the xmlrpc part :)
> I'll give it a try, but in the mean time I want to understand what is
> going wrong with the other middlewares.
>
> Looking the tutorial I mentioned before and at the code of
>
> 'django.contrib.auth.middleware.RemoteUserMiddleware'
>
> and
>
> 'django.contrib.auth.backends.RemoteUserBackend'
>
> the authentication should be done trough "request.META['REMOTE_USER']"
> but this is not working since the var never appears into my request.
> Probably there is specific manner to pass it to the request but with the
> standard xmlrpclib, AFAIK, you can pass those values only within the url
> (http://user:pas...@www.mysite.com). So, I suppose the middleware to
> take those values from the http request and set them properly.
>
> Also, I 

Re: About extending User model

2010-03-26 Thread Jim N
Carl, scratch my last message.  It does work.  Woot!  Thanks very
much.

On Mar 26, 2:39 pm, Jim N  wrote:
> On Mar 26, 1:39 pm, Carl Zmola  wrote:
>
>
>
>
>
> > On 03/25/2010 02:37 PM, Jim N wrote:
> > > Very interesting, Tom.
>
> > > I have inserted this code, substituting my profile model name
> > > (QotdUser) for UserProfile.  It does create a row in QotdUser, but the
> > > row is empty of course.
>
> > > More importantly, if I create a user via the admin interface (http://
> > > 127.0.0.1:8000/admin/auth/user/add/) there's no apparent way to edit
> > > any of the fields of my profile model.
>
> > > Or if I create the user some other way, would I be able to pass
> > > arguments to the User model to populate the profile?
>
> > > Finally, how do I access the profile, is it like
>
> > >    my_user_profile = User.objects.get(username="jim").get_profile() ?
>
> > > Thanks for the help.
>
> > I have done this, and I think the following link will 
> > helphttp://pyxx.org/2008/08/18/how-to-extend-user-model-in-django-and-ena...
>
> > You need to unregister the current model admin for the user model and
> > create a new one (based on the old one) that includes your user profile
> > "inline".
> > When you understand that last sentence, you will understand what is
> > going on.
>
> > Good luck.
>
> > --
> > Carl Zmola
> > czm...@woti.com
>
> Hi Carl,
>
> I've done just what you spelled out, I think, but I don't see any
> change in the Home › Auth › Users admin panel.  When editing the
> individual users, I can edith the fields that are part of the built-in
> User model, but not of the profile model.
>
> Here is the code:http://dpaste.de/OHwA/
>
> Here is the relevant part:
>
> -=-=-=-=-=-=-=-=-=-=-=-=
>
> class UserProfileInline(admin.TabularInline):
>     model = QotdUser
>     fk_name = 'user'
>     max_num = 1
>     list_display  = ('identifier', 'service', 'location',
> 'featured_status',)
>     list_filter   = ('featured_status', 'service',)
>     search_fields = ('identifier',)
>     exclude = ('alternate_id', 'questions_proposed_cnt',
> 'questions_published_cnt', 'answers_cnt')
>
> class MyUserAdmin(UserAdmin):
>     inlines = [UserProfileInline, ]
>
> admin.site.unregister(User)
>
> admin.site.register(User, MyUserAdmin)
>
> -=-=-=-=-=-=-=-=-=-=-=-=
>
> Am I missing a class there?
>
> Regards,
> Jim

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



Re: About extending User model

2010-03-26 Thread Jim N
On Mar 26, 1:39 pm, Carl Zmola  wrote:
> On 03/25/2010 02:37 PM, Jim N wrote:
> > Very interesting, Tom.
>
> > I have inserted this code, substituting my profile model name
> > (QotdUser) for UserProfile.  It does create a row in QotdUser, but the
> > row is empty of course.
>
> > More importantly, if I create a user via the admin interface (http://
> > 127.0.0.1:8000/admin/auth/user/add/) there's no apparent way to edit
> > any of the fields of my profile model.
>
> > Or if I create the user some other way, would I be able to pass
> > arguments to the User model to populate the profile?
>
> > Finally, how do I access the profile, is it like
>
> >    my_user_profile = User.objects.get(username="jim").get_profile() ?
>
> > Thanks for the help.
>
> I have done this, and I think the following link will 
> helphttp://pyxx.org/2008/08/18/how-to-extend-user-model-in-django-and-ena...
>
> You need to unregister the current model admin for the user model and
> create a new one (based on the old one) that includes your user profile
> "inline".
> When you understand that last sentence, you will understand what is
> going on.
>
> Good luck.
>
> --
> Carl Zmola
> czm...@woti.com


Hi Carl,

I've done just what you spelled out, I think, but I don't see any
change in the Home › Auth › Users admin panel.  When editing the
individual users, I can edith the fields that are part of the built-in
User model, but not of the profile model.

Here is the code: http://dpaste.de/OHwA/

Here is the relevant part:

-=-=-=-=-=-=-=-=-=-=-=-=

class UserProfileInline(admin.TabularInline):
model = QotdUser
fk_name = 'user'
max_num = 1
list_display  = ('identifier', 'service', 'location',
'featured_status',)
list_filter   = ('featured_status', 'service',)
search_fields = ('identifier',)
exclude = ('alternate_id', 'questions_proposed_cnt',
'questions_published_cnt', 'answers_cnt')

class MyUserAdmin(UserAdmin):
inlines = [UserProfileInline, ]

admin.site.unregister(User)

admin.site.register(User, MyUserAdmin)

-=-=-=-=-=-=-=-=-=-=-=-=

Am I missing a class there?

Regards,
Jim

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



extend admin interface - chang_list_results.html

2010-03-26 Thread Sven Richter
Hi,

i am about to extend the admin interface and came to the following problem.
I want to add some information to the overview of an application
model. Now, i look in the change_list.html and see that the {%
result_list cl %}   template tag is the one i need to adapt.
Now, when i look in the templatetags.py i see the link to
register.inclusion_tag("admin/change_list_results.html") and finally
found the template i need to adapt.

But the problem is, the path is hardcoded. So i have to put
change_list_results.html in "templates/admin" path to get it used
instead of "templates/app/model/" path.

That of course is not very useful, cause the template will be used for
every app instead for the one i want to adapt.

How do i get around that? Is there a standard way for doing these things?


Greetings
Sven

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



Re: About extending User model

2010-03-26 Thread Carl Zmola



On 03/25/2010 02:37 PM, Jim N wrote:


Very interesting, Tom.

I have inserted this code, substituting my profile model name
(QotdUser) for UserProfile.  It does create a row in QotdUser, but the
row is empty of course.

More importantly, if I create a user via the admin interface (http://
127.0.0.1:8000/admin/auth/user/add/) there's no apparent way to edit
any of the fields of my profile model.

Or if I create the user some other way, would I be able to pass
arguments to the User model to populate the profile?

Finally, how do I access the profile, is it like

   my_user_profile = User.objects.get(username="jim").get_profile() ?

Thanks for the help.

   


I have done this, and I think the following link will help
http://pyxx.org/2008/08/18/how-to-extend-user-model-in-django-and-enable-new-fields-in-newforms-admin/

You need to unregister the current model admin for the user model and 
create a new one (based on the old one) that includes your user profile 
"inline".
When you understand that last sentence, you will understand what is 
going on.


Good luck.


--
Carl Zmola
czm...@woti.com


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



Re: Tests for contrib.flatpages

2010-03-26 Thread faldridge
Bjunix:

Before you get too far on this, please see the note I attached to your
ticket (cross-referencing ticket #6932).  There has already been some
work done on this issue, and I'd hate for you to waste any time re-
duplicating effort.

On Mar 26, 11:06 am, Bjunix  wrote:
> Thanks for your answer,
>
> I created a ticket for this here:
>
> http://code.djangoproject.com/ticket/13219
>
> I am new to testing django apps, but maybe I'll have a try on some
> tests for flatpages.
>
> On Mar 26, 4:02 pm, Russell Keith-Magee 
> wrote:
>
> > On Fri, Mar 26, 2010 at 9:42 PM, Bjunix  wrote:
> > > Hi all,
>
> > > I am looking for tests for the flatpages app. I can't find any. Do I
> > > miss something or ships django without tests for flatpages?
>
> > You're not missing anything; for historical reasons (specifically,
> > that flatpages was written before Django gained a full testing
> > framework), there aren't any tests for flatpages.
>
> > If someone wants to contribute some, they would be most welcome. There
> > isn't much that needs testing, but there are a couple of edge cases
> > that are worth validating.
>
> > 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: auto authenticate

2010-03-26 Thread CrabbyPete
Thanks Peter that is exactly what I was looking for.

On Mar 25, 5:12 pm, Peter Bengtsson  wrote:
> If what you want to achieve is to log in a user programmatically you
> don't do that by authenticating by username and password.
> Example:
>
> def login_by_id(request):
>
>            user = FacebookUser.objects.get(...).user
>
>            from django.contrib.auth import load_backend, login
>            for backend in settings.AUTHENTICATION_BACKENDS:
>                 if user == load_backend(backend).get_user(user.pk):
>                     user.backend = backend
>            if hasattr(user, 'backend'):
>                  login(request, user)
>
> On 25 Mar, 18:27, CrabbyPete  wrote:> I am connecting 
> facebook to an app I have running. In order not to
> > change a load of code I created a dummy account when someone logs in
> > through facebook. My only problem is I want to authenticate with this
> > account when they log  Is there a way to login in a user using the
> > encrypted password. I am using pyfacebook and FacebookUser is the
> > following model
>
> > class FacebookUser(models.Model):
> >     user            = models.ForeignKey(User, unique = True)
> >     fb_uid          = models.CharField( max_length=100, blank = True,
> > unique = True)
>
> >     def __unicode__(self):
> >         if self.user.username == u'':
> >             return str(self.pk)
> >         return self.user.username
>
> > the fb_uid is the Facebook id I get back. Here is my view when I get
> > called from facebook
>
> > fb = request.facebook
> >  try:
> >       fid = FacebookUser.objects.get(Q(fb_uid = fb.uid))
> > except FacebookUser.DoesNotExist:
> >        return ...
>
> > name = fid.user
> > pswd = fid.user.password
> > user = auth.authenticate(username=name, password=pswd)
> >  if user is not None and user.is_active:
> >      auth.login(request, user)
>
> > pswd is an encrypted password. Is there a way for me to authenticate
> > with it?

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



Re: xmlrpc + 'django.contrib.auth.middleware.RemoteUserMiddleware' throws "Forbidden"

2010-03-26 Thread Simone Orsi
Hi David, Ale, thanks for your answers :)

On 03/26/2010 05:24 PM, David wrote:
> Simone,
>
> It looks to me like there may be a problem in how you have configured
> basic authentication on your web server. 
At the moment I didn't configure any server at all :)
> Firstly, the fact that you
> are able to connect to your unprotected methods without using the
> username "admin" with password "admin" leads me to believe that your
> server is unprotected by basic authentication. 
I supposed the django server provides this...
> Also, the fact that
> you're on port 8000 usually implies that you're using the built-in
> Django test server. 
Yep, because I'm still testing it.
> As far as I know, there is no way to configure the
> built-in server with basic authentication. With Apache/mod_python, you
> can configure it to use Django's database for web server
> authentication [1]. With mod_wsgi, take a look at Django ticket #10809
> [2].
>   
Are you telling me that there's no way to get this workin without an
apache in front of django?
So, all the questions I'm going to ask you at the end of this email have
only this answer? :)

> Alessandro,
>
> I think what you have is perfect is your web server sets
> HTTP_AUTHORIZATION instead of REMOTE_USER when it authenticates.
> However, I think you could just subclass the RemoteUserMiddleware [3].
>
>
> [1] http://docs.djangoproject.com/en/1.1/howto/apache-auth
> [2] http://code.djangoproject.com/ticket/10809
> [3] http://docs.djangoproject.com/en/1.1/howto/auth-remote-user
>
>
> -David
>   

@Alessandro: mmm, I see that your code is pretty much the same of this
[1], except for the xmlrpc part :)
I'll give it a try, but in the mean time I want to understand what is
going wrong with the other middlewares.

Looking the tutorial I mentioned before and at the code of 

'django.contrib.auth.middleware.RemoteUserMiddleware'

and

'django.contrib.auth.backends.RemoteUserBackend'

the authentication should be done trough "request.META['REMOTE_USER']"
but this is not working since the var never appears into my request.
Probably there is specific manner to pass it to the request but with the
standard xmlrpclib, AFAIK, you can pass those values only within the url
(http://user:pas...@www.mysite.com). So, I suppose the middleware to
take those values from the http request and set them properly.

Also, I found that with these settings:

AUTHENTICATION_BACKENDS = (
'lfs.customer.auth.EmailBackend',
#'django.contrib.auth.backends.ModelBackend',
'django.contrib.auth.backends.RemoteUserBackend',
)

I'm not able to login using username and password... and here comes the
big question: isn't this stack supposed to work as fallback chain?

According to the docs [2], yes: "[...] Django tries authenticating
across all of its authentication backends. [...]"

Moreover, the doc [3] says to replace '*.ModelBackend' with
'*.RemoteUserBackend' because it is a subclass of '*.ModelBackend' and
that's true:

[...]
class RemoteUserBackend(ModelBackend):
[...]

BUT, if I comment out "*.ModelBackend" as above, I can't login with
username and password, even if I comment out
'lfs.customer.auth.EmailBackend' too.

What's wrong here?

Any clues will be much appreciated.


[1] http://www.djangosnippets.org/snippets/448/
[2]
http://docs.djangoproject.com/en/1.1/topics/auth/#specifying-authentication-backends
[3] http://docs.djangoproject.com/en/1.1/howto/auth-remote-user/

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



Re: ForeignKeyField

2010-03-26 Thread Daniel Roseman
On Mar 26, 4:44 pm, Asim Yuksel  wrote:
> Yes foreignkey is an object but there must be a way to display the
> value in a list_display. I am a newbie too. self.maphdid.id doesnt
> work

The underlying id field is called "maphdid_id", so you should be able
to use that. But I have no idea why you'd want that to appear in a
list_display, it's of no use to users of your application.

Much more worthwhile is to define a useful __unicode__ method on the
Tblmaphds model itself, which will then appear in the list_display in
place of 'Tblmaphds object'.
--
DR.

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



Re: ForeignKeyField

2010-03-26 Thread Asim Yuksel
Yes foreignkey is an object but there must be a way to display the
value in a list_display. I am a newbie too. self.maphdid.id doesnt
work

On 26 Mart, 06:05, Thierry Chich  wrote:
> Le vendredi 26 mars 2010 04:14:51, Asim Yuksel a écrit :
>
> > I have a question about model.ForeignKey field.Foreign key fields are
> > shown as object in admin page. How can I show them in other types like
> > integer type
> > for example I have a Model like this:
>
> > class Advisor(models.Model):
>
> >     advisorid = models.IntegerField(primary_key=True,
> > db_column='advisorId')
> >     maphdid = models.ForeignKey(Tblmaphds, db_column='maPhDId')
> >     def __str__(self):
> >         return smart_str('%s' % (self.maphdid))
> >     def __unicode__(self):
> >         return smart_str('%s' % (self.maphdid))
> >     class Meta:
> >         db_table = 'Advisor'
>
> > The problem is I see the maphdid value as "Tblmaphds object" instead
> > of a normal integer value.
>
> > What should I do to see a integer value?
>
> I am not sure of what I say because I just begin with django, but it seems to
> me that you are confusing foreignkey in models and foreignkey in SQL database.
> For me, a foreignkey in django is an object, not an id.
>
> So, it seems to me that maphdid is an object Tblmaphds. If you want to print
> the Tblmaphds.id value, you shoud have
> to write
>          return smart_str('%s' % (self.maphdid.id))

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



Re: Is it possible to change the width of the boxes displayed by the filter_horizontal in Django admin interface?

2010-03-26 Thread Walt
I'm sorry I wasn't more clear, the class Media just gets
added to your existing admin class. The path to the css
should be the path that is appended to your SETTINGS.PY
media path to reach the css file. The class ResizeFilterAdmin
was just an example name.

In other words, if your media path is: /var/www/media
and your css file is stored in /var/www/media/css/bisite.css
then your Media entry would be:

css = { 'all': ('/media/css/bisite.css',)}

So the full entry would be:

class ProfileAdmin(admin.ModelAdmin):
search_fields = ('profile_name',)
ordering = ('profile_name',)
filter_horizontal = ('profile_test',)

class Media:
css = {
'all':('/media/css/bisite.css',)
}


Does that make more sense? Again, I apologize for the
miscommunication!

Thanks,
Walt

-~

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



Re: Uploading CSV file via ModelForm and then getting info and storing in a different model

2010-03-26 Thread Chris McComas
So I resolved the previous issue, not i'm getting this error, newline
in string.

http://dpaste.com/176429/

Any idea?

I'm thinking for some reason I need to change something in reader =
csv.reader(file, delimiter=',', quotechar='"')


On Mar 26, 10:27 am, Chris McComas  wrote:
> derek,
>
> thanks, that's a bit much for what we need. i setup this in my views:
>
> http://dpaste.com/176380/
>
> I'm getting this error:
>
> http://dpaste.com/176382/
>
> How can I get it to open the file that was just uploaded and saved?
>
> On Mar 26, 9:27 am, derek  wrote:
>
>
>
> > On Mar 26, 1:54 pm, Chris McComas  wrote:
>
> > > I have to models, one is just a timestamp field and a file, the other
> > > has some information. I need to create a view that'll allow our staff
> > > to upload a CSV and then it'll automatically take that info and save
> > > it into the second model. I found 
> > > thishttp://blog.2theleft.la/2010/02/9/importing-csv-files-django-python/
> > > but my question is, in my view how would I call the file that was
> > > uploaded?
>
> > > View:http://dpaste.com/176327/
>
> > Chris
>
> > Have a look at :http://code.google.com/p/django-batchimport/
>
> > HTH.

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



Re: Any way to have a ModelForm tied to 2 Models?

2010-03-26 Thread bruno desthuilliers


On Mar 26, 5:07 pm, Continuation  wrote:
> So I can have 2 forms with 1 submit buttons, right?
>
> For some reason I was under the impression that there has to be an 1:1
> correspondence.

Form objects don't generate the markup for  and submit buttons
parts - this is something you have to by yourself in the template. So
yes, you can render as many form as you want in a same  tag.

Note that if you have fields by the same name in both forms, you'll
need to know which field belongs to which form - good news, you can
pass a "prefix" when instantiating the Form object, it'll use it to
prefix HTML form controls names during rendering and then strip them
during validation.

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



Re: xmlrpc + 'django.contrib.auth.middleware.RemoteUserMiddleware' throws "Forbidden"

2010-03-26 Thread David
Simone,

It looks to me like there may be a problem in how you have configured
basic authentication on your web server. Firstly, the fact that you
are able to connect to your unprotected methods without using the
username "admin" with password "admin" leads me to believe that your
server is unprotected by basic authentication. Also, the fact that
you're on port 8000 usually implies that you're using the built-in
Django test server. As far as I know, there is no way to configure the
built-in server with basic authentication. With Apache/mod_python, you
can configure it to use Django's database for web server
authentication [1]. With mod_wsgi, take a look at Django ticket #10809
[2].



Alessandro,

I think what you have is perfect is your web server sets
HTTP_AUTHORIZATION instead of REMOTE_USER when it authenticates.
However, I think you could just subclass the RemoteUserMiddleware [3].


[1] http://docs.djangoproject.com/en/1.1/howto/apache-auth
[2] http://code.djangoproject.com/ticket/10809
[3] http://docs.djangoproject.com/en/1.1/howto/auth-remote-user


-David



On Mar 26, 7:48 am, Simone Orsi  wrote:
> Hi *,
>
> I'm trying to set some webservices using rpc4django (cause it supports
> also jSON) on Django 1.1.
>
> I followed this
>
> http://packages.python.org/rpc4django/#overview
>
> and this
>
> http://docs.djangoproject.com/en/1.1/howto/auth-remote-user/
>
> so that in my settings.py I have
>
> MIDDLEWARE_CLASSES = (
>     # 'django.middleware.cache.UpdateCacheMiddleware',
>     'django.middleware.common.CommonMiddleware',
>     'django.contrib.sessions.middleware.SessionMiddleware',
>     'django.contrib.auth.middleware.AuthenticationMiddleware',
>     'django.contrib.auth.middleware.RemoteUserMiddleware',
>     [...]
> )
>
> and
>
> AUTHENTICATION_BACKENDS = (
>     'lfs.customer.auth.EmailBackend',
> #    'django.contrib.auth.backends.ModelBackend',
>     'django.contrib.auth.backends.RemoteUserBackend',
> )
>
> Here's the string I use to connect:
>
> s = ServerProxy('http://admin:ad...@localhost:8000')
>
> With public methods everything works fine (evan without "admin:admin@")
> but with protected methods I get a "404 Forbidden".
>
> Debugging trough the request shows me that the user is still anon:
>
> (Pdb) kwargs.get('request').user
> 
>
> So, it seems to me that the normal http auth doesn't work.
>
> Is this supposed to work and am I missing something or should I handle
> login/logout actions within an ad-hoc webservice?
>
> TIA,
> SimO

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



Re: Any way to have a ModelForm tied to 2 Models?

2010-03-26 Thread Continuation
So I can have 2 forms with 1 submit buttons, right?

For some reason I was under the impression that there has to be an 1:1
correspondence.


On Mar 26, 6:36 am, Russell Keith-Magee 
wrote:
> On Fri, Mar 26, 2010 at 9:11 AM, Continuation  wrote:
> > I have 2 models: A, B
>
> > I need a form that inserts/updates both fields of A and fields of B.
>
> > Is there any way to create a ModelForm tied to A & B? Or do I need to
> > use the plain old Form?
>
> Why not just use two forms? There's no limitation on how many forms
> you can render on a page, so if you need to edit two objects, use two
> forms, and display them both.
>
> 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Tests for contrib.flatpages

2010-03-26 Thread Bjunix
Thanks for your answer,

I created a ticket for this here:

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

I am new to testing django apps, but maybe I'll have a try on some
tests for flatpages.

On Mar 26, 4:02 pm, Russell Keith-Magee 
wrote:
> On Fri, Mar 26, 2010 at 9:42 PM, Bjunix  wrote:
> > Hi all,
>
> > I am looking for tests for the flatpages app. I can't find any. Do I
> > miss something or ships django without tests for flatpages?
>
> You're not missing anything; for historical reasons (specifically,
> that flatpages was written before Django gained a full testing
> framework), there aren't any tests for flatpages.
>
> If someone wants to contribute some, they would be most welcome. There
> isn't much that needs testing, but there are a couple of edge cases
> that are worth validating.
>
> 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Passing context variables from template to view

2010-03-26 Thread Bill Freeman
Actually, by the time your user can click a button the "result-set" is no
longer around, because the context is no longer around (render and the
view function have returned).  All that's left is the rendered representation.

I see two possibilities:

1. You render the data into a hidden form which gets POSTed to the view
that exports it.  POST doesn't have a data size problem.

   1a. You make the rendered version be via form fields which get POSTed.
   You can mark the inputs readonly, but that wouldn't stop a determined
   bad guy from posting modified fields.

You could also hide the stuff in JavaScript variables, but then your page
won't work for folks who disable JavaScript.

This consumes a lot of parsing effort by the submit view.

2. For the first view you computed the data somehow (DB query?).  If you
can repeat the computation and get the same answer in the view that
handles the button submission, just recompute it (requerry...).  If part of
the computation is expensive, you could also squirrel the data in a DB
table based cache (you walk it periodically to find stuff old enough to
expunge).

On Thu, Mar 25, 2010 at 6:17 PM, Kasto  wrote:
> Hi,
>
> I am looking to implement an "Export to Excel sheet" feature. The
> result-set is already available and rendered in the template. I need
> to provide a link or button to export result to Excel sheet.
>
> Result-set is a set of list variables and cannot be passed over GET
> request due to length limitations.
>
> Two solutions that I can think of are:
>
> 1. Use hidden form fields and submit it back to a view that creates
> Excel sheet.
> 2. Directly pass object list to view using reverse() or URL regex.
>
> I have been unable to pass lists using URL Regex. Is it possible to
> pass list variables from template back to the view? If so, how?
>
>
> Appreciate ur help!
>
> Kasto
> --
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Grouped statements in debug_toolbar

2010-03-26 Thread Peter Bengtsson
On 26 March 2010 11:09, Daniel Roseman  wrote:
> On Mar 25, 7:17 pm, Peter Bengtsson  wrote:
>> The old django debug-toolbar used to make it possible to group
>> statements that were the same so you can see if a particular statement
>> was called repeatedly. This does not appear to be possible in the
>> latest version; or am I wrong?
>
> I don't think this has even been possible in the main django-debug-
> toolbar project. However I have a fork at 
> http://github.com/danielroseman/django-debug-toolbar
> that does exactly that.

Awesome! I'll give it a spin.

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



-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
fun crosstips.org

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



Testing email with the testserver

2010-03-26 Thread Ben Gerdemann
I found the Django documentation about testing E-mail services
confusing. It says here 
http://docs.djangoproject.com/en/1.1/topics/testing/#e-mail-services
"Django's test runner automatically redirects all Django-sent e-mail
to a dummy outbox", but the example code shows using the 'mail' object
directly in the TestCase and not in the view like the documentation
states.

I am using "manage.py testserver" and Selenium to drive the browser.
When I have a test that triggers an email event, the email is sent and
not collected in the dummy outbox. Is this the expected behavior?
Would the behavior be different if I loaded the view using
django.test.client instead of through the testserver?

It would be nice of the testserver also used the dummy outbox, but at
a minimum I think the documentation should be clearer and perhaps give
a better example?

Cheers,
Ben

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



Re: Project with main site and sub-domains

2010-03-26 Thread John Wesonga
I've opted to try out multiple instances of Django, and using mod_wsgi
+Apache+Nginx I was able to create Virtual Hosts and the apps work
well. What I'm now testing is the sites framework and wondering if I
have a model Articles that is shared across the sites, do I need to
create the model twice in each app?

On Mar 26, 2:51 pm, John Wesonga  wrote:
> Hi,
>
> I'm working on a web project where the organization will have a main
> site likehttp://www.nameoforg.netand sub-sites (subdomains) 
> likehttp://proj1.nameoforg.net. Some of the content in the sub-domains
> like Case Studies, Resources should be viewable in the Main website.
> I've looked at the Django Sites framework and it seems to deal with
> content across several sites with one DB. What I'm wondering is do I
> need to have a separate Django instance for each sub-domain?

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



Re: Let Django form render field's with custom attributes (e.g CSS)?

2010-03-26 Thread Thierry
Thanks for the feedbacks.
And yes unfortunately I am bound to support our "official corporate
browser" IE6, otherwise I would have happily gone to a more CSS-only
direction.
What puzzles me most is that method BoundField.label_tag() has an
attr(ibute)s argument and some code to support it, but there is no
easy way to call it (unable to pass arguments to methods in
templates).

For the time being, I will go with my initial idea (subclassing my own
Widget/Renderer classes to provide  rendering with custom css),
leaving Field's  HTML definition as is.

I would however appreciate easy/lazy ways to customize attributes on a
Field's , e.g for common CSS patterns where the 
automatically gets "required" or "error" CSS classes depending on the
Field's validation options.

On 26 mar, 15:28, David De La Harpe Golden
 wrote:
> On 26/03/10 13:18, Thierry wrote:
>
> > Hi,
>
> > I want to differentiate CSS style of fields  from the style of
> > RadioSelects  elements (as rendered through
> > RadioFieldRenderer).
> > Immediate action: I could create my RadioFieldRenderer/RadioInput
> > classes to display inner labels as.
>
> > Any direction you could give me? Thanks in advance.
>
> Well, not a general solution for element attributes, but do bear in mind
> that css selectors (and jquery's selectors for that matter) can be a bit
> more than just the basic "element" ".class" and "#id" that you always see.
>
> See e.g.http://www.w3.org/TR/css3-selectors/(or css2)
>
> So, you can style django's simple builtin form outputs somewhat more
> aggressively than you might realise if you're not up on css, without
> having to subclass to override outputs, if you _wrap_ the output in
> something for css to match.  [If your requirements include "support
> ancient versions of MSIE" you might find said ancient versions' css
> handling a bit annoying though]
>
> Vague example:
>
> 
>    
>      
>        div.form_wrapper > label { background-color: #ff }
>        div.form_wrapper label { color: #ff }
>        div.form_wrapper > label:first-child { color: #00ff00 }
>        div.form_wrapper > label:nth-child(3) { color: #00 }
>      
>    
>    
>    
>      FOO
>      
>        BAR
>      
>      BAZ
>      MOO
>    
>    
> 

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



Re: xmlrpc + 'django.contrib.auth.middleware.RemoteUserMiddleware' throws "Forbidden"

2010-03-26 Thread Alessandro Pasotti
2010/3/26 Simone Orsi 

> Hi *,
>
> I'm trying to set some webservices using rpc4django (cause it supports
> also jSON) on Django 1.1.
>
> I followed this
>
> http://packages.python.org/rpc4django/#overview
>
> and this
>
> http://docs.djangoproject.com/en/1.1/howto/auth-remote-user/
>
> so that in my settings.py I have
>
> MIDDLEWARE_CLASSES = (
># 'django.middleware.cache.UpdateCacheMiddleware',
>'django.middleware.common.CommonMiddleware',
>'django.contrib.sessions.middleware.SessionMiddleware',
>'django.contrib.auth.middleware.AuthenticationMiddleware',
>'django.contrib.auth.middleware.RemoteUserMiddleware',
>[...]
> )
>
> and
>
> AUTHENTICATION_BACKENDS = (
>'lfs.customer.auth.EmailBackend',
> #'django.contrib.auth.backends.ModelBackend',
>'django.contrib.auth.backends.RemoteUserBackend',
> )
>
> Here's the string I use to connect:
>
> s = ServerProxy('http://admin:ad...@localhost:8000')
>
> With public methods everything works fine (evan without "admin:admin@")
> but with protected methods I get a "404 Forbidden".
>
> Debugging trough the request shows me that the user is still anon:
>
> (Pdb) kwargs.get('request').user
> 
>
> So, it seems to me that the normal http auth doesn't work.
>
> Is this supposed to work and am I missing something or should I handle
> login/logout actions within an ad-hoc webservice?
>
>

Hi,

I'm also using rpc4django, I remember I did something like this:


class HttpAuthMiddleware:
"""
Simple HTTP-Basic auth for testing webservices
"""
def process_request(self, request):
auth_basic = request.META.get('HTTP_AUTHORIZATION')
if auth_basic:
import base64
try:
username , dummy,  password =
base64.decodestring(auth_basic[6:]).partition(':')
user = User.objects.get(username=username)
if user.check_password(password):
   request.user = user
except User.DoesNotExist:
return None



Now I can call ws with
curl -v -d @test.xml "http://username:passw...@localhost:8000/RPC2;





-- 
Alessandro Pasotti
w3:   www.itopen.it

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



Re: Tests for contrib.flatpages

2010-03-26 Thread Russell Keith-Magee
On Fri, Mar 26, 2010 at 9:42 PM, Bjunix  wrote:
> Hi all,
>
> I am looking for tests for the flatpages app. I can't find any. Do I
> miss something or ships django without tests for flatpages?

You're not missing anything; for historical reasons (specifically,
that flatpages was written before Django gained a full testing
framework), there aren't any tests for flatpages.

If someone wants to contribute some, they would be most welcome. There
isn't much that needs testing, but there are a couple of edge cases
that are worth validating.

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



Re: Problem with cross-database foreign-keys and select_related

2010-03-26 Thread Russell Keith-Magee
On Fri, Mar 26, 2010 at 10:54 PM, greatlemer  wrote:
> Hi,
>
> I'm running the django 1.2 beta and am testing out the multi-db
> system.  Unfortunately I have run into an issue where I have:
>
> class A(models.Model):
>    name = models.CharField()
>    
>
> class B(models.Model):
>    a = models.ForeignKey(A)
>    
>
> I also have database routers set up so that A items are on a separate
> database to B items.
>
> The problem I'm having is when I try to do
> B.objects.select_related().all() as I get a database error saying the
> table for A does not exist.  This same issue occurs if I try to do
> B.objects.filter(a__name='Fred').  Am I right in assuming that this
> usage just isn't possible, or is there something that I've missed (I
> was unable to find any mention of this situation in either the multi-
> db documentation[1] or the select_related documentation[2])?
> Theoretically the query should be possible as both databases are on
> the same host, but database names aren't being prepended so it's not
> finding them.

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

In short, no. Cross database foreign keys aren't possible, because of
problems maintaining referential integrity. We might address this one
day, but it isn't possible right now unless you go out of your way to
bend the rules.

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



Problem with cross-database foreign-keys and select_related

2010-03-26 Thread greatlemer
Hi,

I'm running the django 1.2 beta and am testing out the multi-db
system.  Unfortunately I have run into an issue where I have:

class A(models.Model):
name = models.CharField()


class B(models.Model):
a = models.ForeignKey(A)


I also have database routers set up so that A items are on a separate
database to B items.

The problem I'm having is when I try to do
B.objects.select_related().all() as I get a database error saying the
table for A does not exist.  This same issue occurs if I try to do
B.objects.filter(a__name='Fred').  Am I right in assuming that this
usage just isn't possible, or is there something that I've missed (I
was unable to find any mention of this situation in either the multi-
db documentation[1] or the select_related documentation[2])?
Theoretically the query should be possible as both databases are on
the same host, but database names aren't being prepended so it's not
finding them.

Cheers,

G

1. http://docs.djangoproject.com/en/dev/topics/db/multi-db/
2. http://docs.djangoproject.com/en/dev/ref/models/querysets/#id4

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



xmlrpc + 'django.contrib.auth.middleware.RemoteUserMiddleware' throws "Forbidden"

2010-03-26 Thread Simone Orsi
Hi *,

I'm trying to set some webservices using rpc4django (cause it supports
also jSON) on Django 1.1.

I followed this

http://packages.python.org/rpc4django/#overview

and this

http://docs.djangoproject.com/en/1.1/howto/auth-remote-user/

so that in my settings.py I have

MIDDLEWARE_CLASSES = (
# 'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.RemoteUserMiddleware',
[...]
)

and

AUTHENTICATION_BACKENDS = (
'lfs.customer.auth.EmailBackend',
#'django.contrib.auth.backends.ModelBackend',
'django.contrib.auth.backends.RemoteUserBackend',
)

Here's the string I use to connect:

s = ServerProxy('http://admin:ad...@localhost:8000')

With public methods everything works fine (evan without "admin:admin@")
but with protected methods I get a "404 Forbidden".

Debugging trough the request shows me that the user is still anon:

(Pdb) kwargs.get('request').user


So, it seems to me that the normal http auth doesn't work.

Is this supposed to work and am I missing something or should I handle
login/logout actions within an ad-hoc webservice?

TIA,
SimO

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



Re: Let Django form render field's with custom attributes (e.g CSS)?

2010-03-26 Thread David De La Harpe Golden

On 26/03/10 13:18, Thierry wrote:

Hi,

I want to differentiate CSS style of fields  from the style of
RadioSelects  elements (as rendered through
RadioFieldRenderer).
Immediate action: I could create my RadioFieldRenderer/RadioInput
classes to display inner labels as.




Any direction you could give me? Thanks in advance.



Well, not a general solution for element attributes, but do bear in mind 
that css selectors (and jquery's selectors for that matter) can be a bit 
more than just the basic "element" ".class" and "#id" that you always see.


See e.g. http://www.w3.org/TR/css3-selectors/ (or css2)

So, you can style django's simple builtin form outputs somewhat more 
aggressively than you might realise if you're not up on css, without 
having to subclass to override outputs, if you _wrap_ the output in 
something for css to match.  [If your requirements include "support 
ancient versions of MSIE" you might find said ancient versions' css 
handling a bit annoying though]


Vague example:


  

  div.form_wrapper > label { background-color: #ff }
  div.form_wrapper label { color: #ff }
  div.form_wrapper > label:first-child { color: #00ff00 }
  div.form_wrapper > label:nth-child(3) { color: #00 }

  
  
  
FOO

  BAR

BAZ
MOO
  
  









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



Re: Uploading CSV file via ModelForm and then getting info and storing in a different model

2010-03-26 Thread Chris McComas
derek,

thanks, that's a bit much for what we need. i setup this in my views:

http://dpaste.com/176380/

I'm getting this error:

http://dpaste.com/176382/

How can I get it to open the file that was just uploaded and saved?

On Mar 26, 9:27 am, derek  wrote:
> On Mar 26, 1:54 pm, Chris McComas  wrote:
>
> > I have to models, one is just a timestamp field and a file, the other
> > has some information. I need to create a view that'll allow our staff
> > to upload a CSV and then it'll automatically take that info and save
> > it into the second model. I found 
> > thishttp://blog.2theleft.la/2010/02/9/importing-csv-files-django-python/
> > but my question is, in my view how would I call the file that was
> > uploaded?
>
> > View:http://dpaste.com/176327/
>
> Chris
>
> Have a look at :http://code.google.com/p/django-batchimport/
>
> HTH.

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



Re: Deleted blog posts not disappearing

2010-03-26 Thread Karen Tracey
On Fri, Mar 26, 2010 at 9:32 AM, grimmus  wrote:

> In the view:
>
> diary = Entry.objects.filter(status=1).order_by('-pub_date')[:5]
>
> t = loader.get_template('cms/page.html')
> c = RequestContext(request,{
> 'diary':diary,
> })
> return HttpResponse(t.render(c))
>

Is that diary = line really inside your view function? Since you have not
shown the actual view function definition it is hard to be sure. Based on
the behavior you describe it sounds like that line is not inside the view
function definition, and therefore possibly only executed once, when
views.py is loaded. If you want it to be executed when the view function is
called, it needs to be inside the view function itself.

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



Re: Let Django form render field's with custom attributes (e.g CSS)?

2010-03-26 Thread Xavier Ordoquy
Hello,

I believe {{form.as_ul}} is for prototypes but once you get deeper into the 
project you most probably want to throw it, only use {{form.field}} and define 
label in html within your template.

Xavier.

Le 26 mars 2010 à 14:18, Thierry a écrit :

> Hi,
> 
> I want to differentiate CSS style of fields  from the style of
> RadioSelects  elements (as rendered through
> RadioFieldRenderer).
> Immediate action: I could create my RadioFieldRenderer/RadioInput
> classes to display inner labels as .
> 
> But (and this is mostly my point of raising the issue), I was also
> looking at a way to provide attributes (CSS classes, inline style, id,
> etc) to the  element rendered directly by Django (though
> {{form.as_ul}} or {{field.label_tag}} for instance).
> 
> Digging the code, I found the BoundField class with its method
> label_tag. Problems:
> - this method is either called from form.as_ul() (or as_p(), etc)
> without passing attrs parameters
> - or it can be called directly from a template
> ({{myfield.label_tag}}), but without the ability to pass extra
> arguments.
> 
> Basically I am stuck wondering how to set attributes on a Field's
> rendered label, without having to hardcode it in every form template,
> or subclassing the whole Form/BoundField classes...
> 
> Any direction you could give me? Thanks in advance.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Tests for contrib.flatpages

2010-03-26 Thread Bjunix
Hi all,

I am looking for tests for the flatpages app. I can't find any. Do I
miss something or ships django without tests for flatpages?

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



Re: Extending the admin - add 'save and go to next' button

2010-03-26 Thread derek
On Mar 26, 12:13 pm, filias  wrote:
> Hi,
>
> I want to extend the admin by adding a 'Save/Next' button next to the
> default 'Save' button.
>
> This action would save the instance and show the next instance (if it
> exists) or go back to the list.
>
> What is the best way to do it? Is there any post on best practices on
> these topic or other admin customizations?

Its not clear what you are asking - what is "the next instance" that
you are talking about?

Otherwise, from my wanderings on the web, I can recommend some good
places to get an idea of the type of things that can be done:

http://blog.awarelabs.com/2008/custom-actions-in-django-admin-object-editor/
http://www.ibm.com/developerworks/opensource/library/os-django-admin/index.html
http://www.lonelycode.com/2009/05/28/customising-the-django-admin/

Derek

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



Re: Deleted blog posts not disappearing

2010-03-26 Thread grimmus
In the view:

diary = Entry.objects.filter(status=1).order_by('-pub_date')[:5]

t = loader.get_template('cms/page.html')
c = RequestContext(request,{
 'diary':diary,
})
return HttpResponse(t.render(c))

And the template


{% for entry in diary %}

{{entry.title}}

{% endfor %}


Thanks

On Mar 26, 12:59 pm, Daniel Roseman  wrote:
> On Mar 26, 11:25 am, grimmus  wrote:
>
>
>
> > Hi,
>
> > I have a website with 5 pages and a blog.
>
> > At the bottom of every page is a list of recent blog posts.
>
> > When i delete some blog posts they still appear in the recent posts
> > list.
>
> > I am not using any caching.
>
> > If i restart the local dev server then they disappear.
>
> > Could anyone tell me why this is happening ?
>
> > Thanks
>
> Not without seeing the code that is generating the list.
> --
> DR.

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



Re: Uploading CSV file via ModelForm and then getting info and storing in a different model

2010-03-26 Thread derek
On Mar 26, 1:54 pm, Chris McComas  wrote:
> I have to models, one is just a timestamp field and a file, the other
> has some information. I need to create a view that'll allow our staff
> to upload a CSV and then it'll automatically take that info and save
> it into the second model. I found 
> thishttp://blog.2theleft.la/2010/02/9/importing-csv-files-django-python/
> but my question is, in my view how would I call the file that was
> uploaded?
>
> View:http://dpaste.com/176327/

Chris

Have a look at :
http://code.google.com/p/django-batchimport/

HTH.

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



Let Django form render field's with custom attributes (e.g CSS)?

2010-03-26 Thread Thierry
Hi,

I want to differentiate CSS style of fields  from the style of
RadioSelects  elements (as rendered through
RadioFieldRenderer).
Immediate action: I could create my RadioFieldRenderer/RadioInput
classes to display inner labels as .

But (and this is mostly my point of raising the issue), I was also
looking at a way to provide attributes (CSS classes, inline style, id,
etc) to the  element rendered directly by Django (though
{{form.as_ul}} or {{field.label_tag}} for instance).

Digging the code, I found the BoundField class with its method
label_tag. Problems:
- this method is either called from form.as_ul() (or as_p(), etc)
without passing attrs parameters
- or it can be called directly from a template
({{myfield.label_tag}}), but without the ability to pass extra
arguments.

Basically I am stuck wondering how to set attributes on a Field's
rendered label, without having to hardcode it in every form template,
or subclassing the whole Form/BoundField classes...

Any direction you could give me? Thanks in advance.

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



Re: Using ModelForm to edit ManyToMany in both directions?

2010-03-26 Thread Wilberoni
Clarification:

I'd like to see a Multi-select widget containing ALL the volunteers,
with those who currently have the job selected.  I'd like to them be
able to select additional volunteers for that job or unselect existing
ones.

Wilb

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



Re: Deleted blog posts not disappearing

2010-03-26 Thread Daniel Roseman
On Mar 26, 11:25 am, grimmus  wrote:
> Hi,
>
> I have a website with 5 pages and a blog.
>
> At the bottom of every page is a list of recent blog posts.
>
> When i delete some blog posts they still appear in the recent posts
> list.
>
> I am not using any caching.
>
> If i restart the local dev server then they disappear.
>
> Could anyone tell me why this is happening ?
>
> Thanks

Not without seeing the code that is generating the list.
--
DR.

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



Uploading CSV file via ModelForm and then getting info and storing in a different model

2010-03-26 Thread Chris McComas
I have to models, one is just a timestamp field and a file, the other
has some information. I need to create a view that'll allow our staff
to upload a CSV and then it'll automatically take that info and save
it into the second model. I found this
http://blog.2theleft.la/2010/02/9/importing-csv-files-django-python/
but my question is, in my view how would I call the file that was
uploaded?

View: http://dpaste.com/176327/

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



Project with main site and sub-domains

2010-03-26 Thread John Wesonga
Hi,

I'm working on a web project where the organization will have a main
site like http://www.nameoforg.net and sub-sites (subdomains) like
http://proj1.nameoforg.net. Some of the content in the sub-domains
like Case Studies, Resources should be viewable in the Main website.
I've looked at the Django Sites framework and it seems to deal with
content across several sites with one DB. What I'm wondering is do I
need to have a separate Django instance for each sub-domain?

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



django-simplepages "stable"?

2010-03-26 Thread Ivan Uemlianin
Dear All

I need a basic CMS and django-simplepages looks like it should fit the
bill.  I notice it hasn't had any changes since Aug 2008, or issues
posted since Feb 2009.  Does this mean it's "stable" or "broken"?  Is
anyone using it?

I've noticed an error in simplepages/models.py:

 5from django import forms
  ...
35class HTMLTextField(forms.TextField):
  ...

django.forms has no TextField.  I'm thinking of changing it to
forms.CharField.

Does anyone have (recent) experience of using simplepages?  Is it
bascially usable, or is it full of holes?

Thanks and best wishes

Ivan

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



Re: Any way to have a ModelForm tied to 2 Models?

2010-03-26 Thread Matt Schinckel
On Mar 26, 11:11 am, Continuation  wrote:
> I have 2 models: A, B
>
> I need a form that inserts/updates both fields of A and fields of B.
>
> Is there any way to create a ModelForm tied to A & B? Or do I need to
> use the plain old Form?

You can use a ModelForm on one, and add the extra fields to it, and
handle these in save().

I did this to get some extra behaviour in the admin, although in a
user-page I would probably use two forms.

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



Deleted blog posts not disappearing

2010-03-26 Thread grimmus
Hi,

I have a website with 5 pages and a blog.

At the bottom of every page is a list of recent blog posts.

When i delete some blog posts they still appear in the recent posts
list.

I am not using any caching.

If i restart the local dev server then they disappear.

Could anyone tell me why this is happening ?

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



Re: problems with get_or_create

2010-03-26 Thread Karen Tracey
On Fri, Mar 26, 2010 at 1:49 AM, Kenneth Gonsalves wrote:

> Here is what I mean - A simple model with two fields, 'name' is unique,
> and 'num' is not null:
>
> >>> Tm.objects.get_or_create(name='me',num=1)
> (, True)
> >>> Tm.objects.get_or_create(name='me',num=2)
>

If you want get_or_create to return the instance with name 'me', regardless
of the value of num which that instance may have, then you need to include
the num value in the defaults argument to get_or_create, NOT as a bare
keyword argument. From
http://docs.djangoproject.com/en/dev/ref/models/querysets/#get-or-create-kwargs
:

"Any keyword arguments passed to get_or_create() -- except an optional one
called defaults -- will be used in a get() call."

So with the arguments as you have passed them, get_or_create is looking for
a model with name='me' and num=2, and since one does not exist, it is going
to go down the path of attempting to create an instance with those values.
Since you have specified at the database level that name must be unique,
that is not going to work: attempting to create a 2nd row with an
already-existing name value is going to raise an IntegrityError.

To accomplish what you want, you need to move num into the defaults
argument, so that it will not be used on the get() lookup, but will be used
if the get fails to find a match and an object needs to be created. That is:

Tm.objects.get_or_create(name='me', defaults={'num': 2})


Traceback (most recent call last):
> [snip]
>   File "/usr/lib/python2.6/django/db/backends/__init__.py", line 61, in
> _savepoint_rollback
>self.cursor().execute(self.ops.savepoint_rollback_sql(sid))
>  File "/usr/lib/python2.6/django/db/backends/__init__.py", line 75, in
> cursor
>cursor = self._cursor()
>  File "/usr/lib/python2.6/django/db/backends/postgresql/base.py", line 149,
> in _cursor
>cursor.execute("SET client_encoding to 'UNICODE'")
> ProgrammingError: ERROR:  current transaction is aborted, commands ignored
> until end of transaction block
>
> SET client_encoding to 'UNICODE'
>

Here you are running into a bug in the postgresql backend.  Is there some
reason you are using the old psycopg1 backend instead of the psycopg2 one?
The latter is really a much better choice at this point.

Anyway, what has happened here is the get_or_create code has gone down the
path of trying to create the new object, which has failed because of the
unique constraint on name. It is trying to rollback to the
previously-created savepoint, but that is failing due to a bug that was
fixed yesterday in r12848 (trunk) and r12849 (1.1.X branch).  So to avoid
this you could either simply switch to the psycopg2 backend (which did not
have the bug) or update to a latest trunk or 1.1.X Django code.

Note when you fix the call to get_or_create to properly specify which of the
values must be used on the get() part of get_or_create(), you won't be going
down this path as you are now, so you likely won't see this exception during
basic testing even if you don't change backends or update to latest Django
code. However, you could still go down this path legitimately -- if two
threads "simultaneously" attempt to create an object with the same name,
both may see that it does not exist and try to create it. Only one will
succeed, and the other will go down this path. You'll need this path to work
properly in order for the 2nd thread to be able to retrieve the object
created by the other thread. So even if you notice that fixing the
get_or_create call makes this other exception go away, you should still
update the code you are using, if you want the call to behave correctly in
all situations.

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



DateFormat and localization

2010-03-26 Thread Wim Feijen
Hi,

I'm unsure if and how to use DateFormat from django/utils/
dateformat.py .

I'd like to use a local (Dutch) representation of dates. What I get
is:
u'26th March 2010'

I'd like that to be in Dutch. How do I do that?

Major thanks!

Wim


My IPython looks like this:

In [1]: import datetime

In [2]: d = datetime.datetime.now()

In [3]: from django.utils.dateformat import DateFormat

In [4]: df = DateFormat(d)

In [5]: df.format('jS F Y')
Out[5]: u'26th March 2010'

In [6]:

In [7]: import settings

In [8]: settings.USE_L10N
Out[8]: True

In [9]: settings.LANGUAGE_CODE
Out[9]: 'nl'

In [10]: settings.LANGUAGES
Out[10]: (('nl', 'Dutch'),)

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



Re: Grouped statements in debug_toolbar

2010-03-26 Thread Daniel Roseman
On Mar 25, 7:17 pm, Peter Bengtsson  wrote:
> The old django debug-toolbar used to make it possible to group
> statements that were the same so you can see if a particular statement
> was called repeatedly. This does not appear to be possible in the
> latest version; or am I wrong?

I don't think this has even been possible in the main django-debug-
toolbar project. However I have a fork at 
http://github.com/danielroseman/django-debug-toolbar
that does exactly that.
--
DR.

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



post_syncdb signal

2010-03-26 Thread Sławek Tuleja
Hi all!
In my application i have mutable and immutable components.
After sync_db command i use post_syncdb singal to create table with
info about this components.

How to pass new attr about component to register_component function
established with post_syncdb signal?


code:

# Page models are immutable
signals.post_syncdb.connect(register_component, sender=page_models, #
where to put info about is_mutable=False)

# Posts models are mutable
signals.post_syncdb.connect(register_component, sender=post_models, #
where to put info about is_mutable=True)

def register_component(app, created_models, verbosity, **kwargs):
"""
Registers components.
"""
# if immutable
#component = Component(name=app, area=0, is_mutable=False)
# if mutable
# else:
#component = Component(name=app)
component.save()

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



Re: help needed in ModelForm __unicode__

2010-03-26 Thread Kenneth Gonsalves
On Friday 26 Mar 2010 3:38:10 pm Emanuel wrote:
> both combo's.
> I want to filter only men or women depending the case. Is it possible? Or 
> should I create another method for independent cases? If it is the
>  solution  how can I use it? I'm not getting there because it is a instance
>  of a class...
> 

one way is to override __init__. Here is a sample:
class Accountaddform(ModelForm):
def __init__(self,head,*args,**kwargs):
super (Accountaddform,self).__init__(*args,**kwargs)
self.head = head
self.fields['head'].queryset=Account.objects.filter(pk=self.head)
class Meta:
model = Account
-- 
regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS
http://certificate.nrcfoss.au-kbc.org.in

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



Re: help needed in ModelForm __unicode__

2010-03-26 Thread Daniel Roseman
On Mar 26, 10:08 am, Emanuel  wrote:
> Hi!
>
> I Have this model:
> class Person(models.Model):
>     user = models.ForeignKey(User)
>     nr = models.IntegerField(blank=True,)
>     gender = models.CharField(max_length=1, blank=True,
> choices=gender_choices)
>
>     def __unicode__(self):
>         return self.user.get_full_name()
> 
>
> I'm using a modelForm of this form.
>
> I have another model:
> class Couple(models.Model):
>     season = models.ForeignKey(season)
>     man = models.ForeignKey(Person, related_name='man',)
>     woman = models.ForeignKey(Person, related_name='woman',)
> 
>
> And I'm also using a modelForm of this one.
>
> In the template I  have a combobox for the man and for the woman wich shows
> the __unicode__ method of Person model, but it shows both women and men in
> both combo's.
> I want to filter only men or women depending the case. Is it possible? Or
> should I create another method for independent cases? If it is the solution
> how can I use it? I'm not getting there because it is a instance of a class...
>
> Thanks
> Emanuel

Nothing to do with __unicode__. You want limit_choices_to.
http://docs.djangoproject.com/en/1.1/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to
--
DR.

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



session

2010-03-26 Thread nadae ivar
Hi Guys,

i'm new in django and i want to use the session in my application.
Someone can help me ? i already enabled session in the middelware but
i want to fix the session expire times.

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



help needed in ModelForm __unicode__

2010-03-26 Thread Emanuel
Hi!

I Have this model:
class Person(models.Model):
user = models.ForeignKey(User)
nr = models.IntegerField(blank=True,)
gender = models.CharField(max_length=1, blank=True, 
choices=gender_choices)


def __unicode__(self):
return self.user.get_full_name()


I'm using a modelForm of this form.

I have another model:
class Couple(models.Model):
season = models.ForeignKey(season)
man = models.ForeignKey(Person, related_name='man',)
woman = models.ForeignKey(Person, related_name='woman',)


And I'm also using a modelForm of this one.

In the template I  have a combobox for the man and for the woman wich shows 
the __unicode__ method of Person model, but it shows both women and men in 
both combo's.
I want to filter only men or women depending the case. Is it possible? Or 
should I create another method for independent cases? If it is the solution 
how can I use it? I'm not getting there because it is a instance of a class...


Thanks
Emanuel

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



Re: Any way to have a ModelForm tied to 2 Models?

2010-03-26 Thread Russell Keith-Magee
On Fri, Mar 26, 2010 at 9:11 AM, Continuation  wrote:
> I have 2 models: A, B
>
> I need a form that inserts/updates both fields of A and fields of B.
>
> Is there any way to create a ModelForm tied to A & B? Or do I need to
> use the plain old Form?

Why not just use two forms? There's no limitation on how many forms
you can render on a page, so if you need to edit two objects, use two
forms, and display them both.

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



Extending the admin - add 'save and go to next' button

2010-03-26 Thread filias
Hi,

I want to extend the admin by adding a 'Save/Next' button next to the
default 'Save' button.

This action would save the instance and show the next instance (if it
exists) or go back to the list.

What is the best way to do it? Is there any post on best practices on
these topic or other admin customizations?

Thanks in advance.

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



Re: ForeignKeyField

2010-03-26 Thread Thierry Chich
Le vendredi 26 mars 2010 04:14:51, Asim Yuksel a écrit :
> I have a question about model.ForeignKey field.Foreign key fields are
> shown as object in admin page. How can I show them in other types like
> integer type
> for example I have a Model like this:
> 
> class Advisor(models.Model):
> 
> advisorid = models.IntegerField(primary_key=True,
> db_column='advisorId')
> maphdid = models.ForeignKey(Tblmaphds, db_column='maPhDId')
> def __str__(self):
> return smart_str('%s' % (self.maphdid))
> def __unicode__(self):
> return smart_str('%s' % (self.maphdid))
> class Meta:
> db_table = 'Advisor'
> 
> The problem is I see the maphdid value as "Tblmaphds object" instead
> of a normal integer value.
> 
> What should I do to see a integer value?
> 
I am not sure of what I say because I just begin with django, but it seems to 
me that you are confusing foreignkey in models and foreignkey in SQL database.
For me, a foreignkey in django is an object, not an id.

So, it seems to me that maphdid is an object Tblmaphds. If you want to print 
the Tblmaphds.id value, you shoud have 
to write 
 return smart_str('%s' % (self.maphdid.id))

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



Re: Any way to have a ModelForm tied to 2 Models?

2010-03-26 Thread bruno desthuilliers
On Mar 26, 2:11 am, Continuation  wrote:
> I have 2 models: A, B
>
> I need a form that inserts/updates both fields of A and fields of B.
>
> Is there any way to create a ModelForm tied to A & B? Or do I need to
> use the plain old Form?

A possible solution would be to wrap both ModelForms in a "form-like"
object. FWIW, last time I had a similar problem, I just used a plain
old form, but I had so much specific stuff going on that a ModelForm
wouldn't have helped that much 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to locate the OS user name? [newbie]

2010-03-26 Thread Baurzhan Ismagulov
On Thu, Mar 25, 2010 at 11:32:46PM -0700, BobAalsma wrote:
> So I think now the question seems to be "how to extract the OS user
> name from the browser environment?"

If you don't mind logging in once, a cookie could be one solution
(Django does this by default, AFAIK).

With kind regards,
-- 
Baurzhan Ismagulov
http://www.kz-easy.com/

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



Re: Django 1.2b multidatabase + manytomany relationship

2010-03-26 Thread Russell Keith-Magee
On Wed, Mar 24, 2010 at 6:16 PM, mbdtsmh
 wrote:
> Hi All, still trying to get my head around the multi db stuff in 1.2
> release.
>
> Here is my problem that I have hit upon.
>
> I have a model in my default db...
>
> class Set1(models.Model):
>    create_date = models.DateTimeField(auto_now_add='True')
>    last_update = models.DateTimeField(auto_now='True', null=True)
>    fields = models.ManyToManyField(Field)
>    project = models.ForeignKey(Project)
>
> This model has a m2m relationship to Field. This Field table (called
> HASH_TABLE) is an existing table on another database so in models I
> have...
>
> class Field(models.Model):
>    NAME = models.CharField(max_length=10,primary_key=True)
>    HASHCODE = models.DecimalField(decimal_places=0,max_digits=64)
>
>    class Meta:
>        managed = False
>        db_table = 'HASH_TABLE'
>
> In a script to populate the database I have...
>
> for row in upload:
>        field = Field.objects.using('apcc').get(NAME=row[1])
>        project = Project.objects.get(pk=row[2])
>        set1 = Set1(project=project)
>        set1.save()
>        set1.field.add(field) # add m2m relationship
>
> running the script I get the error...
>
> Cannot add "": instance is on database "default", value
> is is on database "test_database"
>
> I currently have the m2m table (linking Set1 to Field) on the default
> database (which is where I'd like to keep it) but how do I get around
> this problem? Does anyone have an example of multi db use where you
> have a m2m relationship between tables on different datbases?

You can't. This is one of the known limitations of the multi-db
implementation. The reason for this is referential integrity - it's
impossible (or, at least, very difficult) to maintain referential
integrity if you don't have access to the canonical store of keys.

We might address this in the future, but for now, Django specifically
prevents you from trying to create cross-database relations. If you're
really enthusiastic, and you don't care about referential integrity,
you should be able to create a router that will allow the relation,
but it's certainly not recommended practice at this time.

I've opened ticket [13216] as a reminder that this needs to be
formally documented.

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



Re: tests fail for django.contrib.auth

2010-03-26 Thread Russell Keith-Magee
2010/3/24 Filip Gruszczyński :
> When I run all tests, tests for django.contrib.auth. I tried googling
> it and found information, that django.contrib.sites is required, but I
> have this app installed. I was also advised to use
> TEMPLATE_CONTEXT_LOADERS, but this didn't help. Have anyone
> encountered this problem and know, how to solve this?
>
> ==
> ERROR: test_known_user
> (django.contrib.auth.tests.remote_user.RemoteUserCustomTest)
> --
> Traceback (most recent call last):
>  File "/usr/lib/pymodules/python2.6/django/contrib/auth/tests/remote_user.py",
> line 160, in test_known_user
>    super(RemoteUserCustomTest, self).test_known_user()
>  File "/usr/lib/pymodules/python2.6/django/contrib/auth/tests/remote_user.py",
> line 67, in test_known_user
>    self.assertEqual(response.context['user'].username, 'knownuser')
> TypeError: 'NoneType' object is unsubscriptable

It looks like something is going awry with the test client. A couple
of thoughts:

 - Is there any possibility you have a Django 1.0 (or earlier)
checkout somewhere on your path?
 - Is there anywhere in your test suite where you are enabling or
disabling DEBUG?
 - Are you doing anything interesting with template rendering?

If you're interested in digging into this yourself - the auth tests
are using the test client; when you start a test run, Django uses
test.utils.setup_test_environment() to monkeypatch the template module
with an instrumented version. This instrumented test renderer emits
signals whenever a template is rendered, and the test client adds a
listener on this signal (test.client.store_rendered_templates()). The
test client gathers the data emitted by this signal and stores it as
response.context.

response.context will be None (and therefore unscriptable) if the
listener is never fired. This either means that the signal wasn't
installed, the signal wasn't sent (probably because a template wasn't
rendered), or the signal isn't hitting the listener. I'm not sure
which of these is happening for you, but hopefully this gives you
enough detail to work out what is going on.

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



Re: How to locate the OS user name? [newbie]

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

Regards,
Bob

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

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



Re: High, ongoing CPU consumption

2010-03-26 Thread David Christiansen
Thank you very much, Graham.  I'll do some more looking and get back
to the list.

/David Christiansen

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



Re: How to locate the OS user name? [newbie]

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

Regards,
Bob

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

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



Re: How to locate the OS user name? [newbie]

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

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

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

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

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

Regards,
Bob


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

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



Re: How to locate the OS user name? [newbie]

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

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

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

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

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

Regards,
Bob


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

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