Polls app not showing in Admin > Django Tutorial

2008-06-26 Thread Moodie

Hi,

I've been going over this, but for some reason the Polls app is not
showing up in the admin after adding 'class Admin: pass' to the poll
model. I've searched through this user group, and have tried all the
things suggested, but am still not having much luck. My models.py page
looks like this:

from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
class Admin:
pass

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

Any help would be great.
(ps running the latest trunk)

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



Anyone got a backend for MS SQL Server working?

2008-06-26 Thread Ulf Kronman

Hi all,
sorry; I know that this is an ever-coming-back question, but I need to
dig a bit deeper to get further, before deciding to struggle on or
give up.

I've been coding happily with Django for over a year, using an Ubuntu
server with a PostgreSQL database and a development environment on Max
OS X and PostgreSQL on my MacBook to develop databases for
bibliometric analyzes.

A few months ago, I started working with a new organization that is
running a big bibliometric database in a Windows environment on an MS
SQL Server. I'm not in the position to suggest a platform switch, but
I have managed to get an Ubuntu server to act as a front-end towards
the database. I have installed Django on the Ubuntu server and can
access the database using Python and pymssql (0.8). But I have not had
any luck with the different external efforts to interface Django
against MS SQL Server.

As far as I have seen from this forum there is two different external
development efforts for Django MS SQL support; django-mssql and django-
pydobc, and I have tried both with no luck.

Here is my report:

django-mssql (http://code.google.com/p/django-mssql/)

I seems that django-mssql is a Windows-only solution, since it is
based on sqlserver_ado, which in turn is dependent on win32com.client,
which is Windows-specific.

As I have a good development-server pairing on my Mac laptop and the
Ubuntu server, I would rather not switch to development in a Windows
environment, so this does not seem to be a viable solution to me.

django-pyodbc (http://code.google.com/p/django-pyodbc/)
---
django-pyodbc seemed to be a much more promising path to walk, since
it is based on pyodbc and pymssql, which both seems to be rather
platform neutral. The present django-pyodbc is furthermore primarily
based on pymssql, which I already have running on both my server and
development environment against the MS SQL Server.

But when I try to install and run django-pyodbc I run into a number of
basic problems.

The first problem is that the developer suggests the package to be
installed in a directory named django-pyodbc and called in as an
external module, but Python doesn't allow for hyphens in module names.
I have tried to rename the module to django_pyodbc to get around the
problem, but the files of the module have a number of hard-coded
includes referring to django-pyodbc, so I had to edit all of those
also, but didn't get it working anyhow.

My question is: Is there anyone around running Django on a Linux
platform towards an MS SQL Server with some kind of Django-integrated
database backend support? If, so; how did you do it?

I'm not interested in fancy stuff like paging record sets (I've
understood that there is a lack of support for this in MS SQL Server),
but just basic Django model support.

Thanks for any help on this,
Ulf

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



Re: Permissiond

2008-06-26 Thread Jeff Anderson

[EMAIL PROTECTED] wrote:

I don't understand why I keep getting "permission denied" when I try
to install Django. Here is what I get when trying to install as the
Admin:
  
You don't have write permission in whatever directory you are executing 
that command in. Either change to a directory in which you do have write 
permission, or change the user you are using to one that has write 
permission to the directory that you are in.


Jeff Anderson



signature.asc
Description: OpenPGP digital signature


Re: Problems setting up LDAP backend

2008-06-26 Thread Jeff Anderson

satish wrote:

Hi All,

I was able to setup review board with the default auth backend.
However I am having problem setting it with LDAP.
  

It looks like you are using the patch from ticket #2507

When you say "no errors or warnings" what undesired behavior are you 
experiencing?


some things that might help to diagnose:

* tail the log of the ldap server to see if a request is actually 
hitting it.

* try authenticating a user from the python shell

If you are still stuck, provide some more details, and I'll be happy to 
help from there.



Jeff Anderson



signature.asc
Description: OpenPGP digital signature


Permissiond

2008-06-26 Thread [EMAIL PROTECTED]

I don't understand why I keep getting "permission denied" when I try
to install Django. Here is what I get when trying to install as the
Admin:

svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk
svn: Can't make directory 'django-trunk': Permission denied

I've had the same problem when trying to install MySQL-python-1.2.2

If anyone can help me out I would appreciate it.

Thanks,

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



Custom field in JSON serializer

2008-06-26 Thread M.Ganesh

Hi All,

I picked up this sample code from django documentation:

from django.core import serializers
data = serializers.serialize('xml', SomeModel.objects.all(), 
fields=('name','size'))

How do I extend this to do the following:

data = serializers.serialize('xml', SomeModel.objects.all(), 
fields=('name','size', '__unicode__'))

Thanks in advance

Regards Ganesh


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



Re: ImportError: No module named _md5

2008-06-26 Thread Grunev Ivan

Hello

You need to install md5 module at first.

On Thu, 2008-06-26 at 22:28 -0700, [EMAIL PROTECTED] wrote:
> Hello,
> 
> I'm trying to install MySQL-python-1.2.2 and don't know how to resolve
> tis error:
> 
> jason-neridas-macbook:~ jasonnerida$ cd /Users/jasonnerida/Downloads/
> MySQL-python-1.2.2
> jason-neridas-macbook:MySQL-python-1.2.2 jasonnerida$ python setup.py
> build
> Traceback (most recent call last):
>   File "setup.py", line 5, in 
> import ez_setup; ez_setup.use_setuptools()
>   File "/Users/jasonnerida/Downloads/MySQL-python-1.2.2/ez_setup.py",
> line 83, in use_setuptools
> egg = download_setuptools(version, download_base, to_dir,
> download_delay)
>   File "/Users/jasonnerida/Downloads/MySQL-python-1.2.2/ez_setup.py",
> line 111, in download_setuptools
> import urllib2, shutil
>   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/
> lib/python2.5/urllib2.py", line 91, in 
> import hashlib
>   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/
> lib/python2.5/hashlib.py", line 133, in 
> md5 = __get_builtin_constructor('md5')
>   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/
> lib/python2.5/hashlib.py", line 60, in __get_builtin_constructor
> import _md5
> ImportError: No module named _md5
> 
> Thanks for any assistance,
> 
> Jason
> > 
-- 
With best regards,
Project Manager  
Ivan Grunev
Email: [EMAIL PROTECTED]  
Work Phone: +7(383)330-6626 ext 104
MSN: [EMAIL PROTECTED]  
YM: [EMAIL PROTECTED]  
Skype: ivan.grunev  
Sibers Group Ltd. (HireRussians)
http://sibers.com/ (http://hirerussinas.ru)


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



ImportError: No module named _md5

2008-06-26 Thread [EMAIL PROTECTED]

Hello,

I'm trying to install MySQL-python-1.2.2 and don't know how to resolve
tis error:

jason-neridas-macbook:~ jasonnerida$ cd /Users/jasonnerida/Downloads/
MySQL-python-1.2.2
jason-neridas-macbook:MySQL-python-1.2.2 jasonnerida$ python setup.py
build
Traceback (most recent call last):
  File "setup.py", line 5, in 
import ez_setup; ez_setup.use_setuptools()
  File "/Users/jasonnerida/Downloads/MySQL-python-1.2.2/ez_setup.py",
line 83, in use_setuptools
egg = download_setuptools(version, download_base, to_dir,
download_delay)
  File "/Users/jasonnerida/Downloads/MySQL-python-1.2.2/ez_setup.py",
line 111, in download_setuptools
import urllib2, shutil
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/
lib/python2.5/urllib2.py", line 91, in 
import hashlib
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/
lib/python2.5/hashlib.py", line 133, in 
md5 = __get_builtin_constructor('md5')
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/
lib/python2.5/hashlib.py", line 60, in __get_builtin_constructor
import _md5
ImportError: No module named _md5

Thanks for any assistance,

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



Re: Django Database Relationship Question

2008-06-26 Thread [EMAIL PROTECTED]

You may also be interested in this ticket: 
http://code.djangoproject.com/ticket/6095
(which will hopefully be hitting relatively soon).

On Jun 26, 11:27 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> You'd almost think they were handing out prizes for being quickest on  
> the draw :)
>
> On Jun 27, 2008, at 12:18 PM, joshuajonah wrote:
>
>
>
> > And this is why the Django community rocks, two examples and a full
> > explaination with a link in less than 10 minutes, GW guys
>
> > On Jun 26, 11:55 pm, bhunter <[EMAIL PROTECTED]> wrote:
> >> Hi, sorry for what is probably a trivial question, but I'm new to
> >> Django and a little fuzzy on databases in general, so I hope someone
> >> here can help.  Just to keep the motif, I'll frame my question in
> >> terms of journalism.
>
> >> I'd like to set up a database with the following relationships:  a
> >> model of articles and a model of journalists.  That's easy enough.
> >> Because one article can have multiple journalists associated with it,
> >> that's a ManyToMany relationship:
>
> >> class Journalist(models.Model):
> >>  pass
>
> >> class Article(models.Model):
> >>  journalists = models.ManyToManyField(Journalist)
>
> >> Simple, but that's not what I happen to want.  What I really want in
> >> my application is to know the *status* of a journalist with respect  
> >> to
> >> an article.  That status could be, let's say, one of four things:
> >> ["Unafilliated", "CurrentlyWriting", "DoneWriting", "Dead"].
>
> >> Coming from a Python background, I might just call this a dictionary
> >> of statuses, with Journalists being the keys, and each entry
> >> containing one of four values:
>
> >> class Article(models.Model):
> >>  status = { "Bob Ryan" : "CurrentlyWriting",
> >>                 "Rob Bradford" : "Unaffiliated",
> >>                 "Peter Gammons" : "DoneWriting",
> >>                 "Dan Shaughnessy" : "Dead"}
>
> >> Ok, Shaughnessy isn't dead, but if you lived in Boston, you'd
> >> understand.  Anyway, a dictionary is nice and all, but then the
> >> information isn't in the database, and that's the whole point.
>
> >> Can anyone tell me what this relationship is called and how to do it
> >> in Django?
>
> >> Thanks!
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Database Relationship Question

2008-06-26 Thread Eric Abrahamsen

You'd almost think they were handing out prizes for being quickest on  
the draw :)


On Jun 27, 2008, at 12:18 PM, joshuajonah wrote:

>
> And this is why the Django community rocks, two examples and a full
> explaination with a link in less than 10 minutes, GW guys
>
> On Jun 26, 11:55 pm, bhunter <[EMAIL PROTECTED]> wrote:
>> Hi, sorry for what is probably a trivial question, but I'm new to
>> Django and a little fuzzy on databases in general, so I hope someone
>> here can help.  Just to keep the motif, I'll frame my question in
>> terms of journalism.
>>
>> I'd like to set up a database with the following relationships:  a
>> model of articles and a model of journalists.  That's easy enough.
>> Because one article can have multiple journalists associated with it,
>> that's a ManyToMany relationship:
>>
>> class Journalist(models.Model):
>>  pass
>>
>> class Article(models.Model):
>>  journalists = models.ManyToManyField(Journalist)
>>
>> Simple, but that's not what I happen to want.  What I really want in
>> my application is to know the *status* of a journalist with respect  
>> to
>> an article.  That status could be, let's say, one of four things:
>> ["Unafilliated", "CurrentlyWriting", "DoneWriting", "Dead"].
>>
>> Coming from a Python background, I might just call this a dictionary
>> of statuses, with Journalists being the keys, and each entry
>> containing one of four values:
>>
>> class Article(models.Model):
>>  status = { "Bob Ryan" : "CurrentlyWriting",
>> "Rob Bradford" : "Unaffiliated",
>> "Peter Gammons" : "DoneWriting",
>> "Dan Shaughnessy" : "Dead"}
>>
>> Ok, Shaughnessy isn't dead, but if you lived in Boston, you'd
>> understand.  Anyway, a dictionary is nice and all, but then the
>> information isn't in the database, and that's the whole point.
>>
>> Can anyone tell me what this relationship is called and how to do it
>> in Django?
>>
>> Thanks!
> >


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




Re: Django Database Relationship Question

2008-06-26 Thread joshuajonah

And this is why the Django community rocks, two examples and a full
explaination with a link in less than 10 minutes, GW guys

On Jun 26, 11:55 pm, bhunter <[EMAIL PROTECTED]> wrote:
> Hi, sorry for what is probably a trivial question, but I'm new to
> Django and a little fuzzy on databases in general, so I hope someone
> here can help.  Just to keep the motif, I'll frame my question in
> terms of journalism.
>
> I'd like to set up a database with the following relationships:  a
> model of articles and a model of journalists.  That's easy enough.
> Because one article can have multiple journalists associated with it,
> that's a ManyToMany relationship:
>
> class Journalist(models.Model):
>   pass
>
> class Article(models.Model):
>   journalists = models.ManyToManyField(Journalist)
>
> Simple, but that's not what I happen to want.  What I really want in
> my application is to know the *status* of a journalist with respect to
> an article.  That status could be, let's say, one of four things:
> ["Unafilliated", "CurrentlyWriting", "DoneWriting", "Dead"].
>
> Coming from a Python background, I might just call this a dictionary
> of statuses, with Journalists being the keys, and each entry
> containing one of four values:
>
> class Article(models.Model):
>   status = { "Bob Ryan" : "CurrentlyWriting",
>  "Rob Bradford" : "Unaffiliated",
>  "Peter Gammons" : "DoneWriting",
>  "Dan Shaughnessy" : "Dead"}
>
> Ok, Shaughnessy isn't dead, but if you lived in Boston, you'd
> understand.  Anyway, a dictionary is nice and all, but then the
> information isn't in the database, and that's the whole point.
>
> Can anyone tell me what this relationship is called and how to do it
> in Django?
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Database Relationship Question

2008-06-26 Thread Eric Abrahamsen

Hey there,

A M2M field creates an intermediary join table which doesn't show up  
in the admin, or other places. It's basically just a pairing of  
Journalist ids with Article ids, and the M2M field is a convenience  
that allows you to ignore this table. If you want to add additional  
information to this intermediary table (which is what you're doing),  
you'll have to create the table explicitly, and use it yourself. There  
are instructions for doing so here:

http://www.djangoproject.com/documentation/models/m2m_intermediary/

which coincidentally use an example very similar to your setup...

Good luck!
Eric


On Jun 27, 2008, at 11:55 AM, bhunter wrote:

>
> Hi, sorry for what is probably a trivial question, but I'm new to
> Django and a little fuzzy on databases in general, so I hope someone
> here can help.  Just to keep the motif, I'll frame my question in
> terms of journalism.
>
> I'd like to set up a database with the following relationships:  a
> model of articles and a model of journalists.  That's easy enough.
> Because one article can have multiple journalists associated with it,
> that's a ManyToMany relationship:
>
> class Journalist(models.Model):
>  pass
>
> class Article(models.Model):
>  journalists = models.ManyToManyField(Journalist)
>
> Simple, but that's not what I happen to want.  What I really want in
> my application is to know the *status* of a journalist with respect to
> an article.  That status could be, let's say, one of four things:
> ["Unafilliated", "CurrentlyWriting", "DoneWriting", "Dead"].
>
> Coming from a Python background, I might just call this a dictionary
> of statuses, with Journalists being the keys, and each entry
> containing one of four values:
>
> class Article(models.Model):
>  status = { "Bob Ryan" : "CurrentlyWriting",
> "Rob Bradford" : "Unaffiliated",
> "Peter Gammons" : "DoneWriting",
> "Dan Shaughnessy" : "Dead"}
>
> Ok, Shaughnessy isn't dead, but if you lived in Boston, you'd
> understand.  Anyway, a dictionary is nice and all, but then the
> information isn't in the database, and that's the whole point.
>
> Can anyone tell me what this relationship is called and how to do it
> in Django?
>
> Thanks!
>
>
> >


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



Re: Django Database Relationship Question

2008-06-26 Thread Julien

Hi,

To do that I would use an auxilliary model:

class Journalist(models.Model):
  pass

class Article(models.Model):
pass

class JournalistArticleRelationship(models.Model):
  journalist = models.ForeignKey(Journalist)
  article = models.ForeignKey(Article)
  status = models.Charfield()

That way you could associate a particular article with a particular
journalist and giving it a particular status.

Hope that helps.

On Jun 27, 1:55 pm, bhunter <[EMAIL PROTECTED]> wrote:
> Hi, sorry for what is probably a trivial question, but I'm new to
> Django and a little fuzzy on databases in general, so I hope someone
> here can help.  Just to keep the motif, I'll frame my question in
> terms of journalism.
>
> I'd like to set up a database with the following relationships:  a
> model of articles and a model of journalists.  That's easy enough.
> Because one article can have multiple journalists associated with it,
> that's a ManyToMany relationship:
>
> class Journalist(models.Model):
>   pass
>
> class Article(models.Model):
>   journalists = models.ManyToManyField(Journalist)
>
> Simple, but that's not what I happen to want.  What I really want in
> my application is to know the *status* of a journalist with respect to
> an article.  That status could be, let's say, one of four things:
> ["Unafilliated", "CurrentlyWriting", "DoneWriting", "Dead"].
>
> Coming from a Python background, I might just call this a dictionary
> of statuses, with Journalists being the keys, and each entry
> containing one of four values:
>
> class Article(models.Model):
>   status = { "Bob Ryan" : "CurrentlyWriting",
>                  "Rob Bradford" : "Unaffiliated",
>                  "Peter Gammons" : "DoneWriting",
>                  "Dan Shaughnessy" : "Dead"}
>
> Ok, Shaughnessy isn't dead, but if you lived in Boston, you'd
> understand.  Anyway, a dictionary is nice and all, but then the
> information isn't in the database, and that's the whole point.
>
> Can anyone tell me what this relationship is called and how to do it
> in Django?
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Database Relationship Question

2008-06-26 Thread joshuajonah

Well you'd want a relational table of author status', some thing like
this:

class Journalist(models.Model):
  name = models.Charfield()

class Article(models.Model):
  articles = models.Charfield

class State(models.Model):
  state = models.CharField()

class Article_relationship(models.Model):
  article = models.ForeignKey(Article)
  journalist = models.ForeignKey(Journalist)
  state = models.ForeignKey(State)

You can define a ManyToMany and it will make relational tables for you
in simple databases, but you can also define those tables explicitly
like this and create a more custom database scheme. That's what i
would do, however this could be set up in a few different ways.

Joshua


On Jun 26, 11:55 pm, bhunter <[EMAIL PROTECTED]> wrote:
> Hi, sorry for what is probably a trivial question, but I'm new to
> Django and a little fuzzy on databases in general, so I hope someone
> here can help.  Just to keep the motif, I'll frame my question in
> terms of journalism.
>
> I'd like to set up a database with the following relationships:  a
> model of articles and a model of journalists.  That's easy enough.
> Because one article can have multiple journalists associated with it,
> that's a ManyToMany relationship:
>
> class Journalist(models.Model):
>   pass
>
> class Article(models.Model):
>   journalists = models.ManyToManyField(Journalist)
>
> Simple, but that's not what I happen to want.  What I really want in
> my application is to know the *status* of a journalist with respect to
> an article.  That status could be, let's say, one of four things:
> ["Unafilliated", "CurrentlyWriting", "DoneWriting", "Dead"].
>
> Coming from a Python background, I might just call this a dictionary
> of statuses, with Journalists being the keys, and each entry
> containing one of four values:
>
> class Article(models.Model):
>   status = { "Bob Ryan" : "CurrentlyWriting",
>  "Rob Bradford" : "Unaffiliated",
>  "Peter Gammons" : "DoneWriting",
>  "Dan Shaughnessy" : "Dead"}
>
> Ok, Shaughnessy isn't dead, but if you lived in Boston, you'd
> understand.  Anyway, a dictionary is nice and all, but then the
> information isn't in the database, and that's the whole point.
>
> Can anyone tell me what this relationship is called and how to do it
> in Django?
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django Database Relationship Question

2008-06-26 Thread bhunter

Hi, sorry for what is probably a trivial question, but I'm new to
Django and a little fuzzy on databases in general, so I hope someone
here can help.  Just to keep the motif, I'll frame my question in
terms of journalism.

I'd like to set up a database with the following relationships:  a
model of articles and a model of journalists.  That's easy enough.
Because one article can have multiple journalists associated with it,
that's a ManyToMany relationship:

class Journalist(models.Model):
  pass

class Article(models.Model):
  journalists = models.ManyToManyField(Journalist)

Simple, but that's not what I happen to want.  What I really want in
my application is to know the *status* of a journalist with respect to
an article.  That status could be, let's say, one of four things:
["Unafilliated", "CurrentlyWriting", "DoneWriting", "Dead"].

Coming from a Python background, I might just call this a dictionary
of statuses, with Journalists being the keys, and each entry
containing one of four values:

class Article(models.Model):
  status = { "Bob Ryan" : "CurrentlyWriting",
 "Rob Bradford" : "Unaffiliated",
 "Peter Gammons" : "DoneWriting",
 "Dan Shaughnessy" : "Dead"}

Ok, Shaughnessy isn't dead, but if you lived in Boston, you'd
understand.  Anyway, a dictionary is nice and all, but then the
information isn't in the database, and that's the whole point.

Can anyone tell me what this relationship is called and how to do it
in Django?

Thanks!


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



Re: manage.py dumpdata and swap

2008-06-26 Thread Malcolm Tredinnick


On Thu, 2008-06-26 at 19:57 -0700, [EMAIL PROTECTED] wrote:
> Hello
> 
> I have a small server, just 5 users and I use the django for data
> entry. My server have only 512MB of RAM but it is enough and it work
> really well. But whenever I run "manage.py dumpdata xml" --format=xml"
> for backup purposes it uses all my RAM and start filling the swap
> space on my server. Is it some kind of memory leak in that routine?
> And it is really the dumpdata data that fills the memory, I've run my
> server for more than 3 month without using the swap space and the
> first time I execute manage.py dumpdata it fill up the RAM

It's not too hard to believe that dumpdata would use up a lot of memory.
Basically, for any given model in the app, it does the equivalent of
TheModel.objects.all() and then iterates through the result to dump them
out. Since iterating through a queryset also caches the results, you'll
end up with a copy of all the data in member for each model (which will
then be discarded before moving onto the next model). So if you have a
model with a lot of data in it, it could well be a lot of memory. That
will depend on the amounts of data you have, though.

There's probably some possibility of being a bit less aggressive in this
respect with some code changes (for example, a --maxrecords option to
dumpdata could be added), but I haven't really thought that through.

Why are you running dumpdata so frequently that this really matters,
though? For backup purposes, just dumping the database is going to be a
lot faster and easier, for example.

Reagrds,
Malcolm



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



manage.py dumpdata and swap

2008-06-26 Thread [EMAIL PROTECTED]

Hello

I have a small server, just 5 users and I use the django for data
entry. My server have only 512MB of RAM but it is enough and it work
really well. But whenever I run "manage.py dumpdata xml" --format=xml"
for backup purposes it uses all my RAM and start filling the swap
space on my server. Is it some kind of memory leak in that routine?
And it is really the dumpdata data that fills the memory, I've run my
server for more than 3 month without using the swap space and the
first time I execute manage.py dumpdata it fill up the RAM

Daniel

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



Re: The Lost Fingers

2008-06-26 Thread [EMAIL PROTECTED]

While definitely off-topic, I appreciate the heads up. I live in a
world where the framework and the guitarist often intersect.

On Jun 26, 9:01 am, Dan <[EMAIL PROTECTED]> wrote:
> This isn't related to Django the framework but Django the musician, I
> figure you'd find it interesting anyway.
>
> I saw in the newspaper this morning that a group from Quebec called
> The Lost Fingers released an album called Lost in the 80's where they
> play well known songs in Django Reinhardt style. The album costs $40
> on Amazon but only $15 if you buy it from a Quebec Label / Discstore 
> :http://www.archambault.ca/store/product.asp?sku=002106354&type=1&lang...
>
> Or just use bittorrent :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problems setting up LDAP backend

2008-06-26 Thread satish

Hi All,

I was able to setup review board with the default auth backend.
However I am having problem setting it with LDAP.

Here is what I did:

1). I added the following to the settings_local.py. Restarted the
server "manage.py runserver 0.0.0.0:8000"

I made sure all the LDAP props are correct. I tried both
'django.contrib.auth.contrib.ldapauth.LDAPBackend' and
reviewboard.accounts.backends.LDAPBackend'. No errors or warnings. Any
thoughts on what I am doing wrong? Help is appreciated.

Thanks

AUTH_PROFILE_MODULE = 'accounts.Profile'
BUILTIN_AUTH = False
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.contrib.ldapauth.LDAPBackend'
)
#'reviewboard.accounts.backends.LDAPBackend'
LDAP_EMAIL_DOMAIN = ''
LDAP_URI = ''
LDAP_SERVER_URI = ''
LDAP_UID_MASK = ''
LDAP_ANON_BIND_UID = ''
LDAP_ANON_BIND_PASSWD = ''
LDAP_DEBUG = True
DEBUG = True




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



Re: Development environment

2008-06-26 Thread Michael Wieher

I prefer command line, vi  its always the same, no matter if you
ssh, log on locally, connect via sat-modem

On Thu, Jun 26, 2008 at 7:39 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> I use kubuntu+kate, and I just use a terminal for running code and
> such.
> >
>

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



Re: Development environment

2008-06-26 Thread [EMAIL PROTECTED]

I use kubuntu+kate, and I just use a terminal for running code and
such.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: i18n model - tri-lingual data

2008-06-26 Thread Julien

I reckon your view should check what the language is set in the
request (request.LANGUAGE_CODE), and then pull out the right field
from the model.

On Jun 26, 11:22 pm, pihentagy <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I have a 3-lingual app, and there are some model fields translated,
> like this:
>
> class Category(models.Model)
>         name_hu = models.CharField(_(u'név (magyar)'), max_length=255,)
>         name_en = models.CharField(_(u'név (angol)'), max_length=255)
>         name_de = models.CharField(_(u'név (német)'), max_length=255)
>
> In some caces __unicode__ method is used for representing data (like
> in the admin app, and many other places).
> Is there a way I can tell the model about the request's language? Or,
> well, I know it is a violation of MVC, but how to solve this problem?
>
> thanks
> Gergo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Stability of trunk and 1.0 target: experience, testimonials?

2008-06-26 Thread Julien

Hi,

As far as I'm concerned, I only use the trunk in all my projects. For
more testimonials and advice, check these earlier threads:

http://groups.google.com/group/django-users/browse_thread/thread/93ec5b37ef0cf3ab/7d9a1dd11c91c8b0?lnk=gst&q=trunk+stable#7d9a1dd11c91c8b0
http://groups.google.com/group/django-users/browse_thread/thread/16243cfa42e6f54/5a11415a6f39c206?lnk=gst&q=trunk+stable#5a11415a6f39c206
http://groups.google.com/group/django-users/browse_thread/thread/cab4871359973c1c/77af36d29d8525d5?lnk=gst&q=trunk+stable#77af36d29d8525d5
http://groups.google.com/group/django-users/browse_thread/thread/3eaa92415908d65e/e014ea972c3e6d8f?lnk=gst&q=trunk+stable#e014ea972c3e6d8f

 and more threads to be found on this mailing list.

A side remark. If you're just starting development and you are not
planning to deploy your site before the next couple of months, I'd
strongly advise to go for trunk, as the version 1.0 is to be released
in September.

Julien


On Jun 27, 7:00 am, Dan <[EMAIL PROTECTED]> wrote:
> > Hi folks,
>
> > I'm trying to champion Django trunk/1.0 as part of a small project in
> > a mid-sized city newspaper office. There is some worry about choosing
> > a framework which does not currently have a stable release.
>
> Django has a stable release (0.96), it will have an *API-stable*
> release when 1.0 comes out (this September). Given how much of Django
> is already stable (see the list of frozen API), you can show that 1.0
> is almost done.
>
> > Please help us avoid PHP!
>
> If we are to compare API stability between the two, Django has
> detailed backward incompatible changes. PHP doesn't give a shit if
> they break compatibility in minor point releases (like switching some
> functions from HTML to XHTML).
>
> I suggest you show Adrian's presentation of Django, it showcases the
> Lawrence website which is a pretty huge project. Tell your bosses
> Django is just like Adrian said back then except it's even better now
> :)
>
> http://video.google.com/videoplay?docid=-3548805983075267875
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: mod_python install

2008-06-26 Thread Julien

Maybe can you try this: http://cavedoni.com/2005/django-osx

On Jun 27, 9:00 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi there,
>
> I'm trying to set up Python 2.5.2 and Django onmy Mac osx 10.4.11
> But i'm a complete newbie in thing like this and command line
> mastering.
> I'm not feeling really confident a the moment in what i do.
>
> I'm following tho django book install on the django project web site.
>
> the Python and django install seems to have work well, i can create
> project and run the test server.
>
> but when i modify the settings.py to define the database name, account
> and password (that i have set up with phpMy Admin)
> on the launch of the server it says that it can't validate the models.
> If i empty the strings it start with no error again.
>
> I think it is because i don't have mod_python installed.
>
> I downloaded the latest version from the apache website but then i
> don't really know what to anymore and when i google install mod_python
> on mac osx it is not very helpful. it mostly return install mod
> phyton.
>
> so could somebody describe to me the command line to use to install
> mod python or refer me to a proper tutorial for osx.
>
> thank youvery much
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: site_media paths

2008-06-26 Thread Alex Slesarev

> All my static files (css, js and so forth) live under a folder called
> media

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



Re: Problems retrieving array from POST

2008-06-26 Thread Alex Slesarev

> def post_handler(request):
>     post_text = request.POST.getlist('data')
>     user = User.objects.get(id=2) # for debugging purposes
>     for x in range( len(post_text)-1 ):
>         name = post_text[x]
>         panel =
> user.panels_set.get(name__istartswith=name,side="left")
>         panel.order = x
>         panel.save()

What 'print post_text' shows?

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



mod_python install

2008-06-26 Thread [EMAIL PROTECTED]

Hi there,

I'm trying to set up Python 2.5.2 and Django onmy Mac osx 10.4.11
But i'm a complete newbie in thing like this and command line
mastering.
I'm not feeling really confident a the moment in what i do.

I'm following tho django book install on the django project web site.

the Python and django install seems to have work well, i can create
project and run the test server.

but when i modify the settings.py to define the database name, account
and password (that i have set up with phpMy Admin)
on the launch of the server it says that it can't validate the models.
If i empty the strings it start with no error again.

I think it is because i don't have mod_python installed.

I downloaded the latest version from the apache website but then i
don't really know what to anymore and when i google install mod_python
on mac osx it is not very helpful. it mostly return install mod
phyton.

so could somebody describe to me the command line to use to install
mod python or refer me to a proper tutorial for osx.

thank youvery much

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



Re: Full list of Django features?

2008-06-26 Thread Brian Luft

A lot of that depends on what you would consider a feature vs. what
you think a modern web framework should provide by default.

Aside from the points listed on the home page, I would suggest going
to the documentation page and look down the list of reference topics.
Those are all "features" in a sense.  You can get more specific by
going to one of the topics and concentrating on the subtopics in the
right-hand sidebar.  Anything that says "New" or "New in development
version" probably isn't in 0.96.  Frankly, many devs and companies run
off of trunk since new commits are rigorously tested against the
pretty comprehensive test suite.

You might also check here:
http://www.djangoproject.com/documentation/release_notes_0.96/#what-s-new-in-0-96

The fact that Django is implemented in Python is a huge win in itself
for many people.  The Django community and Python in general are
fortunate to count a lot of extremely talented and gracious people.
Python has started to turn a lot of heads recently due to the success
of Django, Google hiring Guido, Google App Engine, etc.  The landscape
has changed a little but it can be said that people who learned Python
in the past did so because they appreciated the elegance of the
language.  In my experience engineers who use Python (generally) just
seem to be a little more well rounded to me.  That's not to imply that
people who learn Python suddenly become better engineers, rather that
better engineers have gravitated toward Python.

For me, a vibrant community and a well designed product outweigh any
generic feature list.  The best framework (whatever that is) isn't
going to solve all your problems or magically make your applications
run better.  Once you get beyond "hello world" a good framework should
reduce the boring, repetitive work but you'll still have to solve some
problems on your own.  Personally I'd rather solve those problems
using Python than other languages I've used.  Python itself has a
tremendous ecosystem of libraries and modules.

-Brian


On Jun 26, 2:21 pm, Phillip B Oldham <[EMAIL PROTECTED]> wrote:
> I'm looking to propose python+django for a new project at work, as I
> feel it will be a good fit. Generally everything is done in PHP, so
> its going to be a bit of a change.
>
> I've already gathered a list of benefits to using python (fully oo,
> maintainability across developers, etc), now I just need to find a
> list of features for django which I can use with my proposal to
> highlight why django would be a better choice than our current
> framework.
>
> Can anyone point me to a complete list of features for django 0.96.2?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Blank choice for USStateField?

2008-06-26 Thread Nathaniel Whiteinge

On Jun 26, 12:00 pm, Huuuze <[EMAIL PROTECTED]> wrote:
> Just out of curiosity, are the Django devs working on a patch?  I
> wasn't able to find a ticket for this issue.

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



Problems retrieving array from POST

2008-06-26 Thread elspiko

Hi all,

I've fairly new to django but i'm loving it!

I've got some draggable panels on a site and want to save their
positions so when a user logs back in, the panels are in the same
place when they last hit the save button. What I'm doing is (using
jQuery) retrieving the id's of the panels, putting them into an array,
and using ajax to pass the array to the server:

var data = []
$('#left > div').each(function() {
data.push($(this).attr('id'));
});
var Left = 'Left';
for(x in data)
{
Left += data[x] + " in pos " + x + "";
}
Left += "";
$('#var_test').html(Left);

$.post("/post_test/",{'data[]': data });

Using firebug, I can see that the data is being posted correctly.

Below is the view (abridged):

def post_handler(request):
post_text = request.POST.getlist('data')
user = User.objects.get(id=2) # for debugging purposes
for x in range( len(post_text)-1 ):
name = post_text[x]
panel =
user.panels_set.get(name__istartswith=name,side="left")
panel.order = x
panel.save()

The problem is its not saving to the database, I'm assuming it to do
with the way I'm accessing the POST data, but I can't work it out.
I've tried post_text = request.POST['data'], but that didn't work
either,

I really am at a loose end with this...please help!!

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



Re: psycopg2

2008-06-26 Thread Russell Keith-Magee

On Thu, Jun 26, 2008 at 10:05 PM, Will <[EMAIL PROTECTED]> wrote:
>
> Couldn't Django be pluggable with respect to the Database drivers?
> There's a DBAPI2 interface spec, therefore it should be possible.

Erm... the database backends _are_ pluggable. Hence, the
DATABASE_ENGINE setting.

If you want to write your own database engine, supporting whatever
backend API you want, you are free to do so. There are already several
efforts trying to build backends for MS-SQL.

If you demonstrate a history of supporting your backend and keeping it
up to date, we will consider it for inclusion into Django trunk.

Yours,
Russ Magee %-)

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



Re: Problem logging in to admin using Safari

2008-06-26 Thread Jacob Kaplan-Moss

Hey Pieter --

You may want to experiment with the SESSION_COOKIE_DOMAIN setting
(http://www.djangoproject.com/documentation/settings/#session-cookie-domain);
it could be that Safari's doing strange things with ".local" session
cookies and doing something explicit could help. Worth a shot, at
least.

Jacob

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



Re: site_media paths

2008-06-26 Thread alce

Oops, sorry, the line:

All my static files (css, js and so forth) live under a folder called
main

should read

All my static files (css, js and so forth) live under a folder called
media

Thanks


On Jun 26, 4:57 pm, alce <[EMAIL PROTECTED]> wrote:
> Hi, I've just started playing with Django and I must say I'm
> impressed. It's easy, it's fast, it's beautiful.
>
> I wrote a small app and will be going to production soon. I deployed
> the site to a staging server and I'm having some trouble serving
> static files (I keep getting 404's). I realize it's really an issue of
> my web server configuration, not Django's but still, I thought I might
> get some help here.
>
> Django itself is running fine on fcgi + Nginx, it's just the static
> content I'm struggling with. For now, I'm using just one instance of
> Nginx to serve both dynamic and static content, on the production
> server I might use Apache + mod_python + nginx, don't know yet.
>
> All my static files (css, js and so forth) live under a folder called
> main in my site's
> root directory.
>
> The relevant parts of the nginx.conf file are here:http://pastie.org/222952
>
> and in my settings.py file:
>
> MEDIA_ROOT = '/var/www/apps/example/current/example/media'
> MEDIA_URL = '/site_media/'
>
> Locally, everything works fine with django.views.static.serve, it's
> just on the remote
> server I am having trouble.
>
> Thank you
> Juan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



site_media paths

2008-06-26 Thread alce

Hi, I've just started playing with Django and I must say I'm
impressed. It's easy, it's fast, it's beautiful.

I wrote a small app and will be going to production soon. I deployed
the site to a staging server and I'm having some trouble serving
static files (I keep getting 404's). I realize it's really an issue of
my web server configuration, not Django's but still, I thought I might
get some help here.

Django itself is running fine on fcgi + Nginx, it's just the static
content I'm struggling with. For now, I'm using just one instance of
Nginx to serve both dynamic and static content, on the production
server I might use Apache + mod_python + nginx, don't know yet.

All my static files (css, js and so forth) live under a folder called
main in my site's
root directory.

The relevant parts of the nginx.conf file are here: http://pastie.org/222952

and in my settings.py file:

MEDIA_ROOT = '/var/www/apps/example/current/example/media'
MEDIA_URL = '/site_media/'

Locally, everything works fine with django.views.static.serve, it's
just on the remote
server I am having trouble.

Thank you
Juan











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



Re: how to get form fields to show

2008-06-26 Thread Hanne Moa

On Thu, Jun 26, 2008 at 11:07 PM, Bobby Roberts <[EMAIL PROTECTED]> wrote:
> Ok i've got the form fields showing fine.  My form action is "." per
> the examples in the documentation.  The form is submitting and tracing
> through the view but i get a "view  didn't return an
> HttpResponse.object.
>
> here's my view:
>
> from forms import *

I'll assume that this is the forms.py of your app, not django? In that
case, it might be better to be explicit:

from myapp.forms import *  # Now also self-documenting!

> def DoPayDetailForm (request):
>if request.method =='POST':
>form = PayDetailForm (request.POST)
>
>if form.is_valid():
>AccountNum=request.POST.get('AccountNum','')

The point of .is_valid() (at least in newforms) is that you don't have
to do this. The data in request.POST is washed, cleaned, checked,
dried and put into form.cleaned_data, as a dict. No need to touch
request.POST.

>return render_to_response("step2.html",{'AccountNum':
> AccountNum, 'NameOnAcct': NameOnAcct,
>'Email': Email, 'Phone': Phone, 'NameOnCard': NameOnCard,
> 'Street1': Street1, 'Street2': Street2,
>'City': City, 'State': State, 'ZipCode': ZipCode, 'form':
> form}, context_instance=RequestContext(request))

I would do:

  data = forms.cleaned_data
  data['form'] = form
  return render_to_response('step2.html', data,
context_instance=RequestContext(request))

Actually, I would use a FormWizard, after patching it with the great
patch in ticket 6893 at http://code.djangoproject.com/ticket/6893 ,
and my own patch that makes it put the previous form in a session
instead of putting it in the next form.


HM

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




Re: ModelChoiceField setting value manually

2008-06-26 Thread Adi

This may sound like a cop out, but why can't you create a gallery
object with that default value.
Then when you construct your query set, you can create so that that
default option is returned. This
would enable you to both display the correct option, as well as work
during the validatio step.

-Regards
Adi

On Jun 26, 12:27 pm, mwebs <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I try to set data for a ModelChoiceField() manually. This means the
> data is not in my db, so it s not in a Queryset.
>
> my form:
>
> class PictureForm(forms.Form):
>     image          = forms.ImageField(label='Picture')
>     gallery        = MyModelChoiceField(models.Gallery.objects.none(),
> empty_label=None)
> -
>
> If there are galleries I populate the modelChoiceField like this:
>
>   [1]  picture_form.fields['gallery'].queryset =
> Gallery.objects.filter(...)
> ---
>
> if ther are no Galleries I want to populate the modelChoiceField with
> an entry "Default"
>
> Default
> 
> this Default-select-option I want to fill in manually, because it does
> not exist in the DB.
>
> because it works the [1]-way I thought about building a queryset
> manually, but I could not figure out how to do this.
> Can anyone please give me a short example how to build and fill a
> queryset manually, or show me a more elegeant way how to populate the
> modelchoicefield with data not comming from the database.
>
> Thanks,Toni
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: default value for filter in admin pages

2008-06-26 Thread OliverMarchand

This is just an idea... didn't try this.
Could you not use HttpRedirect in your url conf to redirect the
standard view
of that models admin with the default filter value?
This is not the most convenient way, but it should work...

On 26 Jun., 14:25, lee <[EMAIL PROTECTED]> wrote:
> Guys,
>
> Is there a way of setting the default value for a filter in the admin
> site?
>
> Class Account(models.model):
>     isClosed = models.BooleanField(blank=True)
>     name = models.CharField(core=True, max_length=255,unique=True)
>
>     class Admin:
>          list_filter = ['isClosed']
>
> On the admin page, I want the default value for the 'isClosed' field
> to be 'no', not 'All'.
>
> Thanks.
>
> - Lee.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unexpected Keyword Argument 'radio_admin'

2008-06-26 Thread Alfonso

Thanks Karen and Brian for your suggestions.  Turned out a combination
of the two (got to read those error messages more closely - cough)

It was incorrect radio_admin syntax in the 'pluggable' basic blog app
- http://code.google.com/p/django-basic-apps/, had to clear pyc's as
well.

Now got a new error now -

AttributeError at /
'Manager' object has no attribute 'published'

Which is linked to the basic-blog app.  Strange because code was
working fine prior to newforms issue.

I look forward to the day when I can confidently produe error free
django apps!

Thanks

Allan


On Jun 26, 8:38 pm, Brian Rosner <[EMAIL PROTECTED]> wrote:
> On Jun 26, 2008, at 10:09 AM, Alfonso wrote:
>
>
>
> > TypeError: __init__() got an unexpected keyword argument
> > 'radio_admin'.
>
> > Where did that come from?
>
> Sounds like you may have some lingering .pyc files that might be  
> causing this from newforms-admin if you have switched your copy of  
> Django from newforms-admin to trunk.\
>
> Brian Rosnerhttp://oebfare.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to get form fields to show

2008-06-26 Thread Bobby Roberts

disregard this last post... i figured it out


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



Full list of Django features?

2008-06-26 Thread Phillip B Oldham

I'm looking to propose python+django for a new project at work, as I
feel it will be a good fit. Generally everything is done in PHP, so
its going to be a bit of a change.

I've already gathered a list of benefits to using python (fully oo,
maintainability across developers, etc), now I just need to find a
list of features for django which I can use with my proposal to
highlight why django would be a better choice than our current
framework.

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



Re: how to get form fields to show

2008-06-26 Thread Bobby Roberts

Ok i've got the form fields showing fine.  My form action is "." per
the examples in the documentation.  The form is submitting and tracing
through the view but i get a "view  didn't return an
HttpResponse.object.

here's my view:

from forms import *
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.template import Template, Context

def DoPayDetailForm (request):
if request.method =='POST':
form = PayDetailForm (request.POST)

if form.is_valid():
AccountNum=request.POST.get('AccountNum','')
NameOnAcct=request.POST.get('NameOnAcct','')
Email=request.POST.get('Email','')
Phone=request.POST.get('phone','')
NameOnCard=request.POST.get('NameOnCard','')
Street1=request.POST.get('Street1','')
Street2=request.POST.get('Street2','')
City=request.POST.get('City','')
State=request.POST.get('State','')
ZipCode=request.POST.get('ZipCode','')

return render_to_response("step2.html",{'AccountNum':
AccountNum, 'NameOnAcct': NameOnAcct,
'Email': Email, 'Phone': Phone, 'NameOnCard': NameOnCard,
'Street1': Street1, 'Street2': Street2,
'City': City, 'State': State, 'ZipCode': ZipCode, 'form':
form}, context_instance=RequestContext(request))
else:

form = PayDetailForm()
return render_to_response('step1.html',{'form': form},
context_instance=RequestContext(request))


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



Re: Stability of trunk and 1.0 target: experience, testimonials?

2008-06-26 Thread Dan

> Hi folks,
>
> I'm trying to champion Django trunk/1.0 as part of a small project in
> a mid-sized city newspaper office. There is some worry about choosing
> a framework which does not currently have a stable release.

Django has a stable release (0.96), it will have an *API-stable*
release when 1.0 comes out (this September). Given how much of Django
is already stable (see the list of frozen API), you can show that 1.0
is almost done.

> Please help us avoid PHP!

If we are to compare API stability between the two, Django has
detailed backward incompatible changes. PHP doesn't give a shit if
they break compatibility in minor point releases (like switching some
functions from HTML to XHTML).

I suggest you show Adrian's presentation of Django, it showcases the
Lawrence website which is a pretty huge project. Tell your bosses
Django is just like Adrian said back then except it's even better now
:)

http://video.google.com/videoplay?docid=-3548805983075267875

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



Re: Why I can't include external javascript???

2008-06-26 Thread Karen Tracey
On Thu, Jun 26, 2008 at 4:22 PM, JPC <[EMAIL PROTECTED]> wrote:

>
> Maybe Im wrong in some stupid thing because Im a Django newbie.
> My problem is with external JS file. Im trying to include it in the
> usual HTML way
> (i.e. 

Re: Why I can't include external javascript???

2008-06-26 Thread Michael Wieher

Key Reference:
http://www.djangoproject.com/documentation/static_files/

You need 2  in your HTTPD configuration file, one for things
 that will be processed by Django, one for static files.
Thus, you need to actually put your static JS files on a
/var/www/static-file/ or some web-served thing and use that URL
also be sure that the  handle  is set to None so it doesn't
waste overhead.


On Thu, Jun 26, 2008 at 3:22 PM, JPC <[EMAIL PROTECTED]> wrote:
>
> Maybe Im wrong in some stupid thing because Im a Django newbie.
> My problem is with external JS file. Im trying to include it in the
> usual HTML way
> (i.e. 

Re: how to get form fields to show

2008-06-26 Thread rskm1

> urlpatterns = patterns('',
> (r'/step-1.html', 'billpay.views.DoPayDetailForm'),
> )
>
> Wouldn't this call the dopaydetailform view if you went to  the page /
> step-1.html ?

At this stage, while you're still learning, I would AVOID making URL
mappings that "appear" to be HTML files, because you'll end up
confusing yourself.  (Django will let you do stuff like that later, if
you have some compelling *reason* for it).

But the way it works is the urlpatterns map a URL to a Python "views"
function, and this mapping has NOTHING to do with the name of your
template.

This would work equally well and be less confusing:
| # urls.py
| urlpatterns = patterns('',
| (r'/step-1/$', 'billpay.views.DoPayDetailForm'),
| )

Visiting "http://yoursite/step-1/"; will call the DoPayDetailForm()
function in your billpay/views.py and pass it an HTTP Request
parameter.  Simple.

The TEMPLATE (which you named step-1.html) doesn't come into the
picture until that code returns an HTTP Response object.  The first
parameter of render_to_response() is the template name, which has
_nothing_ to do with the URL mapping.

You can map the URL "/step-1/" and name the template step-1.html if
you want, but that's merely a coincidence for your own convenience;
there's no ACTUAL direct relationship between those names.

I'm probably overemphasizing a simple point, but it seems like you
might've assumed there is some "connection" where there isn't one,
since you put that unusual ".html" into your URL mapping.

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



Why I can't include external javascript???

2008-06-26 Thread JPC

Maybe Im wrong in some stupid thing because Im a Django newbie.
My problem is with external JS file. Im trying to include it in the
usual HTML way
(i.e. 

Re: Django setup with apache

2008-06-26 Thread phillc

your urls is setup for
http://yourdomain.com/login/...
not http://yourdomain.com/sommerspil/login


On Jun 26, 11:46 am, Peter Rowell <[EMAIL PROTECTED]> wrote:
> You didn't share with us the specific error you are getting.
>
> I strongly recommend a) DEBUG=True in settings.py, and b) checking
> your Apache error_log.
>
> If you are getting a generic Apache 404, then the problem will be in
> the Apache httpd.conf or .htaccess files. If you are getting a Django
> 404, then the problem is in urls.py and the DEBUG output can be very
> informative.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: url views problem

2008-06-26 Thread Emil Styrke
This line:

   query = show.objects.filter(show_feed__contains="http://";)

selects all shows that have a feed url(?) containing "http://";. The for loop
then loops through these items and passes each one to feedparser. If you
want to view only one show you have to change this to use the show ID you're
passing in.  So maybe replacing the query line with

  s = show.objects.get(pk=show_feed)

and getting rid of the "for s in query" line might do the trick? Then you'll
get only the feed for show 1 parsed when you go to /shows/1.

  /Emil

2008/6/25 sebey <[EMAIL PROTECTED]>:

>
>
> sorry but I do not want to limit the results as I am useing a parser
> in the views.py but I want to get all of the urls and the first url
> show/1, the second url I want to give shows/2 and so on and so on
> On Jun 25, 1:48 pm, Jeff FW <[EMAIL PROTECTED]> wrote:
> > You've now passed in the variable (which you can check by throwing a
> > "print show_feed" at the top of the function), but now you actually
> > need to *do* something with it.  I'm assuming (not really knowing what
> > you want out of this) that you'd want to add an order_by clause to
> > order your podcasts (?) by *something*, then do some slicing to limit
> > the results.
> >
> > Read:
> http://www.djangoproject.com/documentation/db-api/#limiting-querysets
> >
> > -Jeff
> >
> > On Jun 25, 4:58 am, sebey <[EMAIL PROTECTED]> wrote:
> >
> > > yes i have that set up it now looks like this
> >
> > > def show_page(request,show_feed):
> > > """this is where we take what we need form the rss feeds in the
> > > data base"""
> > > query = show.objects.filter(show_feed__contains="http://";)
> > > for s in query:
> > > podcast = feedparser.parse(s.show_feed)
> > > if  podcast.entries:
> > > elements = {'show_about':
> > > podcast.feed.summary,'show_latest_title':
> > > podcast.entries[0].title,'show_latest': podcast.entries[0].summary}
> > > e = elements
> > > t = loader.get_template('shows/show_page_base.html')
> > > return  HttpResponse(t.render(Context(e)))
> >
> > > but it still in not working so help please thank you for trying
> >
> > > On Jun 24, 3:07 pm, phillc <[EMAIL PROTECTED]> wrote:
> >
> > > > you did not readhttp://
> www.djangoproject.com/documentation/url_dispatch/
> >
> > > > your method, show_page, is now passed a parameter called show_feed.
> > > > you need to use it accordingly
> >
> > > > On Jun 24, 10:02 am, sebey <[EMAIL PROTECTED]> wrote:
> >
> > > > > either way its still the same thanks though but it still is not
> > > > > working
> >
> > > > > On Jun 24, 1:44 pm, Jeff FW <[EMAIL PROTECTED]> wrote:
> >
> > > > > > The regex you're using has a trailing /, so you need to have that
> in
> > > > > > your link as well:
> > > > > > /shows/1/
> >
> > > > > > The other option is to make the trailing slash optional like so:
> > > > > > r'^shows/(?P\d{1})[/]?$'
> >
> > > > > > On Jun 24, 7:09 am, sebey <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > it works but  (thanks for the tips) it still is getting the
> same feed
> > > > > > > for local/shows/1/ and local/show/2 help please
> >
> > > > > > > everyone who has helped so far thank you
> >
> > > > > > > On Jun 24, 12:06 pm, sebey <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > ok fixed that yeah i saw that after I posted but here is what
> it looks
> > > > > > > > like now
> >
> > > > > > > > from django.conf.urls.defaults import *
> >
> > > > > > > > urlpatterns = patterns('',
> > > > > > > > # Example:
> > > > > > > > # (r'^ubermicro/', include('ubermicro.foo.urls')),
> >
> > > > > > > > # Uncomment this for admin:
> > > > > > > > (r'^admin/', include('django.contrib.admin.urls')),
> > > > > > > > #temp only fo dev proposes
> > > > > > > > (r'^shows/(?p\d{1})/
> > > > > > > > $','ubermicro.shows.views.show_page')
> > > > > > > > )
> >
> > > > > > > > thanks some please
> >
> > > > > > > > On Jun 24, 11:46 am, Tye <[EMAIL PROTECTED]>
> wrote:
> >
> > > > > > > > > Why does the /shows/ etc url string end with
> >
> > > > > > > > > /s'
> >
> > > > > > > > > ?
> >
> > > > > > > > > Typo?
> >
> > > > > > > > > Sent from my iPhone
> >
> > > > > > > > > On Jun 24, 2008, at 3:23, sebey <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > > > I have gotten this traceback
> >
> > > > > > > > > > Traceback (most recent call last):
> > > > > > > > > > File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > > > > > > > > > site-packages/django/core/handlers/base.py" in
> get_response
> > > > > > > > > >  68. callback, callback_args, callback_kwargs =
> > > > > > > > > > resolver.resolve(request.path)
> > > > > > > > > > File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > > > > > > > > > site-packages/django/core/urlresolvers.py" in resolve
> > > > > > > > > >  160. for pattern in self.urlconf_module.urlpatterns:
> > > > > > > > > > File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > 

Re: problem getting mod_python to serve application..

2008-06-26 Thread phillc

go to a python interpreter
import sys
sys.path

make sure that directory is in there

On Jun 26, 2:34 pm, Adi <[EMAIL PROTECTED]> wrote:
> I get the following error when I hit my websitehttp://ipaddress/enterathletes/
>
> DocumentRoot:   '/var/www/html'
>
> URI:            '/enterathletes/'
> Location:       '/enterathletes/'
> Directory:      None
> Filename:       '/var/www/html/enterathletes'
> PathInfo:       '/'
>
> Phase:          'PythonHandler'
> Handler:        'django.core.handlers.modpython'
>
> Traceback (most recent call last):
>
>   File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
> 1537, in HandlerDispatch
>     default=default_handler, arg=req, silent=hlist.silent)
>
>   File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
> 1202, in _process_target
>     module = import_module(module_name, path=path)
>
>   File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
> 304, in import_module
>     return __import__(module_name, {}, {}, ['*'])
>
> ImportError: No module named django.core.handlers.modpython
>
> In my /usr/lib/python2.5/site-packages, I have
> lrwxrwxrwx  1 root root     34 Jun 25 13:52 django -> /home/adi/django-
> trunk/django/
>
> In my python.conf apache conf file,
>
> LoadModule python_module modules/mod_python.so
>
> # Override type-map handler for /var/www/manual
> 
>         
>                 SetHandler default-handler
>         
> 
>
> 
>         SetHandler python-program
>         PythonHandler django.core.handlers.modpython
>         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>         PythonDebug On
>         PythonPath "['/home/adi/Enterathletes_py/src','/home/arustgi/
> django-trunk'] + sys.path"
> 
>
> I was able to do
> python manage.py validate
> and
> python manage.py load data
> from '/home/adi/Enterathletes_py/src/mysite
>
> What am I missing? What should I check?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem logging in to admin using Safari

2008-06-26 Thread Emil Styrke
I guess it depends on what you mean by "client related". If Safari is the
only browser exhibiting this behavior I think it's safe to assume that the
web server is doing OK. This assumption is only strengthened by the fact
that only a change of the name the server is accessed through changes the
behavior of the browser.

Your guess about DNS vs. hosts-file seems reasonable to me, and the reason
Safari is different could be because it uses a different resolver library. I
guess it interprets the cookie as a third-party cookie when accessed through
a name defined in the hosts file or something like that.

It's not really surprising that it works with other browsers, since it
really should work. Obviously, Safari is misbehaving here, so I still don't
really see how you can say it isn't client related (although it could
possibly be fixed by using a proper DNS entry instead of using the hosts
file).

  /Emil

2008/6/25 Pieter Claerhout <[EMAIL PROTECTED]>:

>
> I think I got closer to the source of the problem.
>
> First of all, it's not client related.
>
> What I tried was the following:
> - Removed all the virtual hosting stuff and defined the complete web
> server to serve the django app.
> - Included django_test.local pointing to 127.0.0.1 in the hosts file.
>
> If I then browse to http://localhost/admin/ using Safari, I can
> properly log in. However, if I try to browse to
> http://django_test.local/admin/, I get the cookie error problem again.
>
> So, I guess it must have something to do with the fact that define the
> hostname using the hosts file on Mac OS X instead of doing it via the
> DNS server.
>
> What's even more strange is that Safari is the only browser having
> problems with this...
>
> Cheers,
>
>
> pieter
>
> 2008/6/24 Emil Styrke <[EMAIL PROTECTED]>:
> > It certainly looks to me like it is a client and not a server problem.
>  Have
> > you tried running the development server on the mac and accessing it with
> > that exact same install of Safari?  Have you tried accessing the site
> from a
> > different mac with safari?
> >
> > As a next step in tracing the error I'd install wireshark or a similar
> tool
> > and look at exactly what HTTP traffic passes between Safari and Django -
> > this would probably reveal for certain whether it's the server or the
> client
> > messing up.
> >
> > Hope that helps,
> >   /Emil
> >
> > 2008/6/24 Pieter Claerhout <[EMAIL PROTECTED]>:
> >>
> >> Anyone an idea? I've also disabled PHP on the server as that might
> >> cause some troubles, but that didn't make a difference.
> >>
> >> pieter
> >>
> >> 2008/6/23 Pieter Claerhout <[EMAIL PROTECTED]>:
> >> > Absolutely, that was the first thing I checked ;-)
> >> >
> >> > pieter
> >> >
> >> > 2008/6/23 TiNo <[EMAIL PROTECTED]>:
> >> >>
> >> >>
> >> >>> Looks like your browser isn't configured to accept cookies. Please
> >> >>> enable cookies, reload this page, and try again.
> >> >>>
> >> >>
> >> >> Well, are cookies enabled in Safari? (Prefs > Security > accept
> >> >> cookies)...
> >> >> >>
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > pieter claerhout . [EMAIL PROTECTED] . http://www.yellowduck.be/
> >> >
> >>
> >>
> >>
> >> --
> >> pieter claerhout . [EMAIL PROTECTED] . http://www.yellowduck.be/
> >>
> >>
> >
> >
> > >
> >
>
>
>
> --
> pieter claerhout . [EMAIL PROTECTED] . http://www.yellowduck.be/
>
> >
>

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



Re: how to get form fields to show

2008-06-26 Thread Huuuze

> urlpatterns = patterns('',
>     (r'/step-1.html', 'billpay.views.DoPayDetailForm'),
> )
>
> Wouldn't this call the dopaydetailform view if you went to  the page /
> step-1.html ?

It's close.  Re-write it as such:

> urlpatterns = patterns('',
> (r'^step-1.html/$', billpay.views.DoPayDetailForm),
> )

The biggest change here is that I removed the single-quotes from
"billpay.views.DoPayDetailForm".
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Attachments in Django

2008-06-26 Thread bruno desthuilliers

On 26 juin, 19:45, "Greg Lindstrom" <[EMAIL PROTECTED]> wrote:
(snip)

> My question deals with handling attachments to the announcements.
(snip)
>  I would like to set things up so we can have downloads (pdf,
> Word, etc.) (snip) associated with the announcement.
(snip)
> Can I, or rather how do I, create a link that
> will either display or download the file given a link?  Would I put
> the actual files in a sub directory of the "site_media" directory?

The models.FileField takes care of most of the gory details.


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



Re: newforms and views.generic.create_update.create_object

2008-06-26 Thread Brian Rosner


On Jun 26, 2008, at 1:23 PM, timc3 wrote:

>
> Might be a stupid question but how did you apply the patch?

Get inside your Django directory and execute::

patch -p0 < the_path.diff

That should get it going. Let me know if you have any more questions.

Brian Rosner
http://oebfare.com




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



Re: Unexpected Keyword Argument 'radio_admin'

2008-06-26 Thread Brian Rosner


On Jun 26, 2008, at 10:09 AM, Alfonso wrote:
>
> TypeError: __init__() got an unexpected keyword argument
> 'radio_admin'.
>
> Where did that come from?

Sounds like you may have some lingering .pyc files that might be  
causing this from newforms-admin if you have switched your copy of  
Django from newforms-admin to trunk.\

Brian Rosner
http://oebfare.com




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



Re: newforms and views.generic.create_update.create_object

2008-06-26 Thread timc3

Might be a stupid question but how did you apply the patch?

On May 12, 5:06 pm, Wes Winham <[EMAIL PROTECTED]> wrote:
> I've been using Brian Rosner's patch from that ticket, and it's been
> working great for me. I haven't ran in to any bugs so far and it's cut
> my view code down by several lines each view in some places and
> completely eliminated view code in many others. Gotta love newforms
> and modelforms :)
>
> I might be a little dense, but the documentation was a little
> confusing as far as what parameters I needed to pass, so I had to look
> at the great test cases that were added with that patch. So if seeing
> examples helps, I recommend checking out the url_conf for the
> generic.create_update tests.
>
> -wes
>
> On May 11, 10:10 am, "M.Ganesh" <[EMAIL PROTECTED]> wrote:

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



Re: I'm sure this is one of those clueless newbie mistakes

2008-06-26 Thread Colin Bean

For a start, you want your KVM model to subclass models.Model.

Colin

On Thu, Jun 26, 2008 at 11:59 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Karen;
>
> On Jun 26, 12:56 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>> If you post the contents of your cmdb/models.py file on someplace like
>> dpaste.com someone might be able to help identify what is going on.
>
> Thanks for that advice.
>
> You can find my models.py at:
>
> http://pastebin.sfee-hosted.com/562
>
> There's a very good possibility that I've screwed something
> fundamental up, so don't be afraid to tell me that my implementation
> is totally incorrect.
>
> Ian
> >
>

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



Validation Problem with ModelChoiceField

2008-06-26 Thread mwebs

Hello,
I have a serious validation problem with a form using a
ModelSchoiceField.

Forms:

class MyModelChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return "%s" % obj.name

class PictureForm(forms.Form):
image  = forms.ImageField(label='Picture')
gallery= MyModelChoiceField(models.Gallery.objects.none(),
empty_label=None)
__

View:
picture_form = forms.PictureForm()
picture_form.fields['gallery'].queryset = Gallery.objects.filter(...)

It displays all fine, my ModelchoiceField has all Gallery-Entries I
pass.
But when it comes to validation an ValidationError is raised.

I cannot understand this at all. Everthing is properly passed to the
server.
request.POST['gallery']  is the right Gallery-id, everthing seems fine
but it does not work.

Please help me, these ModelChoiceField drive me crazy!

Thanks, Toni



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



Re: I'm sure this is one of those clueless newbie mistakes

2008-06-26 Thread [EMAIL PROTECTED]

Karen;

On Jun 26, 12:56 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> If you post the contents of your cmdb/models.py file on someplace like
> dpaste.com someone might be able to help identify what is going on.

Thanks for that advice.

You can find my models.py at:

http://pastebin.sfee-hosted.com/562

There's a very good possibility that I've screwed something
fundamental up, so don't be afraid to tell me that my implementation
is totally incorrect.

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



User Filtering

2008-06-26 Thread Greg Taylor

I've got a model that represents a boat of rowers which has eight
seats (order is important). The easiest way to handle this was a model
with eight foreign keys:

class Boat(models.Model):
  seat_1 = models.ForeignKey(User)
  [...]
  seat_8 = models.ForeignKey(User)

Which is fine and great, but now in the user-space boat editing page,
we have to go through a large list of usernames for each seat to find
the person we're looking for. The site refers to everyone by their
full names, usernames are only used for logging in, so we need to be
able to filter or auto-complete based on first/last name (which is not
a problem).

Does anyone know of a good way to let them quickly search by name and
set these seats without having to navigate away from the page? Any
AJAX utilities to recommend? I looked at YUI auto-complete, but that
might get tricky since ForeignKey expects an integer in this case
(id=int). It's very easy to set up auto-complete, but I'm not sure of
the best way to have it set the Int.

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



problem getting mod_python to serve application..

2008-06-26 Thread Adi

I get the following error when I hit my website http://ipaddress/enterathletes/

DocumentRoot:   '/var/www/html'

URI:'/enterathletes/'
Location:   '/enterathletes/'
Directory:  None
Filename:   '/var/www/html/enterathletes'
PathInfo:   '/'

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
1202, in _process_target
module = import_module(module_name, path=path)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
304, in import_module
return __import__(module_name, {}, {}, ['*'])

ImportError: No module named django.core.handlers.modpython

In my /usr/lib/python2.5/site-packages, I have
lrwxrwxrwx  1 root root 34 Jun 25 13:52 django -> /home/adi/django-
trunk/django/

In my python.conf apache conf file,

LoadModule python_module modules/mod_python.so

# Override type-map handler for /var/www/manual


SetHandler default-handler




SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonPath "['/home/adi/Enterathletes_py/src','/home/arustgi/
django-trunk'] + sys.path"


I was able to do
python manage.py validate
and
python manage.py load data
from '/home/adi/Enterathletes_py/src/mysite

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



Re: How to use dynamic choice in a ChoiceField

2008-06-26 Thread M.Ganesh

mwebs wrote:
> Thanks Nathaniel,
>
> but where and how do I pass the Queryset? From my view?
> I am sorry but I dont understand completly
>
> class MyModelChoiceField(forms.ModelChoiceField):
> def label_from_instance(self, obj):
> return "My Object #%i" % obj.id
>
>
> class PictureForm(forms.Form):
> image  = forms.ImageField(label='Picture')
> gallery= MyModelChoiceField(..)
>   

No, don't be carried away by the example provided there, that is for a 
slightly complicated case.

class MyForm(forms.Form):
image=  forms.ImageField(label='Picture')
gallery   =  forms.ModelChoiceFiled(/your/query/goes/here)

def my_view(request):
if request.method == 'POST':
form = MyForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect(/sucess/page)
else:
form = MyForm()
return render_to_response('your_template.html, {'form': form})


Hope this helps

Regards Ganesh


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



Re: Do you code django with Komodo?

2008-06-26 Thread rskm1

On Jun 24, 4:22 pm, Tye <[EMAIL PROTECTED]> wrote:
> Semi-off-topic:
> Does anybody know how to get notepad to save as UTF-8 by default? It
> keeps trying ANSI, and I keep hating.

Unlikely; Notepad is REALLY lightweight.
Wordpad is MUCH better; it handles files >64K, files with UNIX-style
linebreaks, and files with foreign characters.  So if you're stuck
with Windows and don't want to install any third-party stuff, just use
Wordpad and forget that Notepad even exists.

Personally, I'm running Linux with KDE, and "kwrite" and "kdevelop"
both have pretty good Python syntax recognition builtin.  "kdevelop"
even has tabs and a navigator like the Eclipse IDE, but seems to be
less "bloated".  (haven't tried Komodo; freeIDE>$IDE =)

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



Re: Blank choice for USStateField?

2008-06-26 Thread Huuuze

You da man.  That worked perfectly.

Just out of curiosity, are the Django devs working on a patch?  I
wasn't able to find a ticket for this issue.


On Jun 26, 12:46 pm, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
> On Jun 26, 8:29 am, Huuuze <[EMAIL PROTECTED]> wrote:
>
> > How can I add an empty value as the initial value?
>
> At the moment you have do a bit of leg-work for this. Something like
> the following should work (untested)::
>
>     from django.contrib.localflavor.us.us_states import STATE_CHOICES
>     from django.contrib.localflavor.us.forms import USStateField
>
>     class YourModelForm(forms.ModelForm):
>         class Meta:
>             ...
>
>         YOUR_STATE_CHOICES = list(STATE_CHOICES)
>         YOUR_STATE_CHOICES.insert(0, ('', '-'))
>         state = USStateField(widget=forms.Select(
>                 choices=YOUR_STATE_CHOICES))
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Attachments in Django

2008-06-26 Thread Greg Lindstrom

I am just about ready to launch my first Django Website!  It for a
local gym where my daughter trains and I offered to rewrite their
current site because it's out of date (www.sonshineacademy.com).  I've
set up the database to handle their announcements and I think it's
going to work out fine.  Now to get hosting and, hopefully, have it up
in a couple of weeks (not bad, seeing as I started learning it at
PyCon this year).

My question deals with handling attachments to the announcements.  I
have it set up so all announcements are displayed on the home page and
then each program (gymnastics, dance, cheer leading, etc.) will have
only the announcements flagged for them on their individual home
pages.  I would like to set things up so we can have downloads (pdf,
Word, etc.) because they tend to have a lot of maps, meet information,
schedules, etc. associated with the announcement.  My intention is to
create a "download_info" table with a description, the path to the
file, and a link to the announcement table then display all of the
associated downloads for any given announcement (the users can clink
on the annoucement on the main page and the announcement gage come up
with the details).Can I, or rather how do I, create a link that
will either display or download the file given a link?  Would I put
the actual files in a sub directory of the "site_media" directory?

Does that make sense?

Thanks for your help,

--greg

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



Re: How to use dynamic choice in a ChoiceField

2008-06-26 Thread M.Ganesh

mwebs wrote:
> Hello,
>
> I am trying to do something like this
>
> class PictureForm(forms.Form):
> image  = forms.ImageField(label='Picture')
> gallery= forms.ChoiceField(Gallery.objects.all())
>
> this just works fine, but I only want to pass several Galleries to the
> ChoiceField...
> something like:
>
> ...
> gallery = forms.ChoiceField(Gallery.objects.filter( ...))
>
> so how can I do this?
>
> Thanks,Toni
>
>   
Have a look at ModelChoiceField

http://www.djangoproject.com/documentation/newforms/#fields-which-handle-relationships


Regards Ganesh


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



Is it possible to collapse stacked or table inline in newforms-admin?

2008-06-26 Thread AmanKow

I don't want to collapse the individual items, but the whole stack or
table.  Anyone know how to go about this?
Thanks
Wayne
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ModelChoiceField setting value manually

2008-06-26 Thread mwebs

Hello,

I try to set data for a ModelChoiceField() manually. This means the
data is not in my db, so it s not in a Queryset.

my form:

class PictureForm(forms.Form):
image  = forms.ImageField(label='Picture')
gallery= MyModelChoiceField(models.Gallery.objects.none(),
empty_label=None)
-

If there are galleries I populate the modelChoiceField like this:

  [1]  picture_form.fields['gallery'].queryset =
Gallery.objects.filter(...)
---

if ther are no Galleries I want to populate the modelChoiceField with
an entry "Default"

Default

this Default-select-option I want to fill in manually, because it does
not exist in the DB.


because it works the [1]-way I thought about building a queryset
manually, but I could not figure out how to do this.
Can anyone please give me a short example how to build and fill a
queryset manually, or show me a more elegeant way how to populate the
modelchoicefield with data not comming from the database.

Thanks,Toni



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



Re: I'm sure this is one of those clueless newbie mistakes

2008-06-26 Thread Karen Tracey
On Thu, Jun 26, 2008 at 12:22 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> I'm a little stumped right now.
>
> I'm trying to run syncdb, on a project that I'm really just starting
> to work on/build, and I get this error message:
>
> [EMAIL PROTECTED]:~/NotBackedUp/cmdb-svn/src/cmdb$ python manage.py
> syncdbError: Couldn't install apps, because there were errors in one
> or more models:
> cmdb.cmdb: __init__() takes at least 3 arguments (2 given)
>
> I'm not really sure where I should begin debugging this particular
> error message.  When checking online a few different places, I didn't
> really see anything definitive that would point me in the right
> direction.
>

If you post the contents of your cmdb/models.py file on someplace like
dpaste.com someone might be able to help identify what is going on.

Karen

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



Re: Unexpected Keyword Argument 'radio_admin'

2008-06-26 Thread Karen Tracey
On Thu, Jun 26, 2008 at 12:09 PM, Alfonso <[EMAIL PROTECTED]> wrote:

>
> Just updated to latest svn checkout of Django and seeing this error
> for the first time at root (across the entire site actually)??
>
> TypeError: __init__() got an unexpected keyword argument
> 'radio_admin'.
>
> Where did that come from?
>
> Help appreciated!
>

Are you using newforms-admin?  The radio_admin stuff was recently
implemented there, meaning support for the old way of specifying radio_admin
was removed (previously on newforms-admin it was just being ignored).

If you are using trunk I'm confused how you could hit this, since I just
verified that the old way of specifying radio_admin still works there
(r7770).  If you are using newforms-admin, see:

http://code.djangoproject.com/wiki/NewformsAdminBranch

for the new proper way to specify radio fields in admin.

Karen

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



Re: Blank choice for USStateField?

2008-06-26 Thread Nathaniel Whiteinge

On Jun 26, 8:29 am, Huuuze <[EMAIL PROTECTED]> wrote:
> How can I add an empty value as the initial value?

At the moment you have do a bit of leg-work for this. Something like
the following should work (untested)::

from django.contrib.localflavor.us.us_states import STATE_CHOICES
from django.contrib.localflavor.us.forms import USStateField

class YourModelForm(forms.ModelForm):
class Meta:
...

YOUR_STATE_CHOICES = list(STATE_CHOICES)
YOUR_STATE_CHOICES.insert(0, ('', '-'))
state = USStateField(widget=forms.Select(
choices=YOUR_STATE_CHOICES))
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Timeout for URLField?

2008-06-26 Thread jabbercat

Hello,

does somebody know if there is a possibility to specify a timeout for
the URLField? I'm just using a URLField, but if the URL is not correct
the URLField needs a lot of time to response with an error.

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



Stability of trunk and 1.0 target: experience, testimonials?

2008-06-26 Thread J Meier

Hi folks,

I'm trying to champion Django trunk/1.0 as part of a small project in
a mid-sized city newspaper office. There is some worry about choosing
a framework which does not currently have a stable release. I've been
addressing these worries with examples of the stability of trunk and
the excellent planning and engineering of the project in general.
Never the less, it would be valuable to me to have testimonials from
others using or targeting trunk/1.0 in their applications, especially
from traditional businesses. I think such testimonials could also help
others get steam behind the 1.0 effort in organizations which are wary
of support and stability.

So I'd like to request that, if you have time and inclination, such
users would post or email testimonials explaining your use of Django,
experience with it's stability over time, confidence in the core
developers, and (and here's where the higher-ups are interested) the
size and nature of your project and company.

Please help us avoid PHP!

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



I'm sure this is one of those clueless newbie mistakes

2008-06-26 Thread [EMAIL PROTECTED]

I'm a little stumped right now.

I'm trying to run syncdb, on a project that I'm really just starting
to work on/build, and I get this error message:

[EMAIL PROTECTED]:~/NotBackedUp/cmdb-svn/src/cmdb$ python manage.py
syncdbError: Couldn't install apps, because there were errors in one
or more models:
cmdb.cmdb: __init__() takes at least 3 arguments (2 given)

I'm not really sure where I should begin debugging this particular
error message.  When checking online a few different places, I didn't
really see anything definitive that would point me in the right
direction.

Thanks;

Ian

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



Re: Unicode issue in Admin

2008-06-26 Thread Lee Hinde



On Jun 26, 4:10 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2008-06-26 at 01:41 -0700, Lee Hinde wrote:
> > Hi;
>
> > Exhibits are here:
>
> >http://hinde.net/clients/djangoq/
>
> > Summary, I have accented data that displays fine in my sql browser,
> > but shows up funky in django admin.
>
> > Using revision 7763.
>
> > Using __unicode__ not __str__
>
> > Any pointers would be appreciated.
>
> Looks a lot like your database character encoding is incorrect. What
> program are you using to display what you think is the "correct" input
> in the top part of the screenshot? If it's something PHP-based, it's
> untrustworthy, since PHP's UTF-8 encoding handling with databases seems
> to be broken.
>
> What database are you using? What have you done to ensure that the
> encoding on the server side for storing the database is able to store
> the characters (e.g. making sure it's UTF-8 or UTF-16 or something
> similar)?
>
> I am very confident that when the server-side database encoding is set
> appropriately, Django stores and retrieves data correctly, so look
> carefully at your database.

Thanks Malcom.  I'm using MySQL. I checked the data with a different
client and you're correct, the data appears munged.


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



Unexpected Keyword Argument 'radio_admin'

2008-06-26 Thread Alfonso

Just updated to latest svn checkout of Django and seeing this error
for the first time at root (across the entire site actually)??

TypeError: __init__() got an unexpected keyword argument
'radio_admin'.

Where did that come from?

Help appreciated!

Alfonso

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



Re: Group by week

2008-06-26 Thread Chris H.

On Jun 26, 10:44 am, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> Chris, I have a utility function that does this for me.  You can call it
> from your view, or if you set things up right from your template:

Good stuff, Scott.  Thanks!  Might be worth turning into a proper
template tag/filter at some point.  I'll look into expanding it at
some point and posting to djangosnippets.  But for now, it gets me
what I need.  Much appreciated!

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



Re: how to get form fields to show

2008-06-26 Thread Bobby Roberts

> Hey no problem -- great you are learning new skills after that much
> time. I did not mean to sound abrasive.

I don't think you sounded abrasive @ all... I appreciate the hand up
on this stuff.  Definitely different (and a hell of a lot better) than
programming with MS.

here's what i've added to my urls.py

from django.conf.urls.defaults import *
from billpay.views import *   # my app is called billpay

urlpatterns = patterns('',
(r'/step-1.html', 'billpay.views.DoPayDetailForm'),
)


Wouldn't this call the dopaydetailform view if you went to  the page /
step-1.html ?


BR





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



Re: views.py: Always a simple return?

2008-06-26 Thread Norman Harman

RossGK wrote:
> 
> Stuff

I think you don't want HTTP.

In other words you are wanting (like the Comet folks) HTTP to do things 
it was not designed to do.  In other words you are avoiding its 
strengths and chasing after its weaknesses.

Not sure what your real requirement is but,

Look at the Meta Refresh Tag 
http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm

Which AJAX is an improvement on, which sounds like you are already using 
and I'm not sure why it doesn't work for you.  And stateless requests 
are far more elegant than open TCP connections.  There are reasons the 
HTTP Internet has exploded in a way client server never did.

 From my understanding of Comet it's more or less exactly what you are 
asking for.  http://www.google.com/search?q=django%20comet

-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___
You've got fun!  Check out Austin360.com for all the entertainment
info you need to live it up in the big city!

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



Re: Django setup with apache

2008-06-26 Thread Peter Rowell

You didn't share with us the specific error you are getting.

I strongly recommend a) DEBUG=True in settings.py, and b) checking
your Apache error_log.

If you are getting a generic Apache 404, then the problem will be in
the Apache httpd.conf or .htaccess files. If you are getting a Django
404, then the problem is in urls.py and the DEBUG output can be very
informative.


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



Re: Group by week

2008-06-26 Thread Scott Moonen
Chris, I have a utility function that does this for me.  You can call it
from your view, or if you set things up right from your template:

from datetime import date
def most_recent_Sunday(dt = None) :
  if dt is None : dt = date.today()
  return date.fromordinal(date.toordinal(dt) - (dt.weekday() + 1) %7)

  -- Scott

On Thu, Jun 26, 2008 at 11:36 AM, Chris H. <[EMAIL PROTECTED]>
wrote:

>
> I have a view which returns a group of upcoming events.  I would like
> to display the events grouped by week:
>
> Week of June 22
> * Event 1
> * Event 2
> * Event 3
>
> Week of June 29
> * Event 4
> * Event 5
> * Event 6
>
> I've seen examples for doing this using the ifchanged tag, and I've
> got that working.  But I can't seem to figure out how to display the
> beginning of the week as the heading since the first event isn't
> always a Sunday.  Any thoughts or pointers?
> >
>


-- 
http://scott.andstuff.org/ | http://truthadorned.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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: base template and views

2008-06-26 Thread Eric Abrahamsen

Probably what you want is to make a custom template tag that does the  
proper query-to-html business, and then stick that tag in your base  
template. Might want to look into caching the result, if it doesn't  
change often...

http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags


Eric



On Jun 26, 2008, at 11:14 PM, moonsand wrote:

>
> I have a design issue where i want to have a standard base template
> display a list of database entries with a count for the most popular
> entries. If I am using this as the base template this means that I
> need to pass the list and the calculated count from any view which
> calls any template which extends the base template. I can't help but
> think I am going about this the wrong way since I am repeating code
> and procedure in the views section. Anyone know what I really ought to
> be doing?
>
> Many thanks.
> >


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



Group by week

2008-06-26 Thread Chris H.

I have a view which returns a group of upcoming events.  I would like
to display the events grouped by week:

Week of June 22
* Event 1
* Event 2
* Event 3

Week of June 29
* Event 4
* Event 5
* Event 6

I've seen examples for doing this using the ifchanged tag, and I've
got that working.  But I can't seem to figure out how to display the
beginning of the week as the heading since the first event isn't
always a Sunday.  Any thoughts or pointers?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unit test problem

2008-06-26 Thread Norman Harman

Malcolm Tredinnick wrote:
> Status code 302 is an HTTP redirect, which is what you would expect to
> see, since your view is always returning a HttpResponseRedirect. The
> test framework doesn't follow redirects.

What about? assertRedirects(response, expected_url, status_code=302, 
target_status_code=200)

http://www.djangoproject.com/documentation/testing/#assertions

-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___
You've got fun!  Check out Austin360.com for all the entertainment
info you need to live it up in the big city!

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



Re: how to get form fields to show

2008-06-26 Thread Matthias Kestenholz

On Thu, 2008-06-26 at 08:19 -0700, Bobby Roberts wrote:
> > But you should really start with the tutorial[1] or the Django Book[2].
> > The documentation for Django is really outstanding, you'll progress much
> > faster if you do some more reading.
> >
> > [1]:http://www.djangoproject.com/documentation/
> > [2]:http://www.djangobook.com/
> 
> 
> -
> Yeah i've got these bookmarked and hit them all the time.  Bear with
> me.  I've been a MS programmer since 1992 so i'm having to unwire my
> brain to learn how to program correctly.
> 
> :)

Hey no problem -- great you are learning new skills after that much
time. I did not mean to sound abrasive.


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



Re: base template and views

2008-06-26 Thread Peter Rowell

> Anyone know what I really ought to be doing?

What you want is a default context. Look at
http://www.djangoproject.com/documentation/templates_python/#playing-with-context-objects

Also see 
http://www.djangoproject.com/documentation/settings/#template-context-processors.

Pretty much all of our views end with something like this:

return render_to_response('some_template_name.html',
RequestContext(request, {
   'title': 'My Title,etc. etc.
   }))

RequestContext will automatically call each of the
TEMPLATE_CONTEXT_PROCESSORS listed in the settings.py file.

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



Re: how to get form fields to show

2008-06-26 Thread Bobby Roberts

> But you should really start with the tutorial[1] or the Django Book[2].
> The documentation for Django is really outstanding, you'll progress much
> faster if you do some more reading.
>
> [1]:http://www.djangoproject.com/documentation/
> [2]:http://www.djangobook.com/


-
Yeah i've got these bookmarked and hit them all the time.  Bear with
me.  I've been a MS programmer since 1992 so i'm having to unwire my
brain to learn how to program correctly.

:)

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



Re: how to get form fields to show

2008-06-26 Thread Matthias Kestenholz

On Thu, 2008-06-26 at 08:10 -0700, Bobby Roberts wrote:
> Hey -
> 
> i've only included a single line in my urls file as follows:
> 
> urlpatterns=patterns('django.views.generic.simple',
> (r'step-1.html', 'direct_to_template', {'template':
> 'step1.html'}),
> 
> 
> This obviously calls my html page.  how do i call the view?
> 
> 

Add another section, something like that:

urlpatterns += patterns('',
  (r'^whatever/$', 'your_project.your_app.views.DoPaymentDetailForm'),
)


But you should really start with the tutorial[1] or the Django Book[2].
The documentation for Django is really outstanding, you'll progress much
faster if you do some more reading.

[1]: http://www.djangoproject.com/documentation/
[2]: http://www.djangobook.com/



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



base template and views

2008-06-26 Thread moonsand

I have a design issue where i want to have a standard base template
display a list of database entries with a count for the most popular
entries. If I am using this as the base template this means that I
need to pass the list and the calculated count from any view which
calls any template which extends the base template. I can't help but
think I am going about this the wrong way since I am repeating code
and procedure in the views section. Anyone know what I really ought to
be doing?

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



Re: how to get form fields to show

2008-06-26 Thread Bobby Roberts

> Do you have an URLconf entry for your DoPaymentDetailForm view? Are you
> sure, the view gets called?
> Maybe you have an error in your Django Template? How do you access the
> fields? (Something like {{ form.your_field }} should work.)
>
> Matthias


My urls.py file only has the call for the template at this time...


urlpatterns=patterns('django.views.generic.simple',
(r'step-1.html', 'direct_to_template', {'template':
'step1.html'}),


How do I call the view?

BR

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



language should be part of the url

2008-06-26 Thread pihentagy

Hi!

As I read in 
http://groups.google.com/group/django-users/browse_thread/thread/f8558f8c4c0de564/28ae8a6ecbb921ff
the current language should be part of the URL.

Just a little question: how can I achieve that without messing up all
my reverse function, and of course links in the template... and
companion?

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



Re: how to get form fields to show

2008-06-26 Thread Bobby Roberts

Hey -

i've only included a single line in my urls file as follows:

urlpatterns=patterns('django.views.generic.simple',
(r'step-1.html', 'direct_to_template', {'template':
'step1.html'}),


This obviously calls my html page.  how do i call the view?



BR


On Jun 26, 10:52 am, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> On Thu, 2008-06-26 at 07:30 -0700, Bobby Roberts wrote:
> > hey -
>
> > got a quick question.  I think i'm missing part of the puzzle here.
>
> > I have a form set up in a forms.py file.  In my template i have it
> > hand coded instead of using {{form.as_table}} because I want to be
> > very specific on how it looks and operates.
>
> > I have a view as follows:
>
> > def PayDetailForm (request):
> >     if request.method =='POST':
> >         form = PayDetailForm (request.POST)
> >     else:
> >         form = PayDetailForm()
> >     return render_to_response('step-1.html',{'form': form}
>
> > The form fields are not showing up when i go to view the page but
> > everything else is.  Any idea what i could be missing?
>
> Simple: You should not use the same name for your view method and for
> the form class.
>
> Matthias
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to get form fields to show

2008-06-26 Thread Matthias Kestenholz

On Thu, 2008-06-26 at 08:01 -0700, Bobby Roberts wrote:
> Hi Matthias -
> 
> I changed my view name to DoPaymentDetailForm and still no luck.  Does
> something have to call this view or does Django just do it
> automatically?
> 
> 

I'm not sure what you are talking about. Django does nearly nothing
automatically (remember, "Explicit is better than implicit." from the
Zen of Python).

It's hard to tell why it is not working for you without more
information. Here are some questions for you:

Do you have an URLconf entry for your DoPaymentDetailForm view? Are you
sure, the view gets called?
Maybe you have an error in your Django Template? How do you access the
fields? (Something like {{ form.your_field }} should work.)

Matthias


-- 
BTW: Top-posting sucks


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



Django setup with apache

2008-06-26 Thread Gorm

Hi all,

I have a weird problem hitting the methods matched through urls.py.
My setup works through when I just set it up manually using

python manage.py runserver 0.0.0.0:8000 etc, but not when using apache

The path to the the application
is /home/dradmin/wwwroot/php/drmu/sommerspil

I have verified that I hit the correct directory by going to
http://.../sommerspil/ with a browser. However it tells me that
http://.../sommerspil/login/ does not exist, (and it doesn't, since
login is a script under sommerspil/spil/login, etc). Again, using
runserver the request is correctly handled with django, but when using
apache.

My urls.py file look like:

from sommerspil.spil.views import *

urlpatterns = patterns('',

(r'^/php/drmu/sommerspil/',include('normal.root.urls')),
   (r'^register/', register),
   (r'^setupdatabase/', setupDatabase),
   (r'^login/',  loginUser),
   (r'^setroute/$',  setRoute),
   (r'^updatetonextday/$',  updateToNextDay),
   (r'^(?P.*)$',
'django.views.static.serve',
{'document_root': '/home/dradmin/wwwroot/'}),
)


I have also added sommerspil.spil to the list of applications in
settings.py

the setup in the apache configuration looks like

 
SetHandler python-program
PythonPath "sys.path +
['/home/dradmin/wwwroot/php/drmu']"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE sommerspil.settings
PythonDebug On


Please, is there anyone who can me a hint to what I am doing wrong? I
have a sneaking feeling, that it is just a little mistake somewhere,
that I have to figure out.

Cheers,
Gorm

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



Re: how to get form fields to show

2008-06-26 Thread Bobby Roberts

Hi Matthias -

I changed my view name to DoPaymentDetailForm and still no luck.  Does
something have to call this view or does Django just do it
automatically?



BR

On Jun 26, 10:52 am, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> On Thu, 2008-06-26 at 07:30 -0700, Bobby Roberts wrote:
> > hey -
>
> > got a quick question.  I think i'm missing part of the puzzle here.
>
> > I have a form set up in a forms.py file.  In my template i have it
> > hand coded instead of using {{form.as_table}} because I want to be
> > very specific on how it looks and operates.
>
> > I have a view as follows:
>
> > def PayDetailForm (request):
> >     if request.method =='POST':
> >         form = PayDetailForm (request.POST)
> >     else:
> >         form = PayDetailForm()
> >     return render_to_response('step-1.html',{'form': form}
>
> > The form fields are not showing up when i go to view the page but
> > everything else is.  Any idea what i could be missing?
>
> Simple: You should not use the same name for your view method and for
> the form class.
>
> Matthias
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: wizard authentication

2008-06-26 Thread twenger26

That fixed the problem, thanks!

On Jun 26, 6:00 am, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
> On Jun 25, 12:13 pm, twenger26 <[EMAIL PROTECTED]> wrote:
>
> > def wrapper_for_wizard(request):
> > return AddOrderWizard([OrderForm1, OrderForm2Quote, OrderForm3])
>
> You're on the right track! You need to pass your list of forms to the
> wizard constructor, as you're doing, as well as pass the request
> object when instantiating the form. Try this::
>
> return AddOrderWizard([OrderForm1, ...])(request)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Need help with django poll tutorial (poll form doesn't work)

2008-06-26 Thread Mog

Actually I did have spaces. I removed them and BAM... they worked!

Thanks for you help.

On Jun 26, 9:42 am, phillc <[EMAIL PROTECTED]> wrote:
> 
>
> do you have spaces around post?
>
> i dont even know if that would cause the problem.
>
> if you ar eusing the dev console, the way to debug is use the print
> statement
>
> so put these someplace and tell us what you get
>
> print request.method
> print request.POST['choice']
>
> On Jun 26, 9:29 am, Mog <[EMAIL PROTECTED]> wrote:
>
> > Here is the model.py file:
>
> > from django.db import models
> > import datetime
>
> > class Poll(models.Model):
> >     question = models.CharField(maxlength = 200)
> >     pub_date = models.DateTimeField('date published')
> >     def __str__(self):
> >         return self.question
> >     def was_published_today(self):
> >         return self.pub_date.date() == datetime.date.today()
> >     was_published_today.short_description ='Published today?'
> >     class Admin:
> >         fields = (
> >             (None, {'fields': ('question',)}),
> >             ('Date information', {'fields': ('pub_date',), 'classes':
> > 'collapse'}),
> >         )
> >         list_display = ('question', 'pub_date', 'was_published_today')
> >         list_filter = ['pub_date']
> >         search_fields = ['question']
> >         date_hierarchy = 'pub_date'
>
> > class choice(models.Model):
> >     poll = models.ForeignKey(Poll, edit_inline = models.TABULAR,
> > num_in_admin = 3)
> >     choice = models.CharField(maxlength = 200, core = True)
> >     votes = models.IntegerField(core = True)
> >     def __str__(self):
> >         return self.choice
>
> > On Jun 26, 8:27 am, Mog <[EMAIL PROTECTED]> wrote:
>
> > > the form's method is post:
>
> > > {{ object.question }}
>
> > > {% if error_message %}{{ error_message }}{%
> > > endif %}
>
> > > 
> > > {% for choice in object.choice_set.all %}
> > >        > > "choice{{ forloop.counter}}" value = "{{ choice.id}}" />
> > >        {{ choice.choice }} > > label>
> > >                 {{ choice.choice }}
> > > {% endfor %}
> > > 
> > > 
>
> > > On Jun 26, 2:29 am, bruno desthuilliers
>
> > > <[EMAIL PROTECTED]> wrote:
> > > > On 26 juin, 04:15, Mog <[EMAIL PROTECTED]> wrote:
>
> > > > > I'm new to Django and I've been able to get to the end of the Django
> > > > > tutorial using localhost as my server. for some reason I can't get the
> > > > > form poll to recognize my choices. Regardless whether I click on the
> > > > > radio buttons and click vote or if I just click vote without
> > > > > selecting, I always get the screen saying "You didn't select a
> > > > > choice".
>
> > > > > Here is code from my urls.py ->
>
> > > > > from django.conf.urls.defaults import *
> > > > > from djangoblogproject.polls.models import Poll
>
> > > > > info_dict = {
> > > > >     'QuerySet': Poll.objects.all(),
>
> > > > > }
>
> > > > > urlpatterns = patterns('',
> > > > >      (r'^$',
> > > > > 'django.views.generic.list_detail.object_list',info_dict),
> > > > >      (r'^(?P\d+)/$',
> > > > > 'django.views.generic.list_detail.object_detail',info_dict),
> > > > >      (r'^(?P\d+)/results/$',
> > > > > 'django.views.generic.list_detail.object_detail', dict(info_dict,
> > > > > template_name = 'polls/results.html')),
> > > > >      (r'^(?P\d+)/vote/$',
> > > > > 'djangoblogproject.polls.views.vote'),
>
> > > > > )
>
> > > > > and here is the code from my views.py file ->
>
> > > > > from djangoblogproject.polls.models import choice, Poll
> > > > > from django.shortcuts import render_to_response, get_object_or_404
> > > > > from django.http import HttpResponseRedirect
>
> > > > > def vote(request, poll_id):
> > > > >     p = get_object_or_404(Poll, pk = poll_id)
> > > > >     try:
> > > > >         selected_choice = p.choice_set.get(pk =
> > > > > request.POST['choice'])
> > > > >     except (KeyError, choice.DoesNotExist):
> > > > >         return render_to_response('polls/poll_detail.html', {
> > > > >             'object': p,
> > > > >             'error_message': "You didn't select a choice.",
> > > > >         })
> > > > >     else:
> > > > >         selected_choice.votes +=1
> > > > >         selected_choice.save()
> > > > >         return HttpResponseRedirect('/polls/%s/results/' % p.id)
>
> > > > > Anybody know what is causing the problem?
>
> > > > Sorry, you didn't show the template, form and models, and my crystal
> > > > ball is out for repair. Just to make sure : is the form's method GET
> > > > or POST, and is there any field named 'choice' whose value is a valid
> > > > pk for the Choice model objects related to the current Poll object ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~-

Re: how to get form fields to show

2008-06-26 Thread Matthias Kestenholz

Hi,

On Thu, 2008-06-26 at 07:30 -0700, Bobby Roberts wrote:
> hey -
> 
> got a quick question.  I think i'm missing part of the puzzle here.
> 
> I have a form set up in a forms.py file.  In my template i have it
> hand coded instead of using {{form.as_table}} because I want to be
> very specific on how it looks and operates.
> 
> I have a view as follows:
> 
> def PayDetailForm (request):
> if request.method =='POST':
> form = PayDetailForm (request.POST)
> else:
> form = PayDetailForm()
> return render_to_response('step-1.html',{'form': form}
> 
> 
> 
> The form fields are not showing up when i go to view the page but
> everything else is.  Any idea what i could be missing?
> 

Simple: You should not use the same name for your view method and for
the form class.

Matthias


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



Re: How to use dynamic choice in a ChoiceField

2008-06-26 Thread mwebs

Thanks Nathaniel,

but where and how do I pass the Queryset? From my view?
I am sorry but I dont understand completly

class MyModelChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return "My Object #%i" % obj.id


class PictureForm(forms.Form):
image  = forms.ImageField(label='Picture')
gallery= MyModelChoiceField(..)


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



Re: Need help with django poll tutorial (poll form doesn't work)

2008-06-26 Thread phillc



do you have spaces around post?

i dont even know if that would cause the problem.

if you ar eusing the dev console, the way to debug is use the print
statement

so put these someplace and tell us what you get

print request.method
print request.POST['choice']



On Jun 26, 9:29 am, Mog <[EMAIL PROTECTED]> wrote:
> Here is the model.py file:
>
> from django.db import models
> import datetime
>
> class Poll(models.Model):
>     question = models.CharField(maxlength = 200)
>     pub_date = models.DateTimeField('date published')
>     def __str__(self):
>         return self.question
>     def was_published_today(self):
>         return self.pub_date.date() == datetime.date.today()
>     was_published_today.short_description ='Published today?'
>     class Admin:
>         fields = (
>             (None, {'fields': ('question',)}),
>             ('Date information', {'fields': ('pub_date',), 'classes':
> 'collapse'}),
>         )
>         list_display = ('question', 'pub_date', 'was_published_today')
>         list_filter = ['pub_date']
>         search_fields = ['question']
>         date_hierarchy = 'pub_date'
>
> class choice(models.Model):
>     poll = models.ForeignKey(Poll, edit_inline = models.TABULAR,
> num_in_admin = 3)
>     choice = models.CharField(maxlength = 200, core = True)
>     votes = models.IntegerField(core = True)
>     def __str__(self):
>         return self.choice
>
> On Jun 26, 8:27 am, Mog <[EMAIL PROTECTED]> wrote:
>
> > the form's method is post:
>
> > {{ object.question }}
>
> > {% if error_message %}{{ error_message }}{%
> > endif %}
>
> > 
> > {% for choice in object.choice_set.all %}
> >        > "choice{{ forloop.counter}}" value = "{{ choice.id}}" />
> >        {{ choice.choice }} > label>
> >                 {{ choice.choice }}
> > {% endfor %}
> > 
> > 
>
> > On Jun 26, 2:29 am, bruno desthuilliers
>
> > <[EMAIL PROTECTED]> wrote:
> > > On 26 juin, 04:15, Mog <[EMAIL PROTECTED]> wrote:
>
> > > > I'm new to Django and I've been able to get to the end of the Django
> > > > tutorial using localhost as my server. for some reason I can't get the
> > > > form poll to recognize my choices. Regardless whether I click on the
> > > > radio buttons and click vote or if I just click vote without
> > > > selecting, I always get the screen saying "You didn't select a
> > > > choice".
>
> > > > Here is code from my urls.py ->
>
> > > > from django.conf.urls.defaults import *
> > > > from djangoblogproject.polls.models import Poll
>
> > > > info_dict = {
> > > >     'QuerySet': Poll.objects.all(),
>
> > > > }
>
> > > > urlpatterns = patterns('',
> > > >      (r'^$',
> > > > 'django.views.generic.list_detail.object_list',info_dict),
> > > >      (r'^(?P\d+)/$',
> > > > 'django.views.generic.list_detail.object_detail',info_dict),
> > > >      (r'^(?P\d+)/results/$',
> > > > 'django.views.generic.list_detail.object_detail', dict(info_dict,
> > > > template_name = 'polls/results.html')),
> > > >      (r'^(?P\d+)/vote/$',
> > > > 'djangoblogproject.polls.views.vote'),
>
> > > > )
>
> > > > and here is the code from my views.py file ->
>
> > > > from djangoblogproject.polls.models import choice, Poll
> > > > from django.shortcuts import render_to_response, get_object_or_404
> > > > from django.http import HttpResponseRedirect
>
> > > > def vote(request, poll_id):
> > > >     p = get_object_or_404(Poll, pk = poll_id)
> > > >     try:
> > > >         selected_choice = p.choice_set.get(pk =
> > > > request.POST['choice'])
> > > >     except (KeyError, choice.DoesNotExist):
> > > >         return render_to_response('polls/poll_detail.html', {
> > > >             'object': p,
> > > >             'error_message': "You didn't select a choice.",
> > > >         })
> > > >     else:
> > > >         selected_choice.votes +=1
> > > >         selected_choice.save()
> > > >         return HttpResponseRedirect('/polls/%s/results/' % p.id)
>
> > > > Anybody know what is causing the problem?
>
> > > Sorry, you didn't show the template, form and models, and my crystal
> > > ball is out for repair. Just to make sure : is the form's method GET
> > > or POST, and is there any field named 'choice' whose value is a valid
> > > pk for the Choice model objects related to the current Poll object ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: views.py: Always a simple return?

2008-06-26 Thread Scott Moonen
Ross, I had one more thought.

Are most browsers capable of using persistent HTTP for XMLHttpRequests?  If
so, and *assuming your main motivation is simply to be more efficient by
using a single HTTP connection* for your traffic, then I think you might be
able to implicitly exploit persistent HTTP to get what you want.  If you use
a pull model rather than a push model, and have the client make its requests
frequently enough that most browsers' timeouts don't tear down the
persistent HTTP connection, and if you ensure that your responses are
suitable for use with persistent HTTP (i.e., they contain a valid
Content-Length header), then I think you may satisfy your goal.

  -- Scott

On Thu, Jun 26, 2008 at 10:33 AM, Scott Moonen <[EMAIL PROTECTED]> wrote:

> Ross, it seems to me that there are a number of potential hurdles to
> holding a connection open for a long period:
>
>1. Some server configurations may require that requests be satisfied
>within a certain time period or else the connection will be reset.  Of
>course, since the server is under your control, you can probably ensure 
> this
>is not an issue.
>2. It seems possible to me that some browsers may have problems with
>this approach.  Specifically, they might not be willing to hold connections
>open for longer than a certain period, or they may not have a reliable 
> means
>for Javascript to access the partial data, or they may not have a means for
>Javascript to discard the already-read data (resulting in memory creep).
>I'm not sure any of these are the case, lacking personal experience in this
>area, but they are things you'd need to research and satisfy yourself of
>across multiple browsers and platforms.  Certainly there are Flash 
> streaming
>applications out there, so if you can elect to use Flash (or some other
>plugin) on the client-side then some of these client-side questions may go
>away.
>3. Many firewalls, intrusion detection systems, proxies, and NATs will
>likely have issues with long-running HTTP connections.  It is possible that
>a firewall or IDS will reset such connections; it is possible that a NAT
>mapping expiration will sever the connection (especially if the data is
>intermittent rather than continuous); and it is possible that a proxy
>reassignment (think AOL) or other configured proxy restrictions (e.g.,
>connection lifetime limits) will disrupt the connection as well.  Again,
>there are a large number of environments here you need to consider.  Some 
> of
>these issues may go away if you use a port other than 80, but many
>intermediate hosts are still smart enough to discover that you are using
>HTTP regardless of the port value.
>4. In cases where the data to be pushed is intermittent you may also
>need to enable and configure TCP keepalives to ensure that your connections
>and server threads don't linger any longer than necessary.
>5. How many clients do you expect to have?  If it's a large number,
>then you should weigh the potential cost of having many server-side request
>processing threads open simultaneously.  You may also find that you hit
>configuration limits on Apache threads (and Django threads if you are
>running using WSGI) that need to be raised.
>6. Performance is also a consideration here; what sort of model will
>these threads use to suspend or throttle themselves?  Will they select on
>some event that wakes them up to trigger a new notification?  Will they
>sleep for a specified amount of time and execute a query to determine if 
> new
>data is to be sent?  How will you ensure they aren't doing busy waits?  (By
>comparison, performance is of course still an issue for polling requests
>initiated by the client, there are just a different set of questions to be
>answered in that case.)
>7. If #5/#6 brought up a number of limitations, you might need to
>consider a server model that didn't couple threads to requests, but instead
>to some smaller transactional unit of work.  A thread could complete a
>transaction without the overall HTTP request being considered complete or
>the connection being closed.  Here you're ranging far out of normal HTTP
>territory and I'm not sure that most HTTP servers will suit your needs.  
> The
>good news is that you could still use Django's ORM for your database needs,
>but you'd probably not be able to use its url/view/template architecture. 
> :)
>
> It's certainly a very interesting set of problems to solve!  And this is
> not at all a bad model in general for some client-server applications.  But
> there are enough issues unique to using HTTP as a transport that would make
> solving these problems for all possible environments, and with good
> performance characteristics, fairly costly.
>
>   -- Scott
>
>
> On Thu, Jun 26, 2008 at 9:40 AM, RossGK <[EMAIL PROTECTED]> wrote:

  1   2   >