Re: Problems with ImageField

2007-11-06 Thread Ramdas S
Remove the fwdslash in front

image = models.ImageField(upload_to='toy_images/')

It will work


On 11/7/07, Stupid Dustbin <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> recently I decide to try out the ImageField but it gives me some
> problems.
>
> in my models it is
>
> image = models.ImageField(upload_to='/toy_images/')
>
> in my settings.py here are my media settings
>
> MEDIA_ROOT = '/media/'
>
> MEDIA_URL = MEDIA_URL = 'http://localhost:8000/media/'
>
> ADMIN_MEDIA_PREFIX = '/admin_media/'
>
> The image doesn't get uploaded and I'm unable to figure out what
> wrong. :(.
>
> 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: will this hit database more than once by using AUTH_PROFILE_MODULE = 'myuser.MyUser'

2007-11-06 Thread James Bennett

On Nov 5, 2007 9:00 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> i have a topic want to discuss with all:
> there is a option in django-registration  : AUTH_PROFILE_MODULE =
> 'myuser.MyUser'  which can be setted in settings.py, so you can access
> value of MyUser by get_profile.xxx.

This is a feature of Django, not of the registration app.

> does this mean we hit database 3 times in method 1?
> hit once in method 2 ?

If you take a look at the code in django.contrib.auth you'll find your answer.


-- 
"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: will this hit database more than once by using AUTH_PROFILE_MODULE = 'myuser.MyUser'

2007-11-06 Thread [EMAIL PROTECTED]

can somebody help me ?

On 11月6日, 上午11时00分, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> you know django-registration is a famous module(http://code.google.com/
> p/django-registration/).
>
> i have a topic want to discuss with all:
> there is a option in django-registration  : AUTH_PROFILE_MODULE =
> 'myuser.MyUser'  which can be setted in settings.py, so you can access
> value of MyUser by get_profile.xxx.
>
> my topic is, if MyUser have serveral field , to access these filed
> like this in the templates:
>
> Method 1:
> {{ myuser.get_profile.field1 }},
> {{ myuser.get_profile.field2 }},
> {{ myuser.get_profile.field3 }},
>
> Method 2:
> myuser=MyUser.objects.get(.)
> then use:
> {{ myuser.field1 }},
> {{ myuser.field2 }},
> {{ myuser.field3 }},
>
> does this mean we hit database 3 times in method 1?
> hit once in method 2 ?
>
> just a disscussion, thanks author of django-registration!


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



Re: Problems with ImageField

2007-11-06 Thread Kenneth Gonsalves


On 07-Nov-07, at 10:14 AM, Stupid Dustbin wrote:

> image = models.ImageField(upload_to='/toy_images/')

upload_to='toy_images/'

-- 

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



Problems with ImageField

2007-11-06 Thread Stupid Dustbin

Hi,

recently I decide to try out the ImageField but it gives me some
problems.

in my models it is

image = models.ImageField(upload_to='/toy_images/')

in my settings.py here are my media settings

MEDIA_ROOT = '/media/'

MEDIA_URL = MEDIA_URL = 'http://localhost:8000/media/'

ADMIN_MEDIA_PREFIX = '/admin_media/'

The image doesn't get uploaded and I'm unable to figure out what
wrong. :(.

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



Problems with ImageField

2007-11-06 Thread Stupid Dustbin

Hi,

recently I decide to try out the ImageField but it gives me some
problems.

in my models it is

image = models.ImageField(upload_to='/toy_images/')

in my settings.py here are my media settings

MEDIA_ROOT = '/media/'

MEDIA_URL = MEDIA_URL = 'http://localhost:8000/media/'

ADMIN_MEDIA_PREFIX = '/admin_media/'

The image doesn't get uploaded and I'm unable to figure out what
wrong. :(.

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: TemplateDoesNotExis, but actually it exist

2007-11-06 Thread [EMAIL PROTECTED]

I have my project and django in different dirs. But again, this page
seems to work perfectly except this  error notification by mail.

On 7 нояб, 03:42, "helpmesue mailman" <[EMAIL PROTECTED]> wrote:
>  error was django_src, in your temlate dir you have django_projects...typo
> somewhere in there
>
> On 11/6/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have a website, and keep getting this error tracebacks to my mail:
>
> > Traceback (most recent call last):
>
> > File "/home/clients/my_site/django_src/django/core/handlers/base.py",
> > line 81, in _real_get_response
> >response = callback(request, *callback_args, **callback_kwargs)
>
> > File "/home/clients/my_site/django_projects/gamemag/news/views.py",
> > line 58, in index
> >return object_list(request,**kwargs)
>
> > File "/home/clients/my_site/django_src/django/views/generic/
> > list_detail.py", line 96, in object_list
> >t = template_loader.get_template(template_name)
>
> > File "/home/clients/my_site/django_src/django/template/loader.py",
> > line 79, in get_template
> >source, origin = find_template_source(template_name)
>
> > File "/home/clients/my_site/django_src/django/template/loader.py",
> > line 72, in find_template_source
> >raise TemplateDoesNotExist, name
>
> > TemplateDoesNotExist: news/news_list.html
>
> > In my settings.py i have:
>
> > TEMPLATE_DIRS = (
> > "/home/clients/my_site/django_projects/site/templates",
> > )
>
> > And
> > ls -l /home/clients/my_site/django_projects/site/templates/news/
> > news_list.html
> > -rw-r--r-- 1 user virtwww 16071 Nov  5 17:24 /home/clients/my_site/
> > django_projects/site/templates/news/news_list.html
>
> > So, apparently template exists, and (which is really weird) - site is
> > functioning properly and my users seems to get this page allright. I
> > can't think the problem :/


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

2007-11-06 Thread Malcolm Tredinnick

On Mon, 2007-11-05 at 15:29 +, Justin Bronn wrote:
> > (2) The gis branch should really use a better name than "NoField" here.
> > Not a lot of code calls get_internal_type() -- the main critical piece
> > being db_type(). In all the cases where django.contrib.gis overrides
> > get_internal_type(), they are also returning None from db_type(). So the
> > code should probably use descriptive names for the internal type.
> 
> The "NoField" nomenclature is a result of legacy implementation.  When
> I first implemented the GIS branch there was no `db_type` method to
> work with.  Moreover, I needed an internal type that wouldn't actually
> create SQL for the column because PostGIS geometry columns are added
> with a stored procedure.  Using "NoField," (from what I can tell, now
> only used by ManyToManyFields), allowed me to achieve the
> functionality without patching django's core code.

Yes, I realise the history. No criticism of the motivation behind the
approach.

> I commented out the get_internal_type() in my code, and was able to
> sync the database just fine.  Since db_type returns None,
> get_internal_type() would default to using the parent class' routine,
> and the expected name (e.g., "PointField") would be returned.  Do you
> see any problems with the approach of simply removing the
> get_internal_type() routine?

I think that's best, if you're happy with the class name as the type
(and normally that would be most natural).

Regards,
Malcolm

-- 
I've got a mind like a... a... what's that thing called? 
http://www.pointy-stick.com/blog/


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

2007-11-06 Thread Malcolm Tredinnick

On Tue, 2007-11-06 at 15:02 -0800, gordyt wrote:
> Howdy Folks!
> 
> I've got a new project coming up that will generate gazillions (that's
> a technical term for a whole lot) of objects for certain objects in
> the model.
> 
> Is it possible to get Django to use a really large integer type for
> the automatically-generated primary key, like a serial or bigserial in
> postgresql?

You can't change the underlying data type for the automatically
generated primary key without changing Django's source.

So your choices are either to write a custom field or, more easily,
manually alter the type of the primary key column after the table has
been created (see
http://www.djangoproject.com/documentation/model-api/#providing-initial-sql-data
 ).


Regards,
Malcolm

-- 
The cost of feathers has risen; even down is up! 
http://www.pointy-stick.com/blog/


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

2007-11-06 Thread Malcolm Tredinnick

On Mon, 2007-11-05 at 19:21 -0800, Hugh Bien wrote:
> Hi all,
> 
> 
> I'm trying to clear the cache table.  Here's the code I'm using with
> Python 2.5 and Django version 0.96:
> 
> 
> def clear_cache():
> from django.db import connection
> cursor = connection.cursor()
> cursor.execute("DELETE FROM django_cache WHERE 1=1")
> 
> 
> This is for the a SQLite3 backend, but it doesn't seem to work.  I
> tried executing it in the command line and the table still doesn't
> clear.  Is there something obvious I'm missing?

django.db.transaction.commit_unless_managed() is probably going to be
necessary, since you're implicitly in a transaction here.

Regards,
Malcolm

> 
-- 
What if there were no hypothetical questions? 
http://www.pointy-stick.com/blog/


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

2007-11-06 Thread Malcolm Tredinnick

On Mon, 2007-11-05 at 12:00 -0800, ygneo wrote:
> I use Django 0.96 in a SuSE with Python 2.3.3.
> 
> I'm getting this JavaScript error: "gettext is not defined" when I try
> to edit an object with date field in the admin site. I have seen that
> occurs when calendar.js is trying to populate the month names in the
> correct language. I use language_code = es_ES and default_charset =
> utf-8 and i have configurated apache to use utf-8 as default charset.
> I also have found with FireBug that really the error is a Django
> error:
> 
> UnicodeEncodeError at /convenios/admin/jsi18n/
> ascii codec cant encode character u\xe9 in
> position 23:
> 
> For this reason jsi18n doesn't load and i can't use gettext.
> 
> Otherwise, in an Ubuntu installation of Django, with same lang code,
> and Python 2.5.1, all works fine.

Using non-ASCII characters with Django 0.96 is unfortunately not
completely solid. Sometimes things work, sometimes they don't. It's why
we had to put all the work into making things use unicode internally.
Translations are an area that are particularly vulnerable to problems,
since ASCII strings end up being changed to non-ASCII.

There's a not a lot we can do about this except recommend that you
upgrade to use subversion trunk (which will require a bit of porting of
your code). I realise that might not be the easiest solution, but, as I
said, it wasn't possible to fix all the problems without a major change,
so at some point we had to make that change.

Regards,
Malcolm

-- 
The sooner you fall behind, the more time you'll have to catch up. 
http://www.pointy-stick.com/blog/


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

2007-11-06 Thread Malcolm Tredinnick

On Mon, 2007-11-05 at 10:57 -0800, Justin Bronn wrote:
> As Karen noted, I last merged on 10/26 to r6613 -- thus, the latest
> GeoDjango is more up-to-date than your latest checkout of trunk
> (r5988).
> 
> > If the trunk and GeoDjango AREN'T currently compatible, would it be
> > possible for us to add geometry columns AFTER a syncdb creates the
> > "standard" model tables? Would the automatic admin still work in such a
> > situation?
> 
> For all intents and purposes, the GeoDjango branch is identical to the
> latest merge of the trunk -- the largest difference is the addition of
> django.contrib.gis module.  The rest of the changes to the trunk are
> limited in scope and few in number, and are only present to support
> the GIS features.  There should not be a problem using GeoDjango for
> non-GIS Django applications.

Indeed.

I spent a bit of time on Monday going through the differences between
trunk and the GIS branch, looking at what ideas can be usefully merged
back and how trunk can help out things like the GIS changes. Justin is
to be commended for his reasonably unintrusive design changes. They look
very restricted and unlikely to break anything.

So anybody who's staying away from the GIS branch because of some
perception that it's less stable than trunk and they can do a better job
locally should re-evaluate. Trunk maintainers (well, at least one of
them) are paying attention to what's going on in the various branches
and looking for ways to make things easier in the background. It's solid
now and can only become less and less divergent over time.

Regards,
Malcolm

-- 
The hardness of butter is directly proportional to the softness of the
bread. 
http://www.pointy-stick.com/blog/


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

2007-11-06 Thread helpmesue mailman
 error was django_src, in your temlate dir you have django_projects...typo
somewhere in there

On 11/6/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> I have a website, and keep getting this error tracebacks to my mail:
>
> Traceback (most recent call last):
>
> File "/home/clients/my_site/django_src/django/core/handlers/base.py",
> line 81, in _real_get_response
>response = callback(request, *callback_args, **callback_kwargs)
>
> File "/home/clients/my_site/django_projects/gamemag/news/views.py",
> line 58, in index
>return object_list(request,**kwargs)
>
> File "/home/clients/my_site/django_src/django/views/generic/
> list_detail.py", line 96, in object_list
>t = template_loader.get_template(template_name)
>
> File "/home/clients/my_site/django_src/django/template/loader.py",
> line 79, in get_template
>source, origin = find_template_source(template_name)
>
> File "/home/clients/my_site/django_src/django/template/loader.py",
> line 72, in find_template_source
>raise TemplateDoesNotExist, name
>
> TemplateDoesNotExist: news/news_list.html
>
> In my settings.py i have:
>
> TEMPLATE_DIRS = (
> "/home/clients/my_site/django_projects/site/templates",
> )
>
> And
> ls -l /home/clients/my_site/django_projects/site/templates/news/
> news_list.html
> -rw-r--r-- 1 user virtwww 16071 Nov  5 17:24 /home/clients/my_site/
> django_projects/site/templates/news/news_list.html
>
>
> So, apparently template exists, and (which is really weird) - site is
> functioning properly and my users seems to get this page allright. I
> can't think the problem :/
>
>
> >
>

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



TemplateDoesNotExis, but actually it exist

2007-11-06 Thread [EMAIL PROTECTED]

I have a website, and keep getting this error tracebacks to my mail:

Traceback (most recent call last):

 File "/home/clients/my_site/django_src/django/core/handlers/base.py",
line 81, in _real_get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/home/clients/my_site/django_projects/gamemag/news/views.py",
line 58, in index
   return object_list(request,**kwargs)

 File "/home/clients/my_site/django_src/django/views/generic/
list_detail.py", line 96, in object_list
   t = template_loader.get_template(template_name)

 File "/home/clients/my_site/django_src/django/template/loader.py",
line 79, in get_template
   source, origin = find_template_source(template_name)

 File "/home/clients/my_site/django_src/django/template/loader.py",
line 72, in find_template_source
   raise TemplateDoesNotExist, name

TemplateDoesNotExist: news/news_list.html

In my settings.py i have:

TEMPLATE_DIRS = (
"/home/clients/my_site/django_projects/site/templates",
)

And
ls -l /home/clients/my_site/django_projects/site/templates/news/
news_list.html
-rw-r--r-- 1 user virtwww 16071 Nov  5 17:24 /home/clients/my_site/
django_projects/site/templates/news/news_list.html


So, apparently template exists, and (which is really weird) - site is
functioning properly and my users seems to get this page allright. I
can't think the problem :/


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

2007-11-06 Thread Kenneth Gonsalves


On 07-Nov-07, at 6:49 AM, [EMAIL PROTECTED] wrote:

> Sorry to be unclear, I mean blogs about django

then B-list is the best

-- 

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



Re: spam

2007-11-06 Thread Kenneth Gonsalves


On 06-Nov-07, at 11:22 PM, Lars Stavholm wrote:

>> ok, seriously, is there not something we can do about the porn spam?
>> some of us read this list at work on machine's we don't own.  the  
>> image
>> stuff is becoming a serious problem.
>
> I do believe that Google groups are filtering out close to 99%
> of all spam (sign up for a gmail.com account and see for yourself).
> I too find this greatly disturbing, but the fact is that it is,
> to my understanding, difficult or even impossible to filter out
> 100% of the spam.

Only members are allowed to post on this list. Please have confidence  
that the admins will boot spammers - complaining about or discussing  
it simply increases the spam. I dont even mark stuff from this list  
as spam as it may confuse my spam filter.

-- 

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



Re: Best Django Blogs

2007-11-06 Thread [EMAIL PROTECTED]

Sorry to be unclear, I mean blogs about django

On Nov 6, 3:02 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Nov 6, 2007 4:32 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > What are the best django blogs, can you guys tell me. Thanks
>
> Are you looking for blogs which write about Django (and thus which
> you'd want to read), or blog software written with Django?
>
> --
> "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: spam

2007-11-06 Thread Nimrod A. Abing

On Nov 7, 2007 1:47 AM, Derek Anderson <[EMAIL PROTECTED]> wrote:
>
> ok, seriously, is there not something we can do about the porn spam?
> some of us read this list at work on machine's we don't own.  the image
> stuff is becoming a serious problem.

Everyday I tag about 1-3 messages using GMail's in-built spam
filtering button. The number has gone down from about 6-10 every day.
I don't think Google groups do filtering on email sent to groups and I
think the spam filters are trained per account (each account gets its
own spam filter training data). My biggest gripe with Google's
in-built spam filter button is that it tags entire "conversations" and
does not seem to allow you to tag individual messages. So if a Groups
subscriber replies to a spam message his email (and email address)
gets included in my spam filter training data.
-- 
Best Regards,
Nimrod A. Abing

W http://arsenic.ph/
W http://preownedcar.com/
W http://abing.gotdns.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: Best Django Blogs

2007-11-06 Thread Ross Poulton

On Nov 7, 9:32 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> What are the best django blogs, can you guys tell me. Thanks

High on my daily visit list is the Django community aggregator[1]
which displays django-related blog posts from various members of the
community.

[1] http://www.djangoproject.com/community/


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

2007-11-06 Thread Francis Lavoie
Ok, I found my problem.

Because I was storing a object into the session dictionnary, when I called
method to add, modify or delete object's value, the session didn't get
saved.



2007/10/31, Francis Lavoie <[EMAIL PROTECTED]>:
>
> But Isn't the same thing as saving the object in the
> request["session"]["myobject"] ?.
>
> The dictionnary is not being erase entirely, but it is the associate value
> that are reset to empty string. I though at first that I might trigger the
> __init__ , but when I trace it, the object is not being reinitialyse.
>
> Is it possible that the object is only keep in memory because I use a
> third level method to assign the values?
>
> class object1:
>def __init__(self):
>self.key1 = object2()
>
> class object2:
>def do2(self, v):
>self.key2 = { "value": v }
>
> In views.py I do :
>
> myobj = object1()
> myobj.key1.do2("value")
>
>
>
> 2007/10/30, Malcolm Tredinnick <[EMAIL PROTECTED]>:
> >
> >
> > On Tue, 2007-10-30 at 16:40 -0400, Francis Lavoie wrote:
> > > Hi,
> > >
> > >
> > > I have a shopping_cart class that I use with a session to store orders
> >
> > > information.
> > >
> > >
> > > In this shopping cart, I have other object like customer contact.
> > >
> > >
> > > class CustomerContact:
> > > def __init__(self):
> > > self.address = {}
> > >
> > > def add_address(self, add_dict, Company, Contact, Address, City,
> > > State, Zip, Country, Phone, Fax, Email):
> > > self.address[add_dict] = { "Company" : Company,  "Contact" :
> > > Contact,
> > > "Address" :
> > > Address, "City" : City,
> > > "State" :
> > > State,  "Zip" : Zip,
> > > "Country" :
> > > Country, "Phone" : Phone,
> > > "Fax" :
> > > Fax, "Email" : Email }
> > >
> > >
> > > it is quite basic.
> > >
> > >
> > > In my shopping cart I assign a variable to this object in __init__.
> > >
> > >
> > > Step 1.  User fill the address required fields, then commit, it will
> > > set three addresses [add_dict] for billing, shipping, other
> > > To set the address I
> > > use : 
> > > request.session['shopping_cart'].customer_contact.add_address("billing",
> > alltheinfo)
> > >
> > >
> > > Step 2. It display a payment page which also shows the filled address.
> > > Address are display correctly
> > >
> > >
> > > Step 3. Then it display a validation page. My dictionnary is somehow
> > > reset, the keys are still there but nothing is assign to it.
> > >
> > >
> > >
> > >
> > > Is my logic erroneous? I just dont understand why my dictionnary get
> > > reset between step2 and step3.
> >
> > At step 1 you fill in something in memory. You then return to display a
> > new page to the user. So between step 1 and step 2, all information in
> > memory is effectively lost. Once the user submits the form in step 2, it
> >
> > might not even be the same process that is handling the reply, since web
> > servers can use multiple processes and/or threads to handle requests.
> >
> > So you need to save the data after step 1. Since this a Django mailing
> > list, I'd suggest using a Django model and saving it to the database.
> >
> > Regards,
> > Malcolm
> >
> > >
> > --
> > The early bird may get the worm, but the second mouse gets the cheese.
> > http://www.pointy-stick.com/blog/
> >
> >
> > > >
> >
>

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

2007-11-06 Thread James Bennett

On Nov 6, 2007 4:32 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> What are the best django blogs, can you guys tell me. Thanks

Are you looking for blogs which write about Django (and thus which
you'd want to read), or blog software written with Django?

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



Overriding Default Primary Key Type?

2007-11-06 Thread gordyt

Howdy Folks!

I've got a new project coming up that will generate gazillions (that's
a technical term for a whole lot) of objects for certain objects in
the model.

Is it possible to get Django to use a really large integer type for
the automatically-generated primary key, like a serial or bigserial in
postgresql?

Many thanks!

--gordon


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



Best Django Blogs

2007-11-06 Thread [EMAIL PROTECTED]

What are the best django blogs, can you guys tell me. Thanks


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



Re: How to select all the values from my Field attribute 'choices?

2007-11-06 Thread Karen Tracey
On 11/6/07, äL <[EMAIL PROTECTED]> wrote:
>
>
> Hello Karen
>
> I have the same problem as Greg has.
>
> If I try to use your code I got an "page not found" error.
> Here is my code:
>
> views.py
> ### CODE ###
> def Karateka_edit(request, karateka_id):
>
> from kav.info.models import Karateka
>
> try:
> karateka  = Karateka.objects.get(id = karateka_id)
> roles= [y for x,y in ROLE]
> except Karateka.DoesNotExist:
> raise Http404
> return render_to_response('info_karateka_edit.html', {
>  'karateka'  : karateka,
>  'roles'   : roles,
>  'user'  : request.user})
> ### END CODE ###
>
> Do I need to import ROLE like Karateka or do I have an other error in
> my code?


Yes, assuming ROLE is defined in your models file you will need to import it
when you want to use it from another file.  But that is not why you got a
404 (page not found).  Given that code, you'd only get a 404 if the
Karateka.objects.get call raises Karateka.DoesNotExist.  So you didn't even
get as far as the roles= line (there's no reason to include that in the
try/except btw).  If you had gotten as far as the roles= line and if you had
not imported ROLE from wherever it is defined, you would have gotten a
NameError "Global name ROLE is not defined".

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: spam

2007-11-06 Thread Lars Stavholm

Michael Best wrote:
> Jay Klehr wrote:
>> Are the other lists powered by Google Groups?  Are they as active as 
>> Django's list?
>>
>> Perhaps you should direct your complaints to Google, as I don't think 
>> the people on this list (or even the owners of the list) can do much 
>> about it (aside from moderating every new user/post).
>>
>> Jay
> 
> This is one of the few lists where I get spam in my gmail account at 
> all.  I don't know why that is, it almost feels like there is no 
> filtering on the list by Google at all.

That's not right. There's a lot o filtering going on.
What we see is the few that slips through. After a bit
of spam filter training, these will be gone as well.
After that, the spam senders will figure out a new way
to slip through the filter(s), the filter(s) will learn
and improve, the spam'ers will figure out a new way, the
filter's..., and so on. I get a few spam's now and then
on other lists as well, including Google Groups lists.
Nevertheless, the latest porno spam's are appalling.
/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: Strange UnicodeDecodeError in template

2007-11-06 Thread Karen Tracey
On 11/6/07, Mikkel Høgh <[EMAIL PROTECTED]> wrote:
>
> ...
> I wonder if this is a bug and should be reported...


I think it is a bug, and I have opened a ticket:

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

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: spam

2007-11-06 Thread Michael Best

James Bennett wrote:
> On Nov 6, 2007 1:22 PM, Michael Best <[EMAIL PROTECTED]> wrote:
>> This is one of the few lists where I get spam in my gmail account at
>> all.  I don't know why that is, it almost feels like there is no
>> filtering on the list by Google at all.
> 
> I'm subscribed to a number of Google Groups-based lists, and I've seen
> spam make it to every single one of them, so django-users is not
> unique in that regard. It is a fairly high-traffic list with a large
> number of subscribers, which I imagine makes it a more tempting target
> for a spammer, but I've seen identical spam messages make it onto the
> lists for other popular frameworks and for popular JavaScript toolkits
> which use Google Groups as well.

After reviewing a few of them, they all appear to have computer
generated gmail.com addresses, I wouldn't be surprised if email from
within the gmail domain is less scrutinized than email originating
remotely.  Or that email going into google groups is not filtered and
then once it originates from the group servers it's given a pass by some
of the filtering.

I'd be surprised if I haven't gotten more than a hundred spam from this
list alone.

-Mike


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

2007-11-06 Thread James Bennett

On Nov 6, 2007 1:22 PM, Michael Best <[EMAIL PROTECTED]> wrote:
> This is one of the few lists where I get spam in my gmail account at
> all.  I don't know why that is, it almost feels like there is no
> filtering on the list by Google at all.

I'm subscribed to a number of Google Groups-based lists, and I've seen
spam make it to every single one of them, so django-users is not
unique in that regard. It is a fairly high-traffic list with a large
number of subscribers, which I imagine makes it a more tempting target
for a spammer, but I've seen identical spam messages make it onto the
lists for other popular frameworks and for popular JavaScript toolkits
which use Google Groups as well.


-- 
"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: spam

2007-11-06 Thread Michael Best

Jay Klehr wrote:
> Are the other lists powered by Google Groups?  Are they as active as 
> Django's list?
> 
> Perhaps you should direct your complaints to Google, as I don't think 
> the people on this list (or even the owners of the list) can do much 
> about it (aside from moderating every new user/post).
> 
> Jay

This is one of the few lists where I get spam in my gmail account at 
all.  I don't know why that is, it almost feels like there is no 
filtering on the list by Google at all.

-Mike

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

2007-11-06 Thread Gonzalo Delgado
El Tue, 06 Nov 2007 10:28:39 -0800
Chris Brand <[EMAIL PROTECTED]> escribió:

> 
> Gonzalo Delgado wrote:
> >
> >  The question is: why doesn't something like this work:
> >
> > ticketform.fields['server'].queryset = 
> > Server.objects.filter(users=request.user)
> > ?
> >  It doesn't end up on any error, but the rendered form doesn't filter out 
> > the server choices.. any clue?
> >
> >   
> Sounds like you're hitting bug 4787 
> (http://code.djangoproject.com/ticket/4787), where the change in 
> queryset on the field doesn't get propagated to the widget. You can work 
> around by assigning to the widget's choices directly :
> ticketform.fields['server'].widget.choices = 
> ticketform.fields['server'].choices
> (after changing the field's choices, obviously)
> 
> Chris
> 

 Smelled like a bug.. thanks Chris! :)

-- 
Gonzalo Delgado <[EMAIL PROTECTED]>


pgpfN5WqhEDGa.pgp
Description: PGP signature


Re: MyISAM table locking.

2007-11-06 Thread Peter

Very nice, thanks for the detailed response!

-Peter

On Nov 6, 12:53 pm, Karen Tracey <[EMAIL PROTECTED]> wrote:
> At 10:40 AM 11/6/2007, you wrote:
>
> >Hi All,
>
> >I tried writing some code to do table locking on a MySQL MyISAM
> >database.  I used the code below, which seemed to work in basic
> >examples, but the code would complain of accessing a non-locked table
> >whenever I made a more complex query such as
> >objects.filter(__) saying
> >that the table __ wasn't
> >locked with "LOCK TABLES", even though I had locked the table for the
> >foreign key.  Furthermore, it failed to lock if I tried to reference
> >the table using the syntax of the form of the complex query.
>
> >Has anyone had success running table locks?
>
> Yes, I can get this to work, but it requires knowing exactly how
> Django is going to construct the queries -- what tables will be
> listed and what aliases used.  That means code you get to work now
> may easily break in the future if Django changes how it builds
> queries.  I would not be at all surprised if code that works today
> for this breaks when queryset-refactor lands on the trunk.  But, if
> you really need to make this work, it can be done.
>
> Note that when an alias is used, you must use "real_table AS alias
> lock_type" in the LOCK TABLES statement.
>
> Here's an annotated transcript of how I got lock tables with a
> non-trivial query to work with my DB.  Where I displayed the sql for
> the query I manually split the lines to highlight the tables involved
> in the query.  (Note my database existed before I ever started using
> Django so the tables and column names are not what you might expect
> for a Django DB.)
>
> --
>
>  >>> # Contstruct a query to get a list of Clues in the DB for the
> Entry "DJANGOREINHARDT"
>  >>> cl =
> Clues.objects.select_related().filter(EntryID__Entry='DJANGOREINHARDT')
>
>  >>> # Naively assume the only table we need to lock is Clues itself
>  >>> cursor.execute("LOCK TABLES Clues READ")
> 0L
>
>  >>> # See how wrong we are
>  >>> cl
> Traceback (most recent call last):
>File "", line 1, in 
>File "/homedir/django/newforms-admin/django/db/models/query.py",
> line 108, in __repr__
>  return repr(self._get_data())
>File "/homedir/django/newforms-admin/django/db/models/query.py",
> line 482, in _get_data
>  self._result_cache = list(self.iterator())
>File "/homedir/django/newforms-admin/django/db/models/query.py",
> line 189, in iterator
>  cursor.execute("SELECT " + (self._distinct and "DISTINCT " or
> "") + ",".join(select) + sql, params)
>File "/homedir/django/newforms-admin/django/db/backends/util.py",
> line 18, in execute
>  return self.cursor.execute(sql, params)
>File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line
> 166, in execute
>  self.errorhandler(self, exc, value)
>File "/var/lib/python-support/python2.5/MySQLdb/connections.py",
> line 35, in defaulterrorhandler
>  raise errorclass, errorvalue
> OperationalError: (1100, "Table 'Clues__EntryID' was not locked with
> LOCK TABLES")
>
>  >>> Examine the sql for the last query to see what all really needs
> to be locked
>  >>> connection.queries[-1]['sql']
> u'SELECT `Clues`.`ID`,`Clues`.`Theme`,`Clues`.`Entry
> ID`,`Clues`.`Puzzle
> ID`,`Clues`.`Clue`,`Clues`.`Num`,`Clues`.`Dir`,`Clues`.`Derived`,`Entries`.`Entry
> ID`,`Entries`.`Entry`,`Entries`.`Exclude`,`Puzzles`.`Puzzle
> ID`,`Puzzles`.`Publisher ID`,`Puzzles`.`Date`,`Puzzles`.`Day of
> Week`,`Puzzles`.`Author
> ID`,`Puzzles`.`Title`,`Puzzles`.`Columns`,`Puzzles`.`Rows`,`Puzzles`.`Entry
> Count`,`Puzzles`.`Block Count`,`Puzzles`.`Avg Entry
> Length`,`Puzzles`.`Avg Scrabble Value`,`Puzzles`.`Unused
> Letters`,`Puzzles`.`DateAux`,`Publishers`.`Publisher
> ID`,`Publishers`.`Publisher`,`Publishers`.`Short
> Name`,`Publishers`.`Editor`,`Authors`.`Author
> ID`,`Authors`.`Author`,`Authors`.`Pseudonym`,`Authors`.`Notes`
>
> FROM `Clues`
>
> INNER JOIN `Entries` AS `Clues__EntryID` ON `Clues`.`Entry ID` =
> `Clues__EntryID`.`Entry ID` ,
>
> `Entries`,
>
> `Puzzles`,
>
> `Publishers`,
>
> `Authors`
>
> WHERE ((NOT ((`Clues`.`Derived` = True))) AND
> `Clues__EntryID`.`Entry` = DJANGOREINHARDT) AND `Clues`.`Entry ID` =
> `Entries`.`Entry ID` AND `Clues`.`Puzzle ID` = `Puzzles`.`Puzzle ID`
> AND `Puzzles`.`Publisher ID` = `Publishers`.`Publisher ID` AND
> `Puzzles`.`Author ID` = `Authors`.`Author ID` ORDER BY `Clues`.`Dir`
> ASC, `Clues`.`Num` ASC'
>
>  >>> # Try again, this time locking all the tables & aliases used in the query
>  >>> cursor.execute("LOCK TABLES Clues READ, Entries as
> Clues__EntryID READ, Entries READ, Puzzles READ, Publishers READ,
> Authors READ")
> 0L
>
>  >>> # And now the query works
>  >>> cl =
> Clues.objects.select_related().filter(EntryID__Entry='DJANGOREINHARDT')
>  >>> cl
> []
>  >>>
>
> --
>
> Karen


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 

Re: newforms ModelChoiceField queryset

2007-11-06 Thread Chris Brand

Gonzalo Delgado wrote:
>
>  The question is: why doesn't something like this work:
>
>   ticketform.fields['server'].queryset = 
> Server.objects.filter(users=request.user)
> ?
>  It doesn't end up on any error, but the rendered form doesn't filter out the 
> server choices.. any clue?
>
>   
Sounds like you're hitting bug 4787 
(http://code.djangoproject.com/ticket/4787), where the change in 
queryset on the field doesn't get propagated to the widget. You can work 
around by assigning to the widget's choices directly :
ticketform.fields['server'].widget.choices = 
ticketform.fields['server'].choices
(after changing the field's choices, obviously)

Chris


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



[[ Banana Secret ]]

2007-11-06 Thread Mr.Thawatchai Boontan
Download [[ Banana Secret ]] : http://w14.easy-share.com/9247851.html

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

2007-11-06 Thread Joe

You could also add some functions to the models to add pull the
related data

class TagItem(models.Model):
...

def get_related_artists(self):
   # pull the data
   return data

That function is available in the template and can be called inline so
to speak.

Joe

On Nov 6, 12:40 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I've run into a problem trying to model something in Django and could
> use some advice.  In a nutshell, I'm trying to relate a single table
> to multiple (other) tables using a single foreign key field and
> foreign key type.  I'm aware of the manytomany relationship type of
> Django but I don't think this will provide the functionality I'm
> looking for.
>
> Based on the model below, I have tables named "Artist", "Album" and
> "Song".  What I'm trying to accomplish is making lists of records from
> these tables and assigning a tag to them.  This will let me pull a
> list by tag name and have access to all of its items.  For example, I
> might have a Tag named "Legends Of Jazz" that contains 10 tag items.
> Some of the tag items point to an Album and some point to an Artist.
> Based on the ForeignID field and ItemType relationship, I can create
> this list in the database.  A problem arises when I try to extract the
> list in a view or template.  There is no "hard" relationship establish
> that I use to get items.  If I pull a list of TagItems, how would I
> then get the artist or song?
>
> I realize that some readers might question the purpose of creating a
> soft relationship like this.  The reason is that it allows me to
> create new entities in the database and then establish a relationship
> without code or database changes.  If I decided to start tagging
> "Genres" or some other type of entity then I would only need to add a
> new ItemType to the database table.
>
> The end goal is to pass a list to my template and format each item
> according to its type.  I'm actually going to have a view picking tags
> at random in order to present different music to the user as they
> navigate the site.  This way the site appears to be more dynamic and I
> don't have to keep adding content.  Just create some new Tags.
>
> I would appreciate any advice on how to accomplish this in Django.
>
> Here is my current model:
>
> from django.db import models
> import datetime
>
> class Genre(models.Model):
> name = models.CharField(maxlength=150)
> slug =
> models.SlugField(unique=True,prepopulate_from=('name',),maxlength=150)
>
> def __str__(self):
> return self.name
>
> class Admin:
> pass
>
> class Artist(models.Model):
> name = models.CharField(maxlength=150)
> slug =
> models.SlugField(unique=True,prepopulate_from=('name',),maxlength=150)
>
> def __str__(self):
> return self.name
>
> class Admin:
> pass
>
> class Album(models.Model):
> name = models.CharField(maxlength=150)
> slug =
> models.SlugField(unique=True,prepopulate_from=('name',),maxlength=150)
> publisher = models.CharField(maxlength=100)
> releasedate = models.CharField(maxlength=50)
> cover = models.CharField(maxlength=300)
> description = models.TextField()
> rating = models.CharField(maxlength=3)
> lookupon = models.DateField(null=True,editable=False)
> failedlookup = models.BooleanField(null=True)
> modifiedon = models.DateField(editable=False)
>
> artist = models.ForeignKey(Artist,related_name='album_artist')
> genre = models.ForeignKey(Genre,related_name='album_genre')
>
> def save(self):
> self.modifiedon = datetime.datetime.today()
> super(Album, self).save()
>
> def __str__(self):
> return self.name
>
> class Admin:
> pass
>
> class AlbumReview(models.Model):
> Summary = models.CharField(maxlength=100)
> Content = models.TextField()
> ReviewDate = models.CharField(maxlength=50)
> Rating = models.CharField(maxlength=3)
>
> album = models.ForeignKey(Album,related_name='review_album')
>
> def __str__(self):
> return self.id
>
> class Admin:
> pass
>
> class Song(models.Model):
> name = models.CharField(maxlength=150)
> slug =
> models.SlugField(unique=True,prepopulate_from=('name',),maxlength=150)
> bitrate = models.CharField(maxlength=12)
> length = models.CharField(maxlength=10)
> duration = models.IntegerField()
> track = models.IntegerField()
> filepath = models.TextField()
>
> album = models.ForeignKey(Album,related_name='song_album')
>
> def __str__(self):
> return self.name
>
> class Admin:
> pass
>
> class Tag(models.Model):
> name = models.CharField(maxlength=100)
> slug =
> models.SlugField(unique=True,prepopulate_from=('name',),maxlength=150)
> displayCount = models.IntegerField()
> description = models.TextField(blank=True)
>
> def __str__(self):
> return self.name
>
> class Admin:
> pass
>
> class 

Re: spam

2007-11-06 Thread Jay Klehr

Are the other lists powered by Google Groups?  Are they as active as 
Django's list?

Perhaps you should direct your complaints to Google, as I don't think 
the people on this list (or even the owners of the list) can do much 
about it (aside from moderating every new user/post).

Jay


Jeffrey Johnson wrote:
> This is the ONE list where I consistently get porn spam in gmail. What gives?
>
>   


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

2007-11-06 Thread Lars Stavholm

Jeffrey Johnson wrote:
> This is the ONE list where I consistently get porn spam in gmail. What gives?

The format of these porn spam's is new,
I do believe the filtering will take care
of it soon enough. Takes a few of these to
train the spam filter(s).
/L

> On Nov 6, 2007 9:52 AM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> Derek Anderson wrote:
>>> ok, seriously, is there not something we can do about the porn spam?
>>> some of us read this list at work on machine's we don't own.  the image
>>> stuff is becoming a serious problem.
>> I do believe that Google groups are filtering out close to 99%
>> of all spam (sign up for a gmail.com account and see for yourself).
>> I too find this greatly disturbing, but the fact is that it is,
>> to my understanding, difficult or even impossible to filter out
>> 100% of the spam.
>> /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: spam

2007-11-06 Thread Forest Bond
On Tue, Nov 06, 2007 at 10:02:50AM -0800, Jeffrey Johnson wrote:
> This is the ONE list where I consistently get porn spam in gmail. What gives?

High demand on this list?

-Forest
-- 
Forest Bond
http://www.alittletooquiet.net


signature.asc
Description: Digital signature


Re: spam

2007-11-06 Thread Jeffrey Johnson

This is the ONE list where I consistently get porn spam in gmail. What gives?

On Nov 6, 2007 9:52 AM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>
> Derek Anderson wrote:
> > ok, seriously, is there not something we can do about the porn spam?
> > some of us read this list at work on machine's we don't own.  the image
> > stuff is becoming a serious problem.
>
> I do believe that Google groups are filtering out close to 99%
> of all spam (sign up for a gmail.com account and see for yourself).
> I too find this greatly disturbing, but the fact is that it is,
> to my understanding, difficult or even impossible to filter out
> 100% of the spam.
> /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: spam

2007-11-06 Thread Lars Stavholm

Derek Anderson wrote:
> ok, seriously, is there not something we can do about the porn spam? 
> some of us read this list at work on machine's we don't own.  the image 
> stuff is becoming a serious problem.

I do believe that Google groups are filtering out close to 99%
of all spam (sign up for a gmail.com account and see for yourself).
I too find this greatly disturbing, but the fact is that it is,
to my understanding, difficult or even impossible to filter out
100% of the spam.
/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: spam

2007-11-06 Thread Bryan L. Fordham


> About all you can do is mark it as spam and let that train Google's spam 
> filter.
>
>   
A mail client that doesn't automatically show images will help, too.

--B

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

2007-11-06 Thread James Bennett

On Nov 6, 2007 11:47 AM, Derek Anderson <[EMAIL PROTECTED]> wrote:
> ok, seriously, is there not something we can do about the porn spam?
> some of us read this list at work on machine's we don't own.  the image
> stuff is becoming a serious problem.

About all you can do is mark it as spam and let that train Google's spam filter.

-- 
"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: MyISAM table locking.

2007-11-06 Thread Karen Tracey

At 10:40 AM 11/6/2007, you wrote:

>Hi All,
>
>I tried writing some code to do table locking on a MySQL MyISAM
>database.  I used the code below, which seemed to work in basic
>examples, but the code would complain of accessing a non-locked table
>whenever I made a more complex query such as
>objects.filter(__) saying
>that the table __ wasn't
>locked with "LOCK TABLES", even though I had locked the table for the
>foreign key.  Furthermore, it failed to lock if I tried to reference
>the table using the syntax of the form of the complex query.
>
>Has anyone had success running table locks?

Yes, I can get this to work, but it requires knowing exactly how 
Django is going to construct the queries -- what tables will be 
listed and what aliases used.  That means code you get to work now 
may easily break in the future if Django changes how it builds 
queries.  I would not be at all surprised if code that works today 
for this breaks when queryset-refactor lands on the trunk.  But, if 
you really need to make this work, it can be done.

Note that when an alias is used, you must use "real_table AS alias 
lock_type" in the LOCK TABLES statement.

Here's an annotated transcript of how I got lock tables with a 
non-trivial query to work with my DB.  Where I displayed the sql for 
the query I manually split the lines to highlight the tables involved 
in the query.  (Note my database existed before I ever started using 
Django so the tables and column names are not what you might expect 
for a Django DB.)

--

 >>> # Contstruct a query to get a list of Clues in the DB for the 
Entry "DJANGOREINHARDT"
 >>> cl = 
Clues.objects.select_related().filter(EntryID__Entry='DJANGOREINHARDT')

 >>> # Naively assume the only table we need to lock is Clues itself
 >>> cursor.execute("LOCK TABLES Clues READ")
0L

 >>> # See how wrong we are
 >>> cl
Traceback (most recent call last):
   File "", line 1, in 
   File "/homedir/django/newforms-admin/django/db/models/query.py", 
line 108, in __repr__
 return repr(self._get_data())
   File "/homedir/django/newforms-admin/django/db/models/query.py", 
line 482, in _get_data
 self._result_cache = list(self.iterator())
   File "/homedir/django/newforms-admin/django/db/models/query.py", 
line 189, in iterator
 cursor.execute("SELECT " + (self._distinct and "DISTINCT " or 
"") + ",".join(select) + sql, params)
   File "/homedir/django/newforms-admin/django/db/backends/util.py", 
line 18, in execute
 return self.cursor.execute(sql, params)
   File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 
166, in execute
 self.errorhandler(self, exc, value)
   File "/var/lib/python-support/python2.5/MySQLdb/connections.py", 
line 35, in defaulterrorhandler
 raise errorclass, errorvalue
OperationalError: (1100, "Table 'Clues__EntryID' was not locked with 
LOCK TABLES")

 >>> Examine the sql for the last query to see what all really needs 
to be locked
 >>> connection.queries[-1]['sql']
u'SELECT `Clues`.`ID`,`Clues`.`Theme`,`Clues`.`Entry 
ID`,`Clues`.`Puzzle 
ID`,`Clues`.`Clue`,`Clues`.`Num`,`Clues`.`Dir`,`Clues`.`Derived`,`Entries`.`Entry
 
ID`,`Entries`.`Entry`,`Entries`.`Exclude`,`Puzzles`.`Puzzle 
ID`,`Puzzles`.`Publisher ID`,`Puzzles`.`Date`,`Puzzles`.`Day of 
Week`,`Puzzles`.`Author 
ID`,`Puzzles`.`Title`,`Puzzles`.`Columns`,`Puzzles`.`Rows`,`Puzzles`.`Entry 
Count`,`Puzzles`.`Block Count`,`Puzzles`.`Avg Entry 
Length`,`Puzzles`.`Avg Scrabble Value`,`Puzzles`.`Unused 
Letters`,`Puzzles`.`DateAux`,`Publishers`.`Publisher 
ID`,`Publishers`.`Publisher`,`Publishers`.`Short 
Name`,`Publishers`.`Editor`,`Authors`.`Author 
ID`,`Authors`.`Author`,`Authors`.`Pseudonym`,`Authors`.`Notes`

FROM `Clues`

INNER JOIN `Entries` AS `Clues__EntryID` ON `Clues`.`Entry ID` = 
`Clues__EntryID`.`Entry ID` ,

`Entries`,

`Puzzles`,

`Publishers`,

`Authors`

WHERE ((NOT ((`Clues`.`Derived` = True))) AND 
`Clues__EntryID`.`Entry` = DJANGOREINHARDT) AND `Clues`.`Entry ID` = 
`Entries`.`Entry ID` AND `Clues`.`Puzzle ID` = `Puzzles`.`Puzzle ID` 
AND `Puzzles`.`Publisher ID` = `Publishers`.`Publisher ID` AND 
`Puzzles`.`Author ID` = `Authors`.`Author ID` ORDER BY `Clues`.`Dir` 
ASC, `Clues`.`Num` ASC'

 >>> # Try again, this time locking all the tables & aliases used in the query
 >>> cursor.execute("LOCK TABLES Clues READ, Entries as 
Clues__EntryID READ, Entries READ, Puzzles READ, Publishers READ, 
Authors READ")
0L

 >>> # And now the query works
 >>> cl = 
Clues.objects.select_related().filter(EntryID__Entry='DJANGOREINHARDT')
 >>> cl
[]
 >>>

--

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

spam

2007-11-06 Thread Derek Anderson

ok, seriously, is there not something we can do about the porn spam? 
some of us read this list at work on machine's we don't own.  the image 
stuff is becoming a serious problem.

-- 
  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: Help With Modeling This

2007-11-06 Thread Tim Chase

> I've run into a problem trying to model something in Django
> and could use some advice.  In a nutshell, I'm trying to
> relate a single table to multiple (other) tables using a
> single foreign key field and foreign key type.  I'm aware of
> the manytomany relationship type of Django but I don't think
> this will provide the functionality I'm looking for.

It sounds like you're looking for

http://www.djangoproject.com/documentation/contenttypes/#generic-relations

which, serendipitously happens to use tagging as an example :)

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



Help With Modeling This

2007-11-06 Thread [EMAIL PROTECTED]

I've run into a problem trying to model something in Django and could
use some advice.  In a nutshell, I'm trying to relate a single table
to multiple (other) tables using a single foreign key field and
foreign key type.  I'm aware of the manytomany relationship type of
Django but I don't think this will provide the functionality I'm
looking for.

Based on the model below, I have tables named "Artist", "Album" and
"Song".  What I'm trying to accomplish is making lists of records from
these tables and assigning a tag to them.  This will let me pull a
list by tag name and have access to all of its items.  For example, I
might have a Tag named "Legends Of Jazz" that contains 10 tag items.
Some of the tag items point to an Album and some point to an Artist.
Based on the ForeignID field and ItemType relationship, I can create
this list in the database.  A problem arises when I try to extract the
list in a view or template.  There is no "hard" relationship establish
that I use to get items.  If I pull a list of TagItems, how would I
then get the artist or song?

I realize that some readers might question the purpose of creating a
soft relationship like this.  The reason is that it allows me to
create new entities in the database and then establish a relationship
without code or database changes.  If I decided to start tagging
"Genres" or some other type of entity then I would only need to add a
new ItemType to the database table.

The end goal is to pass a list to my template and format each item
according to its type.  I'm actually going to have a view picking tags
at random in order to present different music to the user as they
navigate the site.  This way the site appears to be more dynamic and I
don't have to keep adding content.  Just create some new Tags.

I would appreciate any advice on how to accomplish this in Django.

Here is my current model:

from django.db import models
import datetime

class Genre(models.Model):
name = models.CharField(maxlength=150)
slug =
models.SlugField(unique=True,prepopulate_from=('name',),maxlength=150)

def __str__(self):
return self.name

class Admin:
pass

class Artist(models.Model):
name = models.CharField(maxlength=150)
slug =
models.SlugField(unique=True,prepopulate_from=('name',),maxlength=150)

def __str__(self):
return self.name

class Admin:
pass

class Album(models.Model):
name = models.CharField(maxlength=150)
slug =
models.SlugField(unique=True,prepopulate_from=('name',),maxlength=150)
publisher = models.CharField(maxlength=100)
releasedate = models.CharField(maxlength=50)
cover = models.CharField(maxlength=300)
description = models.TextField()
rating = models.CharField(maxlength=3)
lookupon = models.DateField(null=True,editable=False)
failedlookup = models.BooleanField(null=True)
modifiedon = models.DateField(editable=False)

artist = models.ForeignKey(Artist,related_name='album_artist')
genre = models.ForeignKey(Genre,related_name='album_genre')

def save(self):
self.modifiedon = datetime.datetime.today()
super(Album, self).save()

def __str__(self):
return self.name

class Admin:
pass

class AlbumReview(models.Model):
Summary = models.CharField(maxlength=100)
Content = models.TextField()
ReviewDate = models.CharField(maxlength=50)
Rating = models.CharField(maxlength=3)

album = models.ForeignKey(Album,related_name='review_album')

def __str__(self):
return self.id

class Admin:
pass

class Song(models.Model):
name = models.CharField(maxlength=150)
slug =
models.SlugField(unique=True,prepopulate_from=('name',),maxlength=150)
bitrate = models.CharField(maxlength=12)
length = models.CharField(maxlength=10)
duration = models.IntegerField()
track = models.IntegerField()
filepath = models.TextField()

album = models.ForeignKey(Album,related_name='song_album')

def __str__(self):
return self.name

class Admin:
pass

class Tag(models.Model):
name = models.CharField(maxlength=100)
slug =
models.SlugField(unique=True,prepopulate_from=('name',),maxlength=150)
displayCount = models.IntegerField()
description = models.TextField(blank=True)

def __str__(self):
return self.name

class Admin:
pass

class TagItemType(models.Model):
name = models.CharField(maxlength=200)

def __str__(self):
return self.name

class Meta:
verbose_name_plural = "Tag Item Types"

class Admin:
pass

class TagItem(models.Model):
foreignID = models.IntegerField()
description = models.TextField(blank=True)

tag = models.ForeignKey(Tag,related_name='tagItem_tag')
itemType =
models.ForeignKey(TagItemType,related_name='tagItem_type')

def __str__(self):
return ("%s %s ID=%s") %
(self.tag,self.itemType,self.foreignID)

class Meta:

Re: gettext is not defined - admin site

2007-11-06 Thread ygneo

Some advances in my investigation about this error.

The problem seems to be in the characters codification. I don't know
if django or maybe apache are codifying badly the special characteres
in spanish needed for translations. The same error happened when I try
to translate title and branding in templates of the Admin Site. I had
to delete every "trans" from templates y put the text directly,
without possibility of translation. I remenbered that recently and I
decided to do the same in calendar.js and DateTimeShorctus.js, getting
disappear all gettext calls and using directly spanish text for
months, days and Today link.

It's a solution for the application I'm doing, 'cause it doesn't have
to be translated, but I think it's not a good solution, and I'm still
wondering waht is the origin of the problema. Exactly the same app
works fine in the same django version but over Ubuntu 7.04 with python
2.5 instead of SuSE 9.X with python 2.3, where I found the problem.

Any idea about this issue?

(Sorry if my english is not so good)


On 5 nov, 21:00, ygneo <[EMAIL PROTECTED]> wrote:
> I use Django 0.96 in a SuSE with Python 2.3.3.
>
> I'm getting this JavaScript error: "gettext is not defined" when I try
> to edit an object with date field in the admin site. I have seen that
> occurs when calendar.js is trying to populate the month names in the
> correct language. I use language_code = es_ES and default_charset =
> utf-8 and i have configurated apache to use utf-8 as default charset.
> I also have found with FireBug that really the error is a Django
> error:
>
> UnicodeEncodeError at /convenios/admin/jsi18n/
> ascii codec cant encode character u\xe9 in
> position 23:
>
> For this reason jsi18n doesn't load and i can't use gettext.
>
> Otherwise, in an Ubuntu installation of Django, with same lang code,
> and Python 2.5.1, all works fine.
>
> Any idea?
>
> Thanks a lot!


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



[[ Watch?? r u want Sex ]]

2007-11-06 Thread Mr.Thawatchai Boontan
Download Watch?? r u want Sex.Wmv ==> http://w14.easy-share.com/9248491.html

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

2007-11-06 Thread Mikkel Høgh

Thank you Karen, that was it.

I wonder if this is a bug and should be reported...

The origial error was an error in the {% cycle %}-tag...

Kind regards,

Mikkel Høgh

On Nov 6, 2:58 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> It would appear the Django template code is actually trying to raise a
> VariableDoesNotExist error, and tripping up on attempting to render a
> context that contains non-ASCII data.  I don't know the correct fix for
> that, but as a temporary fix if you change line 130 of your
>
> /usr/local/lib/python2.5/site-packages/django/template/__init__.py
>
> (currently "return self.msg % self.params")
>
> to something like:
>
> return 'Variable does not exist: %s' % self.params[0]
>
> You should at least get an error pinpointing the variable your template is
> accessing that does not exist and where it is trying to be used instead of
> the UnicodeDecodeError, so you might be able to make progress on getting
> your own template/code to work.
>
> Karen
>
> On 11/5/07, Mikkel Høgh <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have a bit of a problem with a project I'm creating. I get an
> > UnicodeDecodeError from some of the template code. The traceback is
> > here:
> >http://dpaste.com/24285/
>
> > It tries to decode the title field from unicode into ascii, but I
> > cannot seem to understand why...
> > I have dpaste'd the code in question.
>
> > Template:http://dpaste.com/24284/
> > Model (where the get_task function is):http://dpaste.com/24281/
> > View (I suppose that's rather irrelevant):http://dpaste.com/24286/
>
> > Since the code is open source, you can browse it in its entirety here:
> >http://codebrowse.launchpad.net/~mikl/kaplan/kaplan.dev/files
>
> > If anyone can figure this out, you will have my eternal gratitude
> > Thanks to Magus- in #django for trying - if you are reading this, I
> > changed the part you pointed out to use Django's slugify function
> > instead of str().lower(), but that wasn't it, sadly.
>
> > Kind regards,
> > Mikkel Høgh


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



[[ Family Sex ]]

2007-11-06 Thread Mr.Thawatchai Boontan
Download Family Sex.3gp : http://w14.easy-share.com/9248891.html

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



MyISAM table locking.

2007-11-06 Thread Peter

Hi All,

I tried writing some code to do table locking on a MySQL MyISAM
database.  I used the code below, which seemed to work in basic
examples, but the code would complain of accessing a non-locked table
whenever I made a more complex query such as
objects.filter(__) saying
that the table __ wasn't
locked with "LOCK TABLES", even though I had locked the table for the
foreign key.  Furthermore, it failed to lock if I tried to reference
the table using the syntax of the form of the complex query.

Has anyone had success running table locks?

The code:  (note: I was getting connection using: from django.db
import connection)


 def lock_tables(connection, args):
 
'''
Performs a table lock with the given connection, args is a
list of tuples
with (, )
**Remember to call unlock_tables at some point after this
call
'''
if not len(args):
raise Exception("Must supply args to lock table!")
cursor = connection.cursor()
try:
tbl_clause = [MySQLdb.escape_string(x[0] + " " + x[1]) for x
in args]
except:
raise Exception("Args was improperly constructed")
cursor.execute("LOCK TABLES %s" % MySQLdb.escape_string(',
'.join(tbl_clause)))

def unlock_tables(connection):
 
'''
Unlocks all table locks for the given
connection
'''
cursor = connection.cursor()
cursor.execute("UNLOCK TABLES")


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



Re: mod_python: problem with http.conf

2007-11-06 Thread Joe

Can you open a python interpreter and import your application?
I place a sim link (ln -s) within the python site-packages directory
to my project directory and the django source directory.

J

On Nov 5, 4:37 pm, stranger <[EMAIL PROTECTED]> wrote:
> Hello I am using Fedora 7. I am using Django for the first time. I
> want the django to run on port 80. so that :
>
> http://localhost/mysite/
>
> should retreive the Django dafault page. I have installed mod_python
> and imported it into http.conf.
>
> In http.conf I have also:
>
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> PythonDebug On
> 
>
> MY CLASS PATH IS:
> $ echo $PATH
> /home/priya/mysite:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/
> home/priya/bin
>
> CHECK THE SCREEN SHOT OF THE ERROR PAGE:
>
> http://img222.imageshack.us/my.php?image=screenshotuf4.png
>
> Advance thank you for the 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 select all the values from my Field attribute 'choices?

2007-11-06 Thread äL

Hello Karen

I have the same problem as Greg has.

If I try to use your code I got an "page not found" error.
Here is my code:

views.py
### CODE ###
def Karateka_edit(request, karateka_id):

from kav.info.models import Karateka

try:
karateka  = Karateka.objects.get(id = karateka_id)
roles= [y for x,y in ROLE]
except Karateka.DoesNotExist:
raise Http404
return render_to_response('info_karateka_edit.html', {
 'karateka'  : karateka,
 'roles'   : roles,
 'user'  : request.user})
### END CODE ###

Do I need to import ROLE like Karateka or do I have an other error in
my code?
Regards,
äL

On 24 Okt., 00:06, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On 10/23/07, Greg <[EMAIL PROTECTED]> wrote:
> [snip]
>
> > class Collection(models.Model):
>
> > THE_MATERIAL = (
> > ('1', 'Paper'),('2', 'Plastic'),('3', 'Other'),
> > )
>
> > material = models.CharField(max_length=50, choices=THE_MATERIAL)
>
> > ///
>
> > However, now I want to be able to do a query that returns all of the
> > values in THE_MATERIAL (even if it's not being used by any
> > collection).  How would the query be setup to do this?
>
> Well, you can't set up a query for something that isn't in the database.
> But the values are right there in THE_MATERIAL.  If you want a list of just
> the text values, stripping away the numeric choices, some simple Python:
>
> material_list = [y for x,y in THE_MATERIAL]
>
> would do it.
>
> 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: "and" type query over related objects

2007-11-06 Thread Tim Chase

> I need to be able to query an object that has a set of related
>  objects - the query is to find which objects contain the same
> set of query objects. For example the main object could be a
> research paper and the related object would be a set of topics
> that the papers could contain.


This is a popular question that I've found a solution to.  It 
might be kinder in the queryset refactor (Malcolm?), but for the 
time being, this is what I've used:

http://groups.google.com/group/django-users/browse_thread/thread/24de9d4b74935296/

Because of the way the underlying SQL builds the query, you 
basically end up asking for two contradictory conditions of the 
same row:

   WHERE x = 1 AND x = 2

which, as you discovered, returns no rows.

The solution I've found is to use an extra() call to build an 
IN/EXISTS[1] subselect that asks what I want.  Thus, it becomes 
something like

   WHERE EXISTS(
 SELECT 0
 FROM  i
 WHERE  AND
   i. = .id
 ) AND EXISTS(
 SELECT 0
 FROM  i
 WHERE  AND
   i. = .id
 )

-tim

[1] FWIW, I've found EXISTS to be faster in PostgreSQL and IN to 
be faster in SQLServer; haven't profiled MySQL or sqlite.






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

2007-11-06 Thread Thomas Guettler

Am Dienstag, 6. November 2007 07:00 schrieb Matti Haavikko:
> Here's an alternative solution - it's based on the idea that the
> handlers are added to the logger only once. (getLogger returns the same
> logger instance each time).
>
> import logging
> logger=logging.getLogger("dws")
> if not logger.handlers:
> ...
> logger.addHandler()

Hi,

I used something like this, but used the root logger (getLogger()).

If there is a call to logging.log(...) before you add your handler,
python automatically inserts one for you. This means the if-statement
above will be false (and addHandler() would not be called), even on the first 
run.

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



"and" type query over related objects

2007-11-06 Thread James Cordiner

Hi,

I need to be able to query an object that has a set of related  
objects - the query is to find which objects contain the same set of  
query objects. For example the main object could be a research paper  
and the related object would be a set of topics that the papers could  
contain.

class Topic(models.Model):
 label = models.CharField(maxlength=255)

class Paper(models.Model):
topic = models.ManyToManyField(Topic)

I have tried a few approaches, I thought I could simply chain a  
series of filters or AND some Q objects:

In [28]: p=Paper.objects.filter(topic=t2).filter(topic=t)

In [29]: p
Out[29]: []


In [39]: Paper.objects.filter(Q(topic=t)|Q(topic=t2))
Out[39]: [, ]

In [40]: Paper.objects.filter(Q(topic=t),Q(topic=t2))
Out[40]: []

But these don't work and I end up with an empty query set, but there  
is  a Paper object with both a t and t2 object.

Thanks,
jms.

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

2007-11-06 Thread Joe

Great answer, thank you!

On Nov 5, 5:17 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> The latest roundup on thread safety of Django is that although it was
> not designed for thread safety initially, the only known
> multithreading problem has been fixed some time back. As such,
> numerous people do run it in Apache worker MPM for UNIX and on winnt
> MPM on Windows, both of which are multithreaded. The Django
> instructions even show using multithreaded mode with FASTCGI, so that
> it is present must mean people are having success with it also.
>
> The important thing though is whether your own application code built
> on top of Django is itself thread. You would therefore need to ensure
> you test you code properly.
>
> Using mod_wsgi is another option and perhaps simpler to configure and
> manage than FASTCGI solutions, especially if the later requires a
> separate supervisor system to startup your FASTCGI processes and keep
> them running. Using mod_wsgi you also have the option of easily
> changing your mind and moving an application back into the main Apache
> child processes (like in mod_python) if performance is more important
> for a specific application than memory consumption.
>
> Graham
>
> On Nov 6, 6:11 am, Joe <[EMAIL PROTECTED]> wrote:
>
> > Also, should I take a look at mod_wsgi?
>
> > On Nov 5, 11:22 am, Joe <[EMAIL PROTECTED]> wrote:
>
> > > I am considering switching from mod_python and apache to lighttpd and
> > > fastcgi because of the large number of virtual hosts I am serving.
>
> > > Because each virtual host gets its own sub interpreter, each apache
> > > instance on my server can weigh in at over 160 megs.
>
> > > I have heard that apache-mpm, mod_python and Django will not work, so
> > > I would like to know if using fastcgi with method=threaded would be a
> > > good way to solve my memory usage problems.
>
> > > When I start one fastcgi process in threaded mode, it only uses 8 megs
> > > of memory, which is a lot more scalable than apache instances weighing
> > > in at 160 megs.
>
> > > Thoughts, please.


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

2007-11-06 Thread Marcin Mierzejewski

Hi,

>From Django Book:
"syncdb command is a simple sync of your models to your database.
It looks at all of the models in each app in your INSTALLED_APPS
setting".

But you can uses --settings option for manage.py.

./manage.py syncdb --settings=mysettings

where mysettings.py contains only your application in INSTALLED_APPS
---
INSTALLED_APPS = ( 'myproject.myapps' )
---

Regards,
Marcin


On Nov 6, 12:54 pm, AngelCaido <[EMAIL PROTECTED]> wrote:
> I don't know if this was asked before, but I can't seem to find an
> answer
> I want to syncDB for a specific application in my site.
> Something like when you do
>
> python manage.py sql MyApplication
>
> and it only generates the SQL for that application.
> Can I do something like:
>
> python manage.py syncdb MyApplication
>
> 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
-~--~~~~--~~--~--~---



newforms ModelChoiceField queryset

2007-11-06 Thread Gonzalo Delgado
Hello there,
  I'm using Django 0.96 here. I've got a couple of models 
related by a ForeignKey that look more or less like this:

 class Server(models.model):
 name = models.CharField(maxlength=20)
 users = models.ManyToManyField(User)

 class Ticket(models.model):
 desc = models.TextField()
 server = models.ForeignKey(Server)


 Then, I define a form to load tickets:

 from django import newforms as forms

 class NewTicket(forms.Form):
 desc = forms.CharField(widget=forms.Textarea())
 server = forms.ModelChoiceField(queryset=Server.objects.all())

OK then, what I want to do is filter the servers in the form according to the 
current user (request.user). The only way I've been able to do this (so far) in 
a view is this:

serversbyuser = Server.objects.filter(users=request.user)
ticketform = NewTicket()
ticketform.fields['server'] = 
forms.ModelChoiceField(queryset=serverbyuser)

 The question is: why doesn't something like this work:

ticketform.fields['server'].queryset = 
Server.objects.filter(users=request.user)
?
 It doesn't end up on any error, but the rendered form doesn't filter out the 
server choices.. any clue?

 Regards.

-- 
Gonzalo Delgado <[EMAIL PROTECTED]>


pgpkCM10etD0q.pgp
Description: PGP signature


syncDB

2007-11-06 Thread AngelCaido

I don't know if this was asked before, but I can't seem to find an
answer
I want to syncDB for a specific application in my site.
Something like when you do

python manage.py sql MyApplication

and it only generates the SQL for that application.
Can I do something like:

python manage.py syncdb MyApplication

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: Authorization Model at the Field Level

2007-11-06 Thread Marcin Mierzejewski

Hi Manakel,

On Nov 6, 11:53 am, Manakel <[EMAIL PROTECTED]> wrote:
> This web application had a Authorization model at the Field level.
> []
> TASK has a progress status field and a due date field
> realisator user can only change the status field
> owner can change both the status field and the
> initalize the due date field project manager can initialize the due
> date field but also change it.
> Is there any best practice to manage this kind of very fine grained
> authorisations in Django?

You can use many-to-one relation to split Task for more then one
model.
http://www.djangoproject.com/documentation/models/many_to_one/

Task(models.Model):
Description

DueDate(models.Model):
task = models.ForeignKey(Task)
due_date

Status(models.Model):
task = models.ForeignKey(Task)
status

And now, you can assign permission individually for every model.

Regards,
Marcin

--
http://www.zenzire.com | Software Development Company


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Is it possible to debug a view using breakpoints in Eclipse?

2007-11-06 Thread crybaby

By the way Karen, thanks for the help.

joe


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Is it possible to debug a view using breakpoints in Eclipse?

2007-11-06 Thread crybaby

Before I was using pydev 1.2.5 with eclipse 3.2 with mylar.  Now I
just upgraded to eclipse 3.3 and pydev 1.3.10.  Debugger is working,
now I can click on classes, it just takes me there.

If try to install pydev 1.3.10 from eclipse install manager, then you
will get mylar package error.  Just download,
http://sourceforge.net/project/showfiles.php?group_id=85796 and upzip
into eclipse folder.


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



Authorization Model at the Field Level

2007-11-06 Thread Manakel

Hello Everybody,

I'm kind of new to Django (less than 1week now).
I have the task to migrate an existing web application to django.

This web application had a Authorization model at the Field level.

If i take  a  TASK model for demonstration.

TASK has a progress status field and a due date field
realisator user can only change the status field
owner can change both the status field and
the
initalize the due date field
project manager can initialize the due date field but also change it.

Is there any best practice to manage this kind of very fine grained
authorisations in Django?


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



Server error/Template Context processors

2007-11-06 Thread Ryan K

Hi. When there is a server error (error 500 returns) the template
context processors don't seem to be doing anything (not passed to the
template).

I have this template context processor:

import llcom.settings

def site_context(request):
""" Add URL prefixes from settings file to request context """
site_context = {
'link_prefix': llcom.settings.LINK_PREFIX,
'static_prefix': llcom.settings.STATIC_PREFIX,
'no_flash': request.LANGUAGE_CODE in
llcom.settings.NO_FLASH_LANGUAGES,
}
return site_context

and this in my settings:

TEMPLATE_CONTEXT_PROCESSORS = (
'llcom.custom_cp.site_context',
'django.core.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
)

'static_prefix' is where my media is. But when a 500 error occurs, the
'static_prefix' (as well as 'link_prefix') settings aren't making it
to the template and style sheets are applied. 404 errors are fine. Any
reason for this?

Thanks,
Ryan


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



Server error/Template Context processors

2007-11-06 Thread Ryan K

Hi. When there is a server error (error 500 returns) the template
context processors don't seem to be doing anything (not passed to the
template).

I have this template context processor:

import llcom.settings

def site_context(request):
""" Add URL prefixes from settings file to request context """
site_context = {
'link_prefix': llcom.settings.LINK_PREFIX,
'static_prefix': llcom.settings.STATIC_PREFIX,
'no_flash': request.LANGUAGE_CODE in
llcom.settings.NO_FLASH_LANGUAGES,
}
return site_context

and this in my settings:

TEMPLATE_CONTEXT_PROCESSORS = (
'llcom.custom_cp.site_context',
'django.core.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
)

'static_prefix' is where my media is. But when a 500 error occurs, the
'static_prefix' (as well as 'link_prefix') settings aren't making it
to the template and style sheets are applied. 404 errors are fine. Any
reason for this?

Thanks,
Ryan


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



Re: i18n model field not translated

2007-11-06 Thread otonk

problem solved..

it lies on the django.po

i havent remove the

#, fuzzy

mark.. thats why its not translated

link: 
http://groups.google.com/group/django-users/browse_thread/thread/e8476fa11cefc2b7

Notice that the message in question is marked as "fuzzy". That means
the
translation does not quite match the source string. I cannot read
Chinese well enough to know if the string is at all close, but one
obvious difference is that the source string contains a "%d" format
marker whilst the translation contains a "%s" marker.

By default, fuzzy translations are not included in the output. A
translator has to check each one, verify it is correct (or correct it)
and remove the fuzzy comment. Then the result will be include in the
MO
file.

You may wish to update the file and submit a diff of the changes to
Trac
so that it can be committed.


Thanks for the group..


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