Re: loaddata on User bug?

2007-04-26 Thread Vinay Sajip

On Apr 26, 10:49 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I have dumped the User model on one db using dumpdata. I have a single
> json fixture file with one record (see below). When I run the loadata
> I get the error below. I use ptyhon 2.5 with psycopg2 on macOSX. I
> have tested on Ubuntu and I get a similar error. Is it a bug?
>

It's logged on the tracker - see

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

The good news is, it's a one-line patch - there's a missing call to
disable_termcolors() in load_data().

Regards,

Vinay Sajip


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: loaddata on User bug?

2007-04-26 Thread Russell Keith-Magee

On 4/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I have dumped the User model on one db using dumpdata. I have a single
> json fixture file with one record (see below). When I run the loadata
> I get the error below. I use ptyhon 2.5 with psycopg2 on macOSX. I
> have tested on Ubuntu and I get a similar error. Is it a bug?

It's certainly possible. However, I haven't had any difficulty loading
user data in the way you describe.

> psycopg2.ProgrammingError: syntax error at or near "t character 1

Is this the full text of your error message? This looks like it's
getting truncated in some way - possibly as a result of CR/LF type
characters in a string, or as a result of smart quote characters
getting introduced by an editor somewhere. If this is the case, the
fixture will have difficulty loading.

Can you give details on what you have done to produce this fixture
file? Is is just './manage.py dumpdata auth > out.data', or have you
done anything else along the way? Is there anything else interesting
about your machine setup?

Yours,
Russ Magee %-)

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



Built in Users one-to-many in built-in admin

2007-04-26 Thread mynameisgabe

Hello all -

I'm using django's awesome built in admin for internal folks to view
and manage users and the data associated with users. I've got a model
(let's call it "Article") that contains a foreignkey pointing to the
django.contrib.auth.models.User.  That seems to be working perfectly
except for one thing is stumping me (right now) - the admin tool
correctly displays a list of Users to choose when you're creating/
editing an Article, but not the other way around. I don't see a list
of Articles when I'm editing a User.

Is there a way to do this manually, maybe by overriding the automatic
template?

Thanks!

Gabe


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



Re: Newforms Captcha 0.1 release

2007-04-26 Thread Brandon Low

I've setup a website of sorts for this project:
http://www.lostlogicx.com/captchasblow

On 2007-04-26 (Thu) at 09:10:21 -0500, Brandon Low wrote:
> 
> 16 hours ago I posted about my captcha system that was quite rough
> around the edges.
> 
> I've done some house cleaning since then and will call it 0.1.
> 
> This is now in "Works on my live site" state.  I managed to clean up
> most of the hacky crap that was in the last version and add some
> comments to my code.
> 
> http://test.lostlogicx.com/transfer/captcha-0.1.tar.bz2
> 
> Is there a more 'official' place to post django projects like this?
> djangosnippets doesn't seem like the place for 200 line things with
> several files.
> 
> Thanks,
> 
> Brandon
> 
> 
> > 

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



Re: django sendmail

2007-04-26 Thread drourke

hi,

I've had the same problem I believe. For me the problem was twofold.

1. Trying to reach a third-party smpt server through my local internet
connection.

In my case, I've been at several locations where I try to send mail to
the webfaction smpt server  via the local internet connection.

I cannot do it. I always have to use someone else's username/id that
is local to the connection in order to send email
via smpt. When you put your project/application on webfaction, this
problem will disappear (I figure). I don't recall the technical
jargon, but it's related to not relaying smpt request due to spam
concerns.

2. Different smpt servers require different authentication protocols.
Some just assume that if your attached you must be ok.   It's trial
and error until it works.

On Apr 26, 6:19 am, arv43 <[EMAIL PROTECTED]> wrote:
> hello,
> i get a 550, relay not permitted error when i try to use send_mail.
> this is on my laptop running Ubuntu. But when I try this on my host
> (webfaction), I get a different error
>
> Exception Type:  error
> Exception Value: (111, 'Connection refused')
> Exception Location: /usr/local/lib/python2.4/smtplib.py in
> connect, line 310
>
> i have a registration/login form, which simply takes in an email id,
> and sends an email to that id. unfortunately, i get an error.
>
> My guess is something needs to be done about the mail server, but
> unlike Python's smtplib which requires a server to connect and stuff,
> Django doesnt seem to have/need anything. is there someplace that i
> should modify settings for sending mail to work.
>
> 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
-~--~~~~--~~--~--~---



loaddata on User bug?

2007-04-26 Thread [EMAIL PROTECTED]

I have dumped the User model on one db using dumpdata. I have a single
json fixture file with one record (see below). When I run the loadata
I get the error below. I use ptyhon 2.5 with psycopg2 on macOSX. I
have tested on Ubuntu and I get a similar error. Is it a bug?

Installed 1 object(s) from 1 fixture(s)
Resetting sequences
Traceback (most recent call last):
  File "manage.py", line 15, in 
execute_manager(settings)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/core/management.py", line 1669, in
execute_manager
execute_from_command_line(action_mapping, argv)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/core/management.py", line 1583, in
execute_from_command_line
action_mapping[action](args[1:], int(options.verbosity))
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/core/management.py", line 1413, in
load_data
cursor.execute(line)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/db/backends/util.py", line 12, in
execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: syntax error at or near "
INE 1: SELECT setval('auth_user_id_seq', (...

Ubuntu:
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: syntax error at or near "t character 1

^


Data:
[
  {
"pk": "1",
"model": "auth.user",
"fields": {
  "username": "admin",
  "first_name": "",
  "last_name": "",
  "is_active": true,
  "is_superuser": true,
  "is_staff": true,
  "last_login": "2007-04-26 22:05:47",
  "groups": [],
  "user_permissions": [],
  "password":
"sha1$2dc30$459d0391f78b0f8012ce4311d075e10fde50e288",
  "email": "[EMAIL PROTECTED]",
  "date_joined": "2007-04-26 22:05:03"
}
  }
]


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

2007-04-26 Thread Tim Chase

> today = datetime.date.today()
> context[self.varname] = GpUser.objects.filter(birthday=today)
> 
> The problem is, that will never evaluate to true, because I still have
> today's year. So, how does one throw out the year and just compare
> month and day?

Well, the Django ORM handles something like

   gpusers = GpUser.objects.filter(
 birthday__month = today.month,
 birthday__day = today.day
 )

which should do the trick.  You can read more at:

http://www.djangoproject.com/documentation/db-api/#month
http://www.djangoproject.com/documentation/db-api/#day
http://docs.python.org/lib/datetime-date.html


-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: Redirect middleware

2007-04-26 Thread oggie rob

On Apr 26, 12:16 pm, Laurie Harper <[EMAIL PROTECTED]> wrote:
> oggie rob wrote:
> >> (r'^%s(?P[^?#]*)' % (root_url), 'apps.cms.views.render'),
> > Note that '?' is a special character, ...
>
> Nope; it's special outside a character class ([...]), but in a character
> class ? has no special meaning.
>
> L.

Didn't realize that, but it makes sense and is good to know!

 -rob


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



Comparing dates

2007-04-26 Thread [EMAIL PROTECTED]

This is probably more of a python question, but here goes.
I want to compare today's date to the users' birthdays and build a
list of birthdays. I have the birthdays in the db, properly formatted,
and have a template tag with this:

today = datetime.date.today()
context[self.varname] = GpUser.objects.filter(birthday=today)

The problem is, that will never evaluate to true, because I still have
today's year. So, how does one throw out the year and just compare
month and day?


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



Calling all translators - handling international date display

2007-04-26 Thread orestis

I'll give you a short description here:

The date filter doesn't have any internationalization or localization
knowledge built-in. This plays havoc with languages that have genders,
cases etc (Greek, German, French and many more) and use them in
displaying dates.

There is a discussion at

http://groups.google.com/group/Django-I18N/browse_thread/thread/3f5dfb2a9a10f904

and a ticket at

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

that aim to correct this. I have a proposition for my own language
(Greek) but we have to see the big picture here, and make as
unobtrusive changes as possible, per Malcolm's request. So please come
to the discussion and share your thoughts on this.


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

2007-04-26 Thread Laurie Harper

oggie rob wrote:
>> (r'^%s(?P[^?#]*)' % (root_url), 'apps.cms.views.render'),
> Note that '?' is a special character, ...

Nope; it's special outside a character class ([...]), but in a character 
class ? has no special meaning.

L.


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



Development server

2007-04-26 Thread Pythoni

Is the development server from 0.95 or 0.96 compatible with 0.91
version?
I use Django 0.91 but have problem with the development server. .Many
times I receive the error
#

Unhandled exception in thread started by
Error in sys.excepthook:

Original exception was:
Validating models...
0 errors found.

#
or how can I solve the problem? With Apache it works without problems.
Thanks.
Regards
La.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Select widget choices

2007-04-26 Thread Laurie Harper

Christian Markwart Hoeppner wrote:
> I just noticed that it needs an iterable ot two-tuples. I wonder if
> there's a way to automate the creation of such a sequence, when I need a
> numbered sequence. Something like "for i in range(): list.push((i,i))"
> or so? I'm pretty new to python :)

Perhaps [(i,i) for i in range(5)] is what you want.

L.


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



Re: Newforms Captcha 0.1 release

2007-04-26 Thread Brandon Low

Cool project -- do you plan to use some derivative of eggs, the way that
rails components come in ruby gems, or a completely separate deployment
system?

--Brandon

On 2007-04-26 (Thu) at 16:44:53 -, Mike Axiak wrote:
> 
> We're working on it:
> http://code.google.com/soc/django/appinfo.html?csaid=BA8EE19AE8DC2ECA
> 
> -Mike
> 
> On Apr 26, 12:19 pm, Henrik Jensen <[EMAIL PROTECTED]> wrote:
> > Jay Parlar wrote:
> > > On 4/26/07, Brandon Low <[EMAIL PROTECTED]> wrote:
> > >> 16 hours ago I posted about my captcha system that was quite rough
> > >> around the edges.
> >
> > >> I've done some house cleaning since then and will call it 0.1.
> >
> > >> This is now in "Works on my live site" state.  I managed to clean up
> > >> most of the hacky crap that was in the last version and add some
> > >> comments to my code.
> >
> > >>http://test.lostlogicx.com/transfer/captcha-0.1.tar.bz2
> >
> > >> Is there a more 'official' place to post django projects like this?
> > >> djangosnippets doesn't seem like the place for 200 line things with
> > >> several files.
> >
> > > Most people create Google Code projects, prefixed with "django-". See
> > >http://code.google.com/p/django-openid/and
> > >http://code.google.com/p/django-template-utils/for examples.
> >
> > > Jay P.
> >
> > Why don't we have something like the rubies got, a rubyforge. I think it
> > would be cool if we had a similar thing with scm/bug/forum for python
> > projects. What do you guys think?
> >
> > Henrik
> 
> 
> > 

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



Re: Newforms Captcha 0.1 release

2007-04-26 Thread Henrik Jensen

Jay Parlar wrote:
> On 4/26/07, Brandon Low <[EMAIL PROTECTED]> wrote:
>> 16 hours ago I posted about my captcha system that was quite rough
>> around the edges.
>>
>> I've done some house cleaning since then and will call it 0.1.
>>
>> This is now in "Works on my live site" state.  I managed to clean up
>> most of the hacky crap that was in the last version and add some
>> comments to my code.
>>
>> http://test.lostlogicx.com/transfer/captcha-0.1.tar.bz2
>>
>> Is there a more 'official' place to post django projects like this?
>> djangosnippets doesn't seem like the place for 200 line things with
>> several files.
> 
> Most people create Google Code projects, prefixed with "django-". See
> http://code.google.com/p/django-openid/ and
> http://code.google.com/p/django-template-utils/ for examples.
> 
> Jay P.
> 
> > 
Why don't we have something like the rubies got, a rubyforge. I think it
would be cool if we had a similar thing with scm/bug/forum for python
projects. What do you guys think?


Henrik


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



free dating site - similar to lavalife but completely free

2007-04-26 Thread twopunchtony

I just came across this dating site.  Its 100% free, no credit cards
needed, very similar to lavalife, but again its free.  All kinds of
features too, such as instant messaging, emailing, chat rooms, forums,
e-cards, and much more which are all usable without paying.  Take a
look the site is at http://www.webaffection.com


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



Re: Newforms Captcha 0.1 release

2007-04-26 Thread Jay Parlar

On 4/26/07, Brandon Low <[EMAIL PROTECTED]> wrote:
>
> 16 hours ago I posted about my captcha system that was quite rough
> around the edges.
>
> I've done some house cleaning since then and will call it 0.1.
>
> This is now in "Works on my live site" state.  I managed to clean up
> most of the hacky crap that was in the last version and add some
> comments to my code.
>
> http://test.lostlogicx.com/transfer/captcha-0.1.tar.bz2
>
> Is there a more 'official' place to post django projects like this?
> djangosnippets doesn't seem like the place for 200 line things with
> several files.

Most people create Google Code projects, prefixed with "django-". See
http://code.google.com/p/django-openid/ and
http://code.google.com/p/django-template-utils/ for examples.

Jay P.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: audit trail support

2007-04-26 Thread Jason McVetta
Here is my current thinking:

   - No changes to main model tables
   - Designate a model to be audited by including inner class "Audit"
   - One shadow table per audited model
   - Generate shadow tables for all audited models on post_syncdb
   - Only write to one DB, until multi-db support is completed for Django
   - Write audit record on post_save, w/ flag in one column indicating it
   was a post_save write
   - At the user's option (set by attribute on Audit inner class), also
   write an audit record on pre_save, w/ appropriate flag
   - Maybe include a cron script to discard old audit records, based on
   age or total number of records

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Finding out which fields changed

2007-04-26 Thread [EMAIL PROTECTED]

Ah nice, I tried something like that, but I used self.width instead of
doing an actual get on the model.  Works fine now, thanks :)

-Vincent

On Apr 26, 10:28 am, "Mike H" <[EMAIL PROTECTED]> wrote:
> Hi Vincent,
>
> It sounds to me like you need a pre_save signal to check if the width
> and/or height of the model you're about to save is different from the
> one currently stored in the database, and if they are different,
> regenerate the thumbnail.
>
> Something like :
>
> in_db = Model.objects.get(pk=self.id)
> if in_db.width is not self.width
> 
>
> (if I've understood pre_save correctly, that is. I override the save
> method, myself.)
>
> Hope that helps,
>
> Mike
>
> On 4/26/2007, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
>
>
> >Hello,
>
> >I have a small photo gallery application.  My model has two classes,
> >Gallery and Photo.  Gallery contains information on the width and
> >height of the thumbnails of its photos.  I added a post_save signal so
> >that when a Gallery object is saved, all the photo thumbnails are
> >recreated to match the specified width and height.  This means that
> >changing information unrelated to the thumbnails recreates them.
>
> >I would like to know if it's possible to find which fields have been
> >update so that I could resize the thumbnails only when the width or
> >height attributes have been changed.  Is that possible?
>
> >-Vincent


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Finding out which fields changed

2007-04-26 Thread Mike H


Hi Vincent,

It sounds to me like you need a pre_save signal to check if the width
and/or height of the model you're about to save is different from the
one currently stored in the database, and if they are different,
regenerate the thumbnail.

Something like :

in_db = Model.objects.get(pk=self.id)
if in_db.width is not self.width


(if I've understood pre_save correctly, that is. I override the save
method, myself.)

Hope that helps,

Mike


On 4/26/2007, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

>
>Hello,
>
>I have a small photo gallery application.  My model has two classes,
>Gallery and Photo.  Gallery contains information on the width and
>height of the thumbnails of its photos.  I added a post_save signal so
>that when a Gallery object is saved, all the photo thumbnails are
>recreated to match the specified width and height.  This means that
>changing information unrelated to the thumbnails recreates them.
>
>I would like to know if it's possible to find which fields have been
>update so that I could resize the thumbnails only when the width or
>height attributes have been changed.  Is that possible?
>
>-Vincent
>
>
>>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Finding out which fields changed

2007-04-26 Thread Malcolm Tredinnick

On Thu, 2007-04-26 at 07:21 -0700, [EMAIL PROTECTED] wrote:
> Hello,
> 
> I have a small photo gallery application.  My model has two classes,
> Gallery and Photo.  Gallery contains information on the width and
> height of the thumbnails of its photos.  I added a post_save signal so
> that when a Gallery object is saved, all the photo thumbnails are
> recreated to match the specified width and height.  This means that
> changing information unrelated to the thumbnails recreates them.
> 
> I would like to know if it's possible to find which fields have been
> update so that I could resize the thumbnails only when the width or
> height attributes have been changed.  Is that possible?

You would need to requery the database at the start of your save method
and compare the values you are about to save to the values in the
version you just retrieved from the database.

There's no way to have this sort of detection happen automatically,
because it's not information that a database will provide. If you tell
it to update to a new value it does just that, it doesn't also say "and
by the way, here's the value I'm replacing". So the extra query each
time is necessary.

Regards,
Malcolm


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



Re: Help with queryset

2007-04-26 Thread [EMAIL PROTECTED]

Looks like I had overlooked isnull. Thanks guys.


On Apr 24, 5:06 pm, robin_percy <[EMAIL PROTECTED]> wrote:
> Looks like my earlier reply got dropped.  Sorry if this ends up being
> a double post.
>
> Check out the Model API 
> docs:http://www.djangoproject.com/documentation/db-api/#isnull
>
> You want to do something like:
> Year.objects.filter(event__isnull=False)
>
> - Robin
>
> On Apr 24, 11:15 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > I'll apologize in advance, as I just know this is a dumb question...
>
> > I have queryset=Year.objects.all()
>
> > But I want to limit that years in which event is not Null.
>
> > I'm assuming I want something like Year.objects.filter(event != Null)
>
> > but I'm unsure about the 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
-~--~~~~--~~--~--~---



Finding out which fields changed

2007-04-26 Thread [EMAIL PROTECTED]

Hello,

I have a small photo gallery application.  My model has two classes,
Gallery and Photo.  Gallery contains information on the width and
height of the thumbnails of its photos.  I added a post_save signal so
that when a Gallery object is saved, all the photo thumbnails are
recreated to match the specified width and height.  This means that
changing information unrelated to the thumbnails recreates them.

I would like to know if it's possible to find which fields have been
update so that I could resize the thumbnails only when the width or
height attributes have been changed.  Is that possible?

-Vincent


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: "mpm-prefork" vs. "mpm-worker"

2007-04-26 Thread Atilla

On 26/04/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
>
> On Apr 25, 7:10 pm, Atilla <[EMAIL PROTECTED]> wrote:
> > I personally find it Very bad to bind Django users to 1 apache worker
> > model, considering how the Apache modules progress and the performance
> > you can get out of using clever configurations.
>
> Can you elaborate on this further? I often see people being critical
> of worker MPM but they normally don't explain why they think it is bad
> and provide justification.
>
> Specifically, what sort of configuration are you talking about when
> you say "1 apache worker"? Default configurations of worker MPM still
> use multiple Apache child processes so you aren't normally channeling
> all requests through one process. Also, the GIL is not as big an issue
> as people think it is when using Apache as there can be a lot of other
> stuff happening at the same time which isn't being done in Python so
> you still achieve a fair degree of parallelism.
>
> I've ranted about this recently in:
>
>   http://groups.google.com/group/karrigell/browse_frm/thread/488ffd42cee600b4
>
> so will not post all the details again.
>
> Graham
>

Perhaps I haven't expressed myself too clearly, since I think there's
a misunderstanding here. I was saying that I find it bad to tell
people that they should only use "prefork" as the MPM in Apache,
especially not providing a good explanation for that.

I am not critical of the worker MPM, in fact I was saying that I
rather like it and I have used in different places. There are new MPMs
for apache, in development that also look quite promising, should they
reach a stable implementation. Depending on the nature of your
application and the code that's being used, you can have significant
gains, depending on the module and configuration being used.

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



Newforms Captcha 0.1 release

2007-04-26 Thread Brandon Low

16 hours ago I posted about my captcha system that was quite rough
around the edges.

I've done some house cleaning since then and will call it 0.1.

This is now in "Works on my live site" state.  I managed to clean up
most of the hacky crap that was in the last version and add some
comments to my code.

http://test.lostlogicx.com/transfer/captcha-0.1.tar.bz2

Is there a more 'official' place to post django projects like this?
djangosnippets doesn't seem like the place for 200 line things with
several files.

Thanks,

Brandon


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



Re: django sendmail

2007-04-26 Thread Karen Tracey
On 4/26/07, arv43 <[EMAIL PROTECTED]> wrote:
>
>
> hello,
> i get a 550, relay not permitted error when i try to use send_mail.
> this is on my laptop running Ubuntu. But when I try this on my host
> (webfaction), I get a different error
>
> Exception Type:  error
> Exception Value: (111, 'Connection refused')
> Exception Location: /usr/local/lib/python2.4/smtplib.py in
> connect, line 310
>
> i have a registration/login form, which simply takes in an email id,
> and sends an email to that id. unfortunately, i get an error.
>
> My guess is something needs to be done about the mail server, but
> unlike Python's smtplib which requires a server to connect and stuff,
> Django doesnt seem to have/need anything. is there someplace that i
> should modify settings for sending mail to work.


You probably need to set EMAIL_HOST (and maybe EMAIL_PORT, EMAIL_HOST_USER,
EMAIL_HOST_PASSWORD) in your settings file.  EMAIL_HOST defaults to
"localhost" so Django is trying to connect to an SMTP server running on
whatever machine you are running on.

These settings are documented here:

http://www.djangoproject.com/documentation/settings

but not mentioned (last I checked) in the doc for send_mail.

Hope this helps,
Karen

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



Re: django sendmail

2007-04-26 Thread Aidas Bendoraitis

Set some EMAIL_HOST, EMAIL_HOST_USER, and EMAIL_HOST_PASSWORD in your
settings. That might help you.

Regards,
Aidas Bendoraitis aka Archatas

On 4/26/07, arv43 <[EMAIL PROTECTED]> wrote:
>
> hello,
> i get a 550, relay not permitted error when i try to use send_mail.
> this is on my laptop running Ubuntu. But when I try this on my host
> (webfaction), I get a different error
>
> Exception Type:  error
> Exception Value: (111, 'Connection refused')
> Exception Location: /usr/local/lib/python2.4/smtplib.py in
> connect, line 310
>
> i have a registration/login form, which simply takes in an email id,
> and sends an email to that id. unfortunately, i get an error.
>
> My guess is something needs to be done about the mail server, but
> unlike Python's smtplib which requires a server to connect and stuff,
> Django doesnt seem to have/need anything. is there someplace that i
> should modify settings for sending mail to work.
>
> Thanks
>
>
> >
>

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



django sendmail

2007-04-26 Thread arv43

hello,
i get a 550, relay not permitted error when i try to use send_mail.
this is on my laptop running Ubuntu. But when I try this on my host
(webfaction), I get a different error

Exception Type:  error
Exception Value: (111, 'Connection refused')
Exception Location: /usr/local/lib/python2.4/smtplib.py in
connect, line 310

i have a registration/login form, which simply takes in an email id,
and sends an email to that id. unfortunately, i get an error.

My guess is something needs to be done about the mail server, but
unlike Python's smtplib which requires a server to connect and stuff,
Django doesnt seem to have/need anything. is there someplace that i
should modify settings for sending mail to work.

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: using django in cronjobs + database locks...

2007-04-26 Thread Jeremy Dunck

On 4/26/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote:
> I have a particular file-processing "cron" job that uses django.
> Something much like this:
>
> while True:
> for image in Image.objects.filter(processing_state="pending"):
> #process image
> time.sleep(30)

The simplest thing to do is take it out of the "while True" loop and
let the process die between runs.

The next simplest, which may or may not work, is importing and
committing yourself:
from django.db import transaction
transaction.commit()

If that doesn't work, you've got an odd situation going on and I'd
want to see that "#process image" code.  But this will force the
connection to close, if you're sure you want that:
from django.db import connection
connection.close()

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

2007-04-26 Thread Michal


>> Is it possible change the code to generate months in URLs as numbers,
>> instead of 3-letter texts please?
> 
> there is already a ticket in this regard - please add your comments  
> there

Sorry, I forgot to look into Trac. I put my comment there:

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

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

2007-04-26 Thread Kenneth Gonsalves


On 26-Apr-07, at 3:01 PM, Michal wrote:

> Is it possible change the code to generate months in URLs as numbers,
> instead of 3-letter texts please?

there is already a ticket in this regard - please add your comments  
there

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.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
-~--~~~~--~~--~--~---



Template tags with nested block

2007-04-26 Thread fero

Hello I have a problem with my own block tag "labs_block" which
includes other "block" tags.
It seems that inner block inheritance doesn't work. I pasted some code
at http://dpaste.com/9081/ (in this case the inner block is
"resource_details"). I get really into troubles, can you help me
please ?

TIA
fero


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Named URL patterns to use prefix?

2007-04-26 Thread Malcolm Tredinnick

Hey Ryan,

On Wed, 2007-04-25 at 16:23 +, Ryan Kanno wrote:
> Already a ticket?  Shoot, I swore I searched, but I couldn't find
> one.  Sorry about that - my apologies.
> 
> (http://code.djangoproject.net/ticket/4129)

No problems -- I forgot to point you to the ticket number, too.

Anyway, this is fixed in revision [5086].

Regards,
Malcolm



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



using django in cronjobs + database locks...

2007-04-26 Thread Bram - Smartelectronix

hi all,


I have a particular file-processing "cron" job that uses django. 
Something much like this:

while True:
for image in Image.objects.filter(processing_state="pending"):
#process image
time.sleep(30)

Now I notice that while running this script the DB table myapp_image 
seems to be locked the whole time, thus preventing me to -for example- 
run any syncdb statements that have references to this table. (syncdb 
effectively just sits there, waiting)

Is there any way to tell django to close all it's DB connections? Or am 
I running into another type of problem?


thanks!


  - bram

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Primary key field can be empty

2007-04-26 Thread Kai Kuehne

Hi,

On 4/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> Wow .. there's been a lot of response to this without the answer
> actually appearing: it's a bug! :-)
>
> Ticket #3774 is the relevant ticket.
>
> I'm very tempted to fix this by actually implementing the documented
> behaviour, because it makes a lot of sense. My only caution so far has
> been that it's a backwards compatible change and anybody inadvertently
> relying on the current behaviour (and you can see from one of my
> comments in that ticket that I don't consider it completely illogical to
> allow blanks there, so it's not a crazy assumption) would have to change
> things.

In which case it is a good think to let the primary_key field empty?
If I add an entry with my primary key field empty I just cannot delete
it in the admin (because there is no link to click on).
Maybe there are cases which this could be useful.. but I cannot
imagine one of them...


> I keep tossing this one around in my head, but it will be fixed one way
> or another soon, I would expect (either by me or another developer).

Thanks
Kai

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Database design question

2007-04-26 Thread Kai Kuehne

Hi Doug,

On 4/26/07, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> [Links]
> There's no harm in having unique columns in addition to your primary
> key (as you describe).  The nut of the problem around natural keys,
> IMHO, is that the rules that make them natural keys today can change
> such that they are no longer keys tomorrow.  When that happens, you
> float your resume and find a new gig.

Thanks for the links. :-)
In my case, the primary_key will ever be unique. It is impossible
that another entry has the same name.

> Don't take my recommendation as authoritative.  I'm not a DBA by
> trade, I'm a code monkey.  Take the time to read up on the subject.
> The Wikipedia pages are a good start.  :-)

Yes, I'm a code monkey too and I prefer giving the db design to
something else. :-)


> doug.

Thanks again
Kai

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



Databrowse problem

2007-04-26 Thread Michal

Hello,
before a while I tried the new Django feature -- Databrowse. It is 
looked fine, but I found little "bug":

* first, this is my settings: I have set Django to my locale setting 
(ie, TIME_ZONE='Europe/Prague', LANGUAGE_CODE='cs')
* When I try to view data by calendar, I could succesfully select year, 
but selection of month ends with a 404 page.

I looked into Django code and found, that calendar generate URLs with 
month presented as 3-letters text. And that is propably the reason of 
404 page -- in my language I get ugly URLs like:

http://127.0.0.1:8000/databrowse/news/new/calendars/created/2007/b%C5%99e/
http://127.0.0.1:8000/databrowse/news/new/calendars/created/2007/z%C3%A1%C5%99/

It is not so common approach to represent month as 3-letter shortcuts in 
my country. In this situation will be better to represent month as 
number, ie:

http://127.0.0.1:8000/databrowse/news/new/calendars/created/2007/03/
http://127.0.0.1:8000/databrowse/news/new/calendars/created/2007/09/

In django/views/generic/date_based.py I found, that archive_month 
function have parameter month_format, but calendar_view (in 
django/contrib/databrowse.plugins/calendar.py) leave it to default value 
(%b).

Is it possible change the code to generate months in URLs as numbers, 
instead of 3-letter texts please?


Regards
Michal

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



I'm Wondering How It Can Be Real

2007-04-26 Thread betterfuture

It's hard to belive but its really happening.
1st time I saw it, I thought its just another
money making machine, but the way he
prove it to me really got me thinking.

http://whoisjoeschmoe.com/?id=268

If you are thinking on how you can be helped
by helping people, you can ask him the
details because he had prove it to me.
Then I just do the same thing as he did
an I'm wondering how it can be REAL.

http://whoisjoeschmoe.com/?id=268

He did something Very Unusual! Got me thinking...

Najib

[EMAIL PROTECTED]

Tel: 60123889006

http://whoisjoeschmoe.com/?id=268

P.S. Oh! By the way.. get to Step 3, its unbelievable!!

P.P.S. Attract downlines that NEVER want to QUIT!


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



(((< TOP 10 Universities >)))

2007-04-26 Thread Rania Desai
Hi Friends,
Here is top 10 Universities list of the Wolrd
http://information.100stuff.com/top-10-universities/

enjoy it, and if you have any problem about online universities please
reply me
and you have any information about online courses please share with us
Thanks,
Rania

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: contextual ForeignKey?

2007-04-26 Thread chrominance

You may also want to look at this prelim generic relations UI for the
admin view:
http://net-x.org/weblog/2006/nov/29/django-generic-relations-made-easier/

On Apr 25, 8:58 pm, Drasty <[EMAIL PROTECTED]> wrote:
> Thanks for the suggestion. Even if it doesn't work--I haven't really
> looked at Generic Relations before--it'll be fun figuring out how to
> play with them. I'll put something up if I figure out anything useful,
> either here or at djangosnippets.org
>
> Erik
>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: regroup, dictsort and ordering objects

2007-04-26 Thread chrominance

Never mind, I didn't realize that a) dictsort doesn't work so well
when passed related objects, and b) dictsort does great when passed
FIELDS of related objects, say, SportType.name. Problem = solved!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Primary key field can be empty

2007-04-26 Thread Malcolm Tredinnick

On Wed, 2007-04-25 at 16:14 +0200, Kai Kuehne wrote:
> Hi list,
> why can I add a record in the admin where the name field is empty,
> when the docs say:
> "primary_key=True implies blank=False, null=False and unique=True.
> Only one primary key is allowed on an object."
> 
> My code:
> name = models.CharField(maxlength=255, primary_key=True, db_index=True)
> 
> There is no other primary_key defined.

Wow .. there's been a lot of response to this without the answer
actually appearing: it's a bug! :-)

Ticket #3774 is the relevant ticket.

I'm very tempted to fix this by actually implementing the documented
behaviour, because it makes a lot of sense. My only caution so far has
been that it's a backwards compatible change and anybody inadvertently
relying on the current behaviour (and you can see from one of my
comments in that ticket that I don't consider it completely illogical to
allow blanks there, so it's not a crazy assumption) would have to change
things.

I keep tossing this one around in my head, but it will be fixed one way
or another soon, I would expect (either by me or another developer).

Regards,
Malcolm


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