BooleanField trouble

2008-09-11 Thread Jason

I have a "true" or "false" string coming in from an ajax call to my
view. I'm then turning around and directly assigning that string from
the front end to my model object and saving it.

Before the upgrade to django 1.0, the database happily accepted my
model object's value as 'true' or 'false' for that field when it was
assigned and saved.  I could see the value saved in the database as
true/false ( I'm using sqlite )

Now it seems that nothing but a 0 or 1 is saved correctly in the
database for this BooleanField when its assigned to the model object
from the html page.

Any ideas on this one?  What are the boolean values supposed to be
saved as in the database? What type of value should i be giving the
model so that it will save correctly in the database ?

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

2008-09-11 Thread Dana

You could try the template filter "unordered_list" too I believe
(haven't done it myself).

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#unordered-list

Cheers

On Sep 11, 11:36 am, "Lance F. Squire" <[EMAIL PROTECTED]> wrote:
> Currently using Django version 0.96.3, on a Fedora 8 system.
>
> I've currently set-up models for 'Manufacturer' and 'System'. System
> has a Foreignkey to Manufacturer.
>
> I'd like to display a list like so:
>
> Manu A
>    System a
>    System b
>    System c
>
> Manu B
>    System a
>    System b
>    System c
>
> Etc...
>
> Only listing Manufacturers that had systems of type X.
>
> I was thinking of using code like this in the View,
>
>  man=Manufacturer.objects.all()>>> for m in man:
>
> ...    sys=System.objects.filter(manufacturer=m.id)
> ...    print m.name
> ...    for s in sys:
> ...       print "  %s" % s.name
> ...
>
> This works from the shell, but I'm unsure how to get the output to the
> template And, I suspect is a terribly inefficient way to do it anyway.
>
> I'm guessing I should be doing something simpler here and then doing
> something in the template to form the list
>
> Any help appreciated, including severe beatings with a clue stick. ;)
>
> This is only my 2nd attempt at a Django project, and I'm stumped at
> the moment.
>
> Thanks,
>
> Lance
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Making sure published date is respected in views

2008-09-11 Thread Dana

Hey all,

Wondering what the best technique would be to make sure that an entry
(such as a blog entry/story/etc...) with a datetime object 'pub_date'
does not show up on the front end if the pub_date is in the future. I
would assume using ".filter(...something...)" is the way to go but
what would be the best filter to apply? Any other ways to achieve
this?

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

2008-09-11 Thread lingrlongr

Ah, I figured it out.

class ProductImage(models.Model):
  image = models.ImageField(upload_to='images', height_field='height',
width_field='width')

Example:
>>> p = ProductImage.objects.all()[0]
>>> p.image.height
250
>>> p.image.width
100



On Sep 12, 12:06 am, lingrlongr <[EMAIL PROTECTED]> wrote:
> Can someone explain how to use theheight_fieldand width_field for an
> ImageField as it would relate to this model:
>
> class ProductImage(models.Model):
>   image = models.ImageField(upload_to='images')
>
> The explanation in the documentation is:
> Name of a model field which will be auto-populated with the height of
> the image each time the model instance is saved.
>
> I don't think that's 100% clear.  At least to me its not.  I tried
> this:
>
> class ProductImage(models.Model):
>   height = models.IntegerField()
>   width = models.IntegerField()
>   image = models.ImageField(upload_to='images',height_field=height,
> width_field=width)
>
> Must I do anything else specific with my model or am I way off?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ImageField

2008-09-11 Thread lingrlongr

Can someone explain how to use the height_field and width_field for an
ImageField as it would relate to this model:

class ProductImage(models.Model):
  image = models.ImageField(upload_to='images')

The explanation in the documentation is:
Name of a model field which will be auto-populated with the height of
the image each time the model instance is saved.

I don't think that's 100% clear.  At least to me its not.  I tried
this:

class ProductImage(models.Model):
  height = models.IntegerField()
  width = models.IntegerField()
  image = models.ImageField(upload_to='images', height_field=height,
width_field=width)

Must I do anything else specific with my model or am I way off?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 AS400

2008-09-11 Thread Brett H

I've done this - not specifically with AS400 - but with a couple of
obscure databases.

Basically you need to work out ODBC part first. Get your basic
connection working. Once that is done I recommend mx.ODBC as a good
python interface that is the most robust I've found with commercial
support if needed.

The methodology I have used is one way sycnrohonisation of tables with
selective mapping of fields. To get your orders back in is just a
matter of determining that you can write to the AS/400 through the
mx.ODBC connection and you know what tables and fields you are writing
to, and the intricacies of the variant of sql it uses.

Django would be perfect to add value to existing legacy databases this
way, but I'm still trying to work out how I'm going to overcome the no
'read-only' field option in models in a sensible way if I am to
migrate my own existing 'shop' projects to Django.

Unfortunately the tool I have written has the commercial mx.ODBC
library in it - so I can't release it unless I refactor it to use an
open source library.





On Sep 12, 6:50 am, Jason Sypolt <[EMAIL PROTECTED]> wrote:
> Is it possible to connect to an as400 database using django
> (preferably) or with python? I would like to build a product catalog
> site using django and read in products and send orders to the as400.
>
> Note that the site itself will not be on an as400 system. Just
> wondering if anyone has done this before and if so, can you point me
> to some resources/libraries? Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Displaying a list of lists?

2008-09-11 Thread Russell Keith-Magee

On Fri, Sep 12, 2008 at 2:36 AM, Lance F. Squire <[EMAIL PROTECTED]> wrote:
>
> Currently using Django version 0.96.3, on a Fedora 8 system.
>
> I've currently set-up models for 'Manufacturer' and 'System'. System
> has a Foreignkey to Manufacturer.
>
> I'd like to display a list like so:
>
> Manu A
>   System a
>   System b
>   System c
>
> Manu B
>   System a
>   System b
>   System c
>
> Etc...
>
> Only listing Manufacturers that had systems of type X.
>
> I was thinking of using code like this in the View,
>
>  man=Manufacturer.objects.all()
 for m in man:
> ...sys=System.objects.filter(manufacturer=m.id)
> ...print m.name
> ...for s in sys:
> ...   print "  %s" % s.name
> ...
>
> This works from the shell, but I'm unsure how to get the output to the
> template And, I suspect is a terribly inefficient way to do it anyway.

Sounds like you're looking for something like the following:

{% for m in man %}
   {{ m.name }}
   {% for s in m.sys_set.all %}
  {{ s.name }}
   {% endfor %}
{% endfor %}

(plus some formatting bits, but they should be pretty obvious). This
assumes that "man" is in your context, and contains a list of
manufacturers (Manufacturer.objects.all(), for instance). The only
piece of this puzzle that might be a little confusing is
'm.sys_set.all'. m.sys_set is Django's way of saying "get all the sys
objects that are related to the Manufacturer m". More details here:

http://docs.djangoproject.com/en/dev/topics/db/queries/#following-relationships-backward

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: Using unique on a field

2008-09-11 Thread [EMAIL PROTECTED]

If you use a model form it will also be validated.

On Sep 11, 9:41 pm, "Chris Stromberger" <[EMAIL PROTECTED]>
wrote:
> Curious about using "unique" in a column definition of a model for a legacy
> db.  My assumption is that "unique" only comes into play during db creation,
> to create the index on the field, and thereafter uniqueness is enforced by
> the db?  Or does unique in a model affect creation of new model objects or
> anything else?
>
> Just wondering bcs I made a few columns unique on the db after the initial
> model creation.  Is it important to go back and add unique to the Django
> model in this case?
>
> Thanks,
> 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: Displaying a list of lists?

2008-09-11 Thread Lance F. Squire

Is there a way to see if a filed changes between iterations?

That is, I pass the Systems list to the template sorted by
Manufacturer and name. The template then only displays the new
Manufacturer name when it changes?

I thought I saw something like that somewhere, but can't find it
now

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



Re: comparing Model instances

2008-09-11 Thread Eric Abrahamsen


On Sep 12, 2008, at 6:05 AM, Malcolm Tredinnick wrote:

>
>
> On Thu, 2008-09-11 at 17:27 -0400, Steve Holden wrote:
> [...]
>> I've got some timings lying around somewhere that clearly show the
>> decorate/sort/undecorate implementation is way faster under normal
>> circumstances.
>
> True. That's a very important point. Even in the good old days before
> sort() developed the key parameter, decorate-sort-undecorate was The  
> Way
> To Do It in so many cases. Python's sorting is *fast* for simple
> objects.
>
> That's a much better motivation than my technical argument of why it
> will interfere with __eq__.

The answer's clear then! Thanks to both of you for the explanations.  
I'm leaning towards sorting with key=lambda x: getattr(x,  
x._meta.ordering[0].strip('-')) since that's basically what I was  
after to begin with.

Thanks,
Eric


>
>
> 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: Using unique on a field

2008-09-11 Thread Marcelo Ramos

2008/9/11 Chris Stromberger <[EMAIL PROTECTED]>:
> Curious about using "unique" in a column definition of a model for a legacy
> db.  My assumption is that "unique" only comes into play during db creation,
> to create the index on the field, and thereafter uniqueness is enforced by
> the db?  Or does unique in a model affect creation of new model objects or
> anything else?
>
> Just wondering bcs I made a few columns unique on the db after the initial
> model creation.  Is it important to go back and add unique to the Django
> model in this case?

You can read in the documentation of the unique field option[1]:

"This is enforced at the database level and at the Django admin-form
level. If you try to save a model with a duplicate value in a unique
field, a django.db.IntegrityError will be raised by the model's save()
method."

About a legacy db where you put a unique constraint manually it is
recommended to put the option unique to the field so you get
a nice error in the Django forms  instead of an error screen.

Regards.

[1] http://docs.djangoproject.com/en/dev/ref/models/fields/#unique

-- 
Marcelo Ramos

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Enhanced (Wufoo / Digg / Facebook - like) forms

2008-09-11 Thread Ron W

Thanks for the link, some good info in there. Not quite the "Django
Fancy Forms" framework I'm dreaming of, but definitely helps in a big
way... ;)

Ron

On Sep 11, 1:38 am, Dave <[EMAIL PROTECTED]> wrote:
> On Sep 11, 7:54 am, Ron W <[EMAIL PROTECTED]> wrote:
>
> > Trying to prevent some wheel-reinvention on my part and just wondering
> > if anyone out there's built some advanced form widgets to take care of
> > inline / ajax validation a la Digg registration page (http://digg.com/
> > register/), Wufoo's inline help / highlighting. Preferably using
> > jQuery and making life real easy with ModelForms.
>
> > I Googled around for it but couldn't find anything particularly good.
>
> > Suggestions?
>
> This is probably a bit out of date (pre ModelForms, I believe) but
> still quite useful.
>
> Jeremy Dunck, Jacob Kaplan-Moss and Simon Willison did a talk at OSCON
> 2007 called 'Django Master Class'. I believe Simon did the part of the
> talk about forms and AJAX which I think you might find useful.
>
> http://toys.jacobian.org/presentations/2007/oscon/tutorial/
>
> Cheers,
>
> David
>
> --
> David Reynolds
> [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: What do you use as a build tool (like Ant or make)

2008-09-11 Thread ristretto.rb

Thanks very much for the replies.  I was really considering Vellum,
and I still am.
But, that was a very informative post from Kevin on zc.buildout.  I'll
have to give
both a look.

Look forward to your blog post Dan!!

cheers
gene


On Sep 10, 9:58 pm, Dan Fairs <[EMAIL PROTECTED]> wrote:
> > I haven't used any of them with Django, but for managing Zope, Plone
> > and Grok based web apps, zc.buildout is the current preferred tool.
>
> I use zc.buildout to manage my Django builds. Blog post coming soon  
> (when the project's finished!)
>
> Cheers,
> Dan
>
> --
> Dan Fairs <[EMAIL PROTECTED]> |http://www.stereoplex.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
-~--~~~~--~~--~--~---



Using unique on a field

2008-09-11 Thread Chris Stromberger
Curious about using "unique" in a column definition of a model for a legacy
db.  My assumption is that "unique" only comes into play during db creation,
to create the index on the field, and thereafter uniqueness is enforced by
the db?  Or does unique in a model affect creation of new model objects or
anything else?

Just wondering bcs I made a few columns unique on the db after the initial
model creation.  Is it important to go back and add unique to the Django
model in this case?

Thanks,
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: Persistent Global Imports

2008-09-11 Thread Graham Dumpleton



On Sep 12, 10:35 am, "Chris Spencer" <[EMAIL PROTECTED]> wrote:
> On Thu, Sep 11, 2008 at 6:16 AM, Graham Dumpleton
>
>
>
> <[EMAIL PROTECTED]> wrote:
> > Be aware that Apache/mod_wsgi in embedded mode on UNIX is going to be
> > multiprocess. Thus where you think it is being loaded on every
> > request, it is more likely just the result of the various processes
> > loading the application the first time it is used. After they are all
> > loaded, you shouldn't see loading occurring.
>
> > Anyway this is it in simple terms, as it is actually more complicated
> > than that as Apache can kill off processes and replace them in certain
> > situations.
>
> > For some details of how processes are used in Apache/mod_wsgi see:
>
> >  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
>
> > To know what is definitively what is going on, following instructions
> > in:
>
> >  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
>
> > and set:
>
> >  LogLevel info
>
> > in Apache configuration, in place of default 'warn'. This should
> > result in mod_wsgi outputing a lot of information into main and per
> > virtual host, as appropriate, error logs about when processes are
> > being started/restarted and when WSGI application scripts being
> > loaded.
>
> > So do that and report on what you see, including examples of Apache
> > error logs which you believe shows the behaviour you are claiming.
>
> I set LogLevel, and after each request, the only thing I'm seeing in
> the log is something like:
> [Thu Sep 11 20:17:37 2008] [info] mod_wsgi (pid=18858): Create
> interpreter 'localhost.localdomain|/myapp'.
> [Thu Sep 11 20:17:37 2008] [info] [client 127.0.0.1] mod_wsgi
> (pid=18858, process='', application='localhost.localdomain|/myapp'):
> Loading WSGI script '/usr/local/django/myapp/apache/django.wsgi'.,
> referer:http://localhost/myapp
>
> Is there any way to force a specific WSGI app to run on a single
> process, without changing the number of processes used otherwise on
> the server? I've toyed around with WSGIDaemonProcess, but all this
> seems to do is break the debugger without fixing the problem. Would I
> use something like:
>
> WSGIDaemonProcess myapp processes=1 threads=1

Which debugger? Any specific reason you are using a single thread,
such as using older Django version or your application is not
multithread?

Anyway, the in web browser debuggers I know of will only work if one
process, but 'processes=1' still marks it as multiprocess in WSGI
environment. Just drop 'processes=1' and let if use default of 1
process. If you don't do that the debugger may complain it is not
running in valid environment. Thus:

  WSGIDaemonProcess myapp thread=1
  WSGIProcessGroup myapp

For more information on web browser debuggers and debugging in general
see:

  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques

Also see comments about WSGI multiprocess/multithread flags in:

  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

For configuration of WSGIDaemonProcess see examples in:

  http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
  http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines
  http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives

Sorry, but have to run somewhere. Will check later than I actually
answered your question. I may not have. ;-)

Graham

> How does that directive differentiate between multiple WSGI apps
> running on the same server? The docs mention that it specifies a
> "process group", but how do you make a single WSGI Django app run in
> that process group?
>
> > Also, you should still post the configuration you use so we can
> > confirm it is correct. I have many times had people say they followed
> > the documentation, but in fact they had tweaked it slightly and
> > inadvertently caused problems for themselves.
>
> What I posted is my exact configuration. It's a simple minimal case
> app for testing this problem.
>
> Regards,
> 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: validation inline

2008-09-11 Thread Aaron C. de Bruyn

On 2008-09-09 at 22:46:52 -0700, Samuel Mathieson wrote:
> Date: Tue, 9 Sep 2008 22:46:52 -0700 (PDT)
> To: Django users 
> From: Samuel Mathieson <[EMAIL PROTECTED]>
> Subject: validation inline
> 
> Hello, I am trying to get some sort of validation inline for the
> admin:
> 

> 
> The validation works just fine, but it does not seem to show the error
> message anywhere but at the top, and then only a "correct following
> errors:" message with no following errors.
> 
> Am I doing this correctly or is this a bug?

I am running into the same error.
I created a file 'change_form.html' with the following code that I dug
up on google:

{%extends "admin/change_form.html" %}
{%block form_top %}
{{form.error_dict.items|pprint}}
{{errors|pprint}}
{%endblock%}

I end up getting an error message in this format:
'' [u'*the inline object* with this None
already exists.'] 

If I have a Person model with an Address model displayed inline, the
error reads:

'' [u'Address with this None
already exists.'] 

I commented out the 'inlines' line in my PersonAdmin class for now with
the idea of coming back to it later next week--once my deadline has
passed...  ;)

-Aaron

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

2008-09-11 Thread Jon Brisbin

I had quite a bit of trouble with Apache/mod_python on Leopard as  
well. I had to go back to using the default Apache 2 and stock python  
2.5. I also had to rearrange things a bit in the path and ended up  
putting a symlink in /Library/Python/2.5/site-packges/django to ~/src/ 
django-trunk/django, which is found by Apache launched by launchd.  
 From there, the basic mod_python directions seemed to work for me.

I'm not using Apache any more, though, as I've moved to lighttpd.

Thanks!

Jon Brisibn
http://jbrisbin.com

On Sep 11, 2008, at 2:37 PM, [EMAIL PROTECTED] wrote:

>
> Hello,
>
> I'm trying to install Django with Mod_Python on Leopard. I've been
> through the process on Linux and Windows several times without many
> issues, but on Leopard I've come up against a wall and I don't know
> what else to check. OS X is the os I have least experience with.
>
> I wanted to install the newest versions of Python and Apache instead
> of using the versions that come with OS X. That went fine. I have
> django checked, and symlinked from my site-packages directory. It runs
> fine on the development server. If I type python at the terminal, I
> can import Django without issue. Apache is running as well.
>
> I built Apache and Mod_python using the instructions here:
> http://cavedoni.com/2005/django-osx
>
> I have Apache calling a test handler using configurations in
> an .htaccess file, so something is right there. However, after
> fighting with a "forbidden" message (and winning), I get the message
> that I can't import django.core.handlers.modpython when I use the
> configuration in the cavedoni.com tutorial.
>
> I had thought that perhaps Mod_python wasn't linked to the correct
> version of Python, so I tried to build it again (first clearing the
> configuration with distclear). But I'm getting the same problem
>
> I tried to add django to the Python Path using the PythonPath
> declaration in my .htaccess file, but pointing it to the symlink and
> actual code checkout gives me the same results.
>
> My path looks like this when output from my test mod_python handler:
>
> /Users/jdonato/Documents/code-checkouts/django-trunk/django
> /Users/jdonato/Documents/code-checkouts/django-trunk
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-
> darwin
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-
> mac
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-
> mac/lib-scriptpackages
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-
> dynload
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
> packages
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
> packages/PIL
>
> Which is identical to what I see when I open python from the command
> line and view sys.path, except here I have the two extra django
> directories that I'm adding in the config.
>
> I saw this: 
> http://groups.google.com/group/django-users/browse_thread/thread/1cc6ad68d63cb61d?fwc=1
> but I tried changing my permissions and there's no change.
>
> My .htaccess file looks like this:
> AddHandler python-program .py
> PythonHandler mptest
> PythonDebug On
> PythonPath "['/Users/jdonato/Documents/code-checkouts/django-trunk/
> django', '/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django'] + sys.path"
>
> But note that I've tried similiar things in the main apache
> configuration file. Right now, for testing purposes, I've removed
> the .htaccess file, and changed my main conf file to:
>
> 
> AddHandler python-program .py
> AllowOverride FileInfo
> PythonHandler mptest
> PythonDebug On
> PythonPath "['/Users/jdonato/Documents/code-checkouts/django-trunk/
> django','/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django'] + sys.path"
> 
>
> In mptest, I try to import Django, but get:ImportError: No module
> named django
>
> If any one has any ideas, I'm all out myself and would gladly try
> anything. Thank you for reading this long post.
>
> Justin
> >


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

2008-09-11 Thread Jon Brisbin

I don't think Django can natively use unixODBC as it's ORM backend,  
unfortunately. It would be great if it did!

You could Django without the ORM, of course. To connect from a Win  
server (why would want to do that? ;), you could use ClientAccess. To  
connect from Linux, you could use IBM's Linux version of the  
ClientAccess drivers. All other unices would need the DB2 xpress  
install, configured to use unixODBC (which works, but to connect one  
DB2 server to another, you have to pay for the connectivity  
driver...it's kind of underhanded if you ask me when you can connect  
on other platforms, outside of the native DB2 driver for free).

Or you could use the native Python functionality to use REST-based  
webservices (Apache/Tomcat come standard, though unconfigured on v5r4,  
which is what we're running).

So there are several options, but not using the ORM, AFAIK. If I'm  
wrong about that, I'd love to hear it because I could use that as  
well! :)

Thanks!

Jon Brisibn
http://jbrisbin.com

On Sep 11, 2008, at 3:50 PM, Jason Sypolt wrote:

>
> Is it possible to connect to an as400 database using django
> (preferably) or with python? I would like to build a product catalog
> site using django and read in products and send orders to the as400.
>
> Note that the site itself will not be on an as400 system. Just
> wondering if anyone has done this before and if so, can you point me
> to some resources/libraries? Thanks!
>
> >


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



Re: Persistent Global Imports

2008-09-11 Thread Chris Spencer

On Thu, Sep 11, 2008 at 6:16 AM, Graham Dumpleton
<[EMAIL PROTECTED]> wrote:
> Be aware that Apache/mod_wsgi in embedded mode on UNIX is going to be
> multiprocess. Thus where you think it is being loaded on every
> request, it is more likely just the result of the various processes
> loading the application the first time it is used. After they are all
> loaded, you shouldn't see loading occurring.
>
> Anyway this is it in simple terms, as it is actually more complicated
> than that as Apache can kill off processes and replace them in certain
> situations.
>
> For some details of how processes are used in Apache/mod_wsgi see:
>
>  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
>
> To know what is definitively what is going on, following instructions
> in:
>
>  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
>
> and set:
>
>  LogLevel info
>
> in Apache configuration, in place of default 'warn'. This should
> result in mod_wsgi outputing a lot of information into main and per
> virtual host, as appropriate, error logs about when processes are
> being started/restarted and when WSGI application scripts being
> loaded.
>
> So do that and report on what you see, including examples of Apache
> error logs which you believe shows the behaviour you are claiming.

I set LogLevel, and after each request, the only thing I'm seeing in
the log is something like:
[Thu Sep 11 20:17:37 2008] [info] mod_wsgi (pid=18858): Create
interpreter 'localhost.localdomain|/myapp'.
[Thu Sep 11 20:17:37 2008] [info] [client 127.0.0.1] mod_wsgi
(pid=18858, process='', application='localhost.localdomain|/myapp'):
Loading WSGI script '/usr/local/django/myapp/apache/django.wsgi'.,
referer: http://localhost/myapp

Is there any way to force a specific WSGI app to run on a single
process, without changing the number of processes used otherwise on
the server? I've toyed around with WSGIDaemonProcess, but all this
seems to do is break the debugger without fixing the problem. Would I
use something like:

WSGIDaemonProcess myapp processes=1 threads=1

How does that directive differentiate between multiple WSGI apps
running on the same server? The docs mention that it specifies a
"process group", but how do you make a single WSGI Django app run in
that process group?

> Also, you should still post the configuration you use so we can
> confirm it is correct. I have many times had people say they followed
> the documentation, but in fact they had tweaked it slightly and
> inadvertently caused problems for themselves.

What I posted is my exact configuration. It's a simple minimal case
app for testing this problem.

Regards,
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: TestClient with no Django Database

2008-09-11 Thread Russell Keith-Magee

On Fri, Sep 12, 2008 at 7:35 AM, Denali Lumma <[EMAIL PROTECTED]> wrote:
>
> Hi There,
>
>  I am trying to use the TestClient class to validate some of our
> pages.  It seems to work OK for pages which don't require
> authentication.

It should work fine for pages _with_ authentication, too; you just
need to authenticate the client first.

>  I am aware of the test database which is created and used in the
> TestClient run, however, we have a special set up here.  We are not
> using any of Django's database support code.  We have our own lower
> level code which interacts with the database.

You appear to be getting some terminology confused here. Are you talking about:
 * the TestClient - the dummy web browser
 * the Django Test Case - a wrapper around unittest.TestCase that
provides a TestClient instance
 * the Django Test Runner - which creates the test database.

The TestClient itself doesn't do anything with the database
connection. It just hits the URLconf to activate the requested views
and get the response. You should be able to run the TestClient without
ever touching the database backend code.

However, if you're talking about the test runner, the solution is easy
- write a custom test runner. If you want to use an existing database
rather than the Django Test database, take a copy of the runtests
method in django.test.simple, remove the parts that create and destroy
the test database, and refer to your modified version in the
TEST_RUNNNER value of your settings file. See here for more details on
the general process:

http://docs.djangoproject.com/en/dev/topics/testing/#using-different-testing-frameworks

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



TestClient with no Django Database

2008-09-11 Thread Denali Lumma

Hi There,

  I am trying to use the TestClient class to validate some of our
pages.  It seems to work OK for pages which don't require
authentication.

  I am aware of the test database which is created and used in the
TestClient run, however, we have a special set up here.  We are not
using any of Django's database support code.  We have our own lower
level code which interacts with the database.

  So there is really no way for Django to create a test database for
the run, since we have no Models defined, no settings variables
related to database defined, etc.

  Any pointers on the best direction to take, given this limitation?

  This, of course, makes testing pages which require login impossible
at the present time.

Thank you very much for any 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: looking for event registration/calendar modules

2008-09-11 Thread cjl

Probably not exactly what you are looking for, but check out:

https://pycon.coderanger.net/

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



Re: looking for event registration/calendar modules

2008-09-11 Thread coulix

Hi,

There was a django calendar app but it is in 'rewriting' right now
and will be released soon (from what i heard).
For now i built mine based on this snippest
http://www.djangosnippets.org/snippets/129/

Greg

On Sep 11, 5:59 pm, Marcus <[EMAIL PROTECTED]> wrote:
> Hi -- django newbie here putting together a site for a client who
> wants a calendar of events that users can register for.  Before I
> build one I thought I'd check with the community to see if something
> similar already exists-- any suggestions?  I think a general calendar
> model, or something that already handles events with reminders would
> be fine.
>
> Thanks for the help!
> Marcus
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Newbie legacy db question -- ManyToMany

2008-09-11 Thread Chris Stromberger
Fantastic, thanks for the info.

On Thu, Sep 11, 2008 at 4:19 PM, Karen Tracey <[EMAIL PROTECTED]> wrote:

> On Thu, Sep 11, 2008 at 3:32 PM, Chris Stromberger <
> [EMAIL PROTECTED]> wrote:
>
>> I'm wanting to use Django with a preexisting db.  The db features a
>> linking table (Many to Many).  I'm wondering if I need to go ahead and
>> define a model class for this table, or just add the ManyToMany field to one
>> of the linked models.  Or to put it another way, is there any way to define
>> the relationship as a ManyToMany field w/o changing the table
>> name/structure?  Eg, in the online book example, the ManyToMany field
>> generates a table with a specific name, specific fields and an
>> auto-increment primary key.  The existing many to many table I have does not
>> match--name is different, obviously, and it only has the two foreign keys,
>> both of which together form the primary key.
>> Not sure how to handle this with models...
>>
>
> Yes, define a model class for it, and then use the 'through' argument to a
> ManyToMany field to define it as the model that acts as the intermediary for
> the ManyToMany relation.  See:
>
>
> http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships
>
> This was added fairly recently so wouldn't be in the book.
>
> Karen
>
>
> >
>

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



Re: Restricting views

2008-09-11 Thread Dan

> Yeah, ... a super user could have all permissions that are defined
> in a project for example. Wait a moment -- that's already true today!
> (See the User has_perm method)

He will have all permissions that will exist in the future too.

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



Re: comparing Model instances

2008-09-11 Thread Malcolm Tredinnick


On Thu, 2008-09-11 at 17:27 -0400, Steve Holden wrote:
[...]
> I've got some timings lying around somewhere that clearly show the
> decorate/sort/undecorate implementation is way faster under normal
> circumstances.

True. That's a very important point. Even in the good old days before
sort() developed the key parameter, decorate-sort-undecorate was The Way
To Do It in so many cases. Python's sorting is *fast* for simple
objects.

That's a much better motivation than my technical argument of why it
will interfere with __eq__.

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: Newbie legacy db question -- ManyToMany

2008-09-11 Thread Karen Tracey
On Thu, Sep 11, 2008 at 3:32 PM, Chris Stromberger <
[EMAIL PROTECTED]> wrote:

> I'm wanting to use Django with a preexisting db.  The db features a linking
> table (Many to Many).  I'm wondering if I need to go ahead and define a
> model class for this table, or just add the ManyToMany field to one of the
> linked models.  Or to put it another way, is there any way to define the
> relationship as a ManyToMany field w/o changing the table name/structure?
>  Eg, in the online book example, the ManyToMany field generates a table with
> a specific name, specific fields and an auto-increment primary key.  The
> existing many to many table I have does not match--name is different,
> obviously, and it only has the two foreign keys, both of which together form
> the primary key.
> Not sure how to handle this with models...
>

Yes, define a model class for it, and then use the 'through' argument to a
ManyToMany field to define it as the model that acts as the intermediary for
the ManyToMany relation.  See:

http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships

This was added fairly recently so wouldn't be in the book.

Karen

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



Re: Creating an Archive

2008-09-11 Thread djandrow

Thanks Russ, I'm still abit confused about the first part, I
understand it prints 2008-01-01, because its printing the years with
entries in them, and 2008 is the only year with entries, but rather
than get it to show all the years with entries I want it to show all
the months with entries in.

I had a look at the documentation:

http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-date-based-archive-index

I am none the wiser though, how do I pass the months into the view?

I appreciate the help on the date format and the views, thanks,

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

2008-09-11 Thread Karen Tracey
On Thu, Sep 11, 2008 at 5:32 PM, David Durham, Jr. <
[EMAIL PROTECTED]> wrote:

>
> > I'm having the same need for nested inlines.
>
> Bump.  I'm probably going to take the plunge and try to implement this
> if no one has beaten me to it.
>

You might want to take a look at this thread on the developer's list:

http://groups.google.com/group/django-developers/browse_thread/thread/7912f4871d23f985/60e33cf2fb8c4e33
?

Karen

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



Re: Newbie -- ForeignKey to auth_user?

2008-09-11 Thread Chris Stromberger
That works!  Thanks for the help.

On Thu, Sep 11, 2008 at 4:38 PM, Karen Tracey <[EMAIL PROTECTED]> wrote:

> On Thu, Sep 11, 2008 at 5:20 PM, Chris Stromberger <
> [EMAIL PROTECTED]> wrote:
>
>> Oh, thanks.  Ok, I just tried taking that out (so model now says "staff_id
>> = models.ForeignKey(User)"), but that gave this error:
>> OperationalError: (1054, "Unknown column 'restaurant.staff_id_id' in
>> 'field list'")
>>
>> ?
>>
>
> Try:
>
> staff  = models.ForeignKey(User)
>
> Django automatically adds _id to the database field name for ForeignKeys
> unless you specify db_column, as described in the paragraph that begins
> "Behind the scenes" below here:
>
> http://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey
>
> So if your field is actually named 'staff_id' either declare it as 'staff'
> and do not specify db_column or declare it as whatever you want and specify
> db_column = 'staff_id'.
>
> Karen
>
>
>>
>> On Thu, Sep 11, 2008 at 4:09 PM, Malcolm Tredinnick <
>> [EMAIL PROTECTED]> wrote:
>>
>>>
>>>
>>> On Thu, 2008-09-11 at 16:01 -0500, Chris Stromberger wrote:
>>> > I would like to include a foreign key in a table that links to a user
>>> > in Django's auth_user table.  Or maybe this is a dumb idea--if so,
>>> > interested in hearing why.
>>> >
>>> >
>>> > So the table ("restaurant") with the foreign key includes (mysql):
>>> >
>>> >
>>> > staff_id int(11) NOT NULL,
>>> > foreign key(staff_id) references auth_user(id) on delete no action on
>>> > update cascade,
>>> >
>>> >
>>> >
>>> > If I include this in my model:
>>> >
>>> >
>>> >
>>> > from django.contrib.auth.models import User
>>> >
>>> > staff_id = models.ForeignKey(User, db_column = 'id')
>>>
>>> This probably isn't what you inteded to write. The db_column attribute
>>> specifies what the name of the database column in *this* table will be
>>> called. The name of the column in the table it refers to is worked out
>>> automatically (since it's almost always the primary key of that table
>>> and for other cases, Django has the to_field attribute).
>>>
>>> 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: Newbie -- ForeignKey to auth_user?

2008-09-11 Thread Karen Tracey
On Thu, Sep 11, 2008 at 5:20 PM, Chris Stromberger <
[EMAIL PROTECTED]> wrote:

> Oh, thanks.  Ok, I just tried taking that out (so model now says "staff_id
> = models.ForeignKey(User)"), but that gave this error:
> OperationalError: (1054, "Unknown column 'restaurant.staff_id_id' in 'field
> list'")
>
> ?
>

Try:

staff  = models.ForeignKey(User)

Django automatically adds _id to the database field name for ForeignKeys
unless you specify db_column, as described in the paragraph that begins
"Behind the scenes" below here:

http://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey

So if your field is actually named 'staff_id' either declare it as 'staff'
and do not specify db_column or declare it as whatever you want and specify
db_column = 'staff_id'.

Karen


>
> On Thu, Sep 11, 2008 at 4:09 PM, Malcolm Tredinnick <
> [EMAIL PROTECTED]> wrote:
>
>>
>>
>> On Thu, 2008-09-11 at 16:01 -0500, Chris Stromberger wrote:
>> > I would like to include a foreign key in a table that links to a user
>> > in Django's auth_user table.  Or maybe this is a dumb idea--if so,
>> > interested in hearing why.
>> >
>> >
>> > So the table ("restaurant") with the foreign key includes (mysql):
>> >
>> >
>> > staff_id int(11) NOT NULL,
>> > foreign key(staff_id) references auth_user(id) on delete no action on
>> > update cascade,
>> >
>> >
>> >
>> > If I include this in my model:
>> >
>> >
>> >
>> > from django.contrib.auth.models import User
>> >
>> > staff_id = models.ForeignKey(User, db_column = 'id')
>>
>> This probably isn't what you inteded to write. The db_column attribute
>> specifies what the name of the database column in *this* table will be
>> called. The name of the column in the table it refers to is worked out
>> automatically (since it's almost always the primary key of that table
>> and for other cases, Django has the to_field attribute).
>>
>> 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: Nesting inlines with django-admin

2008-09-11 Thread David Durham, Jr.

> I'm having the same need for nested inlines.

Bump.  I'm probably going to take the plunge and try to implement this
if no one has beaten me to it.


-Dave

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

2008-09-11 Thread Chris Stromberger
Oh, thanks.  Ok, I just tried taking that out (so model now says "staff_id =
models.ForeignKey(User)"), but that gave this error:
OperationalError: (1054, "Unknown column 'restaurant.staff_id_id' in 'field
list'")

?


On Thu, Sep 11, 2008 at 4:09 PM, Malcolm Tredinnick <
[EMAIL PROTECTED]> wrote:

>
>
> On Thu, 2008-09-11 at 16:01 -0500, Chris Stromberger wrote:
> > I would like to include a foreign key in a table that links to a user
> > in Django's auth_user table.  Or maybe this is a dumb idea--if so,
> > interested in hearing why.
> >
> >
> > So the table ("restaurant") with the foreign key includes (mysql):
> >
> >
> > staff_id int(11) NOT NULL,
> > foreign key(staff_id) references auth_user(id) on delete no action on
> > update cascade,
> >
> >
> >
> > If I include this in my model:
> >
> >
> >
> > from django.contrib.auth.models import User
> >
> > staff_id = models.ForeignKey(User, db_column = 'id')
>
> This probably isn't what you inteded to write. The db_column attribute
> specifies what the name of the database column in *this* table will be
> called. The name of the column in the table it refers to is worked out
> automatically (since it's almost always the primary key of that table
> and for other cases, Django has the to_field attribute).
>
> 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: comparing Model instances

2008-09-11 Thread Steve Holden

Malcolm Tredinnick wrote:
> 
> On Thu, 2008-09-11 at 15:36 +0800, Eric Abrahamsen wrote:
>> I'm fooling around with comparing instances of different models,  
>> trying to make a unified stream of instances that can be sorted by  
>> date according to a certain datetime attribute on each model. I  
>> thought I'd define a __cmp__ method on each model in question, that  
>> would provide the appropriate attribute, rather than writing a sort  
>> key function. I started off just comparing instances of different  
>> models, to see what would happen, and found that some instances  
>> evaluate to 'greater than' other instances, but I don't know what the  
>> criteria is. It's not foreign key, and looking at the source I don't  
>> see anything defined for Model except for __eq__ and __ne__. Can  
>> someone enlighten?
> 
> The "object" type/class has a __cmp__ method, essentially. It's
> comparing id() of the instances. Having some kind of natural ordering on
> models isn't something Django can do by default, since it's highly
> domain dependent. Also, we need to define __eq__ on models so that
> models with the same primary key of the same type hash as equal. That
> means you can use model instances as dictionary keys, for example.
> 
> Defining your own __lt__ and __gt__ methods is going to mess with that a
> bit unless you're careful, so probably isn't recommend (it's going to be
> confusing if "not a 
A further consideration is that if you want to use the python sort()
method on lists of model instances, the cmp() function will be called
with many pairs of such instances. You will almost certainly find it
quicker to define a key() function and provide that; the function is
called once per model instance to create sort keys, which can be
compared from within the C implementation of the sort() method without
the need to call back out into Python code.

I've got some timings lying around somewhere that clearly show the
decorate/sort/undecorate implementation is way faster under normal
circumstances.

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.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: Slow edit_inline admin forms

2008-09-11 Thread Karen Tracey
On Thu, Sep 11, 2008 at 4:15 PM, OliverMarchand
<[EMAIL PROTECTED]>wrote:

>
> Dear all,
>
> we are experiencing rather slow edit_inline admin forms, especially,
> when the inlined models contain foreign keys to "large tables" for
> which the select boxes must fetch *all* the tables data to be able to
> evaluate the __unicode__ method for each instance of the model.
>
> * Are you experiencing the same?
> * Is there any way to circumvent this/speed this up?
>

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#raw-id-fields

will prevent use of the listboxes.

Karen

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



Re: Newbie -- ForeignKey to auth_user?

2008-09-11 Thread Chris Stromberger
And if I comment out the staff_id line in the model class, my test in the
console works fine (Restaurant.objects.all()).

On Thu, Sep 11, 2008 at 4:20 PM, Chris Stromberger <
[EMAIL PROTECTED]> wrote:

> Oh, thanks.  Ok, I just tried taking that out (so model now says "staff_id
> = models.ForeignKey(User)"), but that gave this error:
> OperationalError: (1054, "Unknown column 'restaurant.staff_id_id' in 'field
> list'")
>
> ?
>
>
> On Thu, Sep 11, 2008 at 4:09 PM, Malcolm Tredinnick <
> [EMAIL PROTECTED]> wrote:
>
>>
>>
>> On Thu, 2008-09-11 at 16:01 -0500, Chris Stromberger wrote:
>> > I would like to include a foreign key in a table that links to a user
>> > in Django's auth_user table.  Or maybe this is a dumb idea--if so,
>> > interested in hearing why.
>> >
>> >
>> > So the table ("restaurant") with the foreign key includes (mysql):
>> >
>> >
>> > staff_id int(11) NOT NULL,
>> > foreign key(staff_id) references auth_user(id) on delete no action on
>> > update cascade,
>> >
>> >
>> >
>> > If I include this in my model:
>> >
>> >
>> >
>> > from django.contrib.auth.models import User
>> >
>> > staff_id = models.ForeignKey(User, db_column = 'id')
>>
>> This probably isn't what you inteded to write. The db_column attribute
>> specifies what the name of the database column in *this* table will be
>> called. The name of the column in the table it refers to is worked out
>> automatically (since it's almost always the primary key of that table
>> and for other cases, Django has the to_field attribute).
>>
>> 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: autofill user

2008-09-11 Thread Malcolm Tredinnick


On Thu, 2008-09-11 at 22:16 +0200, Stephan Hoyer wrote:
> Hi All
> 
> i want to store the add and changetime an user to some models, therefor 
> i created a abstract class to inherit from:
> 
> class DublinCore(models.Model):
> inserted= models.DateTimeField(auto_now_add=True)
> updated = models.DateTimeField(auto_now=True)
> inserter= models.ForeignKey(User, related_name = 'inserter')
> updater = models.ForeignKey(User, related_name = 'update')
> 
> class Meta:
> abstract = True
> 
> 
> How can i get the user automaticaly inserted/updated. I searched the 
> web, but only get stuff of previous djangoversions (2 years ago) which 
> are quite complicated.

With no reference to what you found, it's difficult to know if that's
the recommended way, but the way to do this two years ago is the same as
today.

Models and the ORM layer are quite separate from requests, responses and
views and "the current user" only makes sense in the latter (it's very
common to use models without having any concept of a current user, for
example). So you'll either have to set the user manually in the view, or
use something like threadlocals for storing it in the view so that the
model's save method can pull it out.

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: Newbie -- ForeignKey to auth_user?

2008-09-11 Thread Malcolm Tredinnick


On Thu, 2008-09-11 at 16:01 -0500, Chris Stromberger wrote:
> I would like to include a foreign key in a table that links to a user
> in Django's auth_user table.  Or maybe this is a dumb idea--if so,
> interested in hearing why.
> 
> 
> So the table ("restaurant") with the foreign key includes (mysql):
> 
> 
> staff_id int(11) NOT NULL,
> foreign key(staff_id) references auth_user(id) on delete no action on
> update cascade,
> 
> 
> 
> If I include this in my model:
> 
> 
> 
> from django.contrib.auth.models import User
> 
> staff_id = models.ForeignKey(User, db_column = 'id')

This probably isn't what you inteded to write. The db_column attribute
specifies what the name of the database column in *this* table will be
called. The name of the column in the table it refers to is worked out
automatically (since it's almost always the primary key of that table
and for other cases, Django has the to_field attribute).

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



Connecting to AS400

2008-09-11 Thread Jason Sypolt

Is it possible to connect to an as400 database using django
(preferably) or with python? I would like to build a product catalog
site using django and read in products and send orders to the as400.

Note that the site itself will not be on an as400 system. Just
wondering if anyone has done this before and if so, can you point me
to some resources/libraries? Thanks!

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



autofill user

2008-09-11 Thread Stephan Hoyer

Hi All

i want to store the add and changetime an user to some models, therefor 
i created a abstract class to inherit from:

class DublinCore(models.Model):
inserted= models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
inserter= models.ForeignKey(User, related_name = 'inserter')
updater = models.ForeignKey(User, related_name = 'update')

class Meta:
abstract = True


How can i get the user automaticaly inserted/updated. I searched the 
web, but only get stuff of previous djangoversions (2 years ago) which 
are quite complicated.
How is it done today?

Thanks for answering
Stephan

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



Accessing field names and data from a queryset in a generic template

2008-09-11 Thread SnappyDjangoUser

I am a new django user so please excuse my naive question.

I have a generic view function (see below) which is used to perform a
query on one of many tables (depending on the "model" argument) and
then render the results to a single template file (object_list.html)

def item_list(request, model='device'):
# determine which table
TableName = ModelNameDictionary[model]
order_by_field = OrderByFieldDictionary[model]

# Get a list of all entires for this object
if order_by_field == '':
latest_object_list = TableName.objects.all()
else:
latest_object_list =
TableName.objects.all().order_by(order_by_field)

# Get the number of objects.
paginator = Paginator(latest_object_list, 0)
result_count = paginator._get_count()

t = loader.get_template('object_list.html')
c = Context({
'ObjectName': NameDictionary[model],
'latest_object_list': latest_object_list,
'result_count': result_count,
})
return HttpResponse(t.render(c))

I am planning on using a generic template (object_list.html) to print
the data in a tabular format.  How can I access the database field
names and the data if I don't know which table was queried and is
being renderd?  Below is pseudo code from object_list.html that I am
looking for help filling in

{% if latest_object_list %}



{% for header in latest_object_list %}
{{ header.field_name }}
{% endfor %}



{% for item in latest_object_list %}

{% for column in item %}
{{ item.column_data }}
{% endfor %}

{% endfor %}


{% else %}
No {{ ObjectName }} are available.
{% endif %}

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

2008-09-11 Thread Chris Stromberger
I would like to include a foreign key in a table that links to a user in
Django's auth_user table.  Or maybe this is a dumb idea--if so, interested
in hearing why.
So the table ("restaurant") with the foreign key includes (mysql):

staff_id int(11) NOT NULL,
foreign key(staff_id) references auth_user(id) on delete no action on update
cascade,

If I include this in my model:

from django.contrib.auth.models import User
staff_id = models.ForeignKey(User, db_column = 'id')

it seems to screw things up.  If I start a python shell, import my model,
then run Restaurant.objects.all(), I get

OperationalError: (1054, "Unknown column 'restaurant.id' in 'field list'")

Not sure what is going on.  The model has an explicit primary key defined
(this is a legacy db):

  restaurant_id = models.AutoField(primary_key = True)

Thanks for any help,
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: Security question

2008-09-11 Thread Gerard Petersen

Hi Oliver,

This feels completely off topic for a Django post, nevertheless ..

I don't see the problem. If your webserver contacts the application server via 
port 80 or 443 then you should have your firewall between DMZ 1 and 2 allow 
those ports. And allow only the source IP of the webserver to do that.

For more control you could limit request bursts in your firewall, but then you 
should really know what your doing. As far as mac addresses, everything is 
spoofable these days so monitoring logs from in host firewalls (iptables) is 
always a good idea.

I don't see how this is a Django issue. Don't know if this helped, maybe you 
should drop a post at: http://lists.netfilter.org/


Regards,

Gerard.


OliverMarchand wrote:
> Dear all,
> 
> we are using Django as an application server. Now we want our website
> server to be able to read from (and eventually write to) that
> application server. Now the security question arises. The proposal is
> to have
> - the webserver in a DMZ 1
> - the Django application server in a DMZ 2
> - our internal LAN as another network
> Then we allow very limited requests from DMZ 1 into DMZ 2 and
> to allow no access from DMZ 2 into the LAN.
> 
> Are there people here with similar setup or views on the subject.
> So you have suggestions about the best limitation for requests from
> DMZ 1 to DMZ 2 (based on port,MAC adress, etc...)?
> 
> Thanks for any advice,
> Oliver
> > 

-- 
urls = { 'fun':  'www.zonderbroodje.nl',  'tech':  'www.gp-net.nl' }


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



Slow edit_inline admin forms

2008-09-11 Thread OliverMarchand

Dear all,

we are experiencing rather slow edit_inline admin forms, especially,
when the inlined models contain foreign keys to "large tables" for
which the select boxes must fetch *all* the tables data to be able to
evaluate the __unicode__ method for each instance of the model.

* Are you experiencing the same?
* Is there any way to circumvent this/speed this up?

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

2008-09-11 Thread MikeHowarth

Anyone?

I'm really struggling with this.

As stated in my first post running the code creates a recursive loop.

Had a bit of a hack around with things, but can't figure anything
obvious out.

On Sep 11, 10:58 am, MikeHowarth <[EMAIL PROTECTED]> wrote:
> The model I'm using is very similar to that of Satchmo's
>
> Model basically looks like this:
>
> class Product(models.Model):
> name = models.CharField(_("Full Name"), max_length=255, blank=False,
> slug = models.SlugField(_("Slug Name"), blank=True,
> related_items = models.ManyToManyField('self', blank=True, null=True,
> verbose_name=_('Related Items'), related_name='related_products')
>
> David Reynolds wrote:
> > On 11 Sep 2008, at 10:06 am, MikeHowarth wrote:
>
> > > Could anyone clarify what I need to do be doing to acheive the desired
> > > filtering?
>
> > Can we see your model too?
>
> > Although, I note satchmo do a similar thing:
>
> >http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/
> > product/models.py#L458
>
> > --
> > David Reynolds
> > [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Security question

2008-09-11 Thread OliverMarchand

Dear all,

we are using Django as an application server. Now we want our website
server to be able to read from (and eventually write to) that
application server. Now the security question arises. The proposal is
to have
- the webserver in a DMZ 1
- the Django application server in a DMZ 2
- our internal LAN as another network
Then we allow very limited requests from DMZ 1 into DMZ 2 and
to allow no access from DMZ 2 into the LAN.

Are there people here with similar setup or views on the subject.
So you have suggestions about the best limitation for requests from
DMZ 1 to DMZ 2 (based on port,MAC adress, etc...)?

Thanks for any advice,
Oliver
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: New django 1.0 website: www.astronomy2009.org

2008-09-11 Thread James Matthews
Very nice site!

Just one point, I would recommend changing the default admin login page from
http:///admin to something random. This does not substitute a good
password but makes your site a little more secure.

James

P.S Post this website on djangosites.org


On Thu, Sep 11, 2008 at 7:41 AM, Juan Hernandez <[EMAIL PROTECTED]>wrote:

> nice dude :)
>
>
> On Fri, Sep 12, 2008 at 9:59 AM, Rock <[EMAIL PROTECTED]> wrote:
>
>>
>> Very interesting. Nice work.
>>
>> That scrolling calendar widget near the bottom right of the home page
>> needs a reset button.
>> Once you scroll a bit, it fills up with so many events that finding
>> your way back to today is tough.
>> (Or maybe that thing is supplied by Google and so you are hosed as
>> they almost never fix bugs of that nature.)
>> Fortunately the menus provide access to current events so maybe this
>> SNAFU is ignorable.
>>
>> Also I noticed "The Portal to the Universe" project. Are you guys
>> doing that one? If so, how can I help?
>>
>> Rock
>>
>>
>>
>> On Sep 11, 9:16 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>> > Dear all,
>> >
>> > We just released a new website for the International Year of Astronomy
>> > 2009 (http://www.astronomy2009.org). It's based on the improved
>> > versions of the django applications we used forwww.iau.org. We are
>> > still working towards decoupling the core applications from the rest
>> > of the site, so it can be released for the public benefit, however
>> > when time is short, short-cuts are made, so there is still some
>> > cleanup to do ;-)
>> >
>> > Thanks for viewing,
>> > Lars Holm Nielsen
>> > European Space Agency/Hubble
>>
>>
>
> >
>


-- 
http://www.goldwatches.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
-~--~~~~--~~--~--~---



troubles with mod_python on Leopard

2008-09-11 Thread [EMAIL PROTECTED]

Hello,

I'm trying to install Django with Mod_Python on Leopard. I've been
through the process on Linux and Windows several times without many
issues, but on Leopard I've come up against a wall and I don't know
what else to check. OS X is the os I have least experience with.

I wanted to install the newest versions of Python and Apache instead
of using the versions that come with OS X. That went fine. I have
django checked, and symlinked from my site-packages directory. It runs
fine on the development server. If I type python at the terminal, I
can import Django without issue. Apache is running as well.

I built Apache and Mod_python using the instructions here:
http://cavedoni.com/2005/django-osx

I have Apache calling a test handler using configurations in
an .htaccess file, so something is right there. However, after
fighting with a "forbidden" message (and winning), I get the message
that I can't import django.core.handlers.modpython when I use the
configuration in the cavedoni.com tutorial.

I had thought that perhaps Mod_python wasn't linked to the correct
version of Python, so I tried to build it again (first clearing the
configuration with distclear). But I'm getting the same problem

I tried to add django to the Python Path using the PythonPath
declaration in my .htaccess file, but pointing it to the symlink and
actual code checkout gives me the same results.

My path looks like this when output from my test mod_python handler:

/Users/jdonato/Documents/code-checkouts/django-trunk/django
/Users/jdonato/Documents/code-checkouts/django-trunk
/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-
darwin
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-
mac
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-
mac/lib-scriptpackages
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-
dynload
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages/PIL

Which is identical to what I see when I open python from the command
line and view sys.path, except here I have the two extra django
directories that I'm adding in the config.

I saw this: 
http://groups.google.com/group/django-users/browse_thread/thread/1cc6ad68d63cb61d?fwc=1
but I tried changing my permissions and there's no change.

My .htaccess file looks like this:
AddHandler python-program .py
PythonHandler mptest
PythonDebug On
PythonPath "['/Users/jdonato/Documents/code-checkouts/django-trunk/
django', '/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django'] + sys.path"

But note that I've tried similiar things in the main apache
configuration file. Right now, for testing purposes, I've removed
the .htaccess file, and changed my main conf file to:


AddHandler python-program .py
AllowOverride FileInfo
PythonHandler mptest
PythonDebug On
PythonPath "['/Users/jdonato/Documents/code-checkouts/django-trunk/
django','/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django'] + sys.path"


In mptest, I try to import Django, but get:ImportError: No module
named django

If any one has any ideas, I'm all out myself and would gladly try
anything. Thank you for reading this long post.

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

2008-09-11 Thread Chris Stromberger
I'm wanting to use Django with a preexisting db.  The db features a linking
table (Many to Many).  I'm wondering if I need to go ahead and define a
model class for this table, or just add the ManyToMany field to one of the
linked models.  Or to put it another way, is there any way to define the
relationship as a ManyToMany field w/o changing the table name/structure?
 Eg, in the online book example, the ManyToMany field generates a table with
a specific name, specific fields and an auto-increment primary key.  The
existing many to many table I have does not match--name is different,
obviously, and it only has the two foreign keys, both of which together form
the primary key.
Not sure how to handle this with models...

Thanks for any pointers,
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
-~--~~~~--~~--~--~---



problems with post_save and sites framework

2008-09-11 Thread nek4life

I've been setting trying to set up a tumblelog using the sites
framework and the current site manager and I'm hitting a bug in either
my code or Django's not sure which.

Basically what's happening is the first time I save an object the
tumble item is created, but the site field is not populated so it will
not show up on any site.

The second time I save an object the site field is then populated and
the tumble item shows up on the appropriate site.  I'm not sure what's
going on here, but it's driving me nuts.  Any ideas?


from django.db import models
from django.contrib.contenttypes import generic
from django.template.loader import render_to_string
from django.db.models import signals
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager
from posts.models import *

class TumbleItem(models.Model):
content_type = models.ForeignKey(ContentType)
object_id= models.PositiveIntegerField()
pub_date = models.DateTimeField()
site = models.ManyToManyField(Site)
objects  = models.Manager()
on_site  = CurrentSiteManager()

content_object = generic.GenericForeignKey('content_type',
'object_id')

def get_rendered_html(self):
template_name = 'tumblelog/includes/tumble_item_%s.html' %
(self.content_type.name)
return render_to_string(template_name, { 'object':
self.content_object })


def create_tumble_item(sender, instance, signal, *args, **kwargs):
# Check to see if the object was just created for the first time
if 'created' in kwargs:
if kwargs['created']:
create = True

# Get the instance's content type
ctype = ContentType.objects.get_for_model(instance)

site = instance.site
pub_date = instance.publish

if instance.status == 1:
create = False

if create:
ti, created =
TumbleItem.objects.get_or_create(content_type=ctype,
object_id=instance.id, pub_date=pub_date)
for s in site.all():
ti.site.add(s)

else:
create = True

# Get the instance's content type
ctype = ContentType.objects.get_for_model(instance)

pub_date = instance.publish
site = instance.site

if instance.status == 1:
create = False

if create:
ti, created =
TumbleItem.objects.get_or_create(content_type=ctype,
object_id=instance.id, pub_date=pub_date)
for s in site.all():
ti.site.add(s)


# Send a signal on post_save for each of these models
for Post in [Article, Audio, Video, Download, Quote, Photo, Link,
Snippet]:
models.signals.post_save.connect(create_tumble_item,
sender=Post)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unexpected keyword argument 'raw_in_admin' in Django 1 release 9014?

2008-09-11 Thread Karen Tracey
On Thu, Sep 11, 2008 at 12:44 PM, bkev <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I'm trying to set up this simple model in Django and I'm getting an
> "init got unexpected keyword argument 'raw_in_admin'" in Django 1.0
> release 9014 when doing a syncdb. I'm trying to get a non-dropdown
> ForeignKey (or OneToOneField) field...am I doing something wrong or
> was something changed in Django 1.0?
>
> class Depth(models.Model):
>depth_feetinch = models.CharField(verbose_name="Depth",
> max_length=10)
>
> class Dimensions(models.Model):
>depth = models.ForeignKey(Depth, raw_id_admin=True)
>

Yes, admin changed.  Depending on what your original frame of reference is,
other stuff (unicode, autoescape) may have changed as well.   You'll want to
take a look at:

http://docs.djangoproject.com/en/dev/releases/1.0-porting-guide
Karen

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



Re: Form validation problem for model with ForeignKey having unique=True,blank=True,null=True

2008-09-11 Thread Nathaniel Griswold

Thanks, created Ticket #9039

> I don't think the ModelForm validation should prohibit something the
> databases generally allow. I'd open a ticket (search first though to see if
> it's already been reported/decided on...I could be missing something).
>
> Karen
>

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



Displaying a list of lists?

2008-09-11 Thread Lance F. Squire

Currently using Django version 0.96.3, on a Fedora 8 system.

I've currently set-up models for 'Manufacturer' and 'System'. System
has a Foreignkey to Manufacturer.

I'd like to display a list like so:

Manu A
   System a
   System b
   System c

Manu B
   System a
   System b
   System c

Etc...

Only listing Manufacturers that had systems of type X.

I was thinking of using code like this in the View,

 man=Manufacturer.objects.all()
>>> for m in man:
...sys=System.objects.filter(manufacturer=m.id)
...print m.name
...for s in sys:
...   print "  %s" % s.name
...

This works from the shell, but I'm unsure how to get the output to the
template And, I suspect is a terribly inefficient way to do it anyway.

I'm guessing I should be doing something simpler here and then doing
something in the template to form the list

Any help appreciated, including severe beatings with a clue stick. ;)

This is only my 2nd attempt at a Django project, and I'm stumped at
the moment.

Thanks,

Lance
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Design question: Persistent / non-transactional process & django

2008-09-11 Thread Olivier Guilyardi

[EMAIL PROTECTED] wrote:

> If we want to make a persistent TCP connection with a data queue, is
> django the best place (or even a possible place) for this connection
> layer to live?  I see these options:

In a production environment, you need Django to run on Apache, so I think you
can't expect anything to be persistent at the application level.

> 
> 1) Write a separate TCP daemon app which accepts the input from django
> and maintains a permanent connection to the remote proprietary
> service.  (Which IPC mechanism would work best is another question:
> using a database table as a queue?  Using a unix socket and a memory
> queue on the daemon?)

The problem with a daemon, is that, in the long run, it may crash or become
unresponsive for various reasons.

> 2) Find somewhere in django where I can create a persistent queue,
> have the http transaction write to the queue and have a django service
> persistently checking the queue while maintaining the outbound TCP
> connection.  This is where I am especially short on technical
> knowledge.  Is there any way to have code running persistently in the
> django environment that starts when the web server is started, or is
> everything entirely event driven?

Correct me if I'm wrong, but to my understanding Django operates as a normal web
application framework upon Apache, and so yes it is entirely "event driven".
Running some code persistently, if possible, is going to be complicated, and may
cause the same trouble mentioned above about a daemon.

But if you can tolerate a little latency, the solution to your problem may be
very simple:

1 - Make your Django app write the data that needs to be sent into to a database
table
2 - Every minute (or hour, ...) run a cron job (a simple Python script) that
checks the database table, establish the needed TCP connection, send it all and
cleanup the sent entries from the table.

Hope that helps,

--
  Olivier / Samalyse




-- 
  Olivier Guilyardi / Samalyse

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



Re: comparing Model instances

2008-09-11 Thread Malcolm Tredinnick


On Thu, 2008-09-11 at 15:36 +0800, Eric Abrahamsen wrote:
> I'm fooling around with comparing instances of different models,  
> trying to make a unified stream of instances that can be sorted by  
> date according to a certain datetime attribute on each model. I  
> thought I'd define a __cmp__ method on each model in question, that  
> would provide the appropriate attribute, rather than writing a sort  
> key function. I started off just comparing instances of different  
> models, to see what would happen, and found that some instances  
> evaluate to 'greater than' other instances, but I don't know what the  
> criteria is. It's not foreign key, and looking at the source I don't  
> see anything defined for Model except for __eq__ and __ne__. Can  
> someone enlighten?

The "object" type/class has a __cmp__ method, essentially. It's
comparing id() of the instances. Having some kind of natural ordering on
models isn't something Django can do by default, since it's highly
domain dependent. Also, we need to define __eq__ on models so that
models with the same primary key of the same type hash as equal. That
means you can use model instances as dictionary keys, for example.

Defining your own __lt__ and __gt__ methods is going to mess with that a
bit unless you're careful, so probably isn't recommend (it's going to be
confusing if "not a 
> Thanks,
> Eric
> 
> > 
> 


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



The User mess

2008-09-11 Thread Dan Ellis

First of all, congratulations to the team on reaching 1.0. It looks
like a lot of good features landed in time.

One thing that I still find messy, though, is the whole user/profile
thing. Having separate models for users and profiles has a number of
drawbacks:

  * extra DB hits
  * having to traverse either the user attribute or the result of the
get_profile method
  * by default, the user information is split across two models in the
admin interface
  * the user, the profile, or both might need to be saved depending on
which information was edited
  * uncertainty over whether other models should have user or profile
as FK
  * uncertainty over whether friendship relationship should be on user
or profile

Some people have suggested that the qsrf inheritance be used to create
a model derived from User, and a custom authentication backend written
that creates and returns instances of the appropriate model. I'm
fairly "meh" on that idea (and ORM-based inheritance in general, but
that's another story), and it doesn't seem to be a solution supported
by the official documentation.

What I'd like to see is an easy, supported way of specifying the name
of the user model in the settings file, thereby avoiding all of the
above complexity. There are a few places where hard-coded references
to django.contrib.auth.models.User would need to be replaced, but I
can think of a couple of ways of doing that, including backwards-
compatible ones. Can anyone think of any reasons why this would be a
bad idea? I'd certainly be willing to provide a suitable patch.

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

2008-09-11 Thread Simon Willison

On Sep 11, 5:23 pm, Glimps <[EMAIL PROTECTED]> wrote:
>     I would like to restrict users to the data they can see/modify/
> delete on a table. I have a Reservation table that holds reservations
> for multiple banners of Restaurant chain. I don't want the user from
> franchiseX to be able to see/confirm reservations from franchiseY.
>
> Since all the add/edit/delete is made with the admin interface (Django
> 1.0) I went and search for something I could override in the
> ModelAdmin class. No success.

Take another look at ModelAdmin - the methods you want to over-ride
are queryset(request) which returns the QuerySet used to create the
"change list" view and has_add_permission(request),
has_change_permission(request, obj) and has_delete_permission(request,
obj).

You can over-ride those methods on your ModelAdmin subclass to
implement your permissions logic. Your code will end up looking
something like this:

class ReservationAdmin(admin.ModelAdmin):
def queryset(self, request):
return super(ReservationAdmin, self).filter(user =
request.user)

def has_change_permission(self, request, obj=None):
if not obj:
return False
return obj.user == request.user

def has_delete_permission(self, ...)
# similar

Cheers,

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



Design question: Persistent / non-transactional process & django

2008-09-11 Thread [EMAIL PROTECTED]

This is half design question, half technical question.  I'm hoping
someone in this community may have experience to share.

I need to feed data to a proprietary system over a TCP connection
based on information entered into a web form.  Currently I do this
using django, where the django page opens the connection, sends the
data, and closes the connection again.  This has worked fine for
relatively low volumes but is a lot of overhead (setting up and taking
down the TCP connection) and our number of transactions is about to
dramatically increase.

The design question:

If we want to make a persistent TCP connection with a data queue, is
django the best place (or even a possible place) for this connection
layer to live?  I see these options:

1) Write a separate TCP daemon app which accepts the input from django
and maintains a permanent connection to the remote proprietary
service.  (Which IPC mechanism would work best is another question:
using a database table as a queue?  Using a unix socket and a memory
queue on the daemon?)

2) Find somewhere in django where I can create a persistent queue,
have the http transaction write to the queue and have a django service
persistently checking the queue while maintaining the outbound TCP
connection.  This is where I am especially short on technical
knowledge.  Is there any way to have code running persistently in the
django environment that starts when the web server is started, or is
everything entirely event driven?

If anyone in the community has any ideas or comments, I'd love to hear
them!

Thanks,
Peter


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



Re: NameError

2008-09-11 Thread unklbeemer

On Sep 11, 8:22 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> unklbeemer wrote:
> > Thanks! That helped with that error...but now i get a new one lol
>
> > Exception Type: NoReverseMatch at /profiles/edit/
> > Exception Value: Reverse for 'profile_public' with arguments
> > '(u'username',)' and keyword arguments '{}' not found.
>
> That means that you don't have a named url pattern in your urls.py
> called 'profile_public' but your view seems to be referencing it.
> Alternatively, you do have such a url pattern but it takes a different
> set of arguments than the one you are giving it when you call
> 'reverse'.
>
> You should go over the URL dispatcher docs 
> here:http://docs.djangoproject.com/en/dev/topics/http/urls/
>
> In particular, look at named URL patterns and the reverse function's
> sub-topics there.
>
> Also, it helps if you bottom post your responses -- it's easier for
> people to see what you are responding to as compared to when you top
> post.
>
> Cheers,
> -Rajesh D


Thanks! I'll take a look at that. (Notice how this was on the
bottom :-] )
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Unexpected keyword argument 'raw_in_admin' in Django 1 release 9014?

2008-09-11 Thread bkev

Hi,

I'm trying to set up this simple model in Django and I'm getting an
"init got unexpected keyword argument 'raw_in_admin'" in Django 1.0
release 9014 when doing a syncdb. I'm trying to get a non-dropdown
ForeignKey (or OneToOneField) field...am I doing something wrong or
was something changed in Django 1.0?

class Depth(models.Model):
depth_feetinch = models.CharField(verbose_name="Depth",
max_length=10)

class Dimensions(models.Model):
depth = models.ForeignKey(Depth, raw_id_admin=True)

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



Restrict users to their own data

2008-09-11 Thread Glimps

Hi,
I would like to restrict users to the data they can see/modify/
delete on a table. I have a Reservation table that holds reservations
for multiple banners of Restaurant chain. I don't want the user from
franchiseX to be able to see/confirm reservations from franchiseY.

Since all the add/edit/delete is made with the admin interface (Django
1.0) I went and search for something I could override in the
ModelAdmin class. No success.

I went and try to see if there was a signal I could use, something
like post_model_get, nothing there either.

Now my idea was to add a "User" field (ForeignKey to
django.contrib.auth.models.User) in the Reservation table. Check what
groups the user belongs to and only allow operations on the record for
users of the same group.

Where should I look to do that?

Better ideas?

TIA

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

2008-09-11 Thread Matthias Kestenholz

On Thu, Sep 11, 2008 at 6:00 PM, ek_wals <[EMAIL PROTECTED]> wrote:
>
> What then is the point of 'is_superuser'  or superuser's in general?
>
> Looking through the Django code, it seems that the only use for
> superusers is that a superuser is automatically a moderator.
>
> Could be so much more.
>

Yeah, ... a super user could have all permissions that are defined
in a project for example. Wait a moment -- that's already true today!
(See the User has_perm method)

Do you have some other ideas, what a superuser could be apart from that?

Matthias

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



looking for event registration/calendar modules

2008-09-11 Thread Marcus

Hi -- django newbie here putting together a site for a client who
wants a calendar of events that users can register for.  Before I
build one I thought I'd check with the community to see if something
similar already exists-- any suggestions?  I think a general calendar
model, or something that already handles events with reminders would
be fine.

Thanks for the help!
Marcus

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

2008-09-11 Thread ek_wals

What then is the point of 'is_superuser'  or superuser's in general?

Looking through the Django code, it seems that the only use for
superusers is that a superuser is automatically a moderator.

Could be so much more.




On Sep 11, 8:27 am, "Matthias Kestenholz" <[EMAIL PROTECTED]> wrote:
> On Thu, Sep 11, 2008 at 5:22 PM, ek_wals <[EMAIL PROTECTED]> wrote:
>
> > And I can see exactly how to do it --
> > copy  contrib/admin/views/decorators.py:staff_member _required   and
> > change
> > 'request.user.is_staff'  to 'request.user.is_superuser'
>
> > Sure seems repetitive (non-DRY) (wet?)
> > Its seems so easy that I can't help but think that I'm overlooking
> > something. Why would Django provide both 'is_staff' and 'is_superuser'
> > but only provide a decorator for one of them??  Assuming that its just
> > an oversight seems dangerous.
>
> > Any thoughts would be welcome
>
> Well, normally it is interesting if a user has certain permissions (is he
> allowed to log into the admin interface, does he have add permission on
> a certain model). It is seldom interesting to know if she has ALL permissions.
>
> Matthias
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: utf-8 text in models with coding: keyword

2008-09-11 Thread Elizabeth Kellner



On 11 Sep., 14:27, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
>
> Text in utf-8 is not unicode, this is bytestring (what we had in 0.96  
> in __str__). From __unicode__ you have to return unicode ubjects, not  
> utf-8 encoded bytestrings.

This is important to know, and that was the root of the problem in my
server, thank you.

Once I had unicode-typed strings coming out of my __unicode__
function, I could combine that with a bytestring of utf-8 encoded data
without issue.


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

2008-09-11 Thread Karen Tracey
On Thu, Sep 11, 2008 at 7:40 AM, Elizabeth Kellner <[EMAIL PROTECTED]>wrote:

>
> Hi.  I have a UnicodeDecodeError error that I can't seem to get rid
> of.  My model has utf-8 text, which is being returned in the model's
> __unicode__ function.  However, I can't seem to use the expression
> ("%s" % object) to coerce my utf-8 into a string, without it tring to
> decode the string as ascii.
>
> Here's a mockup of the problem:
> [snipped]


Are you using a binary collation in MySQL for this model field?  Then you
are likely tripping over the fact that MySQLdb 1.2.2 returns these values as
bytestrings instead of unicode objects.  This is documented here:

http://docs.djangoproject.com/en/dev/ref/databases/#collation-settings

That note mentions the smart_unicode() function within Django you can use to
coerce the utf-8 bytestring to unicode (it can be safely used for unicode
values as well, so won't hurt things if this MySQLdb behavior changes in the
future).  This is what you should be using in your __unicode__ method.

If you are not using a binary collation, then specifics of the actual error
you are running into instead of a mockup might help, as it is what you have
described is just how Python works.

Karen

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



Re: New Comments: Bad Magic Number Error

2008-09-11 Thread [EMAIL PROTECTED]

Wow, Thanks everyone!!! These are really helpful tips!
Dave

On Sep 11, 1:42 am, Dave <[EMAIL PROTECTED]> wrote:
> On Sep 11, 9:15 am, Benjamin Buch <[EMAIL PROTECTED]> wrote:
>
>
>
> > find /path/to/the/directory/ -type f -name "*.pyc" -exec rm -f {} \;
>
> > Use it with caution, I'm no wizard with the terminal, just wanted to  
> > share this because it's been useful to me.
> > I found it somewhere on the net, can't find it again, so no link to  
> > the original post...
>
> I would tend to do:
>
> find /path/to/django/source -name '*.pyc' | xargs rm
>
> As this only calls one rm process, rather than one per file. As
> Benjamin says, this should be run with extreme caution and you should
> definately check you've written '*.pyc' instead of '*.py' as I did
> once.
>
> --
> David Reynolds
> [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Restricting views

2008-09-11 Thread Matthias Kestenholz

On Thu, Sep 11, 2008 at 5:22 PM, ek_wals <[EMAIL PROTECTED]> wrote:
>
>
> And I can see exactly how to do it --
> copy  contrib/admin/views/decorators.py:staff_member _required   and
> change
> 'request.user.is_staff'  to 'request.user.is_superuser'
>
> Sure seems repetitive (non-DRY) (wet?)
> Its seems so easy that I can't help but think that I'm overlooking
> something. Why would Django provide both 'is_staff' and 'is_superuser'
> but only provide a decorator for one of them??  Assuming that its just
> an oversight seems dangerous.
>
> Any thoughts would be welcome

Well, normally it is interesting if a user has certain permissions (is he
allowed to log into the admin interface, does he have add permission on
a certain model). It is seldom interesting to know if she has ALL permissions.

Matthias

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



Re: Restricting views

2008-09-11 Thread ek_wals


And I can see exactly how to do it --
copy  contrib/admin/views/decorators.py:staff_member _required   and
change
'request.user.is_staff'  to 'request.user.is_superuser'

Sure seems repetitive (non-DRY) (wet?)
Its seems so easy that I can't help but think that I'm overlooking
something. Why would Django provide both 'is_staff' and 'is_superuser'
but only provide a decorator for one of them??  Assuming that its just
an oversight seems dangerous.

Any thoughts would be welcome


On Sep 11, 8:10 am, David Zhou <[EMAIL PROTECTED]> wrote:
> On Sep 11, 2008, at 11:07 AM, ek_wals wrote:
>
> > How should I restrict a page to a superuser only??
>
> > There's a 'staff_member_required' decorator, wht not a
> > 'superuser_required'?
>
> It'd be simple enough to write your own decorator to check for  
> required permissions.  I usually do so anyway, in case I need to  
> change how permission works in the future.
>
> ---
> David Zhou
> [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Restricting views

2008-09-11 Thread David Zhou

On Sep 11, 2008, at 11:07 AM, ek_wals wrote:

> How should I restrict a page to a superuser only??
>
> There's a 'staff_member_required' decorator, wht not a
> 'superuser_required'?

It'd be simple enough to write your own decorator to check for  
required permissions.  I usually do so anyway, in case I need to  
change how permission works in the future.

---
David Zhou
[EMAIL PROTECTED]





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



Restricting views

2008-09-11 Thread ek_wals

How should I restrict a page to a superuser only??

There's a 'staff_member_required' decorator, wht not a
'superuser_required'?

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

2008-09-11 Thread Juan Hernandez
nice dude :)

On Fri, Sep 12, 2008 at 9:59 AM, Rock <[EMAIL PROTECTED]> wrote:

>
> Very interesting. Nice work.
>
> That scrolling calendar widget near the bottom right of the home page
> needs a reset button.
> Once you scroll a bit, it fills up with so many events that finding
> your way back to today is tough.
> (Or maybe that thing is supplied by Google and so you are hosed as
> they almost never fix bugs of that nature.)
> Fortunately the menus provide access to current events so maybe this
> SNAFU is ignorable.
>
> Also I noticed "The Portal to the Universe" project. Are you guys
> doing that one? If so, how can I help?
>
> Rock
>
>
>
> On Sep 11, 9:16 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > Dear all,
> >
> > We just released a new website for the International Year of Astronomy
> > 2009 (http://www.astronomy2009.org). It's based on the improved
> > versions of the django applications we used forwww.iau.org. We are
> > still working towards decoupling the core applications from the rest
> > of the site, so it can be released for the public benefit, however
> > when time is short, short-cuts are made, so there is still some
> > cleanup to do ;-)
> >
> > Thanks for viewing,
> > Lars Holm Nielsen
> > European Space Agency/Hubble
> >
>

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



Re: Form validation problem for model with ForeignKey having unique=True,blank=True,null=True

2008-09-11 Thread Karen Tracey
On Thu, Sep 11, 2008 at 8:14 AM, krylatij <[EMAIL PROTECTED]> wrote:

>
> You can create only one model with empty 'other' field.
> If you could  create one more, field 'other'  will not be unique more.
> That's why validation fails.
>

This is not generally true at the database level, as Nathaniel showed by the
fact that he could indeed create multiple objects with null values, just not
via a ModelForm.  From the PostgreSQL doc (
http://www.postgresql.org/docs/8.3/interactive/indexes-unique.html):

"When an index is declared unique, multiple table rows with equal indexed
values will not be allowed. Null values are not considered equal."

and MySQL (http://dev.mysql.com/doc/refman/5.0/en/create-index.html):

"A UNIQUE index creates a constraint such that all values in the index must
be distinct. An error occurs if you try to add a new row with a key value
that matches an existing row. This constraint does not apply to NULL values
except for the BDB storage engine. For other engines, a UNIQUE index allows
multiple NULL values for columns that can contain NULL."

I don't think the ModelForm validation should prohibit something the
databases generally allow. I'd open a ticket (search first though to see if
it's already been reported/decided on...I could be missing something).

Karen

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



Re: New django 1.0 website: www.astronomy2009.org

2008-09-11 Thread Rock

Very interesting. Nice work.

That scrolling calendar widget near the bottom right of the home page
needs a reset button.
Once you scroll a bit, it fills up with so many events that finding
your way back to today is tough.
(Or maybe that thing is supplied by Google and so you are hosed as
they almost never fix bugs of that nature.)
Fortunately the menus provide access to current events so maybe this
SNAFU is ignorable.

Also I noticed "The Portal to the Universe" project. Are you guys
doing that one? If so, how can I help?

Rock



On Sep 11, 9:16 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> We just released a new website for the International Year of Astronomy
> 2009 (http://www.astronomy2009.org). It's based on the improved
> versions of the django applications we used forwww.iau.org. We are
> still working towards decoupling the core applications from the rest
> of the site, so it can be released for the public benefit, however
> when time is short, short-cuts are made, so there is still some
> cleanup to do ;-)
>
> Thanks for viewing,
> Lars Holm Nielsen
> European Space Agency/Hubble
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: help using django templates for site translation

2008-09-11 Thread Martin Sagastume

In some way.. it seems to, does anybody knows if its posible to add
mod_python to XAMPP ???

I dont like the risky only for development way to show media !




On Thu, Sep 11, 2008 at 6:01 AM, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> On Thu, Sep 11, 2008 at 9:41 AM, msagas <[EMAIL PROTECTED]> wrote:
>>
>> Hello everyone  :)
>>
>> A newbie here ! coming from PHP and trying to learn django... i bought
>> the Apress Definitive Guide to Django book.. and im stuck in chapter
>> 4... in the template stuff... i do understand the things the expose on
>> the book, but im trying to do some more elaborated examples rather
>> than the simple one of the books. As you realise im not good at
>> english :P ... but i will try to explain the best i can.
>>
>> Ok.. I have a HTML site in my /home/lampp/htdocs/mysite/template
>> there i have the index.html , the /css/style.css and the /images/*
>> directory with the images of the web page.
>>
>> What i want to do is.. to show the user the index.html with the web
>> menu in english:
>>
>> home | download | documentation | .   (a common web menu)
>>
>> if the user enter my website  localhost:8000  i want to show it in
>> english, but if he enter localhost:8000/es/   y want to show it in
>> spanish...
>>
>> what i did is :
>>
>> 000 urls.py 00
>> from django.conf.urls.defaults import *
>> from mysite.views import es
>> urlpatterns = patterns('',
>>(r'es/$',es),
>> )
>>
>> 000 views.py 00
>> from django.shortcuts import render_to_response
>>
>> def es(request):
>>menu =
>> {'home':'inicio','download':'descarga','source':'cod.fuente','documentation':'documentacion'}
>>
>>return render_to_response('index.html',
>> {'home':menu['home'],'download':menu['download'],'source':menu['source'],'documentation':menu['documentation']})
>>
>> 000 settings.py 00
>> TEMPLATE_DIRS = (
>>'/opt/lampp/htdocs/mysite/template',
>> )
>>
>> 000 ..template/index.html 00
>> (...) // all html and css and js import , head and body tags also
>>
>>
>>  
>>
>>> class="menu">{{ home }}  |
>> {{ download }} |  {{ source }} | {{ documentation }}
>>
>> (...)
>>
>> PLEASE NOTE THAT DJANGO SITE is in /opt/lampp/htdocs/mysite/
>>
>> AND THE TEMPLATE IS IN /opt/lampp/htdocs/mysite/template
>>
>> AND ALSO THE index.html USES IMAGES AND CSS STORED IN  /opt/lampp/
>> htdocs/mysite/template/images   and  /opt/lampp/htdocs/mysite/template/
>> css
>>
>> The problem im having is that nor css neither images are shown..
>> because when i enter: http://localhost:8000/es/   the html is looking
>> the files in  localhost/es/  directory :S
>>
>> i include a IFRAME with a src="features.html"  to test.. and the error
>> given is:
>>
>> Page not found (404)
>> Request Method: GET
>> Request URL:http://localhost:8000/es/features.html
>>
>> Sorry for the megapost.. but i dont know what im doing wrong =(  i
>> just want to have the localhost:8000 with the index in english and
>> localhost:8000/es/ with the index in spanish  ... and i have this url
>> mapping problems.
>>
>> The translation is working good... but i have the url mapping problems
>> and cannot use images or css or import anything.
>>
>> Help me please !
>>
>
> Have a look at that:
> http://docs.djangoproject.com/en/dev/howto/static-files/#howto-static-files
>
> It seems this will solve most of your problems.
>
>
> Matthias
>
> >
>



-- 
Martín Sagastume
098 66.82.06
094 57.58.46
Montevideo - Uruguay

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



New django 1.0 website: www.astronomy2009.org

2008-09-11 Thread [EMAIL PROTECTED]

Dear all,

We just released a new website for the International Year of Astronomy
2009 (http://www.astronomy2009.org). It's based on the improved
versions of the django applications we used for www.iau.org. We are
still working towards decoupling the core applications from the rest
of the site, so it can be released for the public benefit, however
when time is short, short-cuts are made, so there is still some
cleanup to do ;-)

Thanks for viewing,
Lars Holm Nielsen
European Space Agency/Hubble

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

2008-09-11 Thread Geir Gunnarsson

Hi,

This same error materialized in another way in my case. It said:

  Caught an exception while rendering: Tried change_stage in module
django.contrib.admin.views.main. Error was: 'module' object has no
attribute 'change_stage'

I spent half a day figuring this out with the help of this thread. It
turned out that the cause, in my case, was because I missed a pre-1.0-
style admin entry in
an urls.py that was included in the main urls.py.

My problem was solved as soon as I changed that to the 1.0 preferred
way as specified in:

http://docs.djangoproject.com/en/dev/intro/tutorial02/#activate-the-admin-site

Just thought I'd post this as an addition to this thread in case
anyone else has the same problem.


-geir

On Aug 14, 10:48 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Thu, Aug 14, 2008 at 6:42 PM, tooper gao <[EMAIL PROTECTED]> wrote:
>
> > how can you change it ? and I have this errors too.
>
> For the specific error mentioned by the original poster, it's the first
> change noted here:
>
> http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Merge...
>
> that is, the change in urlconfs.  There will be more changes needed in your
> code, to move admin declarations out of the model classes, all documented
> there.
>
> Karen

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



Re: 'module' object has no attribute 'TabularInLine' Attribute Error in Django 1

2008-09-11 Thread TeenSpirit83

>
> The L in Inline should not be capitalized.  Is it in some doc you are
> working from?
>
> Karen

The docs are correct!
I'm so dumb, it is the first time I notice the L is not capitalized!
I was sure of the opposite!
Thanks a lot Karen!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 'module' object has no attribute 'TabularInLine' Attribute Error in Django 1

2008-09-11 Thread Karen Tracey
On Thu, Sep 11, 2008 at 9:29 AM, TeenSpirit83
<[EMAIL PROTECTED]>wrote:

>
> I'm trying to upgrade my skills from django 096 to 1.0 so I started a
> new app and tried to create an admin class for a class within its
> model.
> I got the error I specified in the subject. I paste down the
> traceback .Can you help me?
>
> [snipped debug info]


The L in Inline should not be capitalized.  Is it in some doc you are
working from?

Karen

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



'module' object has no attribute 'TabularInLine' Attribute Error in Django 1

2008-09-11 Thread TeenSpirit83

I'm trying to upgrade my skills from django 096 to 1.0 so I started a
new app and tried to create an admin class for a class within its
model.
I got the error I specified in the subject. I paste down the
traceback .Can you help me?

Environment:

Request Method: GET
Request URL: http://localhost:8000/admin/
Django Version: 1.0-final-SVN-unknown
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'retailcenter.publicsite']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.locale.LocaleMiddleware')


Traceback:
File "C:\Python25\Lib\site-packages\django\core\handlers\base.py" in
get_response
  77. request.path_info)
File "C:\Python25\Lib\site-packages\django\core\urlresolvers.py" in
resolve
  178. for pattern in self.urlconf_module.urlpatterns:
File "C:\Python25\Lib\site-packages\django\core\urlresolvers.py" in
_get_urlconf_module
  197. self._urlconf_module =
__import__(self.urlconf_name, {}, {}, [''])
File "C:\Django-1.0\retailcenter\..\retailcenter\urls.py" in 
  5. admin.autodiscover()
File "C:\Python25\Lib\site-packages\django\contrib\admin\__init__.py"
in autodiscover
  40. __import__("%s.admin" % app)
File "C:\Django-1.0\retailcenter\publicsite\admin.py" in 
  22. class DocumentoInLine(admin.TabularInLine):

Exception Type: AttributeError at /admin/
Exception Value: 'module' object has no attribute 'TabularInLine'

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

2008-09-11 Thread Rajesh Dhawan



unklbeemer wrote:
> Thanks! That helped with that error...but now i get a new one lol
>
>
> Exception Type: NoReverseMatch at /profiles/edit/
> Exception Value: Reverse for 'profile_public' with arguments
> '(u'username',)' and keyword arguments '{}' not found.

That means that you don't have a named url pattern in your urls.py
called 'profile_public' but your view seems to be referencing it.
Alternatively, you do have such a url pattern but it takes a different
set of arguments than the one you are giving it when you call
'reverse'.

You should go over the URL dispatcher docs here:
http://docs.djangoproject.com/en/dev/topics/http/urls/

In particular, look at named URL patterns and the reverse function's
sub-topics there.

Also, it helps if you bottom post your responses -- it's easier for
people to see what you are responding to as compared to when you top
post.

Cheers,
-Rajesh D



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



My CACHE FAQ ... A for Asked (Not Answered)

2008-09-11 Thread vbgunz

I was reading the Django definitive guide and practicing on 0.96.2
*but* caching is seriously broken on that version. I mean seriously.
Almost all of my issues were gone with a simple upgrade. I switched
from the book to the docs but still have questions. I would really
appreciate any help at all here!

Q. At what point in time do the query arguments come into play for
CACHE_BACKEND? Is it only a certain combination of arguments? Does
CacheMiddleware, UpdateCacheMiddleware, FetchFromCacheMiddleware play
any part at all with these arguments? Do only certain caching
interfaces accept these arguments? Are these arguments for upstream
caches e.g., squid-cache.org, ISP?

A. Nothing I do gets these arguments working. I've bust my chops
trying and feel the documentation does it absolutely no justice at
all. Its mentioned but when I play with it, nothing I do works :(

Q. Are Cache-Control HTTP directives meant for public, browser and
upstream caches beyond my control? I have finer grain tools for some
of this stuff don't I?

A. This is a little tricky for me. I'd like to understand them a bit
better.

Q. UpdateCacheMiddleware and FetchFromCacheMiddleware are how things
should be done now *but* CacheMiddleware still works. I'll take your
word on getting rid of CacheMiddleware in favor of the former
middleware *but* does CacheMiddleware still play a role I should at
least be aware of?

A. beyond asking for too much, I simply noticed CacheMiddleware works
but the new docs for 1.0 point out using the others. I won't argue and
I'll simply trust using them but anything I should know?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Creating an Archive

2008-09-11 Thread Russell Keith-Magee

On Wed, Sep 10, 2008 at 4:31 AM, djandrow <[EMAIL PROTECTED]> wrote:

> I just get 2008-01-01, i guess thats cos I only have entries in 2008
> and the date is formatted wrongly, so my question is how can i get a
> list of months, like you find on any archive links; September 2008,
> October 2008 etc.

Well - the template is printing exactly what you asked it to. You give
it a list of all dates where you have entries, and it prints a single
date - in the default format.

If you want a different list of dates to be printed, then you will
need to pass that list into your view so your template can iterate
over it. Make sure you handle the case where no entries are available,
either by not rendering those dates as links, or making sure that you
have the empty case handled on the view.

As for formatting the date, Django provides filters that can do this:
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date

> 2. At the moment i've just been testing the generic view in a template
> which does nothing else apart from show archive links, how can I
> incorporate this with my main template (the index page I already have)
> which uses views?

The same way you incorporate any other piece of a Django template -
using {% extends %}

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#extends

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: utf-8 text in models with coding: keyword

2008-09-11 Thread Jarek Zgoda


Wiadomość napisana w dniu 2008-09-11, o godz. 14:16, przez ekellner:

> Coding cookie has nothing to do with bytestring literals decoding,
> it's only for unicode literals. If you try to coerce bytestring with
> unicode, decoding will be done using default system encoding, if
> encoding is not specified explicitly.
>
> Indeed, that's why changing the python default encoding (no matter  
> how 'dangerous' this is supposed to be) is the only technique that  
> worked.
>
> Please correct me if I am wrong then, but if the coding is supposed  
> to be specified explicitly, it seems like django is failing to do  
> that in its handling of __str__.  If my model is returning utf-8  
> data in its __unicode__ function, that shouldn't cause any  
> problems.  That's the point of __unicode__.

Text in utf-8 is not unicode, this is bytestring (what we had in 0.96  
in __str__). From __unicode__ you have to return unicode ubjects, not  
utf-8 encoded bytestrings.

Fredrik Lundh has some good introductory material on handling strings  
vs. unicode: 

> Just do not use bytestrings to represent textual data. Soon (with
> Python 3) it will be considered bad habit.
>
> This means changing every "string" into u"string", right?  This is  
> where I thought that the coding: cookie was supposed to fix things;  
> you tell python that your bytestring is in utf-8 so you don't have  
> to label every single string in your code individually.  Forcing  
> each expression into a specific type seems very un-pythonic.

Well, I am not BDFL, I'm not in a power to change anything in Python  
internals (but if you ask me, I prefer clean separation of "texts"  
from "bytes" Java has from the beginning).

In Python 3 'string' will contain unicode objects, b'string' will  
contain bytes (for convenience, I think).

-- 
We read Knuth so you don't have to. - Tim Peters

Jarek Zgoda, R, Redefine
[EMAIL PROTECTED]


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

2008-09-11 Thread Ronny Haryanto
On Thu, Sep 11, 2008 at 5:28 PM, Petar Marić <[EMAIL PROTECTED]> wrote:
> Unfortunately I was unable to participate on DjangoCon because of my
> Master thesis. Will there be a video of some/all the talks?

I saw this at http://twitter.com/djangocon/statuses/917078011:

"DjangoCon videos will be made available on the djangocon.org site.
 I will make a loud announcement when they're available."

Ronny

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

2008-09-11 Thread ekellner
2008/9/11 Jarek Zgoda <[EMAIL PROTECTED]>

>
> Coding cookie has nothing to do with bytestring literals decoding,
> it's only for unicode literals. If you try to coerce bytestring with
> unicode, decoding will be done using default system encoding, if
> encoding is not specified explicitly.
>

Indeed, that's why changing the python default encoding (no matter how
'dangerous' this is supposed to be) is the only technique that worked.

Please correct me if I am wrong then, but if the coding is supposed to be
specified explicitly, it seems like django is failing to do that in its
handling of __str__.  If my model is returning utf-8 data in its __unicode__
function, that shouldn't cause any problems.  That's the point of
__unicode__.


>
> Just do not use bytestrings to represent textual data. Soon (with
> Python 3) it will be considered bad habit.
>

This means changing every "string" into u"string", right?  This is where I
thought that the coding: cookie was supposed to fix things; you tell python
that your bytestring is in utf-8 so you don't have to label every single
string in your code individually.  Forcing each expression into a specific
type seems very un-pythonic.

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



Re: Form validation problem for model with ForeignKey having unique=True,blank=True,null=True

2008-09-11 Thread krylatij

You can create only one model with empty 'other' field.
If you could  create one more, field 'other'  will not be unique more.
That's why validation fails.




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



attach an image to text in the admin

2008-09-11 Thread V

Hi,

I've quickly put together a small app that allows you to attach
already uploaded images to a text you are actually writing. Moreover,
you can upload new images as well.

For the moment it exclusively uses the markdown[1] syntax to insert
the image.

You can check it out at http://code.google.com/p/django-postimage/

[1] http://daringfireball.net/projects/markdown/syntax

Cheers, Viktor

--
Viktor Nagy - viktornagy.com
Phd Student
Toulouse School of Economics

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

2008-09-11 Thread Jarek Zgoda

Wiadomość napisana w dniu 2008-09-11, o godz. 13:40, przez Elizabeth  
Kellner:

> Hi.  I have a UnicodeDecodeError error that I can't seem to get rid
> of.  My model has utf-8 text, which is being returned in the model's
> __unicode__ function.  However, I can't seem to use the expression
> ("%s" % object) to coerce my utf-8 into a string, without it tring to
> decode the string as ascii.
>
> Here's a mockup of the problem:
>
> #  models.py
> class Person(models.Model):
>name = models.CharField(max_length=255)
>def __unicode__(self):
>return "my name is %s" % self.name
>
> # --- views.py
> # -*- coding: utf-8 -*-
> from models import Person
> def view_test(request):
>p = Person(name=u"Schröder")  # this works
>print "Person is %s" % p
>
>p = Person(name="Schröder") # this does not despite the
> coding:utf-8 on the file
>print "Person is %s" % p

Coding cookie has nothing to do with bytestring literals decoding,  
it's only for unicode literals. If you try to coerce bytestring with  
unicode, decoding will be done using default system encoding, if  
encoding is not specified explicitly.

Just do not use bytestrings to represent textual data. Soon (with  
Python 3) it will be considered bad habit.

-- 
We read Knuth so you don't have to. - Tim Peters

Jarek Zgoda, R, Redefine
[EMAIL PROTECTED]


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



utf-8 text in models with coding: keyword

2008-09-11 Thread Elizabeth Kellner

Hi.  I have a UnicodeDecodeError error that I can't seem to get rid
of.  My model has utf-8 text, which is being returned in the model's
__unicode__ function.  However, I can't seem to use the expression
("%s" % object) to coerce my utf-8 into a string, without it tring to
decode the string as ascii.

Here's a mockup of the problem:

#  models.py
class Person(models.Model):
name = models.CharField(max_length=255)
def __unicode__(self):
return "my name is %s" % self.name

# --- views.py
# -*- coding: utf-8 -*-
from models import Person
def view_test(request):
p = Person(name=u"Schröder")  # this works
print "Person is %s" % p

p = Person(name="Schröder") # this does not despite the
coding:utf-8 on the file
print "Person is %s" % p

The stdout of a request to the view is:
Person is my name is Schröder
Traceback (most recent call last):
  [ snipped irrelevant top part of the stack trace ]
  File "/Users/basis/src/django/utils/encoding.py", line 35, in
smart_unicode
return force_unicode(s, encoding, strings_only, errors)
  File "/Users/basis/src/django/utils/encoding.py", line 70, in
force_unicode
raise DjangoUnicodeDecodeError(s, *e.args)
DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in
position 15: ordinal not in range(128). You passed in
DjangoUnicodeDecodeError('ascii', 'my name is Schr\xc3\xb6der', 15,
16, 'ordinal not in range(128)') ()

Obviously what's happening is that the force_unicode is trying to
convert my utf-8 data from ascii into utf-8. I was able to bypass the
problem by changing python's default encoding, but I've been warned
this is a Bad Idea, and the Right Thing is to use the coding statment
in the source.  Yet, that's what I've done and it hasn't fixed the
issue.

What to do?  I consider it impractical to preface every string with
'u' to force unicode strings.  I use the logging module extensively,
and I cannot have logging statements occasionally take down the server
on a certain small subset of input if I forget a u in front of a
string.

I am working on Mac OS Leopard, and every part of my system already
has by default utf-8 encoded text.  Usually my utf-8 data is coming
from MySQL and not a python source file, but the UnicodeDecodeError is
the same.

Thanks for any hints,
Elizabeth
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: mas sobre unicodedecode erros RESUELTO!

2008-09-11 Thread anonymous

Vaya, se resolvió el problema aparentemente pero me sigue dando
problemas través la shell:

In [59]: Mymodel.objects.all()
Out[59]:
---
UnicodeDecodeErrorTraceback (most recent call
last)

/home/user/myproject/ in ()

/var/lib/python-support/python2.5/IPython/Prompts.pyc in
__call__(self, arg)
549
550 # and now call a possibly user-defined print
mechanism
--> 551 manipulated_val = self.display(arg)
552
553 # user display hooks can change the variable to be
stored in

/var/lib/python-support/python2.5/IPython/Prompts.pyc in
_display(self, arg)
575 return IPython.generics.result_display(arg)
576 except TryNext:
--> 577 return self.shell.hooks.result_display(arg)
578
579 # Assign the default display method:

/var/lib/python-support/python2.5/IPython/hooks.pyc in __call__(self,
*args, **kw)
133 #print "prio",prio,"cmd",cmd #dbg
134 try:
--> 135 ret = cmd(*args, **kw)
136 return ret
137 except ipapi.TryNext, exc:

/var/lib/python-support/python2.5/IPython/hooks.pyc in
result_display(self, arg)
163
164 if self.rc.pprint:
--> 165 out = pformat(arg)
166 if '\n' in out:
167 # So that multi-line strings line up with the left
column of

/usr/lib/python2.5/pprint.pyc in pformat(self, object)
109 def pformat(self, object):
110 sio = _StringIO()
--> 111 self._format(object, sio, 0, 0, {}, 0)
112 return sio.getvalue()
113

/usr/lib/python2.5/pprint.pyc in _format(self, object, stream, indent,
allowance, context, level)
127 self._readable = False
128 return
--> 129 rep = self._repr(object, context, level - 1)
130 typ = _type(object)
131 sepLines = _len(rep) > (self._width - 1 - indent -
allowance)

/usr/lib/python2.5/pprint.pyc in _repr(self, object, context, level)
193 def _repr(self, object, context, level):
194 repr, readable, recursive = self.format(object,
context.copy(),
--> 195 self._depth,
level)
196 if not readable:
197 self._readable = False

/usr/lib/python2.5/pprint.pyc in format(self, object, context,
maxlevels, level)
205 and whether the object represents a recursive
construct.
206 """
--> 207 return _safe_repr(object, context, maxlevels, level)
208
209

/usr/lib/python2.5/pprint.pyc in _safe_repr(object, context,
maxlevels, level)
290 return format % _commajoin(components), readable,
recursive
291
--> 292 rep = repr(object)
293 return rep, (rep and not rep.startswith('<')), False
294

/home/user/myproject/myapp/django/db/models/query.pyc in
__repr__(self)
139
140 def __repr__(self):
--> 141 return repr(list(self))
142
143 def __len__(self):

/home/user/myproject/myapp/django/db/models/base.pyc in __repr__(self)
242
243 def __repr__(self):
--> 244 return smart_str(u'<%s: %s>' %
(self.__class__.__name__, unicode(self).encode('utf-8')))
245
246 def __str__(self):

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
23: ordinal not in range(128)


Y lo mismo cuando trato de ejecutar en una función:

model = get_model(app_label, model_name)
queryset = model.objects.all()
fields = queryset.model._meta.admin.list_display

Django me devuelve una página de error:

 �� Local vars
VariableValue
app_label   'myapp'
model   
model_name  u'mymodel'
querysetError in formatting: 'ascii' codec can't decode byte 0xc3 in
position 23: ordinal not in range(128)


On Aug 21, 5:20 pm, Jeff Anderson <[EMAIL PROTECTED]> wrote:
> anonymous wrote:
>
> > Sin DATABASE_OPTIONS se resuelve el problema en mysql!!
>
> > Muchas Gracias!
>
> De nada.
>
> Como dijo Karen, casi no necesita DATABASE_OPTIONS en settings.py.
> Cuando se usa DATABASE_OPTIONS, solo hay que specificar el tipo del
> database engine y no mas. Es posible que hay otros casos que requieren
> otron opciones, pero nunca he visto un projecto que lo usa.
>
> Jeff Anderson
>
>  signature.asc
> < 1KViewDownload
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Sort order of objects returned by ManyToManyField in admin

2008-09-11 Thread Nianbig

Hi,

I´m using a ManyToManyField to link some posts to different
categories.
However, these categories doesn´t come in a sorted order in the Django
admin-interface.

Is there an extra argument I can give ManyToManyField to choose a
field to sort from (eg. "ORDER BY category_title ASC") or can I add
some function to my category-model to handle this?

Thanks in advance.

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

2008-09-11 Thread David Reynolds


On 11 Sep 2008, at 11:45 am, lingrlongr wrote:

> The Formwizard gave me MANY problems.  What exactly is happening?
> Here's what I was experiencing:
> http://groups.google.com/group/django-users/browse_thread/thread/ 
> 764ddb2d1b5d92d8/7ae5c2633564bd49#7ae5c2633564bd49


The actual wizard is working fine, I'm just trying to work out how I  
can make a test against it...

-- 
David Reynolds
[EMAIL PROTECTED]


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

2008-09-11 Thread lingrlongr

The Formwizard gave me MANY problems.  What exactly is happening?
Here's what I was experiencing:
http://groups.google.com/group/django-users/browse_thread/thread/764ddb2d1b5d92d8/7ae5c2633564bd49#7ae5c2633564bd49

keith

On Sep 11, 4:46 am, David Reynolds <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I am attempting to write a unit test for a Formwizard, but I can't
> seem to make it work.  Has anyone else attempted this or does anyone
> have any pointers?
>
> I think the problem might be the hash not matching, between the steps.
>
> --
> David Reynolds
> [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



DjangoCon video

2008-09-11 Thread Petar Marić
Hi everybody,

Unfortunately I was unable to participate on DjangoCon because of my
Master thesis. Will there be a video of some/all the talks?

Regards,
-- 
Petar Marić
*e-mail: [EMAIL PROTECTED]
*mobile: +381 (64) 6122467

*icq: 224720322
*jabber: [EMAIL PROTECTED]
*web: http://www.petarmaric.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: Persistent Global Imports

2008-09-11 Thread Graham Dumpleton



On Sep 11, 3:24 pm, Chris <[EMAIL PROTECTED]> wrote:
> I have an application that uses some large packages, such as Wordnet,
> and the imports can take awhile. Is there a mechanism in Django to
> persist imported package across requests? I'm running Django viamod_wsgi, and 
> it seems to re-import everything in my view files for
> *every* request, which makes the application unusably slow.

Be aware that Apache/mod_wsgi in embedded mode on UNIX is going to be
multiprocess. Thus where you think it is being loaded on every
request, it is more likely just the result of the various processes
loading the application the first time it is used. After they are all
loaded, you shouldn't see loading occurring.

Anyway this is it in simple terms, as it is actually more complicated
than that as Apache can kill off processes and replace them in certain
situations.

For some details of how processes are used in Apache/mod_wsgi see:

  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

To know what is definitively what is going on, following instructions
in:

  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques

and set:

  LogLevel info

in Apache configuration, in place of default 'warn'. This should
result in mod_wsgi outputing a lot of information into main and per
virtual host, as appropriate, error logs about when processes are
being started/restarted and when WSGI application scripts being
loaded.

So do that and report on what you see, including examples of Apache
error logs which you believe shows the behaviour you are claiming.

Also, you should still post the configuration you use so we can
confirm it is correct. I have many times had people say they followed
the documentation, but in fact they had tweaked it slightly and
inadvertently caused problems for themselves.

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

2008-09-11 Thread Valts Mazurs
Hi, Wishi,

1. Make sure that django fcgi process is running at all.
$ ps ax | grep manage

2. Lighttpd config looks a bit weird for me. Why to have two fcgi processes
- one for admin and other for regular site?
Mine looks like this:
===
fastcgi.server = (
"/django.fcgi" => (
"djangolocal" => (
"socket" => "/tmp/django.sock",
"check-local" => "disable",
)
)
)
alias.url = (
"/static/" => "/path/to/your/projects/media/files/",
"/media/" => "/path/to/django/contrib/admin/media/",
)
# rewrites for django
url.rewrite-once = (
"^(/media.*)$" => "$1",
"^(/static.*)$" => "$1",
"^/favicon\.ico$" => "/media/favicon.ico",
"^(/.*)$" => "/django.fcgi$1"
)
===

Why use TCP for communicating to django fcgi daemon? I suppose that using
unix socket should be significantly faster. To start up django fcgi daemon
use command like this:
$ python ./manage.py runfcgi method=prefork socket=/tmp/django.sock
pidfile=/tmp/django.pid

Note that I have set MEDIA_URL to '/static/' in project's settings.py file
to point to site media.

Another suggestion: If you are just getting acknowledged with Django it
would be more useful to begin with Django 1.0 as it promises future
consistency of API's.

Best regards,
Valts.

On Thu, Sep 11, 2008 at 12:14 AM, wishi <[EMAIL PROTECTED]> wrote:

>
> Hi!
>
>
> Thanks for the tip. Nevertheless: I don't know what's the meaning of
> this either:
>
>
> 2008-09-10 21:52:34: (mod_fastcgi.c.2721) establishing connection
> failed: Connection refused socket: tcp:127.0.0.1:9090
> 2008-09-10 21:52:40: (mod_fastcgi.c.2667) fcgi-server re-enabled:
> tcp:127.0.0.1:9090
>
>
> - Because at 9090 locally there's the django fcgi, which doesn't seem to
> run.
> What would be very helpful: a howto or another config-file of lighttpd I
> could use to diff through.
>
> Just the startup-problems I guess, sorry.
>
>
> wishi
>
>
>
> Valts Mazurs schrieb:
> > Hi,
> >
> > Take a look at lighttpd's error log (see server.errorlog setting in
> lighttpd
> > config file for exact error log location)
> >
> > Valts.
> >
> > On Wed, Sep 10, 2008 at 10:49 PM, wishi <[EMAIL PROTECTED]> wrote:
> >
> >> i mates ;)
> >>
> >> These days I thought working myself into Django - to get some new
> >> skills. I could need some start-up help to configure my environment,
> >> which isn't the "Apatschi" with mod_python. I'm using a lighttpd in my
> >> Debian server environment, that's going to be configured:
> >>
> >> Therefore I added mod_rewrite and mod_fastcgi as described in this
> >> Howto documentation here:
> >> http://sam.bluwiki.com/blog/labels/linux.php
> >>
> >> server.modules  = (
> >>"mod_access",
> >>"mod_alias",
> >>"mod_rewrite",
> >>"mod_fastcgi",
> >>"mod_accesslog",
> >>"mod_redirect",
> >>"mod_status",
> >> #   "mod_evhost",
> >>"mod_compress",
> >>"mod_usertrack",
> >> #   "mod_rrdtool",
> >> #   "mod_webdav",
> >> [...]
> >>
> >> I configured the fastcgi stuff:
> >>
> >> fastcgi.server = (
> >>".php" => ((
> >>"bin-path" => "/usr/bin/php5-cgi",
> >>"socket" => "/tmp/php.socket"
> >>)),
> >> "django.fcgi" => (
> >>"main" => (
> >>"host" => "127.0.0.1",
> >>"port" => 9090, #set the port numbers to what-eva you
> >> want
> >>),
> >> ),
> >> "admin.fcgi" => (
> >>"admin" =>
> >>(
> >>"host" => "127.0.0.1", "port" => 9091, )
> >> )
> >> )
> >>
> >> And the rewrite stuff:
> >>
> >> url.rewrite-once = (
> >>"^(/media.*)$" => "$1",
> >>"^(/static.*)$" => "$1",
> >>"^/favicon\.ico$" => "/media/favicon.ico",
> >>"^(/admin/.*)$" => "/admin.fcgi$1", "^(/.*)$" => "/django.fcgi
> >> $1"
> >> )
> >>
> >>
> >> And sweet as, that's it. Django is working... was just apt-get install
> >> blabla.
> >>
> >> % django-admin --version
> >> 0.95.1
> >>
> >>
> >> % ls /var/django/testproject
> >> __init__.py  manage.py  settings.py  urls.py
> >>
> >> No modifications jet, the basic django-test-webserver works fine.
> >>
> >> % python manage.py runfcgi method=prefork host=127.0.0.1 port=9090
> >> pidfile=django.pid
> >> [no error]
> >>
> >>
> >> Nevertheless - the httpd starts without any error, and django-admin
> >> works, too - I get an internal server error 500. Does anybody know
> >> what's wrong or which steps may be needed for further debugging? Could
> >> be very helpful. The general documentation stuff focuses on Apache,
> >> which I completely dislike and don't want to have on my system.
> >>
> >> Thanks for help,
> >> Marius
> >>
> >>
> >> p.s.: I hope this message isn't on the list twice. Got some issues...
> >>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed 

Re: Filtering ManyToManyField

2008-09-11 Thread MikeHowarth

The model I'm using is very similar to that of Satchmo's

Model basically looks like this:

class Product(models.Model):
name = models.CharField(_("Full Name"), max_length=255, blank=False,
slug = models.SlugField(_("Slug Name"), blank=True,
related_items = models.ManyToManyField('self', blank=True, null=True,
verbose_name=_('Related Items'), related_name='related_products')


David Reynolds wrote:
> On 11 Sep 2008, at 10:06 am, MikeHowarth wrote:
>
> > Could anyone clarify what I need to do be doing to acheive the desired
> > filtering?
>
> Can we see your model too?
>
> Although, I note satchmo do a similar thing:
>
> http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/
> product/models.py#L458
>
> --
> David Reynolds
> [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: possible bug in django-admin

2008-09-11 Thread Benedict Verheyen

Karen Tracey wrote:

> It's not trying to limit you to just one project.   It's just trying to
> prevent confusion by not letting you create and attempt to work with a
> new project when you're running in an environment already set up to
> manage a different project.  In those cases, simply unset the
> DJANGO_SETTINGS_MODULE environment variable, then issue the startproject
> command.
> 
> Karen

Karen,

thanks for the clarification.

Regards,
Benedict


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



Re: Form validation problem for model with ForeignKey having unique=True,blank=True,null=True

2008-09-11 Thread Nathaniel Griswold

My django version is 1.0-final-SVN-9013

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



  1   2   >