Re: Translating App Names

2009-09-20 Thread patrickk

in the meantime, you can translate app names like this:
http://groups.google.com/group/django-users/msg/ef5a723983e56e96

the whole discussion is here:
http://groups.google.com/group/django-users/browse_thread/thread/f8fcbe25e3327c5d/ef5a723983e56e96?#ef5a723983e56e96

it´s over-complicated to translate app-names right now, which is a
shame IMO.

regards,
patrick


On Sep 21, 12:04 am, Ramiro Morales  wrote:
> On Sun, Sep 20, 2009 at 4:22 PM, SaiaGo  wrote:
>
> > I'm trying to make an Israeli site (which means it should be written
> > in Hebrew) using the latest SVN and so far Django made it so easy I
> > can't believe it's free. I got a simple magazine app with up and
> > running in less then a day, and I barely know Python!
> > My only problem so far is application names in admin pages. I can't
> > seem to find a way to translate application names.
>
> > As far as I understand from the docs app names are chosen based on the
> > directory name they reside in. so mysite/magazine should be
> > "Magazine", which is what admin pages display.
> > I tried making a .po file and translating "Magazine" (assuming my app
> > is in "mysite/magazine") like so:
> > msgid "Magazine"
> > msgstr "מגזין"
> > But this approach isn't working.
>
> > Is there a way to explicitly set an app name so I could set it to
> > ugettext("Magazine") or some kind of special msgid I have to use to
> > translate app names, or is this functionality not implemented yet?(In
> > which case I would happily implement it myself)
>
> Corrently in Django we have both problems related to this:
>
> First, the long shot problem: The one about providing and
> documenting an official way to app author to specify or mark
> the app name so it can be somethingg different to the module
> name, to allow translating it in the admin app (and other places?), etc.
> This is a missing feature that need design, discussion and
> implementation.
>
> Second, the fact that even when using the module name
> as the app name in the admin as we currently do, what you have
> done (i.e. providing a translation for that literal it in your .po catalogs
> in the hope of getting it translated) doesn't work. This is a bug that has
> been present in Django code for more than three years. This bug has
> been reported as ticket [1]10436 in our bug tracking system, and it
> has a patch attached to it. You can try it if you need this functionality
> and know how to work with patches (and please report back
> your experiences).
>
> At least one core developer thinks all this is something worth fixing in
> one swoop and the second problem isn´t worth fixing alone. I'm keeping
> the above mentioned ticket (and patch) up to date in the hope it is
> fixed ASAP.
>
> Regards,
>
> --
> Ramiro Moraleshttp://rmorales.net
>
> 1.http://code.djangoproject.com/ticket/10436
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Records doesn't sometimes get upated

2009-09-20 Thread Szymon

Hello,

I have strange problem. I will give example. I have model:

class foo(models.Model)
 bar = models.IntegerField()

and method in it

 def add_bar(c):
  from something.models import bar_log
  b = bar_log(foo=self, cnt=c)
  b.save()
  self.bar += c
  self.save()

... and now the problem. Sometimes "bar" in "foo" doesn't get updated.
There is record in bar_log, but "bar" in "foo" have old value. How can
I trace problem? There are no exceptions at all.

I'm using Django 1.1, Postgresql with psycopg2 as interface. There are
two parts of my application - web interface and daemonized part that
runs some background tasks every 5 seconds.

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



admin app date format: locale dependent

2009-09-20 Thread Tim Bowden

I'm getting started with django (& python), and having a bit of a play
with the admin app while doing the tutorial.  So far all good, but how
do I set the date field to be locale dependent, ie, display & accept
dates using a format that makes sense for my locality, ie, DD/MM/?

Thanks,
Tim Bowden

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



About using django-tinymce

2009-09-20 Thread taijirobot

Hi, guys,

I'm learning django recently and I am trying to add a rich text editor
to the places where long formated text like blog post are needed (the
site is running on local machine with the default django server).

I tried to use django-tinymce : http://code.google.com/p/django-tinymce/
and all the things I did was:

1. download the django-tinymce package, extract, and run 'sudo python
setup.py install'

2. get a tinymce distribution(new enough) and copy the jscripts/
tiny_mce to the media root of my local machine.

my config:
MEDIA_ROOT = '/home/taijirobot/mysite/media/'
MEDIA_URL = ''

3. add 'tinymce' to INSTALLED_APPS in settings

4. Change the definition of the BlogForm (a form defined to generate
form for blog mode), like this:
..
class BlogPost(models.Model):
title = models.CharField(max_length=150)
body = models.TextField()
timestamp = models.DateTimeField(default=datetime.datetime.now)
class Meta:
ordering = ('-timestamp',)
..
class BlogForm(ModelForm):
body = forms.CharField(widget=TinyMCE(attrs={'cols':80, 'rows':
30}))
class Meta:
model = BlogPost
exclude = ['timestamp']
..

The document says we can get a tinymce editor in the admin site after
this. But nothing different shows with mine.

What might be the problem?
Is it because the wrong MEDIA_URL setting? Or I've missed something
when installing or using?

Thank you.

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



Form Select Selected Choice

2009-09-20 Thread Leonel Nunez

Hello:

I'm using

form.base_fields['MYFIELD'].widget=widgets.Select(choices=CA)

to fill a   tag, all works fine but I can't find how to add a
SELECTED  value, been with this issue all day ..

Thank you


leonel






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



Re: Using Psycopg2 on Windows

2009-09-20 Thread walty

hi, you may also try to install the visual C++ 2005 redistributable
package:

http://www.microsoft.com/downloads/details.aspx?familyid=766a6af7-ec73-40ff-b072-9112bab119c2&displaylang=en


have a nice day
walty

On Aug 14, 10:08 pm, James Walmsley  wrote:
> Just in case anyone happens to be still wrestling with this problem.
> There was something wrong with the latest build of Psycopg2, which
> stopped it all working.
>
> Simply install an earlier version, (2.0.10 works great), even with
> PostgreSQL 8.4.x series.
>
> James
>
> James Walmsley wrote:
> > Hi,
>
> > I'm trying to get started with Django, and everything was going
> > wonderfully until I tried to use models (and I had to set up
> > postgreSQL).
>
> > I've installed psycopg2 from the provided compiled binaries, but when
> > I run:
>
> > manage.py runserver
>
> > I get the following errors:
>
> > Error loading psycopg2 module: DLL load failed: The applicatio has
> > failed to start because its side-by-side configuration is incorrect.
> > Please see the application event log for more detail.
>
> > The application event log in Vista says:
>
> > Activation context generation failed for "C:\Python26\lib\site-packages
> > \psycopg2\_psycopg.pyd". Dependent Assembly
> > Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053"
> > could not be found. Please use sxstrace.exe for detailed diagnosis.
>
> > Any help would be appreciated, I also tried to build psycopg2 from
> > source, build I still get a DLL load fail.
>
> > James
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



www.myyshop.com NIKE AIR JORDAN FORCE FUSION SHOES AJF 5 V JORDANs 5 FUSION NIKE

2009-09-20 Thread dong maomao

http://www.myyshop.com

Quality is our Dignity; Service is our Lift.

you can  securely  buy  the   goods   that   you   like   in   my
myyshop.I  will  serve

you  all   day.

..._|\__ _,__
../ `(MyShopsBetterThanHisShop=) ) ]___ . -_|
./_==o __|
...),---.(_(__) /
..// (\) ),".'
.//___// Even our guns are bigger
`---`

Air jordan(1-24)shoes $33

Nike shox(R4,NZ,OZ,TL1,TL2,TL3) $35
Handbags(Coach lv fendi d&g) $35
Tshirts (Polo ,ed hardy,lacoste) $16

free shipping
competitive price
any size available
accept the paypal

Thanks

http://www.myyshop.com/productlist.asp?id=s28 (JORDAN SHOES)
http://www.myyshop.com/productlist.asp?id=s5  (Bikini)
http://www.myyshop.com/productlist.asp?id=s21 (Air_max_man)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Editable sitemap priority

2009-09-20 Thread Chris Moffitt
I'm curious if anyone has done any work in making certain aspects of the
sitemap framework editable via the admin. For instance, someone might want
their marketing folks to tweak the various priorities or changrefreq's of
specific urls. I know it can be done by editing code and subclassing Sitemap
but it's not easy for a non-technical person to maintain this going forward.

Before I go down the path of creating this, I thought I'd reach out to the
group and see if anyone has already solved this problem. Or, if you haven't
solved it but have a great idea about how you would, I'd be interested in
learning.

Thanks for any input,
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Adding Django-Attachments to JaikuEngine

2009-09-20 Thread MateComp

Hi Everyone,

We need to know is there any way to add the "attach" option to a
project as JaikuEngine that uses Django. If it is possible, we need to
know how to do that, where to place de django-attachments folders,
files, etc...

Thank you for your attention.

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



limiting the scope of a ForeignKey relation to within a model?

2009-09-20 Thread Doug

Lets say for instance that I have the following model, Project, which
is related to an Image model in the following ways:


class Project(models.Model):
...
images = models.ManyToManyField(Image, related_name='image')
lead_image = models.ForeignKey(Image, related_name='lead_image')
   


Is there any way to set up this relationship so that the lead_image
choices are limited to only those in the "images" manytomany
association of the current instance of Project?

Thanks for any advice you have.

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



Naming and scoping guidelines to make apps that are actually 'pluggable'?

2009-09-20 Thread Hostile Fork

Hello all,

Page one of the tutorial features a large picture of a lightbulb, next
to a statement of Philosophy:

 "Django apps are 'pluggable': You can use an app in multiple
projects, and you can distribute apps, because they don't have to be
tied to a given Django installation."

The tutorial proceeds to import "mysite.polls.models" from various
files inside the /polls directory:

   
http://docs.djangoproject.com/en/dev/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin
   
http://docs.djangoproject.com/en/dev/intro/tutorial03/#write-views-that-actually-do-something

I think I'm stating the obvious: if your project is called "mysite"
and your app is called "polls", there should be no appearances of the
string "mysite" inside your /mysite/polls directory.  That won't let
polls plug very well into "yoursite".  I know changing your PythonPath
can get you to the point where you can say "import polls.models", but
this seems too foundational for the tutorial to gloss over.

>From my point of view, it's a further problem that "polls" appears
inside the app... over and over.  Namespaces seem to have been
introduced to work around the inevitable problem of wanting to
instantiate an app twice.  But I'd like to have differently-versioned
enlistments of the same app (in different directories) running at the
same time.  Can namespaces help me, in a way that I don't have to
"import polls_alpha.models" in /polls_alpha and "import
polls_beta.models" in /polls_beta??

(I don't know much Python, but I wish there'd been some way to apply
the DRY principle to my app's name through "sys.modules[globals()
['__name__']]"...or some other magic).

What I'd really like to find are best-practices of how to scope
references at every level in the proejct.  Right now I find myself in
constant puzzlement.  Like, if your PythonPath is going to get you
access to polls.models from inside the mysite directory... why would
your mysite's settings.py refer to it as "mysite.polls.models" and not
just "polls.models"?

Thanks,
Brian

http://hostilefork.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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Translating App Names

2009-09-20 Thread Ramiro Morales

On Sun, Sep 20, 2009 at 4:22 PM, SaiaGo  wrote:
>
> I'm trying to make an Israeli site (which means it should be written
> in Hebrew) using the latest SVN and so far Django made it so easy I
> can't believe it's free. I got a simple magazine app with up and
> running in less then a day, and I barely know Python!
> My only problem so far is application names in admin pages. I can't
> seem to find a way to translate application names.
>
> As far as I understand from the docs app names are chosen based on the
> directory name they reside in. so mysite/magazine should be
> "Magazine", which is what admin pages display.
> I tried making a .po file and translating "Magazine" (assuming my app
> is in "mysite/magazine") like so:
> msgid "Magazine"
> msgstr "מגזין"
> But this approach isn't working.
>
> Is there a way to explicitly set an app name so I could set it to
> ugettext("Magazine") or some kind of special msgid I have to use to
> translate app names, or is this functionality not implemented yet?(In
> which case I would happily implement it myself)

Corrently in Django we have both problems related to this:

First, the long shot problem: The one about providing and
documenting an official way to app author to specify or mark
the app name so it can be somethingg different to the module
name, to allow translating it in the admin app (and other places?), etc.
This is a missing feature that need design, discussion and
implementation.

Second, the fact that even when using the module name
as the app name in the admin as we currently do, what you have
done (i.e. providing a translation for that literal it in your .po catalogs
in the hope of getting it translated) doesn't work. This is a bug that has
been present in Django code for more than three years. This bug has
been reported as ticket [1]10436 in our bug tracking system, and it
has a patch attached to it. You can try it if you need this functionality
and know how to work with patches (and please report back
your experiences).

At least one core developer thinks all this is something worth fixing in
one swoop and the second problem isn´t worth fixing alone. I'm keeping
the above mentioned ticket (and patch) up to date in the hope it is
fixed ASAP.

Regards,

-- 
Ramiro Morales
http://rmorales.net

1. http://code.djangoproject.com/ticket/10436

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



Re: Saving ModelForm with commit=False seems to be generating an INSERT in the database

2009-09-20 Thread Andrew Mckay

> Why is an INSERT statement being generated even though I have
> commit=False? The two inserts are causing an Exception which prevent
> the actual user data from being saved (a row in the
> courses_userprofile table does get created, but with all columns
> except the id being blank)

Its odd that the two insert statements have different values for email, 
since between the user_profile_form.save and user_profile.save, you 
arent adding the email in. As Daniel suggested, its more likely the save 
is coming from elsewhere.

Install django-debug-toolbar, then click on the "explain" link on the 
SQL statement, this will tell you exactly where the statement is coming 
from.


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



ImportError: Could not import settings 'WWlove.settings'

2009-09-20 Thread Jose Sibande

Hi,
I get this error in /var/log/apache2/error.log:

[Mon Sep 21 01:38:14 2009] [error] [client 41.157.12.3] ImportError:
Could not import settings 'WWlove.settings' (Is it on sys.path? Does
it have syntax errors?): No module named settings

And my /home/jose/WWlove/apache/django.wsgi Looks like this:
import os, sys
sys.path.append('/home/jose')
sys.path.append('/home/jose/WWlove')
os.environ['DJANGO_SETTINGS_MODULE'] = 'WWlove.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

*The mod_wsgi documentation address this issue and says that if this
error occurs then that means I haven't spelled my path welll.
I looked, trying to spot the error, but evrything seems spelt ok.

Please help, everythinhg works well on local machine.
Thank You
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Translating App Names

2009-09-20 Thread SaiaGo

I have already read it in the docs. My problem isn't model names, it's
the app's name I can't figure how to translate.
Thanks for trying to help.

On Sep 20, 10:41 pm, Joshua Russo  wrote:
> On Sun, Sep 20, 2009 at 6:22 PM, SaiaGo  wrote:
>
> > I'm trying to make an Israeli site (which means it should be written
> > in Hebrew) using the latest SVN and so far Django made it so easy I
> > can't believe it's free. I got a simple magazine app with up and
> > running in less then a day, and I barely know Python!
> > My only problem so far is application names in admin pages. I can't
> > seem to find a way to translate application names.
>
> > As far as I understand from the docs app names are chosen based on the
> > directory name they reside in. so mysite/magazine should be
> > "Magazine", which is what admin pages display.
> > I tried making a .po file and translating "Magazine" (assuming my app
> > is in "mysite/magazine") like so:
> > msgid "Magazine"
> > msgstr "מגזין"
> > But this approach isn't working.
>
> > Is there a way to explicitly set an app name so I could set it to
> > ugettext("Magazine") or some kind of special msgid I have to use to
> > translate app names, or is this functionality not implemented yet?(In
> > which case I would happily implement it myself)
>
> > And while I have the chance I would like to thank anyone who
> > contributed to the design, programming, templates and translation of
> > Django very very much. Projects like this make me hope for a better
> > world where people rather share than sell, at least a better virtual
> > world. And I hope I could contribute to Django in the future.
>
> You can use the verbose_name properties in a Meta class in your model. Just
> keep in mind you will need to use the lazy translation function.
>
> http://docs.djangoproject.com/en/dev/topics/db/models/#id3
> http://docs.djangoproject.com/en/dev/topics/i18n/#topics-i18n(there's
>  a
> section for Lazy translations)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Translating App Names

2009-09-20 Thread Joshua Russo
On Sun, Sep 20, 2009 at 6:22 PM, SaiaGo  wrote:

>
> I'm trying to make an Israeli site (which means it should be written
> in Hebrew) using the latest SVN and so far Django made it so easy I
> can't believe it's free. I got a simple magazine app with up and
> running in less then a day, and I barely know Python!
> My only problem so far is application names in admin pages. I can't
> seem to find a way to translate application names.
>
> As far as I understand from the docs app names are chosen based on the
> directory name they reside in. so mysite/magazine should be
> "Magazine", which is what admin pages display.
> I tried making a .po file and translating "Magazine" (assuming my app
> is in "mysite/magazine") like so:
> msgid "Magazine"
> msgstr "מגזין"
> But this approach isn't working.
>
> Is there a way to explicitly set an app name so I could set it to
> ugettext("Magazine") or some kind of special msgid I have to use to
> translate app names, or is this functionality not implemented yet?(In
> which case I would happily implement it myself)
>
> And while I have the chance I would like to thank anyone who
> contributed to the design, programming, templates and translation of
> Django very very much. Projects like this make me hope for a better
> world where people rather share than sell, at least a better virtual
> world. And I hope I could contribute to Django in the future.
>

You can use the verbose_name properties in a Meta class in your model. Just
keep in mind you will need to use the lazy translation function.

http://docs.djangoproject.com/en/dev/topics/db/models/#id3

http://docs.djangoproject.com/en/dev/topics/i18n/#topics-i18n (there's a
section for Lazy translations)

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



Deploying to UserDir

2009-09-20 Thread dijxtra

I'm trying to deploy my first django app (oh no! :-D). I have a user
account on a server with Apache2. That is: I don't have root access
and I don't have access to apache2 config files. Our server has
UserDir enabled, so http://my.server.url/~my_home/ maps to $HOME/
public_html. According to this:
/etc/apache2/mods-enabled$ ls -l | grep python
lrwxrwxrwx 1 root root 29 Feb 15  2009 python.load -> ../mods-
available/python.load
I'd say we do have mod_python enabled. So, I've put my mod_python
config data into $HOME/public_html/.htaccess:


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug Off
PythonPath "['/home/users/n/nick/code/mysite', '/var/lib/python-
support/python2.5/django'] + sys.path"


That doesn't work (throws 500 Internal Server Error). So I tried to
tweak this a bit and when it didn't work I googled and haven't find
any usable info. Except this: http://code.djangoproject.com/ticket/2255
where a guy says: "[...] requiring admin access to httpd.conf in order
to use Django with mod_python is fine by me. "

So, can I even deploy django without admin access to config files?
Please don't say I can't. Please. 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Saving ModelForm with commit=False seems to be generating an INSERT in the database

2009-09-20 Thread Daniel Roseman

On Sep 20, 6:54 pm, Parag Shah  wrote:
> Hello,
>
> I have a UserProfile Model object which has the
> django.contrib.auth.models.User as it's ForeignKey.
>
> There is a register function in the view module, which goes like this:
>
> def register(request):
>   if request.method == 'POST':
>       user_form = UserCreationForm(request.POST)
>       user_profile_form = UserProfileForm(request.POST)
>       if user_form.is_valid() and user_profile_form.is_valid():
>         user = user_form.save()
>         user_profile = user_profile_form.save(commit=False)
>         user_profile.user = user
>         user_profile.save()
>         return HttpResponseRedirect("/")
>
> The statement
> user_profile = user_profile_form.save(commit=False)
> is causing the following statement to appear in the MySql log
> INSERT INTO `courses_userprofile` (`user_id`, `full_name`, `email`,
> `website`, `timezone`, `bio`) VALUES (39, '', '', '', '', '')
>
> And then the statement
> user_profile.save()
> is causing another INSERT statement
>  INSERT INTO `courses_userprofile` (`user_id`, `full_name`, `email`,
> `website`, `timezone`, `bio`) VALUES (39, 'Test User10',
> 'testus...@ten.com', '', '', '')
>
> Why is an INSERT statement being generated even though I have
> commit=False? The two inserts are causing an Exception which prevent
> the actual user data from being saved (a row in the
> courses_userprofile table does get created, but with all columns
> except the id being blank)
>
> Am I doing something incorrect?
>
> --
> Thanks & Regards
> Parag Shah

Are you sure the first INSERT is coming from that line? Could it be
coming from the save of user_form - maybe there's something in the
UserForm that causes the related model to always be created?

I think we'll need to see the code of both forms to debug further.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: mod_python to mod_wsgi

2009-09-20 Thread Daniel Roseman

On Sep 20, 7:57 pm, When ideas fail  wrote:
> Hello, I've recently updated my setup to use mod_wsgi instead of
> mod_python. I'm having some problems with my urls. The home page loads
> fine but none of my other urls seems to work (404 errors). They worked
> before with mod_python. Do i need to include something else in
> my .wsgi file?
>
> import os
> import sys
>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
>
> sys.path.append('/usr/local/django')
>
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
> --- 
> -
>
> or directives?
>
> 
> Order deny,allow
> Allow from all
> 
>
> WSGIScriptAlias /mysite/ C:/Apache2.2/mysite/django.wsgi
> --- 
> ---
>
> I'm guessing its correct that whatever is in my urls would just go
> after my site, for example
>
> http://localhost:8080/mysite/thanks/
>
> for
>   ('^thanks/$', 'mysite.blog.views.thanks'),
>
> Andrew

>From the WSGI documentation on integration with Django (http://
code.google.com/p/modwsgi/wiki/IntegrationWithDjango):

"When setting up the Apache configuration for a site mounted at a sub
URL, the mount point must not have a trailing slash.
WSGIScriptAlias /mysite /usr/local/django/mysite/apache/django.wsgi"

So I'd guess that would be your problem.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Translating App Names

2009-09-20 Thread SaiaGo

I'm trying to make an Israeli site (which means it should be written
in Hebrew) using the latest SVN and so far Django made it so easy I
can't believe it's free. I got a simple magazine app with up and
running in less then a day, and I barely know Python!
My only problem so far is application names in admin pages. I can't
seem to find a way to translate application names.

As far as I understand from the docs app names are chosen based on the
directory name they reside in. so mysite/magazine should be
"Magazine", which is what admin pages display.
I tried making a .po file and translating "Magazine" (assuming my app
is in "mysite/magazine") like so:
msgid "Magazine"
msgstr "מגזין"
But this approach isn't working.

Is there a way to explicitly set an app name so I could set it to
ugettext("Magazine") or some kind of special msgid I have to use to
translate app names, or is this functionality not implemented yet?(In
which case I would happily implement it myself)

And while I have the chance I would like to thank anyone who
contributed to the design, programming, templates and translation of
Django very very much. Projects like this make me hope for a better
world where people rather share than sell, at least a better virtual
world. And I hope I could contribute to Django in the future.

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



mod_python to mod_wsgi

2009-09-20 Thread When ideas fail

Hello, I've recently updated my setup to use mod_wsgi instead of
mod_python. I'm having some problems with my urls. The home page loads
fine but none of my other urls seems to work (404 errors). They worked
before with mod_python. Do i need to include something else in
my .wsgi file?

import os
import sys

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

sys.path.append('/usr/local/django')

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()


or directives?


Order deny,allow
Allow from all


WSGIScriptAlias /mysite/ C:/Apache2.2/mysite/django.wsgi
--

I'm guessing its correct that whatever is in my urls would just go
after my site, for example

http://localhost:8080/mysite/thanks/

for
  ('^thanks/$', 'mysite.blog.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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django forum

2009-09-20 Thread Brian Neal

On Sep 20, 11:10 am, dijxtra  wrote:
> Is there a free robust django forum app? Or more precisely, a free and
> robust forum app which uses django.contrib.auth for authentication?
>
> Or should I just try out those several projects enabling django to
> access phpBB's user info and use phpBB3?

There are many that seem to be in progress. Not mentioned on the
Django wiki [1] is DjangoBB [2].

The quality and functionality seem to vary wildly. Ultimately I
decided to write my own. With the tools that Django provides, it
really isn't that hard (much to my surprise). I wanted some features
that the other projects didn't have, but more importantly I want to
know how it works, and for my hobby site, rolling my own was the best
course of action for me. YMMW of course.

[1] http://code.djangoproject.com/wiki/ForumAppsComparison
[2] http://djangobb.org/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Saving ModelForm with commit=False seems to be generating an INSERT in the database

2009-09-20 Thread Parag Shah

Hello,

I have a UserProfile Model object which has the
django.contrib.auth.models.User as it's ForeignKey.

There is a register function in the view module, which goes like this:

def register(request):
  if request.method == 'POST':
  user_form = UserCreationForm(request.POST)
  user_profile_form = UserProfileForm(request.POST)
  if user_form.is_valid() and user_profile_form.is_valid():
user = user_form.save()
user_profile = user_profile_form.save(commit=False)
user_profile.user = user
user_profile.save()
return HttpResponseRedirect("/")


The statement
user_profile = user_profile_form.save(commit=False)
is causing the following statement to appear in the MySql log
INSERT INTO `courses_userprofile` (`user_id`, `full_name`, `email`,
`website`, `timezone`, `bio`) VALUES (39, '', '', '', '', '')

And then the statement
user_profile.save()
is causing another INSERT statement
 INSERT INTO `courses_userprofile` (`user_id`, `full_name`, `email`,
`website`, `timezone`, `bio`) VALUES (39, 'Test User10',
'testus...@ten.com', '', '', '')

Why is an INSERT statement being generated even though I have
commit=False? The two inserts are causing an Exception which prevent
the actual user data from being saved (a row in the
courses_userprofile table does get created, but with all columns
except the id being blank)

Am I doing something incorrect?

-- 
Thanks & Regards
Parag Shah

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



sqlite3 permissions (osx deployment setup)

2009-09-20 Thread kelley....@gmail.com

I am having troubles with sqlite3 on my OSX 10.6 box, using fastcgi
for deployment.  On this box, the webserver is called user _www, and
that explains some of the tricks I'm doing at the commandline, in the
tests I show below.  I've given the user _www both read and write
permissions for the database.  The tests indicate that it can read,
but seemingly not write.  Can anyone advise on what I should try next?

$ \rm dreamtof_development*


$ python manage.py syncdb
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table dreams_dream
Creating table dreams_profanity
Creating table tags_tag
Creating table userprofiles_userprofile

You just installed Django's auth system, which means you don't have
any superusers defined.
Would you like to create one now? (yes/no): yes
Username (Leave blank to use 'kelley'):
E-mail address: some...@somewhere.com
Password:
Password (again):
Superuser created successfully.
Installing index for admin.LogEntry model
Installing index for auth.Permission model
Installing index for auth.Message model



$ python manage.py shell
Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import User
>>> users = User.objects.all()
>>> users
[]
>>> u = User.objects.create_user(username="b", password="b", email="a...@a.com")
>>> u

>>> u.save()
>>> users = User.objects.all()
>>> users
[, ]
>>> ^D



$ chmod +a "_www allow read,write" dreamtof_development



$ sudo -u _www python manage.py shell
Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import Use
Traceback (most recent call last):
  File "", line 1, in 
ImportError: cannot import name Use
>>> from django.contrib.auth.models import User
>>> users = User.objects.all()
>>> users
[, ]
>>> u = User.objects.create_user(username="new", password="new", 
>>> email="a...@a.com")
>>> u.save()
>>> users = User.objects.all()
>>> users
[, ]
>>> ^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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: date inside url

2009-09-20 Thread dijxtra

Huh, thank you both for in-depth answers. I implemented Gonzalo's idea
with context processors and it worked like a charm... and then I
realised that I could achieve the same thing with:

url(r'^today$', 'today', name='today'),
+
{% url today %}
+
def today(request):
t = datetime.date.today()
return day(request, t.year, t.month, t.day)

I knew there must be a simple and elegant solution. Django, I love you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sqlite3+fastcgi setup problem [mac 10.6]

2009-09-20 Thread kelley....@gmail.com

This question is superceded by one I just posted.  Rather than waste
bandwidth, I'll post an overall solution when I figure one out. -- dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



formfield_overrides for Auth.User?

2009-09-20 Thread Brandon Taylor

Hello everyone,

I've implemented a custom backend to use an email address instead of a
username. Unfortunately, this prevents me from using the built-in User
change form within admin.

I'm looking for a way to override the username form field with my own
field, or at least change the validation on the username field to
accept an email address.

Does anyone know of a quick way to override the built-in change form
for Auth.User?

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



Re: django forum

2009-09-20 Thread dijxtra

On Sep 20, 6:27 pm, Jonas Obrist  wrote:
> There's django-forum and a couple of others (google them). I'm also
> working on a forum system in django which I plan to release one day. But
> at the moment I fear it's too unstable and coupled to other parts of my app.

I really did google before asking on the list :-D Yeah, anyway, thank
you very much, after some more googling I found this gem:
http://code.djangoproject.com/wiki/ForumAppsComparison

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



Re: django forum

2009-09-20 Thread Jonas Obrist

dijxtra wrote:
> Is there a free robust django forum app? Or more precisely, a free and
> robust forum app which uses django.contrib.auth for authentication?
>
> Or should I just try out those several projects enabling django to
> access phpBB's user info and use phpBB3?
> >
>   
There's django-forum and a couple of others (google them). I'm also 
working on a forum system in django which I plan to release one day. But 
at the moment I fear it's too unstable and coupled to other parts of my app.

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



django forum

2009-09-20 Thread dijxtra

Is there a free robust django forum app? Or more precisely, a free and
robust forum app which uses django.contrib.auth for authentication?

Or should I just try out those several projects enabling django to
access phpBB's user info and use phpBB3?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



sqlite3+fastcgi setup problem [mac 10.6]

2009-09-20 Thread kelley....@gmail.com

*Background* I am working with python 2.6 and django 1.2 on an OSX
10.6 ("snow leopard") box.  I am using fastcgi, not the development
server.  The machine does not have the python/mysql linkage, and I
have had troubles installing it, so I am trying to use sqlite3.  I
have an existing project, which worked with mysql before, so I suspect
the code is at least halfway right.  But I am having problems with
sqlite3, relating (I think) to permissions.

If I do
   python manage.py syncdb
as myself, it creates a database, but then the web server (named _www
on this machine) cannot access it.  I've tried using chmod +a to give
_www more permissions but I get errors when I do that.  I've also
tried doing::

  sudo -u _www python manage.py syncdb

but that gives  a problem with django_content_type (transcript at end
of message).

*Question* can anyone recommend a method for setting up the sqlite3
database, with fcgi instead the development server?  (PS. it passes
'manage.py test'.)

The error log::

Creating table django_admin_log
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table dreams_dream
Creating table dreams_profanity
Creating table tags_tag
Creating table userprofiles_userprofile
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/Library/Python/2.6/site-packages/django/core/management/
__init__.py", line 362, in execute_manager
utility.execute()
  File "/Library/Python/2.6/site-packages/django/core/management/
__init__.py", line 303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.6/site-packages/django/core/management/
base.py", line 195, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/Library/Python/2.6/site-packages/django/core/management/
base.py", line 222, in execute
output = self.handle(*args, **options)
  File "/Library/Python/2.6/site-packages/django/core/management/
base.py", line 351, in handle
return self.handle_noargs(**options)
  File "/Library/Python/2.6/site-packages/django/core/management/
commands/syncdb.py", line 99, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive)
  File "/Library/Python/2.6/site-packages/django/core/management/
sql.py", line 205, in emit_post_sync_signal
interactive=interactive)
  File "/Library/Python/2.6/site-packages/django/dispatch/
dispatcher.py", line 166, in send
response = receiver(signal=self, sender=sender, **named)
  File "/Library/Python/2.6/site-packages/django/contrib/auth/
management/__init__.py", line 25, in create_permissions
ctype = ContentType.objects.get_for_model(klass)
  File "/Library/Python/2.6/site-packages/django/contrib/contenttypes/
models.py", line 31, in get_for_model
defaults = {'name': smart_unicode(opts.verbose_name_raw)},
  File "/Library/Python/2.6/site-packages/django/db/models/
manager.py", line 123, in get_or_create
return self.get_query_set().get_or_create(**kwargs)
  File "/Library/Python/2.6/site-packages/django/db/models/query.py",
line 328, in get_or_create
return self.get(**kwargs), False
  File "/Library/Python/2.6/site-packages/django/db/models/query.py",
line 300, in get
num = len(clone)
  File "/Library/Python/2.6/site-packages/django/db/models/query.py",
line 81, in __len__
self._result_cache = list(self.iterator())
  File "/Library/Python/2.6/site-packages/django/db/models/query.py",
line 238, in iterator
for row in self.query.results_iter():
  File "/Library/Python/2.6/site-packages/django/db/models/sql/
query.py", line 287, in results_iter
for rows in self.execute_sql(MULTI):
  File "/Library/Python/2.6/site-packages/django/db/models/sql/
query.py", line 2369, in execute_sql
cursor.execute(sql, params)
  File "/Library/Python/2.6/site-packages/django/db/backends/util.py",
line 19, in execute
return self.cursor.execute(sql, params)
  File "/Library/Python/2.6/site-packages/django/db/backends/sqlite3/
base.py", line 193, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: django_content_type

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



Re: Django error

2009-09-20 Thread Matthias Kestenholz

On Sun, Sep 20, 2009 at 8:47 AM, zweb  wrote:
>
> When I try to download a file through django in IE , I get
>
> [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1]     response =
> func(request, response), referer: http://www.com
> [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1]   File "/home/
> pmc/webapps/test/lib/python2.5/django/http/utils.py", line 77, in
> fix_IE_for_vary, referer: http://www..com/
> [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1]     if response
> ['Content-Type'].split(';')[0] not in safe_mime_types:, referer:
> http://www.com/
> [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] AttributeError:
> 'list' object has no attribute 'split', referer: http://www.com/
>
>
> I am doing,
>
>  for f in range(len(filepath)):
>        file_data = open('%s' % (filepath[f]), "rb").read()
>        response = HttpResponse(file_data,mimetype= content_type)
>        response['Content-Disposition'] = 'filename ='+ fname

This is wrong. You probably need something like this:

response['Content-Disposition'] = 'attachment; filename=' + fname


That being said, generating a zip archive of all files contained in
`filepath` and sending this would make more sense than sending only
the first file in the list.



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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ImageField anti-duplication

2009-09-20 Thread A. Rossi

Yup, that did it!
Thanks for pointing that out!  That article was hard to find in the
documentation.


On Sep 12, 7:58 pm, "A. Rossi"  wrote:
> I had not considered writing a custom Storage class. I may try that if
> there are no other alternatives.
>
> Any other ideas/solutions?
>
> On Sep 12, 5:31 am, vinilios  wrote:
>
> > Have you read this ?
>
> >http://docs.djangoproject.com/en/dev/howto/custom-file-storage/
>
> > haven't used any custom file storage yet but maybe using a custom file-
> > storage with a dummy save method when file exists is what you need.
>
> > On Sep 12, 1:43 pm, "A. Rossi"  wrote:
>
> > > I have an application where users can upload images, then the image is
> > > renamed to a SHA256 hash of the file's contents.
> > > Here is the relevant snippet of the model
>
> > > class ImagePost(Post):
> > >     def imgurl(self, filename):
> > >         import hashlib, os.path
> > >         extension = os.path.splitext(filename)
> > >         self.image.seek(0)
> > >         return "images/%s%s" % (hashlib.sha256(self.image.read
> > > (self.image.size)).hexdigest(), extension[1])
>
> > >     image = models.ImageField(upload_to=imgurl, blank=True)
>
> > > what I am attempting to do is, if a user uploads an image that already
> > > exists (i.e. the two files have the exact same SHA256 hash) I want to
> > > have the ImageField point to the already existing file, rather than
> > > save the newly uploaded one. I have tried a couple things that didn't
> > > work, and the default behavior when dealing with files of the same
> > > name is to append an extra _ to the end of the name, before the
> > > extension.
>
> > > I feel like I'm on the cusp of figuring this out, but I'm stuck. Also,
> > > would I put the code for this into the imgurl() function, create a
> > > custom storage object, in the view(s) directly?
>
> > > Thank you for your 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: passenger_wsgi import error

2009-09-20 Thread Daniel Roseman

On Sep 20, 2:33 am, "neri...@gmail.com"  wrote:
> I'm trying to use passenger_wsgi on Dreamhost and keeep getting 'An
> error occurred importing your passenger_wsgi.py'. I think I've located
> the syntax that is causing the problem but I don't know how to resolve
> it and Dreamhost doesn't offer any assistance for this.
>
> import sys, os
> INTERP = "/home/USERNAME/local/bin/python2.4"
> if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
> sys.path.append("/home/USERNAME/mysite.com")
> os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
> import django.core.handlers.wsgi    # THIS LINE CAUSING ERRORS
> # application = django.core.handlers.wsgi.WSGIHandler()
>
> Thanks for any help,
>
> Jason

You haven't given enough information to diagnose the problem - exactly
what errors are you seeing? What is the traceback?

However at a guess I would say that the django package isn't on the
pythonpath, so can't be imported. You may need to add it via
sys.path.append('/path/to/django').
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin dashboard : hide and merge modules

2009-09-20 Thread patrickk

you can now use GrappelliSite instead of AdminSite which gives you
some options for the admin index page. take a look at
http://code.google.com/p/django-grappelli/wiki/customizingindex for
more information.

you can hide and merge modules. renaming is a bit more complicated
since it affects subsites (like changelist and changeform).

regards,
patrick


On 18 Aug., 07:40, JF Simon  wrote:
> Thanks, I don't though about users perms !
> Grappelli just turn your admin more pretty, you should 
> try:http://code.google.com/p/django-grappelli/!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Order_by on greatgrandparent.name

2009-09-20 Thread Daniel Roseman

On Sep 20, 4:24 am, adelaide_mike  wrote:
> I have a multi-table model, each table related to the next by a one to
> many foreign key.
>
> I wish to do:
>
> q = Child.objects.filter(date__gte=startdate).order_by
> ('parent.grandparent.greatgrandparent__name')
>
> This raises an exception no such column:
> parent.grandparent.greatgrandparent__name
>
> Is there a workable way to do this?
>
> Thanks in advance for any ideas.
>
> Mike

You have to use the double-underscore format throughout.
q = Child.objects.filter(date__gte=startdate).order_by
('parent__grandparent__greatgrandparent__name')

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



Re: Django error

2009-09-20 Thread Daniel Roseman

On Sep 20, 7:47 am, zweb  wrote:
> When I try to download a file through django in IE , I get
>
> [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1]     response =
> func(request, response), referer:http://www.com
> [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1]   File "/home/
> pmc/webapps/test/lib/python2.5/django/http/utils.py", line 77, in
> fix_IE_for_vary, referer:http://www..com/
> [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1]     if response
> ['Content-Type'].split(';')[0] not in safe_mime_types:, 
> referer:http://www.com/
> [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] AttributeError:
> 'list' object has no attribute 'split', referer:http://www.com/
>
> I am doing,
>
>  for f in range(len(filepath)):
>         file_data = open('%s' % (filepath[f]), "rb").read()
>         response = HttpResponse(file_data,mimetype= content_type)
>         response['Content-Disposition'] = 'filename ='+ fname
>         return response
>
> where content_type is same as content Type of  uploaded file

What is the for loop for? Why are you iterating over filepath? The
first time through, you open a file whose path is just the first
character in filepath - why? And what's more, you return immediately,
so you never do the rest of the loop.

Anyway, that's not the problem. content_type is obviously not what you
think it is. Try putting 'print content_type' at the start to see what
it actually is.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---