Re: hi evereyone i have a django+fastcgi 's issue

2007-05-01 Thread Kula
i am so happy to see your reply .
and i am not good at english so i have a mistake to understand your
sentence.
 i try to use 'python django.fcgi' to lunch my django application.
and i try
 ' /var/www/virtual/kula.51boo.com/htdocs/web/template/'
 '/var/www/virtual/kula.51boo.com/htdocs/web/template/',
'./template'
'./template',
they are both not work.

i think maybe the proplem is occur in the file who names djiango.fcgi.
It works when i use the django simple httpserver. but it occur error ' unpack
non-sequence' when i execute the django.fcgi scripte.
but i don't konw what's the really reason.

Best Regards
Kula




On 5/2/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
>
>
> On 5/2/07, Kula <[EMAIL PROTECTED]> wrote:
> > thanks for your help.
> > i changed the
> > '/var/www/virtual/kula.51boo.com/htdocs/web/template/' to
> > the './template'
> > but the question is also.
> > the problem puzzled me 2 days ..
>
> Perhaps I didn't explain well enough. The problem isn't the directory
> name - it's a missing comma _after_ the directory name.
>
> TEMPLATE_DIRS = ( 'foo' )
>
> is _VERY_ different to
>
> TEMPLATE_DIRS = ( 'foo', )
>
> The first of these two examples will not work. The second one will.
> The settings file you provided matches the first example. Make it
> match the second, and the problem should go away.
>
> Yours,
> Russ Magee %-)
>
> >
>

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



Re: hi evereyone i have a django+fastcgi 's issue

2007-05-01 Thread Russell Keith-Magee

On 5/2/07, Kula <[EMAIL PROTECTED]> wrote:
> thanks for your help.
> i changed the
> '/var/www/virtual/kula.51boo.com/htdocs/web/template/' to
> the './template'
> but the question is also.
> the problem puzzled me 2 days ..

Perhaps I didn't explain well enough. The problem isn't the directory
name - it's a missing comma _after_ the directory name.

TEMPLATE_DIRS = ( 'foo' )

is _VERY_ different to

TEMPLATE_DIRS = ( 'foo', )

The first of these two examples will not work. The second one will.
The settings file you provided matches the first example. Make it
match the second, and the problem should go away.

Yours,
Russ Magee %-)

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



Re: newforms is_valid issue

2007-05-01 Thread Malcolm Tredinnick

On Tue, 2007-05-01 at 21:21 -0700, maeck wrote:
> oops, did not use form_for_instance(d).
> However, is_valid is not telling me that the form is correct.
> What am I doing wrong?

Well, if f.bound is True and f.is_valid() is false, f.errors will
contain the validation errors. That would be a good spot to start
looking.

Regards,
Malcolm



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



Re: connecting to multiple databases

2007-05-01 Thread Brian Luft

Hi Russ,

Thanks for the detailed response and I agree with all of your
sentiments.  You're doing a great job and you are a tremendous asset
to this list.  Keep up the great work.

Having been a committer to other framework projects, I understand the
constant pressure to integrate feature X,Y, and Z.  I'm totally on
board with the direction the core devs are taking and have faith that
the future will see some exciting new developments.

I'm open to any or all solutions to this problem.  If I can use a
compact pattern or drop in a metaclass somewhere that will enable this
functionality then I can certainly live with that.   No need to put in
man hours maintaining a branch if the solution is a simple tweak to an
existing setup.

You're right - "unfortunate" is a value judgement and I really meant
it would be unfortunate if lack of a feature drove people away.  Of
course that happens anyway (what no ajax support? what no clunky
templating engine? i pass...) - you know the story.  It is very
fortunate that we have a solid framework being driven by talented,
dedicated people I can tell you that much :)

Cheers
-Brian

On May 1, 9:37 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 5/2/07, Brian Luft <[EMAIL PROTECTED]> wrote:
>
> > Although I've successfully used the multi-db branch experimentally, it
> > looks to be getting more and more out of date with the django trunk.
> ...
> > Just for the sake of lively discussion, I would go so far as to say
> > that only being able to access a single database per project is an
> > unfortunate limitation and could be a deal-breaker for those
> > evaluating Django for their own use.  I'm sure there are many
>
> ..
>
> Limitation; sure. Unfortunate - that's a value judgement.
>
> The recent Rails/Twitter kurfuffle demonstrates that multi-db support
> can be very significant for a certain users. However, my time (and the
> time of the other devs, for that matter) is very limited, and our own
> itches will always take priority. I have many other features that I
> want to see in Django before multi-db (aggregate clauses, schema
> evolution, and model inheritance to name just 3). Multi-db just isn't
> a priority for any of the ways that I use Django, so there isn't much
> incentive for me to spend my time on it.
>
> The fact that a branch exists demonstrates that the core devs are
> willing to entertain the idea of multi-db as a feature. However, it
> needs somebody to step up to the plate and finish the job. Ultimately,
> this means submitting a branch in a condition suitable for merge back
> into the trunk. What does this mean in practice?
>
> - A branch that is up to date with trunk
> - Evidence that the branch has been used by real users, and bugs have
> been found and fixed
> - The existence of test cases that integrate with existing test framework.
> - Offering to look after the feature for the medium term.
>
> Once you can convince the core devs that these conditions are met, you
> should find the merge back happens pretty quickly - and voila!
> multi-db in the trunk.
>
> Now, before we are flooded with "give me SVN access and I'll do it!"
> requests. We aren't going to give SVN access to just anybody that
> stands up. We have been down this path, and so far, it seems to be the
> single easiest way to make sure you never hear from someone ever again
> (witness the multiple contributors that have offered to finish
> schema-evolution). Before you get SVN access, we want to see a track
> record of contributing first.
>
> Getting started doesn't require access to SVN. If you are interested
> in multi-db, start working and submit patches. If you demonstrate that
> you are in for the long haul, you will get SVN access for that branch
> to make your life a little easier.
>
> So - if you want multi-db (or any other feature, for that matter), have at it!
>
> Yours,
> Russ Magee %-)


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



Re: hi evereyone i have a django+fastcgi 's issue

2007-05-01 Thread Kula
thanks for your help.
i changed the
'/var/www/virtual/kula.51boo.com/htdocs/web/template/' to the './template'
but the question is also.
the problem puzzled me 2 days ..

Best Regards
Kula

On 5/2/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
>
>
> On 5/2/07, Kula <[EMAIL PROTECTED]> wrote:
> >
> > TEMPLATE_DIRS = (
> > # Put strings here, like "/home/html/django_templates".
> > # Always use forward slashes, even on Windows.
> > '/var/www/virtual/kula.51boo.com/htdocs/web/template/'
> > )
>
> Looks like this might be your problem. Sequences with a single item
> need a comma after the first item. Add a comma after the single entry
> in TEMPLATE_DIRS, and the problem may go away.
>
> Yours,
> Russ Magee %-)
>
> >
>

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



Re: Why are my FloatFields strings ?

2007-05-01 Thread Malcolm Tredinnick

On Tue, 2007-05-01 at 16:28 -0400, Andy Dustman wrote:
> On 5/1/07, Chris Brand <[EMAIL PROTECTED]> wrote:
> >
> > I've got a model that includes FloatFields as well as IntegerFields and
> > CharFields.
> > When I access the CharFields, I get strings. When I access the
> > IntegerFields, I get integers, but when I want to use the Floatfields, I
> > always have to add float() to convert the string to an actual float. Not
> > that big a deal, but I always forget it first time around, and it just
> > doesn't feel right.
> >
> > Here's a brief test :
> > >>> c = Camp.objects.get(pk=1)
> > >>> c.min_age
> > '17.0'
> > >>> a = c.min_age
> > >>> type(a)
> > 
> >
> > And here's the corresponding field definition :
> > min_age = models.FloatField("Minimum age", max_digits=3,
> > decimal_places=1, default=0, validator_list=[age_validator])
> >
> > Why is this ?
> >
> > I'm using 0.96 with a MySQL backend.
> 
> What version of Python are you using? I *think* FloatFields are
> returned as Python Decimal objects, which don't exist before
> Python-2.4, which means you would then get a string from MySQLdb. We
> might need a fix for Django on Python-2.3 to work around this.

I'm going to work on that problem (putting in decimal support) this week
sometime. Maybe today or tomorrow. It's starting to annoy me, seeing all
the decimal-reated tickets in Trac, so after I knock off all the email
ones (today), I want to fix up the decimal problem, in between other
things.

Regards,
Malcolm


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



Re: IntegrityError Handling

2007-05-01 Thread Malcolm Tredinnick

On Tue, 2007-05-01 at 05:42 -0700, sandro.dentella wrote:
> hi all,
> 
>   I noticed that recently has been added InterityError as a common
> exception
>   for all db (django.db.IntegrityError), so I wanted to make my view
> aware
>   of that, but I'm uncertain on how to accomplish this.
> 
>   I added a snippet like this one, in a sort of generic view:
> 
>   if form.is_valid():
>  # No errors -- this means we can save the data! except for db
> problems
>  try:
>  new_object = form.save()
>  except IntegrityError:
>  new_object = None
>  form.errors['db'] = "Integrity Error from the db"
> 
>  if new_object:
>  if request.user.is_authenticated():
>   ...
> 
>if new_object is None it falls back to the branch of form error
>handling... this was what I wanted... really it raises:
>ProgrammingError, current transaction is aborted, commands ignored
> until
>end of transaction block.
> 
>What's  wrong and which should be a correct way to handle
> IntegrityError?

If your code is raising ProgrammingError, then you have different
problems to when the code is raising IntegrityError.

The strong reason in favour of making IntegrityError available right now
is because it is one thing we do not have complete control over: some
other process may have changed the database in a way that is
inconsistent with the change we want to make. For example, there might
be a foreign key reference missing or a uniqueness violation or
something like that.

If your code is raising ProgrammingError, it means there is a problem in
your code (bad SQL, for example). This is something that is completely
within your control to fix, rather than not being detectable until it
gets to the database server. ProgrammingErrors are completely fixable by
the programmer, IntegrityErrors are not 100% avoidable.

Now, of course, this all assumes that whichever backend you are using is
compliant with the Python DB-API 2.0. Maybe it really is raising
ProgrammingError when it should be raising IntegrityError, but I doubt
it. As far as I know, all the database backends we support have sensible
exception mappings.

In the long-term it would be nice to maybe expose all the exceptions in
a backend-neutral fashion, as we've done with IntegrityError. However, I
would like to do that without having to list them all one by one,
because that is very repetitive and adds bloat that the code reader has
to skip over without adding much value.

Regards,
Malcolm


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



Re: connecting to multiple databases

2007-05-01 Thread Russell Keith-Magee

On 5/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I'm using the multi-db branch actively on a large project I have
> found a few bugs, but am uncertain if they are specific to the branch
> or if are also found in the trunk, as I haven't ever installed the
> trunk.
>
> I would like to try and take on maintenance of the branch...but am
> unsure of how to get started with that ( if anyone can give me some
> information on how to get a subversion account, and how to get started
> etc. feel free to tell me. ).  There weren't any notes as to the
> specific merging issues, and JP said it takes 4 hours to merge
> conflicts each time the trunk is merged with the branch.

See my earlier reply on how to get started.

> If a core developer would be willling to help me through the first
> merge with the trunk... I'd like to get it back to being an active
> branch.

What sort of help are you looking for? I'm happy to answer any
specific questions you may have.

Yours,
Russ Magee %-)

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



Re: connecting to multiple databases

2007-05-01 Thread Russell Keith-Magee

On 5/2/07, Brian Luft <[EMAIL PROTECTED]> wrote:
>
> Although I've successfully used the multi-db branch experimentally, it
> looks to be getting more and more out of date with the django trunk.
...
> Just for the sake of lively discussion, I would go so far as to say
> that only being able to access a single database per project is an
> unfortunate limitation and could be a deal-breaker for those
> evaluating Django for their own use.  I'm sure there are many
..

Limitation; sure. Unfortunate - that's a value judgement.

The recent Rails/Twitter kurfuffle demonstrates that multi-db support
can be very significant for a certain users. However, my time (and the
time of the other devs, for that matter) is very limited, and our own
itches will always take priority. I have many other features that I
want to see in Django before multi-db (aggregate clauses, schema
evolution, and model inheritance to name just 3). Multi-db just isn't
a priority for any of the ways that I use Django, so there isn't much
incentive for me to spend my time on it.

The fact that a branch exists demonstrates that the core devs are
willing to entertain the idea of multi-db as a feature. However, it
needs somebody to step up to the plate and finish the job. Ultimately,
this means submitting a branch in a condition suitable for merge back
into the trunk. What does this mean in practice?

- A branch that is up to date with trunk
- Evidence that the branch has been used by real users, and bugs have
been found and fixed
- The existence of test cases that integrate with existing test framework.
- Offering to look after the feature for the medium term.

Once you can convince the core devs that these conditions are met, you
should find the merge back happens pretty quickly - and voila!
multi-db in the trunk.

Now, before we are flooded with "give me SVN access and I'll do it!"
requests. We aren't going to give SVN access to just anybody that
stands up. We have been down this path, and so far, it seems to be the
single easiest way to make sure you never hear from someone ever again
(witness the multiple contributors that have offered to finish
schema-evolution). Before you get SVN access, we want to see a track
record of contributing first.

Getting started doesn't require access to SVN. If you are interested
in multi-db, start working and submit patches. If you demonstrate that
you are in for the long haul, you will get SVN access for that branch
to make your life a little easier.

So - if you want multi-db (or any other feature, for that matter), have at it!

Yours,
Russ Magee %-)

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



Re: newforms is_valid issue

2007-05-01 Thread maeck

oops, did not use form_for_instance(d).
However, is_valid is not telling me that the form is correct.
What am I doing wrong?

>>> d = Person.objects.get(id=1)
>>> p = forms.models.form_for_instance(d)
>>> f=p()
>>> print f
Name:
Country:
-
USA
Netherlands

Addr1:
Addr2:
Addr3:
Addr4:




On May 1, 10:10 pm, maeck <[EMAIL PROTECTED]> wrote:
> I am confused about the following:
> If I get a previous saved record, transform it into a form instance
> and then create a form out of it, the data is not valid nor bound (see
> below). However, if I print out the form, all fields are populated
> correctly.
> Am I missing a step?
>
> Thanks, Marcel
>
> >>> d = Person.objects.get(id=1)
> >>> p = forms.models.form_for_model(d)
> >>> f=p()
> >>> f.is_valid()
> False
> >>> f.is_bound
> False
> >>> print f
>
> Name: type="text" name="name" maxlength="200" />
> Country: name="country" id="id_country">
> -
> USA
> Netherlands
> 
> Addr1: id="id_addr1" type="text" name="addr1" maxlength="200" />
> Addr2: id="id_addr2" type="text" name="addr2" maxlength="200" />
> Addr3: id="id_addr3" type="text" name="addr3" maxlength="200" />
> Addr4: id="id_addr4" type="text" name="addr4" maxlength="200" />
>
>


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

2007-05-01 Thread maeck

I am confused about the following:
If I get a previous saved record, transform it into a form instance
and then create a form out of it, the data is not valid nor bound (see
below). However, if I print out the form, all fields are populated
correctly.
Am I missing a step?

Thanks, Marcel

>>> d = Person.objects.get(id=1)
>>> p = forms.models.form_for_model(d)
>>> f=p()
>>> f.is_valid()
False
>>> f.is_bound
False
>>> print f
Name:
Country:
-
USA
Netherlands

Addr1:
Addr2:
Addr3:
Addr4:
>>>


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



hi evereyone i have a django+fastcgi 's issue

2007-05-01 Thread Kula
my server is fastcgi. and i depoy my django project on it.
when i start the django simple server . the result is true
and when i start the fastcgi  the result is

   Request URL:
 http://
 Exception Type:
 TypeError
 Exception Value:
 unpack non-sequence
 Exception Location:
 
/usr/local/lib/python2.5/site-packages/Django-0.95.1-py2.5.egg/django/core/handlers/base.py
in get_response, line 65
my django.fcgi ( i write it to start my fastcgi application) is:
#!/usr/bin/env python
import sys,os
sys.path += ['','/var/www/virtual/kula.51boo.com/htdocs/']
os.environ['DJANGO_SETTINGS_MODULE']='web.settings'
from flup.server.fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
server=WSGIServer(WSGIHandler(),maxThreads=50)
server.run()

my settings.py is:


DEBUG = TRUE
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', '[EMAIL PROTECTED]' ),
)

MANAGERS = ADMINS

DATABASE_ENGINE = 'mysql'   # 'postgresql', 'mysql', 'sqlite3' or
'ado_mssql'.
DATABASE_NAME = 'XXX' # Or path to database file if using
sqlite3.
DATABASE_USER = 'XXX' # Not used with sqlite3.
DATABASE_PASSWORD = 'XXX' # Not used with sqlite3.
DATABASE_HOST = 'XXX' # Set to empty string for localhost. Not
used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used
with sqlite3.

# Local time zone for this installation. All choices can be found here:
#
http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
TIME_ZONE = 'gmt-8'

# Language code for this installation. All choices can be found here:
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
# http://blogs.law.harvard.edu/tech/stories/storyReader$15
LANGUAGE_CODE = 'zh-cn'

SITE_ID = 1

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT.
# Example: " http://media.lawrence.com "
MEDIA_URL = ''

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use
a
# trailing slash.
# Examples: " http://foo.com/media/ ", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'b!z4+n^-lms$z^+(iqvm9wr49lnjk##r&98)ztwu^!v3-yl_fx'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source ',
# 'django.template.loaders.eggs.load_template_source',
)

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

ROOT_URLCONF = 'web.urls'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates".
# Always use forward slashes, even on Windows.
'/var/www/virtual/kula.51boo.com/htdocs/web/template/'
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
' web.forum'
)
css = './source/css'



hope for help

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



Re: connecting to multiple databases

2007-05-01 Thread [EMAIL PROTECTED]

I'm using the multi-db branch actively on a large project I have
found a few bugs, but am uncertain if they are specific to the branch
or if are also found in the trunk, as I haven't ever installed the
trunk.

I would like to try and take on maintenance of the branch...but am
unsure of how to get started with that ( if anyone can give me some
information on how to get a subversion account, and how to get started
etc. feel free to tell me. ).  There weren't any notes as to the
specific merging issues, and JP said it takes 4 hours to merge
conflicts each time the trunk is merged with the branch.

If a core developer would be willling to help me through the first
merge with the trunk... I'd like to get it back to being an active
branch.

On May 1, 8:21 pm, Brian Luft <[EMAIL PROTECTED]> wrote:
> Although I've successfully used the multi-db branch experimentally, it
> looks to be getting more and more out of date with the django trunk.
> I do completely understand the desire of the django devs to ensure a
> solid commitment to a branch and also that there have not been enough
> requests to drive inclusion by default into the main development
> line.  That said, let me throw my single vote for support of this
> feature.  I'm a little surprised that more people apparently aren't
> using Django against legacy databases which in my mind usually
> presents a strong case for the need to be able to split data across
> different databases or least schemas in cases such as Postgres.  Also,
> I've seen a number of other people mention in the archives that they
> employ separation strategies based on varying requirements for their
> applications.
>
> Just for the sake of lively discussion, I would go so far as to say
> that only being able to access a single database per project is an
> unfortunate limitation and could be a deal-breaker for those
> evaluating Django for their own use.  I'm sure there are many
> arguments for why the 'global' database settings reduce code
> complexity and provide optimizations.  Being mostly ignorant about the
> inner workings of Django, it seems like it would be possible to allow
> at least per app specification overrides by simply dropping another
> settings file into an app.
>
> Of course, as they say, the beauty of open source / open community is
> that you can just go build it yourself.  In a fantasy world I would be
> all about that but in reality I can't keep up with my own personal
> projects and I've "involved" myself in other projects when I really
> couldn't make the long term commitment.  So here's to hoping that my
> pitiful plea plants the tiniest of seeds in the brilliant django dev
> minds and here's to hoping that more in the community share my
> viewpoint and make themselves heard.
>
> Thanks for listening.
>
> Cheers
> -Brian


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



Re: Django for complex websites

2007-05-01 Thread Kenneth Gonsalves


On 02-May-07, at 4:17 AM, Eugene Morozov wrote:

> I don't want to start Zope vs Django flame. I just want to know what
> approaches people use for building large sites on Django.

if you want CMS with all types of thingies plugged in - zope/plone is  
for you. If you want flexibility - especially an RDBMS backend that  
can be accessed by programs outside django - then django is for you.  
I came to django from zope/plone and this has been my experience.

-- 

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: Django for complex websites

2007-05-01 Thread Tim Chase

> they're different objects. Very simple. If you need to build a sitemap
> or menu or breadcrumbs, you can travel the objects tree and build it.
> You can attach a new page (section) with arbitrary functionality to
> any node of the site tree with no effort.
> 
> On the other hand, Django uses ORM and this means that each site
> section must be separate application with corresponding database and
> URL mappings. It seems to me that building large site with different
> kinds of sections would be harder in Django. There would be code
> duplication and too much manual work to maintain url mappings and
> hardcoded hierarchy.

I'm not sure these suppositions hold.  Django has a nice
two-tiered model where you can have a single project with
multiple apps within it.  A project has one DB, one URL mapping
file (or more, as it can actually de-complexify matters to
relegate subsections of your site to a separate file, but you
don't have to).  The decoupling of URLs from Models allows a lot
*more* flexibility in site-redesign compared to a "hard-coded"
(by object-tree) URL layout.  Yes, there are some easy/lazy ways
to do this sort of thing where you have a little ugliness exposed
via the object ID in the url (e.g. http://example.com/blog/42/)
but it's not that much harder to tweak a URL file to make that
example into "http://example.com/blog/i-love-django/;.

One can also walk the ORM object tree in Django...fairly
similarly to how the admin interface or the databrowse extension
sniffs your metadata and builds up a default interface for your
models.

I find that Django strikes a good balance between offering
sufficient functionality/abstraction/etc to yield to my will when
I need it to do something, but not have the baggage of complexity
that Zope brings to the table.  Just my $0.02 "it works for me".

-tim




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



Re: Problem running unit tests

2007-05-01 Thread Russell Keith-Magee

On 5/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Problem installing fixture '/home/vfoley/django/copieplus/../copieplus/
> gallery/fixtures/test_data.json': Gallery matching query does not
> exist.
>
> Does anyone know what that means?  I have other applications using
> fixtures/test_data.json and there's no problem.

This suggests that test_data.json contains a foreign key reference to
a Gallery object that isn't defined in the fixture. Beyond that, I
can't provide any advice.

Some questions to help diagnose this:
- What version of Django are you running?
- Under what conditions does the fixture work? What is in the
database? Are there any other fixtures that have been loaded? Any
manually created data?
- Under what conditions does the fixture fail?
- Can you provide the fixture and model file? It would help if you can
trim down your fixture file to a bare minimum - i.e., remove entries
one at a time until the problem goes away, and send us the maximum
working and minimum non-working version.

Yours,
Russ Magee %-)

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



Re: Weird get_or_create error

2007-05-01 Thread Brandon Low

Ugh, why would autocommit be set to 1 in the site but 0 in the shell???

--Brandon

On 2007-05-01 (Tue) at 18:13:55 -0500, Brandon Low wrote:
> 
> So initially, when you said that, I thought to myself, "Of course, how
> could I be so dumb" but then I did:
> 
> >>> from django.db import connection;
> >>> cursor = connection.cursor()
> >>> cursor.execute("select @@autocommit;")
> 1L
> >>> row=cursor.fetchone()
> >>> row
> (0L,)
> 
> at the shell and it looks like autocommit is set to 0.  There isn't some
> kind of per-table autocommit setting that I could still be missing, is
> there?
> 
> Thanks again,
> 
> Brandon
> 
> On 2007-05-01 (Tue) at 17:32:29 -0400, Andy Dustman wrote:
> > 
> > On 5/1/07, Brandon Low <[EMAIL PROTECTED]> wrote:
> > >
> > > my model is very simple:
> > >
> > > class Referrer(models.Model):
> > > url = models.CharField(maxlength=255, unique=True)
> > >
> > > here is the relevent view code:
> > >
> > > referrer = request.META.get('HTTP_REFERER','-')
> > > r, r_new = Referrer.objects.get_or_create(url=referrer)
> > 
> > The only other option I can think of is that you are using a MySQL
> > storage engine that doesn't support transactions (or running in
> > autocommit mode)  and so you are getting a sort of race condition
> > where two requests come in about the same time, both do a SELECT and
> > see there is no matching row, and one gets it INSERTed first. Normally
> > I would expect to see the IntegrityError at the commit phase.
> > -- 
> > Patriotism means to stand by the country. It does
> > not mean to stand by the president. -- T. Roosevelt
> > 
> > This message has been scanned for memes and
> > dangerous content by MindScanner, and is
> > believed to be unclean.
> > 
> > > 
> 
> > 

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

2007-05-01 Thread Brandon Low

So initially, when you said that, I thought to myself, "Of course, how
could I be so dumb" but then I did:

>>> from django.db import connection;
>>> cursor = connection.cursor()
>>> cursor.execute("select @@autocommit;")
1L
>>> row=cursor.fetchone()
>>> row
(0L,)

at the shell and it looks like autocommit is set to 0.  There isn't some
kind of per-table autocommit setting that I could still be missing, is
there?

Thanks again,

Brandon

On 2007-05-01 (Tue) at 17:32:29 -0400, Andy Dustman wrote:
> 
> On 5/1/07, Brandon Low <[EMAIL PROTECTED]> wrote:
> >
> > my model is very simple:
> >
> > class Referrer(models.Model):
> > url = models.CharField(maxlength=255, unique=True)
> >
> > here is the relevent view code:
> >
> > referrer = request.META.get('HTTP_REFERER','-')
> > r, r_new = Referrer.objects.get_or_create(url=referrer)
> 
> The only other option I can think of is that you are using a MySQL
> storage engine that doesn't support transactions (or running in
> autocommit mode)  and so you are getting a sort of race condition
> where two requests come in about the same time, both do a SELECT and
> see there is no matching row, and one gets it INSERTed first. Normally
> I would expect to see the IntegrityError at the commit phase.
> -- 
> Patriotism means to stand by the country. It does
> not mean to stand by the president. -- T. Roosevelt
> 
> This message has been scanned for memes and
> dangerous content by MindScanner, and is
> believed to be unclean.
> 
> > 

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



Django for complex websites

2007-05-01 Thread Eugene Morozov

Hello,
I have a Zope background and new to Django and mainly interested how
people build large websites with it. Imagine a portal with many kinds
of sections: blogs, forums, articles, faqs, etc.

Building such site on Zope platform is more or less straightforward.
As underlying storage is an object oriented database, every page is an
object. Different sections can exhibit different behavior because
they're different objects. Very simple. If you need to build a sitemap
or menu or breadcrumbs, you can travel the objects tree and build it.
You can attach a new page (section) with arbitrary functionality to
any node of the site tree with no effort.

On the other hand, Django uses ORM and this means that each site
section must be separate application with corresponding database and
URL mappings. It seems to me that building large site with different
kinds of sections would be harder in Django. There would be code
duplication and too much manual work to maintain url mappings and
hardcoded hierarchy.

I don't want to start Zope vs Django flame. I just want to know what
approaches people use for building large sites on Django.

Thanks in advance,
Eugene


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



newbie -- trouble using Postgres

2007-05-01 Thread BasicSci007

Can't seem to get django and postgres to hook up.  MySQL or sqlite3
work fine.  postgres seems to work fine with SQLAlchemy, so I'm
thinking psycopg2-2.0.6b1.win32-py2.4-pg8.2.1 installation is OK.  Is
the problem obvious from the following:

C:\django\testproject>manage.py syncdb
Traceback (most recent call last):
  File "C:\django\testproject\manage.py", line 11, in ?
execute_manager(settings)
  File "c:\django_src\django\core\management.py", line 1673, in
execute_manager
execute_from_command_line(action_mapping, argv)
  File "c:\django_src\django\core\management.py", line 1572, in
execute_from_com
mand_line
action_mapping[action](int(options.verbosity),
options.interactive)
  File "c:\django_src\django\core\management.py", line 484, in syncdb
data_types = get_creation_module().DATA_TYPES
AttributeError: 'module' object has no attribute 'DATA_TYPES'


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

2007-05-01 Thread Baurzhan Ismagulov

On Tue, May 01, 2007 at 11:58:44PM +0200, Honza Král wrote:
> >Boolean fields have the value ''. Should I initialize all the fields to
> >false either in code, or in the constructor? I would expect that Django
> >does this for me.
> 
> if you want that you have to supply default value via default kwarg to the 
> field

This worked, thanks much!

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

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

2007-05-01 Thread Honza Král
On 5/1/07, Baurzhan Ismagulov <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I have a class Object(models.Model) which contains model.BooleanFields.
> I'm trying to add rows to it, like this:
>
> o = Object()
> o.a1 = 'a1'
> o.a2 = 'a2'
> o.save()
>
> I don't set boolean values here. save() results in the following
> ProgrammingError:
>
> ERROR: invalid input syntax for type boolean: "" INSERT INTO "info_object" 
> (...) VALUES (..., '', '', ''...)
>
> Boolean fields have the value ''. Should I initialize all the fields to
> false either in code, or in the constructor? I would expect that Django
> does this for me.

if you want that you have to supply default value via default kwarg to the field

>
> How should I fix the problem?

be sure to initialize your fields, either with default, in save() or manually

I'm using Django r4431. Please CC to me,
> I'm temporarily not receiving mail from the list.
>
> Thanks in advance,
> --
> Baurzhan Ismagulov
> http://www.kz-easy.com/
>
> >
>


-- 
Honza Kr�l
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

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



ERROR: invalid input syntax for type boolean: ""

2007-05-01 Thread Baurzhan Ismagulov

Hello,

I have a class Object(models.Model) which contains model.BooleanFields.
I'm trying to add rows to it, like this:

o = Object()
o.a1 = 'a1'
o.a2 = 'a2'
o.save()

I don't set boolean values here. save() results in the following
ProgrammingError:

ERROR: invalid input syntax for type boolean: "" INSERT INTO "info_object" 
(...) VALUES (..., '', '', ''...)

Boolean fields have the value ''. Should I initialize all the fields to
false either in code, or in the constructor? I would expect that Django
does this for me.

How should I fix the problem? I'm using Django r4431. Please CC to me,
I'm temporarily not receiving mail from the list.

Thanks in advance,
-- 
Baurzhan Ismagulov
http://www.kz-easy.com/

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

2007-05-01 Thread [EMAIL PROTECTED]

If it's an existing table, the easiest thing is to go directly to the
db and create the column manually.

On May 1, 4:09 pm, gsmith <[EMAIL PROTECTED]> wrote:
> I'm using sqllite as my database.  I've added a Image Field to one of
> my tables.  I am wondering how i get my database to register this new
> column.  I thought running the command 'python manage.py syncdb' would
> update my database.  However, after I do that my admin errors out
> saying ' no such column rso_members.image.
>
> Does anybody know what i need to do to have the admin register this
> new column without having to delete and recreate my table?


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

2007-05-01 Thread Honza Král
On 5/1/07, gsmith <[EMAIL PROTECTED]> wrote:
>
> I'm using sqllite as my database.  I've added a Image Field to one of
> my tables.  I am wondering how i get my database to register this new
> column.  I thought running the command 'python manage.py syncdb' would
> update my database.  However, after I do that my admin errors out
> saying ' no such column rso_members.image.
>
> Does anybody know what i need to do to have the admin register this
> new column without having to delete and recreate my table?

you have to add your column manually

I don't know much about SQLite, see http://www.sqlite.org/faq.html#q13
for some specific info

with postgresql the syntax would be:
ALTER TABLE your_table ADD COLUMN XXX;
where XXX is the line containing the column you get when running

./manage.py sql your_app_name

like:
ALTER TABLE your_table ADD COLUMN some_text VARCHAR(200);

>
>
> >
>


-- 
Honza Kr�l
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

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

2007-05-01 Thread Andy Dustman

On 5/1/07, Brandon Low <[EMAIL PROTECTED]> wrote:
>
> my model is very simple:
>
> class Referrer(models.Model):
> url = models.CharField(maxlength=255, unique=True)
>
> here is the relevent view code:
>
> referrer = request.META.get('HTTP_REFERER','-')
> r, r_new = Referrer.objects.get_or_create(url=referrer)

The only other option I can think of is that you are using a MySQL
storage engine that doesn't support transactions (or running in
autocommit mode)  and so you are getting a sort of race condition
where two requests come in about the same time, both do a SELECT and
see there is no matching row, and one gets it INSERTed first. Normally
I would expect to see the IntegrityError at the commit phase.
-- 
Patriotism means to stand by the country. It does
not mean to stand by the president. -- T. Roosevelt

This message has been scanned for memes and
dangerous content by MindScanner, and is
believed to be unclean.

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



Added a column

2007-05-01 Thread gsmith

I'm using sqllite as my database.  I've added a Image Field to one of
my tables.  I am wondering how i get my database to register this new
column.  I thought running the command 'python manage.py syncdb' would
update my database.  However, after I do that my admin errors out
saying ' no such column rso_members.image.

Does anybody know what i need to do to have the admin register this
new column without having to delete and recreate my table?


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



RE: Why are my FloatFields strings ?

2007-05-01 Thread Chris Brand

> What version of Python are you using? I *think* FloatFields are
> returned as Python Decimal objects, which don't exist before
> Python-2.4, which means you would then get a string from MySQLdb. We
> might need a fix for Django on Python-2.3 to work around this.

"python -V" reports "Python 2.4.3".

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



Re: Weird get_or_create error

2007-05-01 Thread Brandon Low

my model is very simple:

class Referrer(models.Model):
url = models.CharField(maxlength=255, unique=True)

here is the relevent view code:

referrer = request.META.get('HTTP_REFERER','-')
r, r_new = Referrer.objects.get_or_create(url=referrer)

thanks for your replies!

--Brandon

On 2007-05-01 (Tue) at 16:15:43 -0400, Andy Dustman wrote:
> 
> On 5/1/07, Brandon Low <[EMAIL PROTECTED]> wrote:
> >
> > How can a get_or_create cause an integrity constraint error?
> 
> Also... It's hard to see exactly what's going on because the code in
> the traceback is using **kwargs. If you use get() or get_or_create(),
> it's looking for a match on all the parameters. My guess is that there
> is an additional parameter (other than that URL) which is not matched,
> so it tries to create a new object, but then this violates the unique
> index. The value of kwargs would go a long way towards figuring it
> out.
> -- 
> Patriotism means to stand by the country. It does
> not mean to stand by the president. -- T. Roosevelt
> 
> This message has been scanned for memes and
> dangerous content by MindScanner, and is
> believed to be unclean.
> 
> > 

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

2007-05-01 Thread [EMAIL PROTECTED]

Except I wouldn't use "name", just use an ID... instead of Foo or whatever, just say Foo.
Same thing, just cleaner.

On May 1, 11:08 am, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
> Maybe I'm missing something, but there's nothing specific in this example to
> Django - you would reference a link from within any page the same way as
> plain ole HTML.
>
> 
>
> and then link to it with an Jump to foo.
>
> -joe
>
> On 5/1/07, Pythoni <[EMAIL PROTECTED]> wrote:
>
>
>
> > Let's suppose I have, in one of my HTML pages , this link
>
> > 
>
> > This link should open MyPage.html  in  location set by the Mybookmark.
> > That bookmark is defined  in MyPage.html
> > like  this 
>
> > How can I open a link , by using Django, in a certain location,in
> > other words, how can I use bookmarks with Django?
>
> > Thank you for help
> > 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: How do I Sort Years in Template

2007-05-01 Thread [EMAIL PROTECTED]

I think you want something like
{% for date in date_list|dictsort:"year" %}

On May 1, 11:28 am, Frank Peterson <[EMAIL PROTECTED]> wrote:
> Story archive
> 
> {% for date in date_list %}
> {{ date.year }}
> {% endfor %}
> 
>
> Not sure how to do this


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



Re: Ordered list of objects?

2007-05-01 Thread [EMAIL PROTECTED]

I've got the solution, you can download it here:
http://purplesquirrelgroup.com/order_list.tar.gz

Here's the readme:

To use these models you will want to do the following:

For your Collection class:

from order_list.models import Order_List
from django.db import models

class Collection( Order_List, models.Model):
name = models.CharField('name', maxlength=80)  #Feel free to
customize Maxlength

# I think there should be a better way to do this, but if you want to
use the
# can_reorder permision from the base class you'll need to do this:

class Meta:
permissions = Order_List.Meta.permissions


And for your Item class:

from order_list.models import Order_List_Item
from django.db import models

class Item(Order_List_Item, models.Model):
# This /must/ be called list, and relate_name /must/ be
'_items'
list = models.ForeignKey(Collection, verbose_name='collection
item', related_name='_items')
_next = models.ForeignKey('self', verbose_name=_("next"),
null=True, blank=True, related_name='_prev')

# I like to do this:
def _get_collection(self):
return self.list
collection = property(_get_collection)


By applying this skelleton to any model you can make it arbitrarily
ordered. When you create new objects other then the first in
Collection be sure you use insert_before or insert_after with an
existing item rather then just save to preserve list sanity.


On Apr 20, 3:59 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I don't know if this is the "right" solution or not. In my home grown
> framework I've got a doubly linked list implementation.
>
> My intention in Django is to write an application Ordered_List that
> would be a functioning doubly linked list with minimal data fields
> (currently just a name for each list to keep me sane during testing).
> I'm thinking that I could import from this app and sub class from it
> without having it in INSTALLED_APPS. To be able to mix-in arbitrary
> ordering with any other model.
>
> Brand new to Django, but if it goes well I'll post the code.
>
> If someone has a better/easier solution feel free to share it.
>
> --Lucki
>
> On Apr 4, 9:57 am, "Nathan R. Yergler" <[EMAIL PROTECTED]> wrote:
>
> > On 4/4/07, Atilla <[EMAIL PROTECTED]> wrote:
>
> > > On 04/04/07, Nathan R. Yergler <[EMAIL PROTECTED]> wrote:
>
> > > > I'm working on an app for a client, and one of the requirements is
> > > > that they be able to re-order objects in the admin interface.  I know
> > > > exactly how I'd do with with an object database, but the ideas I've
> > > > come up with for doing it with Django all involve using some tracking
> > > > field, and then updating that to contain the relative order of
> > > > objects.
>
> > > > So... am I missing something obvious here that will let me do with
> > > > with a minimal amount of pain?
>
> > > > Thanks,
>
> > > > Nathan
>
> > > What kind of ordering does it have to be and on what amount of items?
> > > Perhaps it could be useful to create a separate Model that defines the
> > > order of items, with a relation to the actual model that defines the
> > > objects themselves. The biggest issue is how to create usable controls
> > > that define the ordering, which is not always a simple thing to
> > > implement.
>
> > Arbitrary ordering of dozensis it  of items, so I'm not sure an
> > external model would 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: Compound newforms

2007-05-01 Thread Honza Král
Hi,
I use something similar to this. What I did was override the __init__
to take extra arguments with the instances it's editing and store them
for future use.
so it would look something like this:

class MyForm(forms.Form):
  def __init__(self, objects=[], *args, **kwargs):
super(Form, self).__init__( *args, **kwargs )
self.objects = objects
for o in self.objects:
add some fields

  def save( self ):
for o in self.objects:
get data from fields and call save()

in some cases I also add some empty "lines" for new objects:

class MyBetterForm(forms.Form):
  def __init__(self, objects=[], *args, **kwargs):
super(Form, self).__init__( *args, **kwargs )
self.objects = objects
for o in self.objects:
add some fields
for i in range(4):
add some more fields

  def save( self ):
for o in self.objects:
get data from fields and call save()
for i in range(4):
create some new objects

On 5/1/07, vega <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
>   I'd like to understand how to manage newforms save when coping with
> a form
>   that should edit both heading info and details. As an example let's
> think
>   at an invoice splitted between invoice_headings/invoice_detail in a
>   way similar to the following:
>
>   class InvoiceHeading(Model):
>  company = CharField(max_length=10)
>  date= DateField()
>  ...
>
>   class InvoiceDetail(Model):
>  invoice = ForeignKey(InvoiceHeading)
>  qty = integerField()
>  description = CharField(max_length=50)
>
>   Let suppouse that we are only interested in a form that allows us to
> edit 3
>   invoice rows. A form could resamble this one:
>
>   class InvoiceForm(form_for_model()):
> def __init__(self):
>   opts = {'required' : False}
> for row in range(3):
>   self.fields['row_%s_qty' % (row)] = IntegerField(**opts)
>   self.fields['row_%s_descr' % (row)] = CharField(maxlength=50,
> **opts)
>
>
>   Now how should I define save()? I tried something similar:
>
>   def save(self):
> self.invoice = super(InvoiceForm, self).save()
> for row in range(3):
>InvoiceDetail(qty=self.clean_data['row_%s_qty' % row],
>  description=self.clean_data['row_%s_descr'
> %row],).save()
>
>
>   This works when I create an object but how should I define it to
> make it
>   able to update the object. This would just insert new rows each
> time.
>
>   Should I use get_or_create? Is there a sample code for this kind of
>   compound form?
>
>   Thanks in advance
>   *:-)
>
>
> >
>


-- 
Honza Kr�l
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

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



Re: Why are my FloatFields strings ?

2007-05-01 Thread Andy Dustman

On 5/1/07, Chris Brand <[EMAIL PROTECTED]> wrote:
>
> I've got a model that includes FloatFields as well as IntegerFields and
> CharFields.
> When I access the CharFields, I get strings. When I access the
> IntegerFields, I get integers, but when I want to use the Floatfields, I
> always have to add float() to convert the string to an actual float. Not
> that big a deal, but I always forget it first time around, and it just
> doesn't feel right.
>
> Here's a brief test :
> >>> c = Camp.objects.get(pk=1)
> >>> c.min_age
> '17.0'
> >>> a = c.min_age
> >>> type(a)
> 
>
> And here's the corresponding field definition :
> min_age = models.FloatField("Minimum age", max_digits=3,
> decimal_places=1, default=0, validator_list=[age_validator])
>
> Why is this ?
>
> I'm using 0.96 with a MySQL backend.

What version of Python are you using? I *think* FloatFields are
returned as Python Decimal objects, which don't exist before
Python-2.4, which means you would then get a string from MySQLdb. We
might need a fix for Django on Python-2.3 to work around this.

-- 
Patriotism means to stand by the country. It does
not mean to stand by the president. -- T. Roosevelt

This message has been scanned for memes and
dangerous content by MindScanner, and is
believed to be unclean.

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

2007-05-01 Thread Andy Dustman

On 5/1/07, Brandon Low <[EMAIL PROTECTED]> wrote:
>
> How can a get_or_create cause an integrity constraint error?

Also... It's hard to see exactly what's going on because the code in
the traceback is using **kwargs. If you use get() or get_or_create(),
it's looking for a match on all the parameters. My guess is that there
is an additional parameter (other than that URL) which is not matched,
so it tries to create a new object, but then this violates the unique
index. The value of kwargs would go a long way towards figuring it
out.
-- 
Patriotism means to stand by the country. It does
not mean to stand by the president. -- T. Roosevelt

This message has been scanned for memes and
dangerous content by MindScanner, and is
believed to be unclean.

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

2007-05-01 Thread Andy Dustman

On 5/1/07, Brandon Low <[EMAIL PROTECTED]> wrote:
>
> How can a get_or_create cause an integrity constraint error?

The error is on key 2, which is an additional unique index you
presumably have in your model. get_or_create should not cause
integrity errors on the primary key, but that's not what's happening
here.

>   File "/usr/lib/python2.4/site-packages/django/db/models/manager.py", line 
> 76, in get_or_create
> return self.get_query_set().get_or_create(**kwargs)
>
>   File "/usr/lib/python2.4/site-packages/django/db/models/query.py", line 
> 279, in get_or_create
> obj.save()
>
>   File "/usr/lib/python2.4/site-packages/django/db/models/base.py", line 238, 
> in save
> ','.join(placeholders)), db_values)
>
>   File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 163, in 
> execute
> self.errorhandler(self, exc, value)
>
>   File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 35, in 
> defaulterrorhandler
> raise errorclass, errorvalue
>
> IntegrityError: (1062, "Duplicate entry 
> 'http://images.google.de/imgres?imgurl=http://www.lostlogicx.com/' for key 2")

-- 
Patriotism means to stand by the country. It does
not mean to stand by the president. -- T. Roosevelt

This message has been scanned for memes and
dangerous content by MindScanner, and is
believed to be unclean.

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



Compound newforms

2007-05-01 Thread vega

Hi,

  I'd like to understand how to manage newforms save when coping with
a form
  that should edit both heading info and details. As an example let's
think
  at an invoice splitted between invoice_headings/invoice_detail in a
  way similar to the following:

  class InvoiceHeading(Model):
 company = CharField(max_length=10)
 date= DateField()
 ...

  class InvoiceDetail(Model):
 invoice = ForeignKey(InvoiceHeading)
 qty = integerField()
 description = CharField(max_length=50)

  Let suppouse that we are only interested in a form that allows us to
edit 3
  invoice rows. A form could resamble this one:

  class InvoiceForm(form_for_model()):
def __init__(self):
  opts = {'required' : False}
for row in range(3):
  self.fields['row_%s_qty' % (row)] = IntegerField(**opts)
  self.fields['row_%s_descr' % (row)] = CharField(maxlength=50,
**opts)


  Now how should I define save()? I tried something similar:

  def save(self):
self.invoice = super(InvoiceForm, self).save()
for row in range(3):
   InvoiceDetail(qty=self.clean_data['row_%s_qty' % row],
 description=self.clean_data['row_%s_descr'
%row],).save()


  This works when I create an object but how should I define it to
make it
  able to update the object. This would just insert new rows each
time.

  Should I use get_or_create? Is there a sample code for this kind of
  compound form?

  Thanks in advance
  *:-)


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



Weird get_or_create error

2007-05-01 Thread Brandon Low

How can a get_or_create cause an integrity constraint error?

--Brandon

  File "/usr/lib/python2.4/site-packages/django/db/models/manager.py", line 76, 
in get_or_create
return self.get_query_set().get_or_create(**kwargs)

  File "/usr/lib/python2.4/site-packages/django/db/models/query.py", line 279, 
in get_or_create
obj.save()

  File "/usr/lib/python2.4/site-packages/django/db/models/base.py", line 238, 
in save
','.join(placeholders)), db_values)

  File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 163, in 
execute
self.errorhandler(self, exc, value)

  File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 35, in 
defaulterrorhandler
raise errorclass, errorvalue

IntegrityError: (1062, "Duplicate entry 
'http://images.google.de/imgres?imgurl=http://www.lostlogicx.com/' for key 2")


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



Why are my FloatFields strings ?

2007-05-01 Thread Chris Brand

I've got a model that includes FloatFields as well as IntegerFields and
CharFields.
When I access the CharFields, I get strings. When I access the
IntegerFields, I get integers, but when I want to use the Floatfields, I
always have to add float() to convert the string to an actual float. Not
that big a deal, but I always forget it first time around, and it just
doesn't feel right.

Here's a brief test :
>>> c = Camp.objects.get(pk=1)
>>> c.min_age
'17.0'
>>> a = c.min_age
>>> type(a)


And here's the corresponding field definition :
min_age = models.FloatField("Minimum age", max_digits=3,
decimal_places=1, default=0, validator_list=[age_validator])

Why is this ?

I'm using 0.96 with a MySQL backend.

Chris Brand



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

2007-05-01 Thread Michael K

On May 1, 12:38 pm, Pythoni <[EMAIL PROTECTED]> wrote:
> Michael,
> Thank you for your reply.
> I agree the solution with DIVs instead of IFRAMEs would be nice.
> But it needs AJAX. and you say a little AJAX.
> Can you give me an idea how to use that little AJAX together with my
> described problem?
> Thank you
> L.

I'll give it a good stab.  I'm not much of a JavaScript programmer,
but I understand the concepts surrounding AJAX.

Basically, your author links would call a javascript function that
uses XMLHttpRequest to retrieve the data for the descriptions.  It can
either return XML for your javascript to parse, or it can just return
the exact HTML you need for filling in the DIV.  An example for this
might be a simplified view template that just has the loop through the
data to display the markup and actual data, then replace the innerHTML
of the descriptions DIV with the data that's returned.  Instant re-
population.

I believe Django has most of what you need to simplify the generation
of the data already built-in.  It's just a matter of figuring out how
to glue the pieces together.

I'd suggest looking at James' example (http://www.b-list.org/weblog/
2006/07/31/django-tips-simple-ajax-example-part-1) for a start, and
just keep in mind the concepts.  The code part almost come naturally
if you know anything about JavaScript.

Hopefully, someone will read this and will be able to give you a
better, with code, example than I have. :)

HTH,

Michael


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

2007-05-01 Thread Pythoni

Michael,
Thank you for your reply.
I agree the solution with DIVs instead of IFRAMEs would be nice.
But it needs AJAX. and you say a little AJAX.
Can you give me an idea how to use that little AJAX together with my
described problem?
Thank you
L.


You say
> The best way (in my opinion) to do this, is use a little AJAX and use
> DIVs instead of IFRAMEs.  Something like...
>
> 
> {{ code to loop through authors }}
> 
>  the databrowse feature in some way to make this easier.


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



How do I Sort Years in Template

2007-05-01 Thread Frank Peterson

Story archive

{% for date in date_list %}
{{ date.year }}
{% endfor %}


Not sure how to do this


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



Re: How to open a new page with a bookmark

2007-05-01 Thread Joseph Heck
Maybe I'm missing something, but there's nothing specific in this example to
Django - you would reference a link from within any page the same way as
plain ole HTML.



and then link to it with an Jump to foo.

-joe

On 5/1/07, Pythoni <[EMAIL PROTECTED]> wrote:
>
>
> Let's suppose I have, in one of my HTML pages , this link
>
> 
>
> This link should open MyPage.html  in  location set by the Mybookmark.
> That bookmark is defined  in MyPage.html
> like  this 
>
> How can I open a link , by using Django, in a certain location,in
> other words, how can I use bookmarks with Django?
>
> Thank you for help
> 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: Using Django outside of Django

2007-05-01 Thread Jason McVetta
On 5/1/07, Michael K <[EMAIL PROTECTED]> wrote:
>
> Joe's post is on the money.  You shouldn't need to use the shell at
> all, but can directly import django's pieces directly in another
> script (such as your streamer.py).


While it is entirely possible to use Django modules in scripts, you may
encounter some strange errors with ManyToMany relations.  These errors are
caused by a known, but very difficult, bug.  If you see "cannot resolve
keyword" exceptions when running stand-alone scripts, check out the "
django-m2m-kludge.py"
work-around attached to bug 1796 
.

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



Re: Using Django outside of Django

2007-05-01 Thread Michael K


On Apr 30, 7:21 pm, Mike H <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm sure this has been discussed elsewhere, but common terms like
> "using" "django" "models" and "scripts" make it hard to find! ;)
>
> I've written a nice multi-user mp3 jukebox for our office, it lets users
> add tracks to their playlist and then interleaves the playlists so that
> everyone gets a fair turn at getting their tracks played. It also
> streams the mp3s to the machine in the office with the nice speakers
> attached :)
>
> I'm currently running the streamer and playlist rotator by doing similar
> to this :
>
> [EMAIL PROTECTED]:~/dukebox$ python manage.py shell < streamer.py
>
> I'm wondering if there is a less hackish way of interfacing with Django
> outside of the context of a web request?
>

Mike,

Joe's post is on the money.  You shouldn't need to use the shell at
all, but can directly import django's pieces directly in another
script (such as your streamer.py).

Check out http://code.evennia.com for some examples in that regard.
It's a mud codebase that uses Django for its database backend and
authentication.

HTH,

Michael


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

2007-05-01 Thread Michael K



On Apr 29, 6:37 pm, kamil <[EMAIL PROTECTED]> wrote:
> Hi Michael. You are right there was module named utils (coincidentally
> same name as django module) in the nesh thumbnail app.
> Problem resolved :)
> Thank You Very Much for the time You dedicate me.
> I feel in debt with U and I feel really happy to feel such a feedback
> in django community.
>

Kamil,

Glad I could help.  The community's helped me quite a bit, I figured I
should help were I could.  Maybe someday, someone will have a question
you can help with, eh?

Thanks,

Michael


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

2007-05-01 Thread Michael Newman

Try using the related_name option in you manytomany feilds as it might
clear up some of your tables. I agree however posting your models.py
will quickly clear this problem up.

On May 1, 9:46 am, MattW <[EMAIL PROTECTED]> wrote:
> Dear All,
>
> I'm having problems with the Many-to-Many relations in my model.
>
> I've got a list of questions, each of which has a number of marks
> associated with it. The marks are in another table in the DB. I've
> modelled it as Many-to-Many because it seems that each question can
> have many marks, and each mark (only 1-5) could be associated with
> many questions.
>
> I've tried using both sqlite and mysql (although through mysql_old, as
> I don't have the new Python MySQL interface). Under sqlite I get:
> OperationalError columns X and Y are not unique. Under MySQL, I get
> IntegrityError at xxx, (1062, "Duplicate entry '1-1' for key 2").
> Looking at the DB in PhPMySQL, there's a primary key for the Mark
> table (which has three fields, id, question_id and mark_id), composed
> of the question_id and mark_id fields. I suspect that this is the
> problem, as the mark can change...
>
> Any help in rectify the model.py file would be welcome.
>
> Thanks,
>
> Matt


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

2007-05-01 Thread Michael K

On May 1, 5:47 am, Pythoni <[EMAIL PROTECTED]> wrote:
> Julio and James,
> Thank you both for your help.
> I know that frames could be useful to help solve my problem but...
>
> Let's suppose this:
>
>  height="30"style="height:10.8em" marginwidth="0" marginheight="0">
> 
>
>  height="60"style="height:4em"marginwidth="0" marginheight="0">
> 
>
> where you can see two frames( iframes).One Authors ( list of
> authors)and the other Descriptions( their replies).
> As you can see  each frame must consists source page DAuthors.html and
> DDescriptions.html, that should be generated on fly( dynamically)
> according to user's demand( depending on what he will want to see).

What I would suggest, if you're using IFrames, is that you use
different views for those "pages", and never call them from the site
directly, except as iframes in another template.

For example, you might have the following template files:

DAuthors.html
DDescriptions.html
Display.html

Display.html would have the template code needed for the view to work,
including the iframe tags, which would look something like:


along with any attribute tags.  The "context" would be something like
a record ID for the forum or whatever you're using this for.

My only concern is that you seem to be wanting to have it change the
Descriptions when you select an author?

The best way (in my opinion) to do this, is use a little AJAX and use
DIVs instead of IFRAMEs.  Something like...


{{ code to loop through authors }}

http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django and file uploads question

2007-05-01 Thread Craig Kuhns

I am on a mac using the svn version, not sure which one though,  I
tracked it down to that same portion of the code, but did not have a
chance to write a patch for it.  I let it sit for a couple of days,
came back and refactored the whole application, and it ended up
working.  I am not sure what changed to make it work.  But it is
working now

Thanks for the help

Craig

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



Britney Spears Sex VID!!!!!!

2007-05-01 Thread naughtytime


Just found it, it probably won't work long...

http://tinyurl.com/2en7ge

it looks like the vid is from before her pregnancy, from what i can
tell her body is definitely in shape.


__
and some pictures


http://data.blogg.de/18079/images/britney.jpg

http://www.the-planets.com/britney_spears/britney_spears_5_biography.jpg

http://www.poster.net/spears-britney/spears-britney-photo-britney-spears-6233798.jpg

http://www.ringfahndung.de/archives/bsPrerogative.jpg


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

2007-05-01 Thread Jason McVetta
On 5/1/07, MattW <[EMAIL PROTECTED]> wrote:
>
> I'm having problems with the Many-to-Many relations in my model.


You'll need to include the model.py code, so people can see what is going
on.

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



Problem running unit tests

2007-05-01 Thread [EMAIL PROTECTED]

I have a small gallery application with unit tests.  I have my
fixtures in gallery/fixtures/test_data.json.  When I try to run the
tests, I get the following error:

Problem installing fixture '/home/vfoley/django/copieplus/../copieplus/
gallery/fixtures/test_data.json': Gallery matching query does not
exist.

Does anyone know what that means?  I have other applications using
fixtures/test_data.json and there's no problem.

-Vincent


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



Re: Case Sensitivity on MySQL searches

2007-05-01 Thread Tim Chase

> Having read in other posts about MySQL being case insensitive by
> default, I have tried using the __exact method to force exact
> matching, however, this still finds the alternative case version in
> the table. Note there are no duplicates in  the table on this field.
> 
> Example:
> x=Datatable.objects.get(code__exact='AbCd')
> y=x.code
> print y
> 'AbcD'
> 
> Can anyone advise on how I might overcome this issue. For our model,
> it is vital that we can identify distinct case sensitive entries.

Well, GIYF:

mysql case-sensitive

returns the top hit where it's advised that if this matters, you 
can alter your column definition to include "COLLATE latin1_bin"

   create table case_bin_test (
 word VARCHAR(10))
 CHARACTER SET latin1
 COLLATE latin1_bin;

You should be able to do this after you create your DB.  I don't 
know off the top of my head if that is only available table-wide, 
or if you can limit it to a given field like

   create table case_bin_test (
 word VARCHAR(10)
 CHARACTER SET latin1
 COLLATE latin1_bin,
 non_binary_field VARCHAR(10)
 );



If you roll your own SQL, MySQL also supports using

SELECT * FROM tblFoo WHERE fieldname LIKE BINARY 'AbCd'

using "LIKE BINARY" rather than '='

Another option would be to do a CAST(fieldname AS BINARY) to 
force your field to be compared as a binary rather than as strings.

http://mysqldatabaseadministration.blogspot.com/2006/09/case-sensitive-mysql.html

http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html

http://www.delphifaq.com/faq/databases/mysql/f801.shtml

Integrating this into the Django ORM would take a bit more work, 
though it should be possible to cram that into the MySQL code. 
Given the meaning of __exact and __iexact, it would make sense to 
force __exact to have the behavior you describe.  However, sloppy 
coding might break for some folks who unthinkingly used __exact 
when they really meant __iexact.

It might even be as simple as tweaking the 
db/backends/mysql/base.py and changing the entry in the 
OPERATOR_MAPPING value from

   'exact': '= %s',

to

   'exact': 'LIKE BINARY %s',

(though searches with metachars like "%" and "_" might need to be 
escaped somehow before doing this)

If you monkey with the ORM, you'd want to ensure that you run the 
test-suite to smoke out any peculiarities.

-tim







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



Re: Newforms and CSS classes

2007-05-01 Thread Christian Joergensen
Honza Král wrote:
>> Is it possible to have css classes attached to newforms widgets? I would
>> like to be able to distinguish between fx. checkboxes, radio buttons,
>> submit buttons, text fields (which are all 's).

> well, you can pass args={'class' : 'whatever'} to the widget's __init__()
> or you could subclass the widget and do that inside

This does (IMHO) not comply very much with the DRY philosophy of django.

> but there is currently no class set globally for all widgets
> 
>> In the oldforms module when having a required charfield, there would be
>> a class="vTextField required" to make CSS styling easier.
>>
>> Am I overlooking something, or is newforms missing this?

I was able to hack newforms by adding this in the __init__ of Field:

  # Attach field + widget type css classes
  self.css_class = type(self).__name__ + " " + type(widget).__name__

  # Add an extra class, Required, if applicable
  if self.required:
self.css_class += " Required"

Furthermore, to handle the output, I edited the _html_output of BaseForm
and added an extra item in the formatting dict: 'class': field.css_class

At last I updated the output functions (as_table, as_ul and as_p) to
have a 'class="%(class)s"'.

All this results in the following HTML structure for a required
CharField with a (default) TextInput widget:

  
   
CharField:
   
   
  

Just thought I would mention my solution if anyone else is interested ;)

Also, please let me know if anyone else have an easier solution to this.

-- 
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk  | Visit us at: http://www.gmta.info



signature.asc
Description: OpenPGP digital signature


Case Sensitivity on MySQL searches

2007-05-01 Thread Tipan

I've encountered a problem whereby my searches in the database are not
distinguishing between upper and lower case.

Having read in other posts about MySQL being case insensitive by
default, I have tried using the __exact method to force exact
matching, however, this still finds the alternative case version in
the table. Note there are no duplicates in  the table on this field.

Example:
x=Datatable.objects.get(code__exact='AbCd')
y=x.code
print y
'AbcD'

Can anyone advise on how I might overcome this issue. For our model,
it is vital that we can identify distinct case sensitive entries.

The field I'm looking up on is a varchar field in the table, in case
this is relevant. MySQL v5.


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



Many to Many relations - DB errors

2007-05-01 Thread MattW

Dear All,

I'm having problems with the Many-to-Many relations in my model.

I've got a list of questions, each of which has a number of marks
associated with it. The marks are in another table in the DB. I've
modelled it as Many-to-Many because it seems that each question can
have many marks, and each mark (only 1-5) could be associated with
many questions.

I've tried using both sqlite and mysql (although through mysql_old, as
I don't have the new Python MySQL interface). Under sqlite I get:
OperationalError columns X and Y are not unique. Under MySQL, I get
IntegrityError at xxx, (1062, "Duplicate entry '1-1' for key 2").
Looking at the DB in PhPMySQL, there's a primary key for the Mark
table (which has three fields, id, question_id and mark_id), composed
of the question_id and mark_id fields. I suspect that this is the
problem, as the mark can change...

Any help in rectify the model.py file would be welcome.

Thanks,

Matt


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

2007-05-01 Thread Jeff

OK, I understand the problem to be this: you have a user table and a
team table, and the user table has a foreignkey field that relates
back to team.  Assuming a user table named USERS and a team table
named TEAM, in your view, you would do a lookup like this:

team_members =
TEAM.objects.get(team_name="foo").USER_set.exclude(user_name="someperson")
# that exclude keeps the current user off of the list

Add team_members to the template's context.  Then you could do
something like this in your template:


{% for member in team_members %}
{{ member.user_name }}
{% endfor %}


On Apr 30, 8:51 am, "5264277-ew5264277"
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> In a regule view/template.
>
> Thanks,
> Andrew
>
> = From Web Mail 
> 
> Andrew Holt, Managing Director,
> 4A Solutions
>
> Office : +44(0)1257 268351
> Mobile: +44(0)7841 340 608
> email: [EMAIL PROTECTED]
>
> veritas vos liberabit -- The truth will set you free
> 
>
> -- Original Message ---
> From: Jeff <[EMAIL PROTECTED]>
> To: Django users 
> Sent: Mon, 30 Apr 2007 12:45:42 -
> Subject: Re: context sensitive menus
>
> > Are you doing this in Django admin or in a regular view/template?
>
> > Jeff
>
> > On Apr 30, 8:41 am, "5264277-ew5264277"
> > <[EMAIL PROTECTED]> wrote:
> > > Hi,
>
> > > I am fairly new to Django, so this may be an easy question.
>
> > > I have an app where I have a team member table.  One of the attributes is 
> > > the
> > > team that they are a member of.
>
> > > What I want to do is have a drop down menu that lists the team, and 
> > > another
> > > which only lists the members of that team.
>
> > > Any ideas ?
>
> > > Regards,
> > > Andrew
>
> > > = From Web Mail 
> > > 
> > > Andrew Holt, Managing Director,
> > > 4A Solutions
>
> > > email: [EMAIL PROTECTED]
>
> > > veritas vos liberabit -- The truth will set you free
> > > 
>
> > --- End of Original Message ---


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



IntegrityError Handling

2007-05-01 Thread sandro.dentella

hi all,

  I noticed that recently has been added InterityError as a common
exception
  for all db (django.db.IntegrityError), so I wanted to make my view
aware
  of that, but I'm uncertain on how to accomplish this.

  I added a snippet like this one, in a sort of generic view:

  if form.is_valid():
 # No errors -- this means we can save the data! except for db
problems
 try:
 new_object = form.save()
 except IntegrityError:
 new_object = None
 form.errors['db'] = "Integrity Error from the db"

 if new_object:
 if request.user.is_authenticated():
  ...

   if new_object is None it falls back to the branch of form error
   handling... this was what I wanted... really it raises:
   ProgrammingError, current transaction is aborted, commands ignored
until
   end of transaction block.

   What's  wrong and which should be a correct way to handle
IntegrityError?

   Thanks in advance

   sandro
   *:-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: TextInput({'onKeydown': 'some javascript code'} problem

2007-05-01 Thread Ivan Sagalaev

hoamon wrote:
> how can i customize the fields in the newforms, or i walk the wrong
> way ??

What you described is an issue but I want to advice a different 
technique that doesn't suffer from this issue and also considered more 
robust.

You shouldn't mix your HTML with Javascript, instead you should assign 
Javascript after the fact in a single place. For example:

 ID
 


... and then somewhere in window.onload:

 document.getElementById('id_personalid').onkeydown = function() {
   // your code
 }

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

2007-05-01 Thread Russell Keith-Magee

On 5/1/07, Trilok <[EMAIL PROTECTED]> wrote:
>
> I am creating a new second admin page with features different from the
> existing one and it would save me a lot of time if I could use
> components from the django Admin interface. I don't want to modify the
> existing admin interface. Is there a way to access components like the
> calendar?

The admin view isn't magic. From a technical perspective, it's a
fairly ordinary piece of generic view code, with some very pretty CSS
and Javascript backing it up. It is able to do what it does by
leveraging the capabilities of Django. Any or all of the parts that
make up the admin view can be used elsewhere, either by customizing
Admin templates, or emulating the technique used in the admin view on
your own site.

The calendar is just some fancy css with a javascript trigger, and
yes, it can be accessed outside the admin view. Just include the admin
media in your media directory, and include the relevant Javascript,
CSS, and class tags on your page.

Yours,
Russ Magee %-)

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



Re: django settings problem

2007-05-01 Thread Christian Markwart Hoeppner

Python uses PYTHONPATH instead of PATH. Make sure your using the first.

Chris

El mar, 01-05-2007 a las 01:24 +, whidbey escribi�:
> I dint' use the host's django.
> I make my own django folder in my home path ,It's last trunk 0.96
> ~/dango/django_src
> 
> and in my .bash_profile I export my django before  the default sys
> path
> 
> but I can't change any thing,any fact.
> 
> when I use python
> import django
> django.__path__
> 
> It still print
> 
> >>> django.__path__
> ['/usr/local/lib/python2.5/site-packages/Django-0.95.1-py2.5.egg/
> django']
> 
> that's not my need !!!
> I want
> ['myhome'.../django/django_src/]
> 
> 
> How can I do!,thx
> 
> 
> > 


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

2007-05-01 Thread Pythoni


Julio and James,
Thank you both for your help.
I know that frames could be useful to help solve my problem but...

Let's suppose this:








where you can see two frames( iframes).One Authors ( list of
authors)and the other Descriptions( their replies).
As you can see  each frame must consists source page DAuthors.html and
DDescriptions.html, that should be generated on fly( dynamically)
according to user's demand( depending on what he will want to see).

So, it means I must create them before I use them in frames.
But what if  three users will want to see three different results,
that is ,source pages must be different for each of these three users.
Is there a solution for this problem?
Or do I make a mistake in my thinking?
Thanks for help
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
-~--~~~~--~~--~--~---



TextInput({'onKeydown': 'some javascript code'} problem

2007-05-01 Thread hoamon

hi there,
i want to use ajax in newforms library. but when i use the below here:

class RegForm(forms.Form):
personalid = forms.CharField(label='ID',
widget=forms.widgets.TextInput({'onKeydown':
'Element.update("NO_CHECK", " http://mydomain/arrows.gif>");'
...

the html output is

ID, " character was escaped.

how can i customize the fields in the newforms, or i walk the wrong
way ??


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



Re: "Complex" Views/Generic Views

2007-05-01 Thread Malcolm Tredinnick

On Tue, 2007-05-01 at 06:53 +, Bryan Veloso wrote:
> > In fact, that whole thread possibly has some relevance to your problem.
> > Note that the solution in the particular post I've highlighted works on
> > Python 2.3 and up, but if you are using 2.4 or later, Ned Batchelder's
> > post is of more than trivial relevance.
> 
> So, (with my very limited python knowledge) I could essentially do
> this?
> 
> object_list = Entry.objects.all().order_by('-pub_date')
> object_list += Videocast.objects.all().order_by('-pub_date')
> object_list += Tutorial.objects.all().order_by('-pub_date')
> object_list.sort(key=lambda w: w.headline)

You would need to wrap a list() call around the first item in this
sequence so that object_list is actually a list and not a queryset.

> And then pass object_list in the generic view?

Sort of. You can only pass it in as part of extra_context. You cannot
pass it as the queryset argument, because it's no longer a queryset and
the generic views actually use some queryset-specific methods on that
argument.

There is an open ticket in Trac (#3891) that proposes allowing Python
sequences in the queryset argument and that might go in one day, but
it's not there yet. [The reason that ticket isn't a no-brainer is
because we use "generic" to mean "simple, no-frills", rather than
"supports every use-case known to mankind via customisation options" and
we are trying to keep control of creeping featurism in that respect. So
it's not just lack of ability to commit that hasn't led to that going
in. There is some genuine thinking about it that we are doing.]

Regards,
Malcolm



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



Re: "Complex" Views/Generic Views

2007-05-01 Thread Bryan Veloso

> In fact, that whole thread possibly has some relevance to your problem.
> Note that the solution in the particular post I've highlighted works on
> Python 2.3 and up, but if you are using 2.4 or later, Ned Batchelder's
> post is of more than trivial relevance.

So, (with my very limited python knowledge) I could essentially do
this?

object_list = Entry.objects.all().order_by('-pub_date')
object_list += Videocast.objects.all().order_by('-pub_date')
object_list += Tutorial.objects.all().order_by('-pub_date')
object_list.sort(key=lambda w: w.headline)

And then pass object_list in the generic view?


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



Re: "Complex" Views/Generic Views

2007-05-01 Thread Malcolm Tredinnick

On Tue, 2007-05-01 at 06:29 +, Bryan Veloso wrote:
> > What you *can* do, if you're willing to be a bit adventurous, is pull
> > out the content you want from the different models you want, and dump
> > the results into one big list (a list doesn't care what types of
> > objects it contains). Then you can take advantage of Python's
> > list-sorting facilities to specify how you'd like to sort; for
> > example, if all your models had a commonly-named field to represent
> > their publication dates (e.g., each one has a DateTimeField
> > representing the publication date, and all three use the same field
> > name), it's relatively easy to get Python to sort the list by that
> > field -- look at the 'sort' method of Python's List class, which lets
> > you pass in custom comparison functions to be used in sorting.
> 
> Would you happen to have an example of how to do that? My models do
> all have a similar date structure as you mentioned. And yes, I'm
> willing to be a bit adventurous. :)

Here's an example we prepared earlier:

http://groups.google.com/group/django-users/browse_thread/thread/e7e04bea323d71f7/ba30d5da5eb8388c?lnk=gst=cmp+method=2#

In fact, that whole thread possibly has some relevance to your problem.
Note that the solution in the particular post I've highlighted works on
Python 2.3 and up, but if you are using 2.4 or later, Ned Batchelder's
post is of more than trivial relevance.

Regards,
Malcolm



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



Right place to put content-length handler

2007-05-01 Thread meledictas

Hi
 I need to do something with file upload request body that has
size greater than limit. I would like to handler it quick as possible
(base HTTP handler) with simplicity in mind (middleware)
 Any idea is welcomed

chatchai


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



Re: "Complex" Views/Generic Views

2007-05-01 Thread Bryan Veloso

> What you *can* do, if you're willing to be a bit adventurous, is pull
> out the content you want from the different models you want, and dump
> the results into one big list (a list doesn't care what types of
> objects it contains). Then you can take advantage of Python's
> list-sorting facilities to specify how you'd like to sort; for
> example, if all your models had a commonly-named field to represent
> their publication dates (e.g., each one has a DateTimeField
> representing the publication date, and all three use the same field
> name), it's relatively easy to get Python to sort the list by that
> field -- look at the 'sort' method of Python's List class, which lets
> you pass in custom comparison functions to be used in sorting.

Would you happen to have an example of how to do that? My models do
all have a similar date structure as you mentioned. And yes, I'm
willing to be a bit adventurous. :)


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