Re: Order by Relationship name

2008-01-23 Thread Rufman


This is my model:
class TestCaseSuite(models.Model):
id = models.IntegerField(primary_key=True)
hashid = models.CharField(max_length=390, blank=True)
name = models.ForeignKey(Strings, db_column='name',
related_name='tstcName')
url = models.ForeignKey(Text, db_column='url', related_name='url')
startsat = models.DateTimeField()
duration = models.IntegerField()
result = models.IntegerField()
applicationname = models.ForeignKey(Strings,
db_column='applicationname', related_name='applicationname',
db_index=True, blank=True)
hardwareversion = models.ForeignKey(Strings,
db_column='hardwareversion', related_name='hardwareversion',
db_index=True, blank=True)
executionenvironment = models.ForeignKey(Strings,
db_column='executionenvironment', related_name='executionenvironment',
db_index=True, blank=True)
releasetype = models.ForeignKey(Strings, db_column='releasetype',
related_name='releasetype', db_index=True, blank=True)
hostname = models.ForeignKey(Strings, db_column='hostname',
related_name='hostname', db_index=True, blank=True)
releasenumber = models.ForeignKey(Strings,
db_column='releasenumber', related_name='releasenumber',
db_index=True, blank=True)
tsreference = models.IntegerField(null=True, blank=True)
textid = models.ForeignKey(Text, null=True, db_column='textid',
related_name='tstcTextid', db_index=True, blank=True)

class Strings(models.Model):
id = models.IntegerField(primary_key=True)
string = models.CharField(max_length=765, blank=True)

How can I order by the related_name 'releasenumber' field 'string'?

Stephane
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Order by Relationship name

2008-01-23 Thread Rufman

This is my model:
id = models.IntegerField(primary_key=True)
hashid = models.CharField(max_length=390, blank=True)
name = models.ForeignKey(Strings, db_column='name',
related_name='tstcName')
url = models.ForeignKey(Text, db_column='url', related_name='url')
startsat = models.DateTimeField()
duration = models.IntegerField()
result = models.IntegerField()
applicationname = models.ForeignKey(Strings,
db_column='applicationname', related_name='applicationname',
db_index=True, blank=True)
hardwareversion = models.ForeignKey(Strings,
db_column='hardwareversion', related_name='hardwareversion',
db_index=True, blank=True)
executionenvironment = models.ForeignKey(Strings,
db_column='executionenvironment', related_name='executionenvironment',
db_index=True, blank=True)
releasetype = models.ForeignKey(Strings, db_column='releasetype',
related_name='releasetype', db_index=True, blank=True)
hostname = models.ForeignKey(Strings, db_column='hostname',
related_name='hostname', db_index=True, blank=True)
releasenumber = models.ForeignKey(Strings,
db_column='releasenumber', related_name='releasenumber',
db_index=True, blank=True)
tsreference = models.IntegerField(null=True, blank=True)
textid = models.ForeignKey(Text, null=True, db_column='textid',
related_name='tstcTextid', db_index=True, blank=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: Form adding new datum instead of updating existing datum

2008-01-23 Thread almostvindiesel

Bingo. I assumed (incorrectly) that the ModelForm class would
automatically incorporate the PK since it was auto-gened in the Model
class. Your fix does the trick.

Thanks Rajesh,

~John

On Jan 23, 9:55 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Alternatively, you can add the primary key to the instance like this:
>
> modified_recipe = f.save(commit=False)
> modified_recipe.pk = recipe_id # (where recipe_id is obtained as per
> my first response above)
>
> Now when you save modified_recipe, it will update the existing record.
>
> -Rajesh D
--~--~-~--~~~---~--~~
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: Trouble with pattern in urls.py

2008-01-23 Thread almostvindiesel

Got it. I am now regex semi-literate... this helped:
http://www.roblocher.com/technotes/regexp.aspx

For those interested, I changed the broken line to

(r'^chef/home/(?P[a-z]+)/(?P[a-z]+)/
$','mysite.chef.views.sort_recipes')

Thanks Ned

~John

On Jan 23, 2:59 pm, Ned Batchelder <[EMAIL PROTECTED]> wrote:
> I don't know if the URL you show is literally what you hit or not. If it
> is, then it doesn't match because "param1" doesn't match "\d+" which
> means one or more  digits.  Same for param2.
>
> --Ned.
>
>
>
> almostvindiesel wrote:
> > Hi all,
>
> > I'm new to regex/django/python, and I'm having trouble getting urls.py
> > to pass a request to a view. Specifically, when I hit:
>
> >http://django.mysite.com/chef/home/param1/param2/
>
> > I'd expect the 3rd from the last pattern to match:
>
> > ## my urls.py file ##
> > urlpatterns = patterns('',
> > (r'^chef/admin/home/$','mysite.chef.views.admin_home'),
> > (r'^chef/admin/edit/(?P\d+)/
> > $','mysite.chef.views.edit_recipe'),
> > (r'^chef/admin/add/$','mysite.chef.views.add_recipe'),
> > (r'^chef/admin/delete/(?P\d+)/
> > $','mysite.chef.views.delete_recipe'),
> > (r'^chef/admin/save/$','mysite.chef.views.save_recipe'),
> > (r'^chef/admin/error/$','mysite.chef.views.error'),
> > (r'^chef/admin/profile/$','mysite.chef.views.edit_profile'),
> > (r'^chef/home/$','mysite.chef.views.home'),
> > (r'^chef/home/(?P\d+)/(?P\d+)/
> > $','mysite.chef.views.sort_recipes'),
> > (r'^admin/', include('django.contrib.admin.urls')),
> > (r'^chef/', include('mysite.chef.urls')),
> > )
>
> > Instead I get a Page not found (404) error. All of my other requests
> > work fine. Any thoughts as to what I'm doing wrong?
>
> > Cheers,
>
> > ~John
>
> --
> Ned Batchelder,http://nedbatchelder.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: Passing form initial values from one view to another?

2008-01-23 Thread Kenneth Gonsalves


On 24-Jan-08, at 8:49 AM, Dennis wrote:

> Thanks again Jorge!!  This newsgroup is really fantastic!,

possibly - but is that an excuse for sending this mail 10 times?

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Capability Problem With Django ORM

2008-01-23 Thread xunSir

class Person(models.Model):
 PIN = models.CharField(maxlength=20, primary_key=True)
 Name = models.CharField(maxlength=20)

class Burse(models.Model):
 PIN = models.ForeignKey(Person)
 Cash = models.IntegerField()


With HTML Page:   show Burse

A person maybe has many Burse:
Per query Burse,  per query The person by the way, query All
Person(guess).
May:
   Per query Burse, query it's Person in cache;
   If not,  query Person in db, and save it to cache.
   Is it OK ?

I know a little relation in django's models (ORM).
Who can explain them ?
Note: Speaking  chinese is had best



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



How to get a model's fk's host class?

2008-01-23 Thread xunSir

class Person(models.Model):
 PIN = models.CharField(maxlength=20, primary_key=True)
 Name = models.CharField(maxlength=20)

class Burse(models.Model):
 PIN = models.ForeignKey(Person)
 Cash = models.IntegerField()
===
 p = Person(..)
 m = p._meta
 m.get_all_related_objects()Can get Burse !
=
Reverse That !
How to get Person with Burse ?

--~--~-~--~~~---~--~~
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: Passing form initial values from one view to another?

2008-01-23 Thread Dennis

Hi Jorge,

Thank you so much for the response!  This works perfectly.  Thanks for
cluing me in to request.GET.get() functionality.  I do have a slight
follow up here though.  Once this is implemented you end up with the
redirect URL looking something like this:

http://mygreatwebsite.com/django_app/process/?newcontext=22

Which seems okay, but I also have a couple of other fields I'd like to
default, so when we add in more fields, the URL can become unwieldy:

http://mygreatwebsite.com/django_app/process/?newcontext=22=new%20string

Which doesn't seem to be in line with django principles of readable
URL's.  Thinking about this a little longer I thought it might be a
good idea to take a urls.py approach to the problem and create a new
entry such as:

, (r'^process/defaultApplied/(?P\w+)/(?P\d+)/$',
'django_apps.projApp.views.process_task')

Then you could handle both types of defaults, e.g.:
http://mygreatwebsite.com/django_app/process/defaultApplied/context_id/22
http://mygreatwebsite.com/django_app/process/defaultApplied/name/new%20string

Which seems a lot better, but there's no way to pass *both* context_id
AND name at the same time in this approach.  Is there a better way I'm
not seeing?  Or am I just really making my life unnecessarily
difficult here and the GET approach is the best way to handle this?

Thanks again Jorge!!  This newsgroup is really fantastic!,
--Dennis

On Jan 22, 12:37 pm, "Jorge Gajon" <[EMAIL PROTECTED]> wrote:
> On Jan 20, 2008 11:58 PM, Dennis <[EMAIL PROTECTED]> wrote:
>
>
>
> > This works from the standpoint of getting back to the "process.html"
> > template with the new Context object selected on the original form.
> > However, since this is using render_to_response instead of a redirect,
> > the URL on the user's browser still holds the "create_context"
> > location.  So, when the user hits "submit" on the process.html page,
> > the form gets sent back to the "create_context" view and things don't
> > operate as expected (another context gets created rather than
> > submitting to the "process_task" view)
>
> > The ideal way to do this would be to HttpResponseRedirect in place of
> > the "render_to_response" but this doesn't allow me to pass the form
> > object or any kind of dictionary representing the initial values.  Is
> > there a way to do this?  Or am I going about this in the wrong manner?
>
> Hi Dennis,
>
> You are right that the ideal way would be to return an
> HttpResponseRedirect, and that's what I would do too.
>
> You can pass the id of the created context object as a parameter in
> the request back to the 'process_task' view.
>
> For example, your create_context view would look like this:
>
> def create_context( request ):
>    if request.method == 'POST':
>        form = CreateContextForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>            c = Context.objects.create(  name=data['name'] )
>            # Pass the context id in the 'newcontext' parameter
>            return HttpResponseRedirect('/process/?newcontext=%s' % c.id)
>    else:
>        form = CreateContextForm()
>        return render_to_response('create_projctx.html', {'form':form})
>
> Then your process_task view would be changed to check if there is a
> 'newcontext' parameter available in your request, in which case you
> use it to set the initial data of the form.
>
> def process_task(request):
>    if request.method == 'POST':
>        form = ProcessForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>
>            t = Task.objects.create( context=data['context']
>                                    , due_date=data['due_date'] )
>            return HttpResponseRedirect( request.META['HTTP_REFERER'] )
>    else:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>    return render_to_response('process.html', {'form': form})
>
> The important part here is this:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>
> You are setting an initial context depending on the value of the
> 'newcontext' request parameter, but because that parameter may not
> always be present you need to use the .get() method, the first
> parameter is the key to get from the dictionary and the second
> parameter is a value to return if the key is not found.
>
> In this case, when 'newcontext' is not found you'll get a None value
> back. After you create a new context on the other view and get
> redirected to process_task, there should be a value in the
> 'newcontext' request parameter, and the form will render with 

Re: Passing form initial values from one view to another?

2008-01-23 Thread Dennis

Hi Jorge,

Thank you so much for the response!  This works perfectly.  Thanks for
cluing me in to request.GET.get() functionality.  I do have a slight
follow up here though.  Once this is implemented you end up with the
redirect URL looking something like this:

http://mygreatwebsite.com/django_app/process/?newcontext=22

Which seems okay, but I also have a couple of other fields I'd like to
default, so when we add in more fields, the URL can become unwieldy:

http://mygreatwebsite.com/django_app/process/?newcontext=22=new%20string

Which doesn't seem to be in line with django principles of readable
URL's.  Thinking about this a little longer I thought it might be a
good idea to take a urls.py approach to the problem and create a new
entry such as:

, (r'^process/defaultApplied/(?P\w+)/(?P\d+)/$',
'django_apps.projApp.views.process_task')

Then you could handle both types of defaults, e.g.:
http://mygreatwebsite.com/django_app/process/defaultApplied/context_id/22
http://mygreatwebsite.com/django_app/process/defaultApplied/name/new%20string

Which seems a lot better, but there's no way to pass *both* context_id
AND name at the same time in this approach.  Is there a better way I'm
not seeing?  Or am I just really making my life unnecessarily
difficult here and the GET approach is the best way to handle this?

Thanks again Jorge!!  This newsgroup is really fantastic!,
--Dennis

On Jan 22, 12:37 pm, "Jorge Gajon" <[EMAIL PROTECTED]> wrote:
> On Jan 20, 2008 11:58 PM, Dennis <[EMAIL PROTECTED]> wrote:
>
>
>
> > This works from the standpoint of getting back to the "process.html"
> > template with the new Context object selected on the original form.
> > However, since this is using render_to_response instead of a redirect,
> > the URL on the user's browser still holds the "create_context"
> > location.  So, when the user hits "submit" on the process.html page,
> > the form gets sent back to the "create_context" view and things don't
> > operate as expected (another context gets created rather than
> > submitting to the "process_task" view)
>
> > The ideal way to do this would be to HttpResponseRedirect in place of
> > the "render_to_response" but this doesn't allow me to pass the form
> > object or any kind of dictionary representing the initial values.  Is
> > there a way to do this?  Or am I going about this in the wrong manner?
>
> Hi Dennis,
>
> You are right that the ideal way would be to return an
> HttpResponseRedirect, and that's what I would do too.
>
> You can pass the id of the created context object as a parameter in
> the request back to the 'process_task' view.
>
> For example, your create_context view would look like this:
>
> def create_context( request ):
>    if request.method == 'POST':
>        form = CreateContextForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>            c = Context.objects.create(  name=data['name'] )
>            # Pass the context id in the 'newcontext' parameter
>            return HttpResponseRedirect('/process/?newcontext=%s' % c.id)
>    else:
>        form = CreateContextForm()
>        return render_to_response('create_projctx.html', {'form':form})
>
> Then your process_task view would be changed to check if there is a
> 'newcontext' parameter available in your request, in which case you
> use it to set the initial data of the form.
>
> def process_task(request):
>    if request.method == 'POST':
>        form = ProcessForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>
>            t = Task.objects.create( context=data['context']
>                                    , due_date=data['due_date'] )
>            return HttpResponseRedirect( request.META['HTTP_REFERER'] )
>    else:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>    return render_to_response('process.html', {'form': form})
>
> The important part here is this:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>
> You are setting an initial context depending on the value of the
> 'newcontext' request parameter, but because that parameter may not
> always be present you need to use the .get() method, the first
> parameter is the key to get from the dictionary and the second
> parameter is a value to return if the key is not found.
>
> In this case, when 'newcontext' is not found you'll get a None value
> back. After you create a new context on the other view and get
> redirected to process_task, there should be a value in the
> 'newcontext' request parameter, and the form will render with 

Re: Passing form initial values from one view to another?

2008-01-23 Thread Dennis

Hi Jorge,

Thank you so much for the response!  This works perfectly.  Thanks for
cluing me in to request.GET.get() functionality.  I do have a slight
follow up here though.  Once this is implemented you end up with the
redirect URL looking something like this:

http://mygreatwebsite.com/django_app/process/?newcontext=22

Which seems okay, but I also have a couple of other fields I'd like to
default, so when we add in more fields, the URL can become unwieldy:

http://mygreatwebsite.com/django_app/process/?newcontext=22=new%20string

Which doesn't seem to be in line with django principles of readable
URL's.  Thinking about this a little longer I thought it might be a
good idea to take a urls.py approach to the problem and create a new
entry such as:

, (r'^process/defaultApplied/(?P\w+)/(?P\d+)/$',
'django_apps.projApp.views.process_task')

Then you could handle both types of defaults, e.g.:
http://mygreatwebsite.com/django_app/process/defaultApplied/context_id/22
http://mygreatwebsite.com/django_app/process/defaultApplied/name/new%20string

Which seems a lot better, but there's no way to pass *both* context_id
AND name at the same time in this approach.  Is there a better way I'm
not seeing?  Or am I just really making my life unnecessarily
difficult here and the GET approach is the best way to handle this?

Thanks again Jorge!!  This newsgroup is really fantastic!,
--Dennis

On Jan 22, 12:37 pm, "Jorge Gajon" <[EMAIL PROTECTED]> wrote:
> On Jan 20, 2008 11:58 PM, Dennis <[EMAIL PROTECTED]> wrote:
>
>
>
> > This works from the standpoint of getting back to the "process.html"
> > template with the new Context object selected on the original form.
> > However, since this is using render_to_response instead of a redirect,
> > the URL on the user's browser still holds the "create_context"
> > location.  So, when the user hits "submit" on the process.html page,
> > the form gets sent back to the "create_context" view and things don't
> > operate as expected (another context gets created rather than
> > submitting to the "process_task" view)
>
> > The ideal way to do this would be to HttpResponseRedirect in place of
> > the "render_to_response" but this doesn't allow me to pass the form
> > object or any kind of dictionary representing the initial values.  Is
> > there a way to do this?  Or am I going about this in the wrong manner?
>
> Hi Dennis,
>
> You are right that the ideal way would be to return an
> HttpResponseRedirect, and that's what I would do too.
>
> You can pass the id of the created context object as a parameter in
> the request back to the 'process_task' view.
>
> For example, your create_context view would look like this:
>
> def create_context( request ):
>    if request.method == 'POST':
>        form = CreateContextForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>            c = Context.objects.create(  name=data['name'] )
>            # Pass the context id in the 'newcontext' parameter
>            return HttpResponseRedirect('/process/?newcontext=%s' % c.id)
>    else:
>        form = CreateContextForm()
>        return render_to_response('create_projctx.html', {'form':form})
>
> Then your process_task view would be changed to check if there is a
> 'newcontext' parameter available in your request, in which case you
> use it to set the initial data of the form.
>
> def process_task(request):
>    if request.method == 'POST':
>        form = ProcessForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>
>            t = Task.objects.create( context=data['context']
>                                    , due_date=data['due_date'] )
>            return HttpResponseRedirect( request.META['HTTP_REFERER'] )
>    else:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>    return render_to_response('process.html', {'form': form})
>
> The important part here is this:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>
> You are setting an initial context depending on the value of the
> 'newcontext' request parameter, but because that parameter may not
> always be present you need to use the .get() method, the first
> parameter is the key to get from the dictionary and the second
> parameter is a value to return if the key is not found.
>
> In this case, when 'newcontext' is not found you'll get a None value
> back. After you create a new context on the other view and get
> redirected to process_task, there should be a value in the
> 'newcontext' request parameter, and the form will render with 

Re: TemplateDoesNotExist at /admin/

2008-01-23 Thread aws.python.enthusiast

What I found is the following:

Platform: Windows-XP

(1) When I check out the trunk from svn (svn co 
http://code.djangoproject.com/svn/django/trunk
django-source) and then run "python setup.py install" from django-
source, the script does not install the following:

site_packages/django/contrib/admin/templates
site_packages/django/contrib/admin/media

When I look in the "build" directory (django-source/build) which is
generated when I run "python setup.py install", the above two
directories are missing

(2) If I manually copy these two directories from django-source/django/
contrib/admin to site_packages/django/ I no longer get this error on
the tutorial

(3) I do not have this project if I use 0.96, ie the "official
release"

(4) However, when I use the official release, I have a different
problem in that setup.py does not work.  This is referenced in another
thread.  Apparently there is a bug in setup.py & MANIFEST.in in the
0.96 "official release" that was fixed soon after the release.

I am too new to django to offer to fix this trunk and contribute and
am certain that it will be fixed in the next "official release"


On Jan 16, 1:57 pm, Guillermo <[EMAIL PROTECTED]> wrote:
> Now it worked! :-)
>
> These two folders were missing in my install:
>
> python/libs/site_packges/django/contrib/admin/templates
> python/libs/site_packges/django/contrib/admin/media
>
> Copying them from the downloaded django installation files does the
> trick.
>
> Cheers,
>
> Guillermo
--~--~-~--~~~---~--~~
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: Passing form initial values from one view to another?

2008-01-23 Thread Dennis

Hi Jorge,

Thank you so much for the response!  This works perfectly.  Thanks for
cluing me in to request.GET.get() functionality.  I do have a slight
follow up here though.  Once this is implemented you end up with the
redirect URL looking something like this:

http://mygreatwebsite.com/django_app/process/?newcontext=22

Which seems okay, but I also have a couple of other fields I'd like to
default, so when we add in more fields, the URL can become unwieldy:

http://mygreatwebsite.com/django_app/process/?newcontext=22=new%20string

Which doesn't seem to be in line with django principles of readable
URL's.  Thinking about this a little longer I thought it might be a
good idea to take a urls.py approach to the problem and create a new
entry such as:

, (r'^process/defaultApplied/(?P\w+)/(?P\d+)/$',
'django_apps.projApp.views.process_task')

Then you could handle both types of defaults, e.g.:
http://mygreatwebsite.com/django_app/process/defaultApplied/context_id/22
http://mygreatwebsite.com/django_app/process/defaultApplied/name/new%20string

Which seems a lot better, but there's no way to pass *both* context_id
AND name at the same time in this approach.  Is there a better way I'm
not seeing?  Or am I just really making my life unnecessarily
difficult here and the GET approach is the best way to handle this?

Thanks again Jorge!!  This newsgroup is really fantastic!,
--Dennis

On Jan 22, 12:37 pm, "Jorge Gajon" <[EMAIL PROTECTED]> wrote:
> On Jan 20, 2008 11:58 PM, Dennis <[EMAIL PROTECTED]> wrote:
>
>
>
> > This works from the standpoint of getting back to the "process.html"
> > template with the new Context object selected on the original form.
> > However, since this is using render_to_response instead of a redirect,
> > the URL on the user's browser still holds the "create_context"
> > location.  So, when the user hits "submit" on the process.html page,
> > the form gets sent back to the "create_context" view and things don't
> > operate as expected (another context gets created rather than
> > submitting to the "process_task" view)
>
> > The ideal way to do this would be to HttpResponseRedirect in place of
> > the "render_to_response" but this doesn't allow me to pass the form
> > object or any kind of dictionary representing the initial values.  Is
> > there a way to do this?  Or am I going about this in the wrong manner?
>
> Hi Dennis,
>
> You are right that the ideal way would be to return an
> HttpResponseRedirect, and that's what I would do too.
>
> You can pass the id of the created context object as a parameter in
> the request back to the 'process_task' view.
>
> For example, your create_context view would look like this:
>
> def create_context( request ):
>    if request.method == 'POST':
>        form = CreateContextForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>            c = Context.objects.create(  name=data['name'] )
>            # Pass the context id in the 'newcontext' parameter
>            return HttpResponseRedirect('/process/?newcontext=%s' % c.id)
>    else:
>        form = CreateContextForm()
>        return render_to_response('create_projctx.html', {'form':form})
>
> Then your process_task view would be changed to check if there is a
> 'newcontext' parameter available in your request, in which case you
> use it to set the initial data of the form.
>
> def process_task(request):
>    if request.method == 'POST':
>        form = ProcessForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>
>            t = Task.objects.create( context=data['context']
>                                    , due_date=data['due_date'] )
>            return HttpResponseRedirect( request.META['HTTP_REFERER'] )
>    else:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>    return render_to_response('process.html', {'form': form})
>
> The important part here is this:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>
> You are setting an initial context depending on the value of the
> 'newcontext' request parameter, but because that parameter may not
> always be present you need to use the .get() method, the first
> parameter is the key to get from the dictionary and the second
> parameter is a value to return if the key is not found.
>
> In this case, when 'newcontext' is not found you'll get a None value
> back. After you create a new context on the other view and get
> redirected to process_task, there should be a value in the
> 'newcontext' request parameter, and the form will render with 

Re: Passing form initial values from one view to another?

2008-01-23 Thread Dennis

Hi Jorge,

Thank you so much for the response!  This works perfectly.  Thanks for
cluing me in to request.GET.get() functionality.  I do have a slight
follow up here though.  Once this is implemented you end up with the
redirect URL looking something like this:

http://mygreatwebsite.com/django_app/process/?newcontext=22

Which seems okay, but I also have a couple of other fields I'd like to
default, so when we add in more fields, the URL can become unwieldy:

http://mygreatwebsite.com/django_app/process/?newcontext=22=new%20string

Which doesn't seem to be in line with django principles of readable
URL's.  Thinking about this a little longer I thought it might be a
good idea to take a urls.py approach to the problem and create a new
entry such as:

, (r'^process/defaultApplied/(?P\w+)/(?P\d+)/$',
'django_apps.projApp.views.process_task')

Then you could handle both types of defaults, e.g.:
http://mygreatwebsite.com/django_app/process/defaultApplied/context_id/22
http://mygreatwebsite.com/django_app/process/defaultApplied/name/new%20string

Which seems a lot better, but there's no way to pass *both* context_id
AND name at the same time in this approach.  Is there a better way I'm
not seeing?  Or am I just really making my life unnecessarily
difficult here and the GET approach is the best way to handle this?

Thanks again Jorge!!  This newsgroup is really fantastic!,
--Dennis

On Jan 22, 12:37 pm, "Jorge Gajon" <[EMAIL PROTECTED]> wrote:
> On Jan 20, 2008 11:58 PM, Dennis <[EMAIL PROTECTED]> wrote:
>
>
>
> > This works from the standpoint of getting back to the "process.html"
> > template with the new Context object selected on the original form.
> > However, since this is using render_to_response instead of a redirect,
> > the URL on the user's browser still holds the "create_context"
> > location.  So, when the user hits "submit" on the process.html page,
> > the form gets sent back to the "create_context" view and things don't
> > operate as expected (another context gets created rather than
> > submitting to the "process_task" view)
>
> > The ideal way to do this would be to HttpResponseRedirect in place of
> > the "render_to_response" but this doesn't allow me to pass the form
> > object or any kind of dictionary representing the initial values.  Is
> > there a way to do this?  Or am I going about this in the wrong manner?
>
> Hi Dennis,
>
> You are right that the ideal way would be to return an
> HttpResponseRedirect, and that's what I would do too.
>
> You can pass the id of the created context object as a parameter in
> the request back to the 'process_task' view.
>
> For example, your create_context view would look like this:
>
> def create_context( request ):
>    if request.method == 'POST':
>        form = CreateContextForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>            c = Context.objects.create(  name=data['name'] )
>            # Pass the context id in the 'newcontext' parameter
>            return HttpResponseRedirect('/process/?newcontext=%s' % c.id)
>    else:
>        form = CreateContextForm()
>        return render_to_response('create_projctx.html', {'form':form})
>
> Then your process_task view would be changed to check if there is a
> 'newcontext' parameter available in your request, in which case you
> use it to set the initial data of the form.
>
> def process_task(request):
>    if request.method == 'POST':
>        form = ProcessForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>
>            t = Task.objects.create( context=data['context']
>                                    , due_date=data['due_date'] )
>            return HttpResponseRedirect( request.META['HTTP_REFERER'] )
>    else:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>    return render_to_response('process.html', {'form': form})
>
> The important part here is this:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>
> You are setting an initial context depending on the value of the
> 'newcontext' request parameter, but because that parameter may not
> always be present you need to use the .get() method, the first
> parameter is the key to get from the dictionary and the second
> parameter is a value to return if the key is not found.
>
> In this case, when 'newcontext' is not found you'll get a None value
> back. After you create a new context on the other view and get
> redirected to process_task, there should be a value in the
> 'newcontext' request parameter, and the form will render with 

Re: Passing form initial values from one view to another?

2008-01-23 Thread Dennis

Hi Jorge,

Thank you so much for the response!  This works perfectly.  Thanks for
cluing me in to request.GET.get() functionality.  I do have a slight
follow up here though.  Once this is implemented you end up with the
redirect URL looking something like this:

http://mygreatwebsite.com/django_app/process/?newcontext=22

Which seems okay, but I also have a couple of other fields I'd like to
default, so when we add in more fields, the URL can become unwieldy:

http://mygreatwebsite.com/django_app/process/?newcontext=22=new%20string

Which doesn't seem to be in line with django principles of readable
URL's.  Thinking about this a little longer I thought it might be a
good idea to take a urls.py approach to the problem and create a new
entry such as:

, (r'^process/defaultApplied/(?P\w+)/(?P\d+)/$',
'django_apps.projApp.views.process_task')

Then you could handle both types of defaults, e.g.:
http://mygreatwebsite.com/django_app/process/defaultApplied/context_id/22
http://mygreatwebsite.com/django_app/process/defaultApplied/name/new%20string

Which seems a lot better, but there's no way to pass *both* context_id
AND name at the same time in this approach.  Is there a better way I'm
not seeing?  Or am I just really making my life unnecessarily
difficult here and the GET approach is the best way to handle this?

Thanks again Jorge!!  This newsgroup is really fantastic!,
--Dennis

On Jan 22, 12:37 pm, "Jorge Gajon" <[EMAIL PROTECTED]> wrote:
> On Jan 20, 2008 11:58 PM, Dennis <[EMAIL PROTECTED]> wrote:
>
>
>
> > This works from the standpoint of getting back to the "process.html"
> > template with the new Context object selected on the original form.
> > However, since this is using render_to_response instead of a redirect,
> > the URL on the user's browser still holds the "create_context"
> > location.  So, when the user hits "submit" on the process.html page,
> > the form gets sent back to the "create_context" view and things don't
> > operate as expected (another context gets created rather than
> > submitting to the "process_task" view)
>
> > The ideal way to do this would be to HttpResponseRedirect in place of
> > the "render_to_response" but this doesn't allow me to pass the form
> > object or any kind of dictionary representing the initial values.  Is
> > there a way to do this?  Or am I going about this in the wrong manner?
>
> Hi Dennis,
>
> You are right that the ideal way would be to return an
> HttpResponseRedirect, and that's what I would do too.
>
> You can pass the id of the created context object as a parameter in
> the request back to the 'process_task' view.
>
> For example, your create_context view would look like this:
>
> def create_context( request ):
>    if request.method == 'POST':
>        form = CreateContextForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>            c = Context.objects.create(  name=data['name'] )
>            # Pass the context id in the 'newcontext' parameter
>            return HttpResponseRedirect('/process/?newcontext=%s' % c.id)
>    else:
>        form = CreateContextForm()
>        return render_to_response('create_projctx.html', {'form':form})
>
> Then your process_task view would be changed to check if there is a
> 'newcontext' parameter available in your request, in which case you
> use it to set the initial data of the form.
>
> def process_task(request):
>    if request.method == 'POST':
>        form = ProcessForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>
>            t = Task.objects.create( context=data['context']
>                                    , due_date=data['due_date'] )
>            return HttpResponseRedirect( request.META['HTTP_REFERER'] )
>    else:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>    return render_to_response('process.html', {'form': form})
>
> The important part here is this:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>
> You are setting an initial context depending on the value of the
> 'newcontext' request parameter, but because that parameter may not
> always be present you need to use the .get() method, the first
> parameter is the key to get from the dictionary and the second
> parameter is a value to return if the key is not found.
>
> In this case, when 'newcontext' is not found you'll get a None value
> back. After you create a new context on the other view and get
> redirected to process_task, there should be a value in the
> 'newcontext' request parameter, and the form will render with 

Re: Passing form initial values from one view to another?

2008-01-23 Thread Dennis

Hi Jorge,

Thank you so much for the response!  This works perfectly.  Thanks for
cluing me in to request.GET.get() functionality.  I do have a slight
follow up here though.  Once this is implemented you end up with the
redirect URL looking something like this:

http://mygreatwebsite.com/django_app/process/?newcontext=22

Which seems okay, but I also have a couple of other fields I'd like to
default, so when we add in more fields, the URL can become unwieldy:

http://mygreatwebsite.com/django_app/process/?newcontext=22=new%20string

Which doesn't seem to be in line with django principles of readable
URL's.  Thinking about this a little longer I thought it might be a
good idea to take a urls.py approach to the problem and create a new
entry such as:

, (r'^process/defaultApplied/(?P\w+)/(?P\d+)/$',
'django_apps.projApp.views.process_task')

Then you could handle both types of defaults, e.g.:
http://mygreatwebsite.com/django_app/process/defaultApplied/context_id/22
http://mygreatwebsite.com/django_app/process/defaultApplied/name/new%20string

Which seems a lot better, but there's no way to pass *both* context_id
AND name at the same time in this approach.  Is there a better way I'm
not seeing?  Or am I just really making my life unnecessarily
difficult here and the GET approach is the best way to handle this?

Thanks again Jorge!!  This newsgroup is really fantastic!,
--Dennis

On Jan 22, 12:37 pm, "Jorge Gajon" <[EMAIL PROTECTED]> wrote:
> On Jan 20, 2008 11:58 PM, Dennis <[EMAIL PROTECTED]> wrote:
>
>
>
> > This works from the standpoint of getting back to the "process.html"
> > template with the new Context object selected on the original form.
> > However, since this is using render_to_response instead of a redirect,
> > the URL on the user's browser still holds the "create_context"
> > location.  So, when the user hits "submit" on the process.html page,
> > the form gets sent back to the "create_context" view and things don't
> > operate as expected (another context gets created rather than
> > submitting to the "process_task" view)
>
> > The ideal way to do this would be to HttpResponseRedirect in place of
> > the "render_to_response" but this doesn't allow me to pass the form
> > object or any kind of dictionary representing the initial values.  Is
> > there a way to do this?  Or am I going about this in the wrong manner?
>
> Hi Dennis,
>
> You are right that the ideal way would be to return an
> HttpResponseRedirect, and that's what I would do too.
>
> You can pass the id of the created context object as a parameter in
> the request back to the 'process_task' view.
>
> For example, your create_context view would look like this:
>
> def create_context( request ):
>    if request.method == 'POST':
>        form = CreateContextForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>            c = Context.objects.create(  name=data['name'] )
>            # Pass the context id in the 'newcontext' parameter
>            return HttpResponseRedirect('/process/?newcontext=%s' % c.id)
>    else:
>        form = CreateContextForm()
>        return render_to_response('create_projctx.html', {'form':form})
>
> Then your process_task view would be changed to check if there is a
> 'newcontext' parameter available in your request, in which case you
> use it to set the initial data of the form.
>
> def process_task(request):
>    if request.method == 'POST':
>        form = ProcessForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>
>            t = Task.objects.create( context=data['context']
>                                    , due_date=data['due_date'] )
>            return HttpResponseRedirect( request.META['HTTP_REFERER'] )
>    else:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>    return render_to_response('process.html', {'form': form})
>
> The important part here is this:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>
> You are setting an initial context depending on the value of the
> 'newcontext' request parameter, but because that parameter may not
> always be present you need to use the .get() method, the first
> parameter is the key to get from the dictionary and the second
> parameter is a value to return if the key is not found.
>
> In this case, when 'newcontext' is not found you'll get a None value
> back. After you create a new context on the other view and get
> redirected to process_task, there should be a value in the
> 'newcontext' request parameter, and the form will render with 

Re: Passing form initial values from one view to another?

2008-01-23 Thread Dennis

Hi Jorge,

Thank you so much for the response!  This works perfectly.  Thanks for
cluing me in to request.GET.get() functionality.  I do have a slight
follow up here though.  Once this is implemented you end up with the
redirect URL looking something like this:

http://mygreatwebsite.com/django_app/process/?newcontext=22

Which seems okay, but I also have a couple of other fields I'd like to
default, so when we add in more fields, the URL can become unwieldy:

http://mygreatwebsite.com/django_app/process/?newcontext=22=new%20string

Which doesn't seem to be in line with django principles of readable
URL's.  Thinking about this a little longer I thought it might be a
good idea to take a urls.py approach to the problem and create a new
entry such as:

, (r'^process/defaultApplied/(?P\w+)/(?P\d+)/$',
'django_apps.projApp.views.process_task')

Then you could handle both types of defaults, e.g.:
http://mygreatwebsite.com/django_app/process/defaultApplied/context_id/22
http://mygreatwebsite.com/django_app/process/defaultApplied/name/new%20string

Which seems a lot better, but there's no way to pass *both* context_id
AND name at the same time in this approach.  Is there a better way I'm
not seeing?  Or am I just really making my life unnecessarily
difficult here and the GET approach is the best way to handle this?

Thanks again Jorge!!  This newsgroup is really fantastic!,
--Dennis

On Jan 22, 12:37 pm, "Jorge Gajon" <[EMAIL PROTECTED]> wrote:
> On Jan 20, 2008 11:58 PM, Dennis <[EMAIL PROTECTED]> wrote:
>
>
>
> > This works from the standpoint of getting back to the "process.html"
> > template with the new Context object selected on the original form.
> > However, since this is using render_to_response instead of a redirect,
> > the URL on the user's browser still holds the "create_context"
> > location.  So, when the user hits "submit" on the process.html page,
> > the form gets sent back to the "create_context" view and things don't
> > operate as expected (another context gets created rather than
> > submitting to the "process_task" view)
>
> > The ideal way to do this would be to HttpResponseRedirect in place of
> > the "render_to_response" but this doesn't allow me to pass the form
> > object or any kind of dictionary representing the initial values.  Is
> > there a way to do this?  Or am I going about this in the wrong manner?
>
> Hi Dennis,
>
> You are right that the ideal way would be to return an
> HttpResponseRedirect, and that's what I would do too.
>
> You can pass the id of the created context object as a parameter in
> the request back to the 'process_task' view.
>
> For example, your create_context view would look like this:
>
> def create_context( request ):
>    if request.method == 'POST':
>        form = CreateContextForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>            c = Context.objects.create(  name=data['name'] )
>            # Pass the context id in the 'newcontext' parameter
>            return HttpResponseRedirect('/process/?newcontext=%s' % c.id)
>    else:
>        form = CreateContextForm()
>        return render_to_response('create_projctx.html', {'form':form})
>
> Then your process_task view would be changed to check if there is a
> 'newcontext' parameter available in your request, in which case you
> use it to set the initial data of the form.
>
> def process_task(request):
>    if request.method == 'POST':
>        form = ProcessForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>
>            t = Task.objects.create( context=data['context']
>                                    , due_date=data['due_date'] )
>            return HttpResponseRedirect( request.META['HTTP_REFERER'] )
>    else:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>    return render_to_response('process.html', {'form': form})
>
> The important part here is this:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>
> You are setting an initial context depending on the value of the
> 'newcontext' request parameter, but because that parameter may not
> always be present you need to use the .get() method, the first
> parameter is the key to get from the dictionary and the second
> parameter is a value to return if the key is not found.
>
> In this case, when 'newcontext' is not found you'll get a None value
> back. After you create a new context on the other view and get
> redirected to process_task, there should be a value in the
> 'newcontext' request parameter, and the form will render with 

Re: Passing form initial values from one view to another?

2008-01-23 Thread Dennis

Hi Jorge,

Thank you so much for the response!  This works perfectly.  Thanks for
cluing me in to request.GET.get() functionality.  I do have a slight
follow up here though.  Once this is implemented you end up with the
redirect URL looking something like this:

http://mygreatwebsite.com/django_app/process/?newcontext=22

Which seems okay, but I also have a couple of other fields I'd like to
default, so when we add in more fields, the URL can become unwieldy:

http://mygreatwebsite.com/django_app/process/?newcontext=22=new%20string

Which doesn't seem to be in line with django principles of readable
URL's.  Thinking about this a little longer I thought it might be a
good idea to take a urls.py approach to the problem and create a new
entry such as:

, (r'^process/defaultApplied/(?P\w+)/(?P\d+)/$',
'django_apps.projApp.views.process_task')

Then you could handle both types of defaults, e.g.:
http://mygreatwebsite.com/django_app/process/defaultApplied/context_id/22
http://mygreatwebsite.com/django_app/process/defaultApplied/name/new%20string

Which seems a lot better, but there's no way to pass *both* context_id
AND name at the same time in this approach.  Is there a better way I'm
not seeing?  Or am I just really making my life unnecessarily
difficult here and the GET approach is the best way to handle this?

Thanks again Jorge!!  This newsgroup is really fantastic!,
--Dennis

On Jan 22, 12:37 pm, "Jorge Gajon" <[EMAIL PROTECTED]> wrote:
> On Jan 20, 2008 11:58 PM, Dennis <[EMAIL PROTECTED]> wrote:
>
>
>
> > This works from the standpoint of getting back to the "process.html"
> > template with the new Context object selected on the original form.
> > However, since this is using render_to_response instead of a redirect,
> > the URL on the user's browser still holds the "create_context"
> > location.  So, when the user hits "submit" on the process.html page,
> > the form gets sent back to the "create_context" view and things don't
> > operate as expected (another context gets created rather than
> > submitting to the "process_task" view)
>
> > The ideal way to do this would be to HttpResponseRedirect in place of
> > the "render_to_response" but this doesn't allow me to pass the form
> > object or any kind of dictionary representing the initial values.  Is
> > there a way to do this?  Or am I going about this in the wrong manner?
>
> Hi Dennis,
>
> You are right that the ideal way would be to return an
> HttpResponseRedirect, and that's what I would do too.
>
> You can pass the id of the created context object as a parameter in
> the request back to the 'process_task' view.
>
> For example, your create_context view would look like this:
>
> def create_context( request ):
>    if request.method == 'POST':
>        form = CreateContextForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>            c = Context.objects.create(  name=data['name'] )
>            # Pass the context id in the 'newcontext' parameter
>            return HttpResponseRedirect('/process/?newcontext=%s' % c.id)
>    else:
>        form = CreateContextForm()
>        return render_to_response('create_projctx.html', {'form':form})
>
> Then your process_task view would be changed to check if there is a
> 'newcontext' parameter available in your request, in which case you
> use it to set the initial data of the form.
>
> def process_task(request):
>    if request.method == 'POST':
>        form = ProcessForm(request.POST)
>        if form.is_valid():
>            # Do form processing here...
>            # todo: clean_data is legacy, will need to be changed
>            # to cleaned_data in next release.
>            data = form.clean_data
>
>            t = Task.objects.create( context=data['context']
>                                    , due_date=data['due_date'] )
>            return HttpResponseRedirect( request.META['HTTP_REFERER'] )
>    else:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>    return render_to_response('process.html', {'form': form})
>
> The important part here is this:
>        form = ProcessForm(initial={
>               'context': request.GET.get('newcontext', None)
>        })
>
> You are setting an initial context depending on the value of the
> 'newcontext' request parameter, but because that parameter may not
> always be present you need to use the .get() method, the first
> parameter is the key to get from the dictionary and the second
> parameter is a value to return if the key is not found.
>
> In this case, when 'newcontext' is not found you'll get a None value
> back. After you create a new context on the other view and get
> redirected to process_task, there should be a value in the
> 'newcontext' request parameter, and the form will render with 

Pros and cons of include URLs

2008-01-23 Thread Michael Newman

Just a quick question that might be an easy answer but I am curious.
Why is it that in the URL dispatcher all the direct to views use the
first argument in urlpatterns but when we use include it doesn't
matter? Example:

urlpatterns = patterns('myapp.views',
(r'^foo', include('myapp.foo.urls')),
url(r'^$', 'home'),
)

as opposed to:
urlpatterns = patterns('myapp',
(r'^foo', include('foo.urls')),
url(r'^$', 'views.home'),
)


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



Re: ForeignKey with null=True gives 'may not be NULL' error

2008-01-23 Thread michael

No, it is not the case that null=True is disallowed for FKs, but it
probably should be.

In a full database setup, the existence of foreign key constraints usually
means that records have to be carefully loaded in an appropriate order,
otherwise the FK field in one record has no match in the table that is
supposed to supply the FK.  The concept of Deferrable/Initially deferred,
means that the constraint does not have to be satisfied when the record is
loaded, but at some future time.  Not all databases have the Deferrable
option, and not all have an ability to turn off constraints, but few will
work properly with null values in foreign keys.

It is still a very bad idea to try to force a null into a foreign key
field where even the DB software will be expecting a value it can look up
(expect broken queries and table joins and views), but it is not
prohibited by Django.  On the other hand, it can generate an error
message, possibly depending on the DB employed.

PostgreSQL allows Deferrable, and may accept a temporary null value.  SQL
Server seems to require a turning-off of relationships or constraint
enforcement to load data where the FKs may not match the records in
another table.

And for now a good workaround is to make the one default record which is
used to point to all the unknowns (edit as they become known)

>
> Hello,
>
> On Jan 23, 2008 11:17 PM, Wyley <[EMAIL PROTECTED]> wrote:
>>
>> Michael,
>>
>> Thanks for your reply!
>>
>> > Many databases will allow a constraint with a foreign key to be
>> deferrable
>> > and initially deferred so that you don't have to disable the
>> relationship
>> > to load data.
>>
>> Can you say a bit more about this?  I'm by no means an expert on
>> databases; I'm not quite sure what "deferable" means.
>>
>
> I too have not quite understood this, and am now curious since I have
> been using both blank=True and null=True on ForeignKeys, but haven't
> had an error so far.
>
> To me, the original problem felt like the database wasn't in sync with
> the model (allowing NULL), but apparently that's not the case?
>
> Also, the docs[1] have a section describing field options in which it
> states that it applies to all fields. It comes right before the
> descriptions for ForeignKey and ManyToMany, but it is where it defined
> help_text, verbose_name and other fields that, in fact, do apply to
> ForeignKeys as well. So that kind of confuses me.
>
> Is it really the case that null=True is not allowed for ForeignKeys?
>
>
> [1] http://www.djangoproject.com/documentation/model-api/#field-options
>
>
> Thanks in advance,
> Eduardo.
>
> >
>


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



Re: ForeignKey with null=True gives 'may not be NULL' error

2008-01-23 Thread Eduardo - IdNotFound

Hello,

On Jan 23, 2008 11:17 PM, Wyley <[EMAIL PROTECTED]> wrote:
>
> Michael,
>
> Thanks for your reply!
>
> > Many databases will allow a constraint with a foreign key to be deferrable
> > and initially deferred so that you don't have to disable the relationship
> > to load data.
>
> Can you say a bit more about this?  I'm by no means an expert on
> databases; I'm not quite sure what "deferable" means.
>

I too have not quite understood this, and am now curious since I have
been using both blank=True and null=True on ForeignKeys, but haven't
had an error so far.

To me, the original problem felt like the database wasn't in sync with
the model (allowing NULL), but apparently that's not the case?

Also, the docs[1] have a section describing field options in which it
states that it applies to all fields. It comes right before the
descriptions for ForeignKey and ManyToMany, but it is where it defined
help_text, verbose_name and other fields that, in fact, do apply to
ForeignKeys as well. So that kind of confuses me.

Is it really the case that null=True is not allowed for ForeignKeys?


[1] http://www.djangoproject.com/documentation/model-api/#field-options


Thanks in advance,
Eduardo.

--~--~-~--~~~---~--~~
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 Redirect to login when writing to session

2008-01-23 Thread Kenneth Gonsalves


On 23-Jan-08, at 6:42 PM, Polar Bear z RPA wrote:

> I try to write the form dict to a sesssion

what code do you use to write the dict to the session? Probably you  
are overwriting the session dict instead of adding to it

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



--~--~-~--~~~---~--~~
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 handle django static files(css js etc) properly.the views.static.serve or apache's SetHandler None just too eerie

2008-01-23 Thread mxl

after changed the  MaxRequestsPerChild  from 1 to 24 everything works
just fine
sorry post this glitch on a django forum, it should goes to apache
forum.

On Jan 24, 9:03 am, mxl <[EMAIL PROTECTED]> wrote:
> ok, I got it.
> the glitch baffleed me is the following:
> I changed the apache conf MaxRequestsPerChild  from 0 to 1 to let  py
> code changed inmediate debugable.
> but that just requres the apache create a PROCESS for every single
> static file -- too luxury for my humble old pc.
>
> On Jan 23, 9:38 pm, mxl <[EMAIL PROTECTED]> wrote:
>
> > thanks Corey very much,I have tried your 5-step instruction, it works
> > fine ,but my problem is
> > "I need press F5 constantly to refresh my no-bug page to get the css
> > file down to show that page properly"
> > sometimes those static file loaded very quickly but sometimes it just
> > disaperared living a ugly-looking row html page.
> > thanks a again. *_*
>
> > On Jan 23, 7:02 pm, Corey Oordt <[EMAIL PROTECTED]> wrote:
>
> > > I recommend this approach because it works seamlessly when
> > > transferring between production and development:
>
> > > 1. Put your static files in the repository (assuming you are using one)
> > > 2.  On the production server, add these lines to the site config
> > >  so this doesn't get used except on development boxes:
>
> > >  Alias /static "/home/myproject/static"
> > >  
> > >  SetHandler None
> > >  
>
> > > 3. At the end of your primary urls.py put:
> > >  (
> > >  r'^static/(?P.*)$',
> > >  'django.views.static.serve',
> > >  {'document_root': settings.MEDIA_ROOT}
> > >  ),
>
> > > 4. In your settings file add:
>
> > > import os
> > > SETTINGS_FILE_FOLDER = os.path.dirname(__file__)
> > > MEDIA_ROOT = os.path.join(SETTINGS_FILE_FOLDER, 'static')
>
> > > 5. I use it on all my projects so I can see the static files and
> > > modify them locally, but it seamlessly lets Apache serve them on the
> > > production server
>
> > > Corey
>
> > > On Jan 23, 2008, at 2:28 AM, mxl wrote:
>
> > > > I recently deployed my dear Django on winows + apache +mod_python..
> > > > following DjangoBook step by step everything is fine but one thing
> > > >  the static file(css particularly) .
> > > > I need press F5 constantly to refresh my no-bug page to get the css
> > > > file down to show that page properly.
> > > > I tried views.static.serve failed.
> > > >  tried separate a virual-host to serve the static file sololy failed
> > > > and completely out of any clue.
> > > > I'm a new comer to django hope you offer some 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: ForeignKey with null=True gives 'may not be NULL' error

2008-01-23 Thread Wyley

Michael,

Thanks for your reply!

> Many databases will allow a constraint with a foreign key to be deferrable
> and initially deferred so that you don't have to disable the relationship
> to load data.

Can you say a bit more about this?  I'm by no means an expert on
databases; I'm not quite sure what "deferable" means.

> But a nullable foreign key?  Not likely.  Anyway, Django is trying to
> store a null value into the FK, which is definitely a flaw.  The value
> should only be deferred.  That is a flaw in your setup and also a flaw in
> Django.  It should not permit the setup for storing null values into a FK.
>  The proper way to handle that is to make one entry that is a 'default' or
> 'unknown' in supplier, with a genuine key, and let that be the value
> stored for the FK if you are uncomfortable with a deferred FK.

> Just remember that a FK implies that there is always one supplier which
> may supply many items.  If there are several suppliers which can supply
> one item, and several items available from a single supplier, a
> ManyToManyField is appropriate.

Using an "unknown" record as the default sounds like it might be the
way to go for me.  A ManyToManyField is not appropriate in this case;
there should never be more than one supplier for a Title, but the same
Contact might be the supplier for many Titles.  My goal in setting
null=True was basically to allow soft validation:  I want to be able
to save a Title record without a supplier and fix it later (in case
I'm importing dicey-looking data), but I don't want to allow *more*
than one supplier.  If that's not possible, or not good practice, a
default of an unknown contact seems like the next best thing.

What's the appropriate way to go about creating an "unknown" Contact
record (particularly if I don't want it to be user-editable)?  I
assume this means I must instantiate Contact and save() the instance
before the Title model is ever parsed by Django...I smell a catch-22
in the works if I need to do this for any other fields.

Thanks again for your help.

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



Re: ForeignKey with null=True gives 'may not be NULL' error

2008-01-23 Thread michael

null=True tells Django to STORE a null value--this is why your unit tests
would succeed--because no attempt was made to store a null.  It was a
situation where key storage was deferred.

Many databases will allow a constraint with a foreign key to be deferrable
and initially deferred so that you don't have to disable the relationship
to load data.

But a nullable foreign key?  Not likely.  Anyway, Django is trying to
store a null value into the FK, which is definitely a flaw.  The value
should only be deferred.  That is a flaw in your setup and also a flaw in
Django.  It should not permit the setup for storing null values into a FK.
 The proper way to handle that is to make one entry that is a 'default' or
'unknown' in supplier, with a genuine key, and let that be the value
stored for the FK if you are uncomfortable with a deferred FK.

Just remember that a FK implies that there is always one supplier which
may supply many items.  If there are several suppliers which can supply
one item, and several items available from a single supplier, a
ManyToManyField is appropriate.

Check Table B-5 in the appendix of the Django Book.  The options there for
Foreign Key do not include null=True.  It is a flaw that the null=True is
not filtered from the Model, but then that is more code for no good
purpose except to produce an error message, and you already have one of
those, even if it is a bit cryptic.

Michael Moore


>
> Update:  in the SQL for the Title table,
>
> CREATE TABLE "core_title" (
>  ...
> "supplier_id" integer NULL,
> );
>
> Two things to note:
> 1. the SQL explicitly allows the supplier field to be NULL
> 2. the 'REFERENCES "core_contact" ("id") clause is conspicuously
> absent
>
>
> On Jan 23, 6:12 pm, Wyley <[EMAIL PROTECTED]> wrote:
>> Hello all,
>>
>> I have a model with a ForeignKey field that sets null=True:
>>
>> class Title(models.Model):
>> #...
>> supplier = models.ForeignKey(Contact, verbose_name='Supplier',
>> null=True)
>>
>> ...but when I try to save an instance without a supplier:
>>
>> >>> t = Title()
>> >>> t.save()
>>
>> [complete Traceback below...]
>> IntegrityError: core_title.supplier_id may not be NULL
>>
>> Even weirder, this error does not occur when I save Title objects
>> without a supplier in some of my unit tests -- at least, all tests
>> succeed.
>>
>> Is there some reason that Django would implicitly forbid this field to
>> be NULL, despite my having explicitly set null=True in the model?
>>
>> I am using sqlite3 and Django 0.96, if that's relevant.
>>
>> Thanks,
>> Richard
>>
>> ---
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File "/var/lib/python-support/python2.5/django/db/models/base.py",
>> line 238, in save
>> ','.join(placeholders)), db_values)
>>   File "/var/lib/python-support/python2.5/django/db/backends/util.py",
>> line 12, in execute
>> return self.cursor.execute(sql, params)
>>   File "/var/lib/python-support/python2.5/django/db/backends/sqlite3/
>> base.py", line 93, in execute
>> return Database.Cursor.execute(self, query, params)
>> IntegrityError: core_title.supplier_id may not be NULL
> >
>


--~--~-~--~~~---~--~~
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 handle django static files(css js etc) properly.the views.static.serve or apache's SetHandler None just too eerie

2008-01-23 Thread mxl

ok, I got it.
the glitch baffleed me is the following:
I changed the apache conf MaxRequestsPerChild  from 0 to 1 to let  py
code changed inmediate debugable.
but that just requres the apache create a PROCESS for every single
static file -- too luxury for my humble old pc.

On Jan 23, 9:38 pm, mxl <[EMAIL PROTECTED]> wrote:
> thanks Corey very much,I have tried your 5-step instruction, it works
> fine ,but my problem is
> "I need press F5 constantly to refresh my no-bug page to get the css
> file down to show that page properly"
> sometimes those static file loaded very quickly but sometimes it just
> disaperared living a ugly-looking row html page.
> thanks a again. *_*
>
> On Jan 23, 7:02 pm, Corey Oordt <[EMAIL PROTECTED]> wrote:
>
> > I recommend this approach because it works seamlessly when
> > transferring between production and development:
>
> > 1. Put your static files in the repository (assuming you are using one)
> > 2.  On the production server, add these lines to the site config
> >  so this doesn't get used except on development boxes:
>
> >  Alias /static "/home/myproject/static"
> >  
> >  SetHandler None
> >  
>
> > 3. At the end of your primary urls.py put:
> >  (
> >  r'^static/(?P.*)$',
> >  'django.views.static.serve',
> >  {'document_root': settings.MEDIA_ROOT}
> >  ),
>
> > 4. In your settings file add:
>
> > import os
> > SETTINGS_FILE_FOLDER = os.path.dirname(__file__)
> > MEDIA_ROOT = os.path.join(SETTINGS_FILE_FOLDER, 'static')
>
> > 5. I use it on all my projects so I can see the static files and
> > modify them locally, but it seamlessly lets Apache serve them on the
> > production server
>
> > Corey
>
> > On Jan 23, 2008, at 2:28 AM, mxl wrote:
>
> > > I recently deployed my dear Django on winows + apache +mod_python..
> > > following DjangoBook step by step everything is fine but one thing
> > >  the static file(css particularly) .
> > > I need press F5 constantly to refresh my no-bug page to get the css
> > > file down to show that page properly.
> > > I tried views.static.serve failed.
> > >  tried separate a virual-host to serve the static file sololy failed
> > > and completely out of any clue.
> > > I'm a new comer to django hope you offer some 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: Form validation and clean_data

2008-01-23 Thread J. Clifford Dyer


On Wed, 2008-01-23 at 22:53 +, Andrew Doades wrote:
> Cheers,
> 
> That was basically the question, what do i put in that to field so the 
> what I email address I enter to the to field is where the message is 
> sent to!
> 
> Rajesh Dhawan wrote:
> >
> > On Jan 23, 5:11 pm, Andrew Doades <[EMAIL PROTECTED]> wrote:
> >   
> >> I now have this as the view:
> >> if request.method == 'POST':
> >> form = ContactForm(request.POST)
> >> if form.is_valid():
> >> topic = form.cleaned_data['topic']
> >> message = form.cleaned_data['message']
> >> to = form.cleaned_data.get('to')
> >> sender = form.cleaned_data.get('sender')
> >> send_mail(
> >> 'message, topic: %s' % topic,
> >> message, sender,
> >> ['to']
> >> )
> >>
> >> I need to have to bottom fields to read what is entered into the ' to '
> >> field, I thought something like % to   or something would do the trick!?
> >> 
> >
> > I am not sure I understand the question. However, that ['to'] should
> > instead be [to] in the send_mail() call.
> > >
> >   

Your emails are very difficult to understand.  Please proofread them
before hitting the send button, and adjust your formatting and/or code
to make it clear when you are referring to code, and when you are just
writing.  The ambiguous use of the word/variable "to" in your message
from 5:11 would be cleared up if you renamed the variable "recipient",
or something similar.  Your more recent contains one run on sentence
that doesn't even make sense if you correct the run on.  Rajesh's answer
should help with your problem.  Remove the quotes from your variable
name (to) in the list you pass to send_mail().

Cheers,
Cliff


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



Re: ForeignKey with null=True gives 'may not be NULL' error

2008-01-23 Thread Wyley

Update:  in the SQL for the Title table,

CREATE TABLE "core_title" (
 ...
"supplier_id" integer NULL,
);

Two things to note:
1. the SQL explicitly allows the supplier field to be NULL
2. the 'REFERENCES "core_contact" ("id") clause is conspicuously
absent


On Jan 23, 6:12 pm, Wyley <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I have a model with a ForeignKey field that sets null=True:
>
> class Title(models.Model):
> #...
> supplier = models.ForeignKey(Contact, verbose_name='Supplier',
> null=True)
>
> ...but when I try to save an instance without a supplier:
>
> >>> t = Title()
> >>> t.save()
>
> [complete Traceback below...]
> IntegrityError: core_title.supplier_id may not be NULL
>
> Even weirder, this error does not occur when I save Title objects
> without a supplier in some of my unit tests -- at least, all tests
> succeed.
>
> Is there some reason that Django would implicitly forbid this field to
> be NULL, despite my having explicitly set null=True in the model?
>
> I am using sqlite3 and Django 0.96, if that's relevant.
>
> Thanks,
> Richard
>
> ---
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/var/lib/python-support/python2.5/django/db/models/base.py",
> line 238, in save
> ','.join(placeholders)), db_values)
>   File "/var/lib/python-support/python2.5/django/db/backends/util.py",
> line 12, in execute
> return self.cursor.execute(sql, params)
>   File "/var/lib/python-support/python2.5/django/db/backends/sqlite3/
> base.py", line 93, in execute
> return Database.Cursor.execute(self, query, params)
> IntegrityError: core_title.supplier_id may not be NULL
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ForeignKey with null=True gives 'may not be NULL' error

2008-01-23 Thread Wyley

Hello all,

I have a model with a ForeignKey field that sets null=True:

class Title(models.Model):
#...
supplier = models.ForeignKey(Contact, verbose_name='Supplier',
null=True)

...but when I try to save an instance without a supplier:

>>> t = Title()
>>> t.save()
[complete Traceback below...]
IntegrityError: core_title.supplier_id may not be NULL

Even weirder, this error does not occur when I save Title objects
without a supplier in some of my unit tests -- at least, all tests
succeed.

Is there some reason that Django would implicitly forbid this field to
be NULL, despite my having explicitly set null=True in the model?

I am using sqlite3 and Django 0.96, if that's relevant.

Thanks,
Richard

---
Traceback (most recent call last):
  File "", line 1, in 
  File "/var/lib/python-support/python2.5/django/db/models/base.py",
line 238, in save
','.join(placeholders)), db_values)
  File "/var/lib/python-support/python2.5/django/db/backends/util.py",
line 12, in execute
return self.cursor.execute(sql, params)
  File "/var/lib/python-support/python2.5/django/db/backends/sqlite3/
base.py", line 93, in execute
return Database.Cursor.execute(self, query, params)
IntegrityError: core_title.supplier_id may not be NULL


--~--~-~--~~~---~--~~
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 do you filter fields from queries?

2008-01-23 Thread [EMAIL PROTECTED]

Don't know how I missed this. Thanks.

On Jan 23, 4:41 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Jan 23, 2008 4:38 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > In other words, how do I invoke a query and supply what is essentially
> > a column list in a SQL SELECT statement?
>
> By following the instructions in the nice documentation that's
> provided with Django:
>
> http://www.djangoproject.com/documentation/db-api/#values-fields
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Trouble with pattern in urls.py

2008-01-23 Thread Ned Batchelder

I don't know if the URL you show is literally what you hit or not. If it 
is, then it doesn't match because "param1" doesn't match "\d+" which 
means one or more  digits.  Same for param2.

--Ned.

almostvindiesel wrote:
> Hi all,
>
> I'm new to regex/django/python, and I'm having trouble getting urls.py
> to pass a request to a view. Specifically, when I hit:
>
> http://django.mysite.com/chef/home/param1/param2/
>
> I'd expect the 3rd from the last pattern to match:
>
> ## my urls.py file ##
> urlpatterns = patterns('',
> (r'^chef/admin/home/$','mysite.chef.views.admin_home'),
> (r'^chef/admin/edit/(?P\d+)/
> $','mysite.chef.views.edit_recipe'),
> (r'^chef/admin/add/$','mysite.chef.views.add_recipe'),
> (r'^chef/admin/delete/(?P\d+)/
> $','mysite.chef.views.delete_recipe'),
> (r'^chef/admin/save/$','mysite.chef.views.save_recipe'),
> (r'^chef/admin/error/$','mysite.chef.views.error'),
> (r'^chef/admin/profile/$','mysite.chef.views.edit_profile'),
> (r'^chef/home/$','mysite.chef.views.home'),
> (r'^chef/home/(?P\d+)/(?P\d+)/
> $','mysite.chef.views.sort_recipes'),
> (r'^admin/', include('django.contrib.admin.urls')),
> (r'^chef/', include('mysite.chef.urls')),
> )
>
> Instead I get a Page not found (404) error. All of my other requests
> work fine. Any thoughts as to what I'm doing wrong?
>
> Cheers,
>
> ~John
> >
>
>   

-- 
Ned Batchelder, http://nedbatchelder.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: Form validation and clean_data

2008-01-23 Thread Andrew Doades

Cheers,

That was basically the question, what do i put in that to field so the 
what I email address I enter to the to field is where the message is 
sent to!

Rajesh Dhawan wrote:
>
> On Jan 23, 5:11 pm, Andrew Doades <[EMAIL PROTECTED]> wrote:
>   
>> I now have this as the view:
>> if request.method == 'POST':
>> form = ContactForm(request.POST)
>> if form.is_valid():
>> topic = form.cleaned_data['topic']
>> message = form.cleaned_data['message']
>> to = form.cleaned_data.get('to')
>> sender = form.cleaned_data.get('sender')
>> send_mail(
>> 'message, topic: %s' % topic,
>> message, sender,
>> ['to']
>> )
>>
>> I need to have to bottom fields to read what is entered into the ' to '
>> field, I thought something like % to   or something would do the trick!?
>> 
>
> I am not sure I understand the question. However, that ['to'] should
> instead be [to] in the send_mail() call.
> >
>   

--~--~-~--~~~---~--~~
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: Form validation and clean_data

2008-01-23 Thread Rajesh Dhawan



On Jan 23, 5:11 pm, Andrew Doades <[EMAIL PROTECTED]> wrote:
> I now have this as the view:
> if request.method == 'POST':
> form = ContactForm(request.POST)
> if form.is_valid():
> topic = form.cleaned_data['topic']
> message = form.cleaned_data['message']
> to = form.cleaned_data.get('to')
> sender = form.cleaned_data.get('sender')
> send_mail(
> 'message, topic: %s' % topic,
> message, sender,
> ['to']
> )
>
> I need to have to bottom fields to read what is entered into the ' to '
> field, I thought something like % to   or something would do the trick!?

I am not sure I understand the question. However, that ['to'] should
instead be [to] in the send_mail() call.
--~--~-~--~~~---~--~~
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 do you filter fields from queries?

2008-01-23 Thread James Bennett

On Jan 23, 2008 4:38 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> In other words, how do I invoke a query and supply what is essentially
> a column list in a SQL SELECT statement?

By following the instructions in the nice documentation that's
provided with Django:

http://www.djangoproject.com/documentation/db-api/#values-fields


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



How do you filter fields from queries?

2008-01-23 Thread [EMAIL PROTECTED]

I'm trying to do something I expect would be really simple.

I have a model with a dozen fields.  How to I do a query that returns
a subset of those dozen?

In other words, how do I invoke a query and supply what is essentially
a column list in a SQL SELECT statement?

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: Form validation and clean_data

2008-01-23 Thread Andrew Doades

I now have this as the view:
if request.method == 'POST':
form = ContactForm(request.POST)
if form.is_valid():
topic = form.cleaned_data['topic']
message = form.cleaned_data['message']
to = form.cleaned_data.get('to')
sender = form.cleaned_data.get('sender')
send_mail(
'message, topic: %s' % topic,
message, sender,
['to']
)

I need to have to bottom fields to read what is entered into the ' to ' 
field, I thought something like % to   or something would do the trick!?

Cheers,

Rajesh Dhawan wrote:
>
> On Jan 23, 2:39 pm, Andrew Doades <[EMAIL PROTECTED]> wrote:
>   
>> I am following the section of the django book
>> (http://www.djangobook.com/en/1.0/chapter07/) to create a feedback form,
>> my problem is when I try to submit the form, I get an error (
>> 'ContactForm' object has no attribute 'clean_data' ) I have read a
>> little and see that it's because the form is not validating?  Why is this?
>>
>> What am I doing wrong? ( if anything )
>> 
>
> See:
> http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Newforms:clean_datachangedtocleaned_data
>
> In short, if you are using a current release of Django, clean_data has
> been renamed to cleaned_data. The book references Django 0.96 and you
> seem to be running a current SVN revision (the SVN revision is
> actually better in numerous ways except for this inconvenience if
> you're following the Book.)
>
> -Rajesh D
> >
>   

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Trouble with pattern in urls.py

2008-01-23 Thread almostvindiesel

Hi all,

I'm new to regex/django/python, and I'm having trouble getting urls.py
to pass a request to a view. Specifically, when I hit:

http://django.mysite.com/chef/home/param1/param2/

I'd expect the 3rd from the last pattern to match:

## my urls.py file ##
urlpatterns = patterns('',
(r'^chef/admin/home/$','mysite.chef.views.admin_home'),
(r'^chef/admin/edit/(?P\d+)/
$','mysite.chef.views.edit_recipe'),
(r'^chef/admin/add/$','mysite.chef.views.add_recipe'),
(r'^chef/admin/delete/(?P\d+)/
$','mysite.chef.views.delete_recipe'),
(r'^chef/admin/save/$','mysite.chef.views.save_recipe'),
(r'^chef/admin/error/$','mysite.chef.views.error'),
(r'^chef/admin/profile/$','mysite.chef.views.edit_profile'),
(r'^chef/home/$','mysite.chef.views.home'),
(r'^chef/home/(?P\d+)/(?P\d+)/
$','mysite.chef.views.sort_recipes'),
(r'^admin/', include('django.contrib.admin.urls')),
(r'^chef/', include('mysite.chef.urls')),
)

Instead I get a Page not found (404) error. All of my other requests
work fine. Any thoughts as to what I'm doing wrong?

Cheers,

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



Re: Complex Lookups

2008-01-23 Thread Rajesh Dhawan

>
> I just got this working and it's great.  I feel like I owe you all a steak
> dinner or something.

Mmmm... sounds good :)
--~--~-~--~~~---~--~~
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: Complex Lookups

2008-01-23 Thread Stephen Mizell
>
> But be sure to fix the typo in x first!
>

> >>> x = [ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ]
>   File "", line 1
> x = [ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ]
> ^
> SyntaxError: invalid syntax
>

Ha, whoops.  I don't think I've ever typed a working line of code in my life
the first time!

I just got this working and it's great.  I feel like I owe you all a steak
dinner or something.

--~--~-~--~~~---~--~~
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: Complex Lookups

2008-01-23 Thread J. Cliff Dyer
Stephen Mizell wrote:
>> Try this:
>>
>> x = [ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ]
>> if x:
>> d = x[0]
>> q = Q(id=d['id']) & Q(title=d['title'])
>> for d in x[1:]:
>> q = q | (Q(id=d['id']) & Q(title=d['title']))
>> query = MyModel.objects.filter(q)
>> 
>
> Hey, that makes sense.  I do appreciate the speedy help!
> >
>
>   
But be sure to fix the typo in x first!

>>> x = [ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ]
  File "", line 1
x = [ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ]
^
SyntaxError: invalid syntax


--~--~-~--~~~---~--~~
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: Complex Lookups

2008-01-23 Thread Stephen Mizell

> Try this:
>
> x = [ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ]
> if x:
> d = x[0]
> q = Q(id=d['id']) & Q(title=d['title'])
> for d in x[1:]:
> q = q | (Q(id=d['id']) & Q(title=d['title']))
> query = MyModel.objects.filter(q)

Hey, that makes sense.  I do appreciate the speedy 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: Complex Lookups

2008-01-23 Thread Rajesh Dhawan

> I know I can use the Q object, like:
>
> MyModel.objects.filter(Q(id=1) & Q(title='test1') | Q(id=2) &
> Q(title='test2'))
>
> My question is how can I convert my list to those Q objects?  The list
> may have 2 dictionaries in it like this, or it may have 20.  My hangup
> is getting things into separate Q objects with the correct operator in
> between them.  There could also be a better way that I don't know of!

Try this:

x = [ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ]
if x:
d = x[0]
q = Q(id=d['id']) & Q(title=d['title'])
for d in x[1:]:
q = q | (Q(id=d['id']) & Q(title=d['title']))
query = MyModel.objects.filter(q)

-Rajesh D
--~--~-~--~~~---~--~~
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: Form validation and clean_data

2008-01-23 Thread Andrew Doades



Rajesh Dhawan wrote:
>
> On Jan 23, 2:39 pm, Andrew Doades <[EMAIL PROTECTED]> wrote:
>   
>> I am following the section of the django book
>> (http://www.djangobook.com/en/1.0/chapter07/) to create a feedback form,
>> my problem is when I try to submit the form, I get an error (
>> 'ContactForm' object has no attribute 'clean_data' ) I have read a
>> little and see that it's because the form is not validating?  Why is this?
>>
>> What am I doing wrong? ( if anything )
>> 
>
> See:
> http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Newforms:clean_datachangedtocleaned_data
>
> In short, if you are using a current release of Django, clean_data has
> been renamed to cleaned_data. The book references Django 0.96 and you
> seem to be running a current SVN revision (the SVN revision is
> actually better in numerous ways except for this inconvenience if
> you're following the Book.)
>
> -Rajesh D
>   
Cheers, I just had to change clean_data to cleaned_data and it works!!

Cheers!!

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Complex Lookups

2008-01-23 Thread Stephen Mizell

I've spent a little too much time on this, but before I decided to
make a custom sql query, I wanted to see if anyone could provide any
assistance.  It is really a python question, and the problem I'm
having is I'm not an expert yet with python.

First, I have a list of dictionaries.

[ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ]

I want to do a SQL query like this:

SELECT * FROM mytable WHERE (id = 1 AND title = 'test1') OR (id = 2
AND title = 'test2')

I know I can use the Q object, like:

MyModel.objects.filter(Q(id=1) & Q(title='test1') | Q(id=2) &
Q(title='test2'))

My question is how can I convert my list to those Q objects?  The list
may have 2 dictionaries in it like this, or it may have 20.  My hangup
is getting things into separate Q objects with the correct operator in
between them.  There could also be a better way that I don't know of!

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: symfony developer looking at converting.....just a few quick questions

2008-01-23 Thread Mat

Thanks, thats looks like what I was talking about, would be quite nice to
wrap it all up into a little pop up bar, 

Thanks CJL for the SQL link as well, ill give them both a go.

Mat

-Original Message-
From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Emil
Sent: 23 January 2008 17:49
To: Django users
Subject: Re: symfony developer looking at converting.just a few quick
questions


Hi again Mat!

> Thats great, the debug tag seems to be pretty close to the information I
was
> after, just not wrapped up in a nice JS bar which folds out of the way :),
> maybe a quick template switch would make it really neat, ill have a play
> around with it.

Just after sending the last message, I found this:
http://www.djangosnippets.org/snippets/555/
It seems to be doing pretty much exactly what you're after, with the
Activity Bar-style and all. I haven't tried it out yet myself, but it
looks nice, I think I might have to give it a whirl myself.

Glad I could help someone, this community has helped me a lot in the
past!

Take care,
//emil





--~--~-~--~~~---~--~~
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: Form validation and clean_data

2008-01-23 Thread Rajesh Dhawan



On Jan 23, 2:39 pm, Andrew Doades <[EMAIL PROTECTED]> wrote:
> I am following the section of the django book
> (http://www.djangobook.com/en/1.0/chapter07/) to create a feedback form,
> my problem is when I try to submit the form, I get an error (
> 'ContactForm' object has no attribute 'clean_data' ) I have read a
> little and see that it's because the form is not validating?  Why is this?
>
> What am I doing wrong? ( if anything )

See:
http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Newforms:clean_datachangedtocleaned_data

In short, if you are using a current release of Django, clean_data has
been renamed to cleaned_data. The book references Django 0.96 and you
seem to be running a current SVN revision (the SVN revision is
actually better in numerous ways except for this inconvenience if
you're following the Book.)

-Rajesh D
--~--~-~--~~~---~--~~
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: Looking for a security/encryption programmer for small contract

2008-01-23 Thread Emanuele Pucciarelli
Dear Francis,

> Only one person (or very limited group) will receive the encrypted
> message by email. It will hold customer information need by the sale
> rep. So no user will have to deal with the encrypted data.
>
> Server receive customer info -> encrypt critical info -> sent email to
> sales rep.
> sales rep. decrypt the information.


If I understand your problem, I think that the best course of action is
using GPG (GNU Privacy Guard), possibly with its Python module (
http://wiki.python.org/moin/GnuPrivacyGuard). When you need to send the
critical info to the sales representative, you encrypt it and send it as an
encrypted mail message. Then, the GUI could just be Mozilla Thunderbird, or
any other OpenPGP-enabled e-mail client. This should make both server-side
implementation and client-side deployment rather easy.

As for safety, nothing is safer than OTP, but are we sure that your customer
is able to go to great lengths to distribute long key streams over a
perfectly safe channel to the sales representatives? Remember that if you
make it cheaper to get the information by breaking into your public web
server rather than eavesdropping on the connection, then you have just
switched to a different problem :)

Bye,

-- 
Emanuele

--~--~-~--~~~---~--~~
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: Looking for a security/encryption programmer for small contract

2008-01-23 Thread Tim Chase

> i'll be honest, i don't know anyone who's ever used a one-time-pad 

ooh...terminology clarification:

OTP = one-time password
OTP = one-time pad

The former is a common tool used for safely logging in over an 
insecure channel (such as using S/Key when logging into my 
OpenBSD box over telnet).  They're usually 5 quads of letters 
such as "OVEN DOVE MATE SPIN FLAT" and some generation methods 
kindly use real words to make them easier to type (still leaving 
about 387 quadrillion combos for an attacker to guess based on 
4-letter words from my /usr/share/dict/words).  With a little 
preparation, I can travel with a notecard in my wallet containing 
my next 10 OTPs in case I need something non-confidential on my 
home box and only have access to telnet rather than SSH.

The latter is, as Derek notes, unbreakable without the key 
(assuming quality random data).  However key management becomes 
unweildy.

Which does the OP mean by "OTP"?

-tim







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



Re: Looking for a security/encryption programmer for small contract

2008-01-23 Thread Derek Anderson

i'll be honest, i don't know anyone who's ever used a one-time-pad 
outside of some military applications before we had computers 
everywhere.  while the security is mathematically "perfect", it's so 
encumbering to implement that i consider it overall riskier.  having to 
pass by courier gigs upon gigs of true-random numbers, plus the need to 
securely destroy that data afterwards, is really hard.  many more 
vectors of attack at the human level.  best to make damn sure your 
192-bit AES key gets there in a trustworthy manner, and trust in the 
combined research of the professional cryptographic community.

derek


Tim Chase wrote:
 - Take a message, encrypt it using a secure method (should be better
 or equal than OTP), return the encrypted message.
>>  >
>>> parties, Blowfish and DES3 are popular choices and likely to be 
>> just a point of fact: neither of these are >= to OTP.
> 
> They're all strong cryptographically, but all shared-secret 
> solutions suffer the same fate of having to figure out how to 
> securely share your key/OTP if you aren't both the sender and the 
> recipient.
> 
> I do like OTP for logins over insecure connections if absolutely 
> needed, but otherwise, I don't see non-public-key as a great win :)
> 
>> also, on a side note, i wouldn't use 3DES for any new implementations.
> [snip]
>> i'd highly recommend AES instead.
> 
> Good point...I remember hearing something about that a while 
> back, but I tend to use public-key for just about everything so 
> it didn't register in my active memory.
> 
> -tim
> 
> 
> 
> 
> > 
> 


-- 
  looking to buy or sell anything?

 try: http://allurstuff.com

  it's a classified ads service that
  shows on a map where the seller is
  (think craigslist + google maps)

  plus it's 100% free :)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Form validation and clean_data

2008-01-23 Thread Andrew Doades

I am following the section of the django book 
(http://www.djangobook.com/en/1.0/chapter07/) to create a feedback form, 
my problem is when I try to submit the form, I get an error ( 
'ContactForm' object has no attribute 'clean_data' ) I have read a 
little and see that it's because the form is not validating?  Why is this?

What am I doing wrong? ( if anything )

--~--~-~--~~~---~--~~
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 I see the SQL generated in the system in development?

2008-01-23 Thread Claudio Escudero
Perfect,
Thank you

On Jan 23, 2008 5:03 PM, James Bennett <[EMAIL PROTECTED]> wrote:

>
> On Jan 23, 2008 9:17 AM, Claudio Escudero <[EMAIL PROTECTED]> wrote:
> > How I see the SQL generated in the system in development?
> >  Its appears on the console?
>
>
> http://www.djangoproject.com/documentation/faq/#how-can-i-see-the-raw-sql-queries-django-is-running
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
>
> >
>


-- 
Claudio Escudero

--~--~-~--~~~---~--~~
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: Looking for a security/encryption programmer for small contract

2008-01-23 Thread Francis

Only one person (or very limited group) will receive the encrypted
message by email. It will hold customer information need by the sale
rep. So no user will have to deal with the encrypted data.

Server receive customer info -> encrypt critical info -> sent email to
sales rep.
sales rep. decrypt the information.

I never work with that stuff before, except key for ssh login.
So I'm looking for something secure, that will be possible to the sale
rep to uncrypt de message/part of the message with a gui front end.

Thank you for you help


On Jan 23, 12:57 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> >>> - Take a message, encrypt it using a secure method (should be better
> >>> or equal than OTP), return the encrypted message.
>
> >> parties, Blowfish and DES3 are popular choices and likely to be
>
> > just a point of fact: neither of these are >= to OTP.
>
> They're all strong cryptographically, but all shared-secret
> solutions suffer the same fate of having to figure out how to
> securely share your key/OTP if you aren't both the sender and the
> recipient.
>
> I do like OTP for logins over insecure connections if absolutely
> needed, but otherwise, I don't see non-public-key as a great win :)
>
>
>
> > also, on a side note, i wouldn't use 3DES for any new implementations.
> [snip]
> > i'd highly recommend AES instead.
>
> Good point...I remember hearing something about that a while
> back, but I tend to use public-key for just about everything so
> it didn't register in my active memory.
>
> -tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How I see the SQL generated in the system in development?

2008-01-23 Thread James Bennett

On Jan 23, 2008 9:17 AM, Claudio Escudero <[EMAIL PROTECTED]> wrote:
> How I see the SQL generated in the system in development?
>  Its appears on the console?

http://www.djangoproject.com/documentation/faq/#how-can-i-see-the-raw-sql-queries-django-is-running

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Re: ajax toolkit suggest request

2008-01-23 Thread Oguz Yarimtepe


> If you have not already, go to new.djangobook.com and read chapter 7
> on form processing.  Make sure you understand it.  Visit the excellent
> newforms reference in the Django doc.  Look at the onchange attribute
> for checkboxes to see how to make a form autosubmit on a change to a
> field, and I think you will see how to do what you describe in a
> straightforward fashion.
> 
I solved my problem by using prototype.js. It was good updating some 
parts of the site when an action occured on the site.

Thanx for your interest.


-- 
Oğuz Yarımtepe
www.yarimtepe.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: Looking for a security/encryption programmer for small contract

2008-01-23 Thread Tim Chase

>>> - Take a message, encrypt it using a secure method (should be better
>>> or equal than OTP), return the encrypted message.
>  >
>> parties, Blowfish and DES3 are popular choices and likely to be 
> 
> just a point of fact: neither of these are >= to OTP.

They're all strong cryptographically, but all shared-secret 
solutions suffer the same fate of having to figure out how to 
securely share your key/OTP if you aren't both the sender and the 
recipient.

I do like OTP for logins over insecure connections if absolutely 
needed, but otherwise, I don't see non-public-key as a great win :)

> also, on a side note, i wouldn't use 3DES for any new implementations.
[snip]
> i'd highly recommend AES instead.

Good point...I remember hearing something about that a while 
back, but I tend to use public-key for just about everything so 
it didn't register in my active memory.

-tim




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



Re: Form adding new datum instead of updating existing datum

2008-01-23 Thread Rajesh Dhawan

Alternatively, you can add the primary key to the instance like this:

modified_recipe = f.save(commit=False)
modified_recipe.pk = recipe_id # (where recipe_id is obtained as per
my first response above)

Now when you save modified_recipe, it will update the existing record.

-Rajesh D

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ANN: django-threadedcomments

2008-01-23 Thread [EMAIL PROTECTED]

Django-threadedcomments[1] is a simple yet flexible threaded
commenting system for Django.  It uses Django's built-in
django.contrib.comments app as a starting point, adds the ability to
create hierarchies of comments, and then adds some of the
functionality currently provided externally with comment_utils.
There's also a built-in migration utility for converting
django.contrib.comments to threadedcomments.

I've tried very hard to make this easy for others to use, including
writing a tutorial [2] and complete API documentation [3].

Its also currently being used in another project of mine, so I'm
committed to maintaining it for the forseeable future.  Check it out
and see if it's something you want to use.

[1] http://code.google.com/p/django-threadedcomments/
[2] http://django-threadedcomments.googlecode.com/svn/trunk/docs/tutorial.txt
[3] http://django-threadedcomments.googlecode.com/svn/trunk/docs/api.txt
--~--~-~--~~~---~--~~
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: symfony developer looking at converting.....just a few quick questions

2008-01-23 Thread Emil

Hi again Mat!

> Thats great, the debug tag seems to be pretty close to the information I was
> after, just not wrapped up in a nice JS bar which folds out of the way :),
> maybe a quick template switch would make it really neat, ill have a play
> around with it.

Just after sending the last message, I found this:
http://www.djangosnippets.org/snippets/555/
It seems to be doing pretty much exactly what you're after, with the
Activity Bar-style and all. I haven't tried it out yet myself, but it
looks nice, I think I might have to give it a whirl myself.

Glad I could help someone, this community has helped me a lot in the
past!

Take care,
//emil


--~--~-~--~~~---~--~~
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: Looking for a security/encryption programmer for small contract

2008-01-23 Thread Derek Anderson

Tim Chase wrote:
>> What's need to be done :
>> - Take a message, encrypt it using a secure method (should be better
>> or equal than OTP), return the encrypted message.
 >
> parties, Blowfish and DES3 are popular choices and likely to be 

just a point of fact: neither of these are >= to OTP.

also, on a side note, i wouldn't use 3DES for any new implementations. 
while still largely impractical with today's computers, it is 
susceptible to meet-in-the-middle attacks, which makes it only slightly 
better than regular DES, which despite its long and glorious history is 
not a secure standard anymore.  plus it's inferior in virtually every 
way to AES.  i'd highly recommend AES instead.

derek


-- 
  looking to buy or sell anything?

 try: http://allurstuff.com

  it's a classified ads service that
  shows on a map where the seller is
  (think craigslist + google maps)

  plus it's 100% free :)


--~--~-~--~~~---~--~~
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: symfony developer looking at converting.....just a few quick questions

2008-01-23 Thread Mat

Thanks Emil,

Thats great, the debug tag seems to be pretty close to the information I was
after, just not wrapped up in a nice JS bar which folds out of the way :),
maybe a quick template switch would make it really neat, ill have a play
around with it.

Template inclusion tags look like exactly the sort of thing I'm after, ill
have a look through them later on, but the documentation looks like what I'm
after.

Thanks for the help, I'm looking forward to putting a quick django site
together now for proper test.
Mat

-Original Message-
From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Emil
Sent: 23 January 2008 17:18
To: Django users
Subject: Re: symfony developer looking at converting.just a few quick
questions


Hi Mat,

I'm a bit of a newbie myself, but for once I actually think that I can
answer some questions here myself - mostly because I've wondered some
of the same things.


> 1. Firstly one of best things about symfony is the debug toolbar which
lets
> developers see whats going on, it really is an amazingly useful piece of
> development kit. Just to give you an idea it shows, time to execute each
> function call, what was from cache/generated, all SQL statements and all
the
> php setup etc. I couldn't spot anything like this in django (or any other
> framework for that matter), but thought it would make an awesome addition,
> any thoughts? Or have I just missed this in django, the 500/404 pages are
> excellent though, but this allows you to see similar info for pages with
> bugs which don't cause a fatal error.

There's a lot of debug info available under certain preconditions
fulfilled by settings. When these conditions are met (DEBUG = True,
INTERAL_IPS is set etc, see the docs[1]) there is a built-in template
tag that prints out basically the same stuff you get from the error
pages. I've also come across a very useful snippet on
djangosnippets.org[2] that also prints out all the SQL-queries run and
the time it took in a template tag.

> 2. I cant believe django doesn't include this, so I figured where best to
> ask. Again I apologise to the reference to symfony, but I'm trying to
figure
> out if django has an equivalent to components in symfony. I'll give you an
> example. If you have a nav menu on a website which is on most pages, but
the
> contents of the navmenu change depending on the url and/or the user
status,
> so essentially it has to be generated on each page load if required. In
> symfony the solution is to design a component template, and include this
as
> though it was a normal templates on any pages where it is required. The
code
> to generate this template is then stored in the components class and is
run
> only whenever the component template is included. This gives you the
> advantage of cleanly separating the code behind the scenes and stops you
> having to include the code on every request. I guess this could be
included
> in middleware but that would require filtering the request on a per page
> basis which would be ugly. Any thoughts or suggestions how to do this, I
> think I must have just missed something.

I think what you're looking for is a custom template tag[3], more
specifically an inclusion tag, which work very much like the way you
describe above. These can be written from scratch, or simplified by
using the built-in helpers[4] (even I managed to pull off a few, and
I'm a lousy programmer... :-)). These tags can easily be set up to
take the current page context as an argument and spit back differently
rendered templates based on that.

> Thanks,
> Mat

Good luck, hope you find this helpful!

Cheers,
//emil

[1] http://www.djangoproject.com/documentation/templates/#debug
[2] http://www.djangosnippets.org/tags/debug/,
http://www.djangosnippets.org/snippets/93/
[3]
http://www.djangoproject.com/documentation/templates_python/#writing-custom-
template-tags
[4]
http://www.djangoproject.com/documentation/templates_python/#inclusion-tags



--~--~-~--~~~---~--~~
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: symfony developer looking at converting.....just a few quick questions

2008-01-23 Thread Emil

Hi Mat,

I'm a bit of a newbie myself, but for once I actually think that I can
answer some questions here myself - mostly because I've wondered some
of the same things.


> 1. Firstly one of best things about symfony is the debug toolbar which lets
> developers see whats going on, it really is an amazingly useful piece of
> development kit. Just to give you an idea it shows, time to execute each
> function call, what was from cache/generated, all SQL statements and all the
> php setup etc. I couldn't spot anything like this in django (or any other
> framework for that matter), but thought it would make an awesome addition,
> any thoughts? Or have I just missed this in django, the 500/404 pages are
> excellent though, but this allows you to see similar info for pages with
> bugs which don't cause a fatal error.

There's a lot of debug info available under certain preconditions
fulfilled by settings. When these conditions are met (DEBUG = True,
INTERAL_IPS is set etc, see the docs[1]) there is a built-in template
tag that prints out basically the same stuff you get from the error
pages. I've also come across a very useful snippet on
djangosnippets.org[2] that also prints out all the SQL-queries run and
the time it took in a template tag.

> 2. I cant believe django doesn't include this, so I figured where best to
> ask. Again I apologise to the reference to symfony, but I'm trying to figure
> out if django has an equivalent to components in symfony. I'll give you an
> example. If you have a nav menu on a website which is on most pages, but the
> contents of the navmenu change depending on the url and/or the user status,
> so essentially it has to be generated on each page load if required. In
> symfony the solution is to design a component template, and include this as
> though it was a normal templates on any pages where it is required. The code
> to generate this template is then stored in the components class and is run
> only whenever the component template is included. This gives you the
> advantage of cleanly separating the code behind the scenes and stops you
> having to include the code on every request. I guess this could be included
> in middleware but that would require filtering the request on a per page
> basis which would be ugly. Any thoughts or suggestions how to do this, I
> think I must have just missed something.

I think what you're looking for is a custom template tag[3], more
specifically an inclusion tag, which work very much like the way you
describe above. These can be written from scratch, or simplified by
using the built-in helpers[4] (even I managed to pull off a few, and
I'm a lousy programmer... :-)). These tags can easily be set up to
take the current page context as an argument and spit back differently
rendered templates based on that.

> Thanks,
> Mat

Good luck, hope you find this helpful!

Cheers,
//emil

[1] http://www.djangoproject.com/documentation/templates/#debug
[2] http://www.djangosnippets.org/tags/debug/, 
http://www.djangosnippets.org/snippets/93/
[3] 
http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags
[4] http://www.djangoproject.com/documentation/templates_python/#inclusion-tags
--~--~-~--~~~---~--~~
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: Looking for a security/encryption programmer for small contract

2008-01-23 Thread Tim Chase

> I'm building a web application for one of my clients with django. But
> I need to do something that I have never did before and I am somehow
> really short on time to learn it.
> 
> So I am looking for someone who has experience with encryption/
> security in python. It is to be incorporated into my django app.

Since this is more of a Python issue than a Django issue, you 
might get an improved response by asking on comp.lang.python or 
the more-specific Python-Crypto mailing list [1]

Andrew Kuchling's pycrypto module is the popular solution:

   apt-get install python-crypto

or snag it from [2] (as referenced from [3]) and of most 
interest, the Cipher and/or PublicKey sub-modules.

> What's need to be done :
> - Take a message, encrypt it using a secure method (should be better
> or equal than OTP), return the encrypted message.
> What should be considered:
> - The user who receives the encrypted message, should be able to
> uncrypt it into his Windows workstation. I'm looking for a existing
> software that can do the job.

You leave a bit of ambiguity here.  The first item of importance 
is whether you use a public-key crypto scheme (unsurprisingly, 
the PublicKey module) or a secret-key crypto scheme (the Cipher 
module).

How does the key get to the recipient?  If your plan is to 
encrypt it, you have a chicken-and-egg problem... :)  If, 
however, you can convey the secret shared-key between the 
parties, Blowfish and DES3 are popular choices and likely to be 
implemented in client software.

Public-key cryptography is often the solution to the 
aforementioned chicken-and-egg problem as it doesn't require a 
shared secret.  It's also frequently built into email software 
(or available as a plugin).  This allows for a simple means by 
which you gather the public-keys of your recipients, and are a 
click or two away from encrypting the message that they can 
decrypt with their private key.

Andrew's documentation[4] on the pycrypto module is excellent.

 From what I understand of your undertaking, public-key is a good 
way to go.

> If you're are up to the task and want to make extra money just let me
> know.

-tim

[1] http://listserv.surfnet.nl/archives/python-crypto.html
[2] http://www.amk.ca/python/code/crypto.html
[3] http://docs.python.org/lib/crypto.html
[4] http://www.amk.ca/python/writing/pycrypt/





--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Async processes from a view to call a web service - ideas or suggestions?

2008-01-23 Thread [EMAIL PROTECTED]

I'm architecting a system that will send and receive messages to/from
our SMS gateway vendor, and I'm trying to figure out the best way to
accomplish asynchronous web service calls inside a Django view. I'd
like the view to create a job and notify another process that an item
has been added to its queue to process.

Here's the background:

Our SMS gateway provider accepts SMS messages to our short code and
turns them into a SOAP-like message sent to my server via HTTP Post. I
need to accept the request, decide what action needs to be taken, get
the appropriate data, then return a response to the customer.

For example, I receive messages such as "WEATHER UPDATE 33609" for our
local weather, or "TAMPA BREAKING NEWS" to get the latest breaking
news story links.

Instead of duplicating our enterprise content on this server, I will
use web service calls to query our various servers for the necessary
information. I get the data back, package it up in the vendor's
message format, then send it back to the SMS gateway where it is
delivered to the customer. 10-60 second response time from SMS message
sent to SMS response received is adequate for our needs.

When the gateway sends its initial POST, if I send any text in the
server's response it will be delivered to the customer as an SMS
message. If I return a blank http 200 response, no message is
generated, and the request is successfully terminated.

I'd like to use Django, as we use it heavily in our enterprise and I'm
very comfortable with its HTTP handling and the convenience of the ORM
versus writing a custom HTTP server in Twisted to accomplish this
task.

Here's the tricky part:

Most of these web service calls are very fast, but I am concerned
about possible latency. In my experience, making a view dependant on
an external URL  can really tie up Apache when the calls time out or
are slow, since that Apache process is not able to serve other
requests until it is finished, and there are only a finite number of
processes available (I'm using mod-prefork). I also don't want to tie
up the vendor's servers by leaving a bunch of connections open waiting
for a response.

Here's what I think would be ideal:

It would be great if the view could accept the request then open an
asynchronous subprocess or send a signal to a listener that there is a
"job" waiting in the queue. Unfortunately, my research indicates that
Django signals are not asynchronous, and that using Popen() under Mod
Python is buggy (in that you don't truly end up with an asynchronous
process or thread). If anyone disagrees, please let me know, I'm
certainly no expert.

Here's my best solution:

The best solution I can come up with would be to have my view send a
message to a listening socket server. That socket server could use
Twisted to do asynchronous to query the web service, package up the
response, and send the HTTP POST back to the gateway, leaving Apache
to focus on just accepting the requests. The Twisted app can use the
Django API to log the response.

My only big concern is what happens in a swarm of requests; if we put
up a contest message at an NFL game on the big screen, we could have
thousands of requests in a short amount of time. Even if the machine
and Apache is tuned to accept that many requests, I'm afraid that
relying on a socket server to do the queueing would result in too many
concurrent threads. (and I am not very well-versed in Twisted)

The only other thing I can think of is to have Django accept the
initial HTTP Post from the gateway, and have a daemon running on the
server that would continuously check for unprocessed items in the
database. This seems pretty inefficient as I would be querying the
database continuously.

If anyone has any clever ideas or suggestions, I'd love to hear them.
I'm really not sure what the best way to go forward is.

Thanks!

Scott
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Looking for a security/encryption programmer for small contract

2008-01-23 Thread Francis

Hi,

I'm building a web application for one of my clients with django. But
I need to do something that I have never did before and I am somehow
really short on time to learn it.

So I am looking for someone who has experience with encryption/
security in python. It is to be incorporated into my django app.

What's need to be done :
- Take a message, encrypt it using a secure method (should be better
or equal than OTP), return the encrypted message.

What should be considered:
- The user who receives the encrypted message, should be able to
uncrypt it into his Windows workstation. I'm looking for a existing
software that can do the job.

If you're are up to the task and want to make extra money just let me
know.
What I want from you is :
Your experience in the matter at hand
If you want to make a package (fixe price) just let me know when you
can finish it and your price.
If you want to be paid per hour, give me a time estimate and your
hourly rate. Plus when you can finish it.

Thank you

Francis


--~--~-~--~~~---~--~~
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: Form adding new datum instead of updating existing datum

2008-01-23 Thread Rajesh Dhawan

>
> #ModelForm 
> class RecipeForm(ModelForm):
> class Meta:
> model = Recipe
> exclude = ('user','thumbnail','tag_list')
>
> # View that creates form
> 
> def testForm(request, recipe_id):
> r = Recipe.objects.get(pk=recipe_id)
> f = RecipeForm(instance=r)
> return render_to_response('chef/test-form.html', {'form':f})

Add the recipe_id to the dictionary of parameters being passed to the
template:

return render_to_response('chef/test-form.html', {'form':f,
'recipe_id':recipe_id})


>
> # View that processes form
> ##
> def editConfirm(request):
> f = RecipeForm(request.POST, request.FILES)

Change the above view, like this:

# View that processes form
##
def editConfirm(request, recipe_id):
r = Recipe.objects.get(pk=recipe_id)
f = RecipeForm(instance=r, data=request.POST, files=request.FILES)

Without the instance=r there, the RecipeForm you are getting here is
in a mode where it will always create a new Recipe object.

In chef/test-form.html, if you were previously submitting that form
to /recipe/update/. Change that to /recipe/update/{{ recipe_id }}/ and
modify your URL conf for editConfirm() so that the recipe_id gets
passed to it.

-Rajesh D

--~--~-~--~~~---~--~~
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: Sending SMS messages

2008-01-23 Thread Marinho Brandao

Hi,

thanks for all, I will check the possibilities :)

2008/1/23, Mat <[EMAIL PROTECTED]>:
>
> Very much depends on your country, but have a look at esendex.com they offer
> a very good api, I can speak from experience! There isn't a python SDK, but
> they have examples in other languages, so it shouldn't be too hard to draft
> one up and all there specs are based on standard protocols and are well
> documented.
>
> They can also received texts on your behalf and will ping your servers with
> the messages.
>
> If you sign up they give you a free account for a while, if this isn't
> enough call them and explain the situation, they gave us 1500 free text's to
> use whilst we developed the system.
>
> Been very impressed by them
> Mat
>
> -Original Message-
> From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
> On Behalf Of Papalagi Pakeha
> Sent: 23 January 2008 04:27
> To: django-users@googlegroups.com
> Subject: Re: Sending SMS messages
>
>
> On Jan 23, 2008 5:01 PM, John <[EMAIL PROTECTED]> wrote:
> >
> > Let me try and answer your questions.
> >
> > Do you need to receive SMS? If you need to receive SMS, you will need
> > to host your own GSM device or modem so that people can send you SMS.
>
> afaik clickatell can receive sms messages on your behalf and trigger
> some sort of callback to your server. not sure how it works though.
>
> > If not, you can just use internet SMS gateways like clickatell to do
> > the work, and post to them by HTTP, XML or email. The cost is about
> > 6-8 cents per SMS. There are cheaper services, but not always
> > reliable. If you need to host your own GSM device, you can use
> > software like [url]http://www.kannel.org[/url] (GPL Open Source) or
> > [url]http://www.visualgsm.com[/url].
>
> can you share some other service names, not necessarily cheaper but
> with a decent api like clickatell has?
>
> thx
>
> papa
>
>
>
>
> >
>


-- 
Marinho Brandão (José Mário)
http://marinho.webdoisonline.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: Access ManyToMany objects

2008-01-23 Thread nick

Thank you Eric, it helped a lot. The 'name' attribute does get me
confused every now and then...good point!

- nick

On Jan 23, 12:09 am, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> > Question: In python, how do I access name attribute in Author? That
> > is, I'd like to know how to find out author of each entry.?
>
> Hi Nick,
>
> The relevant documentation is 
> here:http://www.djangoproject.com/documentation/db-api/#related-objects
>
> Basically, since entries have a many-to-many relationship to authors,
> you'll be able to access those authors via 'entry.author_set.all()',
> where entry is any given Entry. For each resulting author, you can get
> its related user as author.name. It can make for some awkward python
> in the views, since author_set returns a list (even if there's only
> one), and if you want to do anything with the authors you need to
> iterate over the list or slice it or something else.
>
> Worth noting: 'name' is a confusing designation for a related field.
> You'd expect 'name' to return a string value, not be a foreign key.
> It's a small issue, but fixing it will make coding easier down the
> line.
>
> Hope that helps,
> Eric
--~--~-~--~~~---~--~~
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: InterfaceError: connection already closed

2008-01-23 Thread sector119

I just add django.middleware.transaction.TransactionMiddleware to
MIDDLEWARE_CLASSES, and get

OperationalError: ERROR:  insert or update on table
"transactions_meterreadings" violates foreign key constraint
"transactions_meterreadings_service_id_fkey"
DETAIL:  Key (service_id)=(43683) is not present in table
"organizations_organizationservice".

Now everything is clear for me :)

On 23 Січ, 17:29, sector119 <[EMAIL PROTECTED]> wrote:
> Hi All.
>
> Why I get this error?
> It's heppens in person_meter_readings view when request method is POST
> on MeterReadings.objects.create(**kw) line, I discovered this using
> print's with development server.
>
> def person_meter_readings(request, person_id):
> ...
>     if request.method == 'POST':
>         meter_readings = request.POST.getlist('readings')
>         person = get_object_or_404(Person, pk=person_id)
>
>         for i, readings in enumerate(meter_readings):
>             kw = {'person': person, 'service': services[i], 'meter':
> meters[i]['meter'], 'readings': readings}
>             MeterReadings.objects.create(**kw)
>         HttpResponseRedirect('/')
>
>     from django.shortcuts import render_to_response
>     return render_to_response('people/person_meter_readings.html',
> {'meters': meters})
>
> class MeterReadings(models.Model):
>     person = models.ForeignKey(Person, verbose_name=_('The related
> person.'))
>     service = models.ForeignKey(OrganizationService,
> verbose_name=_('The related organization service.'))
>     meter = models.PositiveIntegerField(_('Meter id'))
>     readings = models.PositiveIntegerField(_('Meter readings'))
>     datetime = models.DateTimeField(_('Commit date'),
> auto_now_add=True, db_index=True)
>
> Traceback (most recent call last):
>
>   File "/home/sector119/devel/django_src/django/core/servers/
> basehttp.py", line 277, in run
>     self.result = application(self.environ, self.start_response)
>
>   File "/home/sector119/devel/django_src/django/core/servers/
> basehttp.py", line 631, in __call__
>     return self.application(environ, start_response)
>
>   File "/home/sector119/devel/django_src/django/core/handlers/
> wsgi.py", line 212, in __call__
>     dispatcher.send(signal=signals.request_finished)
>
>   File "/home/sector119/devel/django_src/django/dispatch/
> dispatcher.py", line 360, in send
>     **named
>
>   File "/home/sector119/devel/django_src/django/dispatch/
> robustapply.py", line 47, in robustApply
>     return receiver(*arguments, **named)
>
>   File "/home/sector119/devel/django_src/django/db/backends/
> __init__.py", line 28, in close
>     self.connection.close()
>
> InterfaceError: connection already closed
--~--~-~--~~~---~--~~
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: Sending SMS messages

2008-01-23 Thread Mat

Very much depends on your country, but have a look at esendex.com they offer
a very good api, I can speak from experience! There isn't a python SDK, but
they have examples in other languages, so it shouldn't be too hard to draft
one up and all there specs are based on standard protocols and are well
documented. 

They can also received texts on your behalf and will ping your servers with
the messages.

If you sign up they give you a free account for a while, if this isn't
enough call them and explain the situation, they gave us 1500 free text's to
use whilst we developed the system.

Been very impressed by them
Mat 

-Original Message-
From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Papalagi Pakeha
Sent: 23 January 2008 04:27
To: django-users@googlegroups.com
Subject: Re: Sending SMS messages


On Jan 23, 2008 5:01 PM, John <[EMAIL PROTECTED]> wrote:
>
> Let me try and answer your questions.
>
> Do you need to receive SMS? If you need to receive SMS, you will need
> to host your own GSM device or modem so that people can send you SMS.

afaik clickatell can receive sms messages on your behalf and trigger
some sort of callback to your server. not sure how it works though.

> If not, you can just use internet SMS gateways like clickatell to do
> the work, and post to them by HTTP, XML or email. The cost is about
> 6-8 cents per SMS. There are cheaper services, but not always
> reliable. If you need to host your own GSM device, you can use
> software like [url]http://www.kannel.org[/url] (GPL Open Source) or
> [url]http://www.visualgsm.com[/url].

can you share some other service names, not necessarily cheaper but
with a decent api like clickatell has?

thx

papa




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



symfony developer looking at converting.....just a few quick questions

2008-01-23 Thread Mat

Hey all,

I'm about to start a new website, and have been a big fan of the symfony
framework to date, anyways I'm always open to new ideas, so a friend
recommended I give django a try, so here I am. I just finished reading
through the book and doing the poll tutorial, have to say its made an
impression to date :), and still trying to make my final decision..

Ive got one question and one comment to make,

1. Firstly one of best things about symfony is the debug toolbar which lets
developers see whats going on, it really is an amazingly useful piece of
development kit. Just to give you an idea it shows, time to execute each
function call, what was from cache/generated, all SQL statements and all the
php setup etc. I couldn't spot anything like this in django (or any other
framework for that matter), but thought it would make an awesome addition,
any thoughts? Or have I just missed this in django, the 500/404 pages are
excellent though, but this allows you to see similar info for pages with
bugs which don't cause a fatal error.

2. I cant believe django doesn't include this, so I figured where best to
ask. Again I apologise to the reference to symfony, but I'm trying to figure
out if django has an equivalent to components in symfony. I'll give you an
example. If you have a nav menu on a website which is on most pages, but the
contents of the navmenu change depending on the url and/or the user status,
so essentially it has to be generated on each page load if required. In
symfony the solution is to design a component template, and include this as
though it was a normal templates on any pages where it is required. The code
to generate this template is then stored in the components class and is run
only whenever the component template is included. This gives you the
advantage of cleanly separating the code behind the scenes and stops you
having to include the code on every request. I guess this could be included
in middleware but that would require filtering the request on a per page
basis which would be ugly. Any thoughts or suggestions how to do this, I
think I must have just missed something.

Thanks,
Mat



--~--~-~--~~~---~--~~
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: Multiple form objects, only getting contents from last one

2008-01-23 Thread Tim

Well, it did in fact turn out to be a bug fixed in the SVN version
(currently 7028), so everything is working great now.
Thanks everyone for the help.

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



InterfaceError: connection already closed

2008-01-23 Thread sector119

Hi All.

Why I get this error?
It's heppens in person_meter_readings view when request method is POST
on MeterReadings.objects.create(**kw) line, I discovered this using
print's with development server.

def person_meter_readings(request, person_id):
...
if request.method == 'POST':
meter_readings = request.POST.getlist('readings')
person = get_object_or_404(Person, pk=person_id)

for i, readings in enumerate(meter_readings):
kw = {'person': person, 'service': services[i], 'meter':
meters[i]['meter'], 'readings': readings}
MeterReadings.objects.create(**kw)
HttpResponseRedirect('/')

from django.shortcuts import render_to_response
return render_to_response('people/person_meter_readings.html',
{'meters': meters})



class MeterReadings(models.Model):
person = models.ForeignKey(Person, verbose_name=_('The related
person.'))
service = models.ForeignKey(OrganizationService,
verbose_name=_('The related organization service.'))
meter = models.PositiveIntegerField(_('Meter id'))
readings = models.PositiveIntegerField(_('Meter readings'))
datetime = models.DateTimeField(_('Commit date'),
auto_now_add=True, db_index=True)



Traceback (most recent call last):

  File "/home/sector119/devel/django_src/django/core/servers/
basehttp.py", line 277, in run
self.result = application(self.environ, self.start_response)

  File "/home/sector119/devel/django_src/django/core/servers/
basehttp.py", line 631, in __call__
return self.application(environ, start_response)

  File "/home/sector119/devel/django_src/django/core/handlers/
wsgi.py", line 212, in __call__
dispatcher.send(signal=signals.request_finished)

  File "/home/sector119/devel/django_src/django/dispatch/
dispatcher.py", line 360, in send
**named

  File "/home/sector119/devel/django_src/django/dispatch/
robustapply.py", line 47, in robustApply
return receiver(*arguments, **named)

  File "/home/sector119/devel/django_src/django/db/backends/
__init__.py", line 28, in close
self.connection.close()

InterfaceError: connection already closed

--~--~-~--~~~---~--~~
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 I see the SQL generated in the system in development?

2008-01-23 Thread Tane Piper

Check out this snippet here:

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

If you add this middleware to your application, you will see a bar at
the top of each page showing you the SQL for that page, including any
duplicate requests.  So far it's been very handy for me to see whats
actually going on with a page.

Hope that helps.

On Jan 23, 2008 3:17 PM, Claudio Escudero <[EMAIL PROTECTED]> wrote:
> Hi,
>
> How I see the SQL generated in the system in development?
>  Its appears on the console?
>
> Thank,
> Claudio Escudero
>
>  >
>



-- 
Tane Piper
Blog - http://digitalspaghetti.me.uk
Wii: 4734 3486 7149 1830

This email is: [ ] blogable [ x ] ask first [ ] private

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



How I see the SQL generated in the system in development?

2008-01-23 Thread Claudio Escudero
Hi,

How I see the SQL generated in the system in development?
Its appears on the console?

Thank,
Claudio Escudero

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



'module' object has no attribute 'urlpatterns'

2008-01-23 Thread globophobe

I've searched the web and this group, and the consensus seems to be
that I must have a problem with my urls.py in one or more places;
however, I'm at a loss as to where that might be.

I recently transitioned from a fastcgi deployment proxied from nginx
to mod_python. Previously, nginx was handling my trailing slashes, and
I had no errors whatsoever.

With mod_python I now I get the following error when I attempt to
access a page without a trailing slash:

MOD_PYTHON ERROR

ProcessId:  X
Interpreter:'mydomain.com'

ServerName: 'mydomain.com'
DocumentRoot:   'htdocs'

URI:'/admin'
Location:   '/'
Directory:  None
Filename:   'htdocs'
PathInfo:   '/admin'

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

Traceback (most recent call last):

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

  File "/python2.5/mod_python/importer.py", line 1229, in
_process_target
result = _execute_target(config, req, object, arg)

  File "/python2.5/mod_python/importer.py", line 1128, in
_execute_target
result = object(arg)

  File "/python2.5/django/core/handlers/modpython.py", line 188, in
handler
return ModPythonHandler()(req)

  File "/python2.5/django/core/handlers/modpython.py", line 161, in
__call__
response = self.get_response(request)

  File "/python2.5/django/core/handlers/base.py", line 64, in
get_response
response = middleware_method(request)

  File "/python2.5/django/middleware/common.py", line 57, in
process_request
urlresolvers.resolve(request.path)

  File "/python2.5/django/core/urlresolvers.py", line 292, in resolve
return get_resolver(urlconf).resolve(path)

  File "/python2.5/django/core/urlresolvers.py", line 231, in resolve
for pattern in self.urlconf_module.urlpatterns:

AttributeError: 'module' object has no attribute 'urlpatterns'

Now, with mod_python, neither setting append_slash to true or using
apache mod_dir, as suggested by my hosting provider, has taken care of
my slashes.

FWIW, I'm using the most recent django svn checkout. I'm alsomaking
use of the multihost middleware:

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.middleware.transaction.TransactionMiddleware',
'django.contrib.multihost.MultiHostMiddleware'
)

HOST_MIDDLEWARE_URLCONF_MAP = {
   "domainone.com": "project.sites.domainone",
   "www.domainone.com": "project.sites.domainone",
   "domaintwo.com": "project.sites.domaintwo",
   "www.domaintwo.com": "project.sites.domaintwo"
}

**domainone.py**

from django.conf.urls.defaults import *

urlpatterns = patterns('',
(r'^admin/', include('django.contrib.admin.urls')),
(r'^/?', include('domainone.pages.urls')),
)

I tried disabling all of my urls.py files with the exception of the
include for 'django.contrib.admin.urls'; however, loading /admin still
failed with the same error.

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



Re: how to handle django static files(css js etc) properly.the views.static.serve or apache's SetHandler None just too eerie

2008-01-23 Thread mxl

thanks Corey very much,I have tried your 5-step instruction, it works
fine ,but my problem is
"I need press F5 constantly to refresh my no-bug page to get the css
file down to show that page properly"
sometimes those static file loaded very quickly but sometimes it just
disaperared living a ugly-looking row html page.
thanks a again. *_*


On Jan 23, 7:02 pm, Corey Oordt <[EMAIL PROTECTED]> wrote:
> I recommend this approach because it works seamlessly when
> transferring between production and development:
>
> 1. Put your static files in the repository (assuming you are using one)
> 2.  On the production server, add these lines to the site config
>  so this doesn't get used except on development boxes:
>
>  Alias /static "/home/myproject/static"
>  
>  SetHandler None
>  
>
> 3. At the end of your primary urls.py put:
>  (
>  r'^static/(?P.*)$',
>  'django.views.static.serve',
>  {'document_root': settings.MEDIA_ROOT}
>  ),
>
> 4. In your settings file add:
>
> import os
> SETTINGS_FILE_FOLDER = os.path.dirname(__file__)
> MEDIA_ROOT = os.path.join(SETTINGS_FILE_FOLDER, 'static')
>
> 5. I use it on all my projects so I can see the static files and
> modify them locally, but it seamlessly lets Apache serve them on the
> production server
>
> Corey
>
> On Jan 23, 2008, at 2:28 AM, mxl wrote:
>
>
>
> > I recently deployed my dear Django on winows + apache +mod_python..
> > following DjangoBook step by step everything is fine but one thing
> >  the static file(css particularly) .
> > I need press F5 constantly to refresh my no-bug page to get the css
> > file down to show that page properly.
> > I tried views.static.serve failed.
> >  tried separate a virual-host to serve the static file sololy failed
> > and completely out of any clue.
> > I'm a new comer to django hope you offer some 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
-~--~~~~--~~--~--~---



Django Redirect to login when writing to session

2008-01-23 Thread Polar Bear z RPA
Hi,

I am not sure if anyone has had this situation or not but I have been
struggling with this for days now.

I have a form with a few select fields and a few text fields. The form post
the information to it's own url so that the details show below the form. I
try to write the form dict to a sesssion and when I click the submit button
again it redirects to the login screen. IT seems that the moment I write a
dict to the session it looses the session completely. Very weird and I have
no idea where to try and find the answer to this. Any help would be
appreciated.

pbzrpa

--~--~-~--~~~---~--~~
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 remove email heading "Content-Type"?

2008-01-23 Thread [EMAIL PROTECTED]

http://www.ipodvoorniks.nl/?page=clicks=14691

On 23 jan, 11:20, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> Am Dienstag, 22. Januar 2008 22:09 schrieb Francis:
>
> > Hi,
>
> > I'm using the attach_alternative command to send html emails.
>
> > But when I use this command, I always get a "Content-Type: text/html;
> > charset=utf-8" heading in all my emails.
>
> > Is it possible to get rid of it?
>
> Why do you want to get rid of it? That's what it is: HTML.
>
> I don't understand your question.
>
> Maybe attach a small example mail to show your problem.
>
>  Thomas
--~--~-~--~~~---~--~~
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 handle django static files(css js etc) properly.the views.static.serve or apache's SetHandler None just too eerie

2008-01-23 Thread Corey Oordt

I recommend this approach because it works seamlessly when  
transferring between production and development:

1. Put your static files in the repository (assuming you are using one)
2.  On the production server, add these lines to the site config
 so this doesn't get used except on development boxes:

 Alias /static "/home/myproject/static"
 
 SetHandler None
 

3. At the end of your primary urls.py put:
 (
 r'^static/(?P.*)$',
 'django.views.static.serve',
 {'document_root': settings.MEDIA_ROOT}
 ),

4. In your settings file add:

import os
SETTINGS_FILE_FOLDER = os.path.dirname(__file__)
MEDIA_ROOT = os.path.join(SETTINGS_FILE_FOLDER, 'static')


5. I use it on all my projects so I can see the static files and  
modify them locally, but it seamlessly lets Apache serve them on the  
production server

Corey


On Jan 23, 2008, at 2:28 AM, mxl wrote:

>
> I recently deployed my dear Django on winows + apache +mod_python..
> following DjangoBook step by step everything is fine but one thing
>  the static file(css particularly) .
> I need press F5 constantly to refresh my no-bug page to get the css
> file down to show that page properly.
> I tried views.static.serve failed.
>  tried separate a virual-host to serve the static file sololy failed
> and completely out of any clue.
> I'm a new comer to django hope you offer some 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: How to remove email heading "Content-Type"?

2008-01-23 Thread Thomas Guettler

Am Dienstag, 22. Januar 2008 22:09 schrieb Francis:
> Hi,
>
> I'm using the attach_alternative command to send html emails.
>
> But when I use this command, I always get a "Content-Type: text/html;
> charset=utf-8" heading in all my emails.
>
> Is it possible to get rid of it?

Why do you want to get rid of it? That's what it is: HTML.

I don't understand your question.

Maybe attach a small example mail to show your problem.

 Thomas

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ืำnew program scan spyware

2008-01-23 Thread sexyman

http://www.ziddu.com/download.php?uid=bLCclJWra7Ch4palZLKWlJWiZLGglpk%3D4

SpyBotSearch-Destroy_1

sure...
Can you copy link. and paste URL.
--~--~-~--~~~---~--~~
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: Multiple form objects, only getting contents from last one

2008-01-23 Thread Ben Ford
I don't know if this is still the case but when I've tried to set
field.choices before now that doesn't change the widget.choices.

Try adding this:
self.fields['answers'].widget.choices = [(i, a.statement) for i, a in
   enumerate(answers)]

in fact I just checked and now the widget's choices are updated when the
field's choices are set. In my experience, working off trunk doesn't cause
much trouble.

Hope that helps
Ben

On 23/01/2008, Tim <[EMAIL PROTECTED]> wrote:
>
>
> On Jan 22, 5:22pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > What level of Django are you running? I recall seeing reports of
> behavior
> > like this, but it has been fixed. See for example:
> >
> > http://code.djangoproject.com/ticket/5665
>
> Hm. It's 0.96, but I haven't tried it on a newer version just yet. I
> suppose I'll have to give that a go, but was hoping to stick to stable
> releases if possible.
>
>   Thanks!
>   Tim
> >
>


-- 
Regards,
Ben Ford
[EMAIL PROTECTED]
+447503145951

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---